Chromium Code Reviews| Index: tools/gpu/GrContextFactory.h |
| diff --git a/tools/gpu/GrContextFactory.h b/tools/gpu/GrContextFactory.h |
| index 89ca9cadf0903fb73d9baa2f29da19c72f11b5a0..0dc8c20cd503f4b0c05ef0099181a074a118d2da 100644 |
| --- a/tools/gpu/GrContextFactory.h |
| +++ b/tools/gpu/GrContextFactory.h |
| @@ -14,6 +14,8 @@ |
| #include "gl/GLTestContext.h" |
| #include "SkTArray.h" |
| +struct GrVkBackendContext; |
| + |
| namespace sk_gpu_test { |
| struct ContextInfo { |
| @@ -23,7 +25,7 @@ struct ContextInfo { |
| : fGrContext(grContext), fGLContext(glContext) { } |
| GrContext* fGrContext; |
| GLTestContext* fGLContext; //! Valid until the factory destroys it via abandonContexts() or |
| - //! destroyContexts(). |
| + //! destroyContexts(). Null if context is not based on OpenGL. |
| }; |
| /** |
| @@ -35,24 +37,19 @@ struct ContextInfo { |
| */ |
| class GrContextFactory : SkNoncopyable { |
| public: |
| + // The availability of context types is subject to platform and build configuration |
| + // restrictions. |
| enum ContextType { |
| kGL_ContextType, //! OpenGL context. |
| kGLES_ContextType, //! OpenGL ES context. |
| -#if SK_ANGLE |
| -#ifdef SK_BUILD_FOR_WIN |
| kANGLE_ContextType, //! ANGLE on DirectX OpenGL ES context. |
| -#endif |
| kANGLE_GL_ContextType, //! ANGLE on OpenGL OpenGL ES context. |
| -#endif |
| -#if SK_COMMAND_BUFFER |
| kCommandBuffer_ContextType, //! Chromium command buffer OpenGL ES context. |
| -#endif |
| -#if SK_MESA |
| kMESA_ContextType, //! MESA OpenGL context |
| -#endif |
| kNullGL_ContextType, //! Non-rendering OpenGL mock context. |
| kDebugGL_ContextType, //! Non-rendering, state verifying OpenGL context. |
| - kLastContextType = kDebugGL_ContextType |
| + kVulkan_ContextType, //! Vulkan |
| + kLastContextType = kVulkan_ContextType |
| }; |
| //! OpenGL or OpenGL ES context depending on the platform. To be removed. |
| @@ -81,8 +78,12 @@ public: |
| } |
| static GrBackend ContextTypeBackend(ContextType type) { |
| - // Currently all the context types use the GL backed |
| - return kOpenGL_GrBackend; |
| + switch (type) { |
| + case kVulkan_ContextType: |
| + return kVulkan_GrBackend; |
| + default: |
| + return kOpenGL_GrBackend; |
| + } |
| } |
| static const char* ContextTypeName(ContextType type) { |
| @@ -91,28 +92,20 @@ public: |
| return "gl"; |
| case kGLES_ContextType: |
| return "gles"; |
| -#if SK_ANGLE |
| -#ifdef SK_BUILD_FOR_WIN |
| case kANGLE_ContextType: |
| return "angle"; |
| -#endif |
| case kANGLE_GL_ContextType: |
| return "angle-gl"; |
| -#endif |
| -#if SK_COMMAND_BUFFER |
| case kCommandBuffer_ContextType: |
| return "commandbuffer"; |
| -#endif |
| -#if SK_MESA |
| case kMESA_ContextType: |
| return "mesa"; |
| -#endif |
| case kNullGL_ContextType: |
| - return "null"; |
| + return "nullgl"; |
| case kDebugGL_ContextType: |
| - return "debug"; |
| - default: |
| - SkFAIL("Unknown GL Context type."); |
| + return "debuggl"; |
| + case kVulkan_ContextType: |
| + return "vulkan"; |
| } |
| } |
| @@ -140,13 +133,15 @@ public: |
| private: |
| struct Context { |
| - ContextType fType; |
| - ContextOptions fOptions; |
| - GLTestContext* fGLContext; // null if non-GL |
| - GrContext* fGrContext; |
| + ContextType fType; |
| + ContextOptions fOptions; |
| + GLTestContext* fGLContext; // null if non-GL |
| + GrContext* fGrContext; |
| + bool fAbandoned; |
| }; |
| - SkTArray<Context, true> fContexts; |
| - const GrContextOptions fGlobalOptions; |
| + SkTArray<Context, true> fContexts; |
| + SkAutoTDelete<GLTestContext> fSentinelGLContext; |
|
egdaniel
2016/04/11 20:10:01
is it worth having a comment in the header for thi
bsalomon
2016/04/11 20:40:26
I think the one in the cpp is enough.
|
| + const GrContextOptions fGlobalOptions; |
| }; |
| } // namespace sk_gpu_test |
| #endif |