| Index: tools/gpu/GrContextFactory.h
|
| diff --git a/tools/gpu/GrContextFactory.h b/tools/gpu/GrContextFactory.h
|
| index 7c49faaf87a97f013bfe06ef595e789f577e4b4d..16f6fb23ff9e132cd76f2f72bcba3e09404fc1eb 100644
|
| --- a/tools/gpu/GrContextFactory.h
|
| +++ b/tools/gpu/GrContextFactory.h
|
| @@ -24,76 +24,76 @@
|
| */
|
| class GrContextFactory : SkNoncopyable {
|
| public:
|
| - enum ContextType {
|
| - kGL_ContextType, //! OpenGL context.
|
| - kGLES_ContextType, //! OpenGL ES context.
|
| + enum GLContextType {
|
| + kNative_GLContextType, //! OpenGL or OpenGL ES context.
|
| + kGL_GLContextType, //! OpenGL context.
|
| + kGLES_GLContextType, //! OpenGL ES context.
|
| #if SK_ANGLE
|
| #ifdef SK_BUILD_FOR_WIN
|
| - kANGLE_ContextType, //! ANGLE on DirectX OpenGL ES context.
|
| + kANGLE_GLContextType, //! ANGLE on DirectX OpenGL ES context.
|
| #endif
|
| - kANGLE_GL_ContextType, //! ANGLE on OpenGL OpenGL ES context.
|
| + kANGLE_GL_GLContextType, //! ANGLE on OpenGL OpenGL ES context.
|
| #endif
|
| #if SK_COMMAND_BUFFER
|
| - kCommandBuffer_ContextType, //! Chromium command buffer OpenGL ES context.
|
| + kCommandBuffer_GLContextType, //! Chromium command buffer OpenGL ES context.
|
| #endif
|
| #if SK_MESA
|
| - kMESA_ContextType, //! MESA OpenGL context
|
| + kMESA_GLContextType, //! MESA OpenGL context
|
| #endif
|
| - kNullGL_ContextType, //! Non-rendering OpenGL mock context.
|
| - kDebugGL_ContextType, //! Non-rendering, state verifying OpenGL context.
|
| - kLastContextType = kDebugGL_ContextType
|
| + kNull_GLContextType, //! Non-rendering OpenGL mock context.
|
| + kDebug_GLContextType, //! Non-rendering, state verifying OpenGL context.
|
| + kLastGLContextType = kDebug_GLContextType
|
| };
|
|
|
| - //! OpenGL or OpenGL ES context depending on the platform. To be removed.
|
| - static const ContextType kNativeGL_ContextType;
|
| -
|
| - static const int kContextTypeCnt = kLastContextType + 1;
|
| + static const int kGLContextTypeCnt = kLastGLContextType + 1;
|
|
|
| /**
|
| * Options for GL context creation. For historical and testing reasons the options will default
|
| * to not using GL_NV_path_rendering extension even when the driver supports it.
|
| */
|
| - enum ContextOptions {
|
| - kNone_ContextOptions = 0x0,
|
| - kEnableNVPR_ContextOptions = 0x1,
|
| - kRequireSRGBSupport_ContextOptions = 0x2,
|
| + enum GLContextOptions {
|
| + kNone_GLContextOptions = 0,
|
| + kEnableNVPR_GLContextOptions = 0x1,
|
| + kRequireSRGBSupport_GLContextOptions = 0x2,
|
| };
|
|
|
| - static bool IsRenderingContext(ContextType type) {
|
| + static bool IsRenderingGLContext(GLContextType type) {
|
| switch (type) {
|
| - case kNullGL_ContextType:
|
| - case kDebugGL_ContextType:
|
| + case kNull_GLContextType:
|
| + case kDebug_GLContextType:
|
| return false;
|
| default:
|
| return true;
|
| }
|
| }
|
|
|
| - static const char* ContextTypeName(ContextType type) {
|
| + static const char* GLContextTypeName(GLContextType type) {
|
| switch (type) {
|
| - case kGL_ContextType:
|
| + case kNative_GLContextType:
|
| + return "native";
|
| + case kGL_GLContextType:
|
| return "gl";
|
| - case kGLES_ContextType:
|
| + case kGLES_GLContextType:
|
| return "gles";
|
| #if SK_ANGLE
|
| #ifdef SK_BUILD_FOR_WIN
|
| - case kANGLE_ContextType:
|
| + case kANGLE_GLContextType:
|
| return "angle";
|
| #endif
|
| - case kANGLE_GL_ContextType:
|
| + case kANGLE_GL_GLContextType:
|
| return "angle-gl";
|
| #endif
|
| #if SK_COMMAND_BUFFER
|
| - case kCommandBuffer_ContextType:
|
| + case kCommandBuffer_GLContextType:
|
| return "commandbuffer";
|
| #endif
|
| #if SK_MESA
|
| - case kMESA_ContextType:
|
| + case kMESA_GLContextType:
|
| return "mesa";
|
| #endif
|
| - case kNullGL_ContextType:
|
| + case kNull_GLContextType:
|
| return "null";
|
| - case kDebugGL_ContextType:
|
| + case kDebug_GLContextType:
|
| return "debug";
|
| default:
|
| SkFAIL("Unknown GL Context type.");
|
| @@ -122,21 +122,22 @@
|
| /**
|
| * Get a context initialized with a type of GL context. It also makes the GL context current.
|
| */
|
| - ContextInfo getContextInfo(ContextType type,
|
| - ContextOptions options = kNone_ContextOptions);
|
| + ContextInfo getContextInfo(GLContextType type,
|
| + GLContextOptions options = kNone_GLContextOptions);
|
| /**
|
| * Get a GrContext initialized with a type of GL context. It also makes the GL context current.
|
| */
|
| - GrContext* get(ContextType type, ContextOptions options = kNone_ContextOptions) {
|
| + GrContext* get(GLContextType type,
|
| + GLContextOptions options = kNone_GLContextOptions) {
|
| return this->getContextInfo(type, options).fGrContext;
|
| }
|
| const GrContextOptions& getGlobalOptions() const { return fGlobalOptions; }
|
|
|
| private:
|
| struct Context {
|
| - ContextType fType;
|
| - ContextOptions fOptions;
|
| - GLTestContext* fGLContext; // null if non-GL
|
| + GLContextType fType;
|
| + GLContextOptions fOptions;
|
| + GLTestContext* fGLContext;
|
| GrContext* fGrContext;
|
| };
|
| SkTArray<Context, true> fContexts;
|
|
|