Flutter Engine
The Flutter Engine
|
#include <GrContextFactory.h>
Public Types | |
enum class | ContextOverrides { kNone = 0x0 , kAvoidStencilBuffers = 0x1 , kFakeGLESVersionAs2 = 0x2 , kReducedShaders = 0x4 } |
using | ContextType = skgpu::ContextType |
Public Member Functions | |
GrContextFactory (const GrContextOptions &opts) | |
GrContextFactory () | |
~GrContextFactory () | |
void | destroyContexts () |
void | abandonContexts () |
void | releaseResourcesAndAbandonContexts () |
ContextInfo | getContextInfo (ContextType type, ContextOverrides=ContextOverrides::kNone) |
ContextInfo | getSharedContextInfo (GrDirectContext *shareContext, uint32_t shareIndex=0) |
GrDirectContext * | get (ContextType type, ContextOverrides overrides=ContextOverrides::kNone) |
const GrContextOptions & | getGlobalOptions () const |
This is a simple class that is useful in test apps that use different GrContexts backed by different types of GL contexts. It manages creating the GL context and a GrContext that uses it. The GL/Gr contexts persist until the factory is destroyed (though the caller can always grab a ref on the returned Gr and GL contexts to make them outlive the factory).
Definition at line 36 of file GrContextFactory.h.
Definition at line 38 of file GrContextFactory.h.
|
strong |
Overrides for the initial GrContextOptions provided at construction time, and required features that will cause context creation to fail if not present.
Enumerator | |
---|---|
kNone | |
kAvoidStencilBuffers | |
kFakeGLESVersionAs2 | |
kReducedShaders |
Definition at line 44 of file GrContextFactory.h.
|
explicit |
Definition at line 50 of file GrContextFactory.cpp.
sk_gpu_test::GrContextFactory::GrContextFactory | ( | ) |
Definition at line 48 of file GrContextFactory.cpp.
sk_gpu_test::GrContextFactory::~GrContextFactory | ( | ) |
Definition at line 53 of file GrContextFactory.cpp.
void sk_gpu_test::GrContextFactory::abandonContexts | ( | ) |
Definition at line 78 of file GrContextFactory.cpp.
void sk_gpu_test::GrContextFactory::destroyContexts | ( | ) |
Definition at line 57 of file GrContextFactory.cpp.
GrDirectContext * sk_gpu_test::GrContextFactory::get | ( | ContextType | type, |
ContextOverrides | overrides = ContextOverrides::kNone |
||
) |
Get a GrContext initialized with a type of GL context. It also makes the GL context current.
Definition at line 129 of file GrContextFactory.cpp.
ContextInfo sk_gpu_test::GrContextFactory::getContextInfo | ( | ContextType | type, |
ContextOverrides | overrides = ContextOverrides::kNone |
||
) |
Get a context initialized with a type of GL context. It also makes the GL context current.
Definition at line 332 of file GrContextFactory.cpp.
|
inline |
Definition at line 76 of file GrContextFactory.h.
ContextInfo sk_gpu_test::GrContextFactory::getSharedContextInfo | ( | GrDirectContext * | shareContext, |
uint32_t | shareIndex = 0 |
||
) |
Get a context in the same share group as the passed in GrContext, with the same type and overrides. To get multiple contexts in a single share group, pass the same shareContext, with different values for shareIndex.
Definition at line 336 of file GrContextFactory.cpp.
void sk_gpu_test::GrContextFactory::releaseResourcesAndAbandonContexts | ( | ) |
Definition at line 107 of file GrContextFactory.cpp.