Chromium Code Reviews| Index: include/gpu/gl/command_buffer/SkCommandBufferGLContext.h |
| diff --git a/include/gpu/gl/command_buffer/SkCommandBufferGLContext.h b/include/gpu/gl/command_buffer/SkCommandBufferGLContext.h |
| index 47f3fd967a3b665217864a8d24690452e20751bd..be08e0b5e701cc493926153bbe6b83d840f08bf9 100644 |
| --- a/include/gpu/gl/command_buffer/SkCommandBufferGLContext.h |
| +++ b/include/gpu/gl/command_buffer/SkCommandBufferGLContext.h |
| @@ -17,7 +17,15 @@ public: |
| ~SkCommandBufferGLContext() override; |
| static SkCommandBufferGLContext* Create() { |
| - SkCommandBufferGLContext* ctx = new SkCommandBufferGLContext; |
| + SkCommandBufferGLContext* ctx = new SkCommandBufferGLContext(kGLES2); |
| + if (!ctx->isValid()) { |
| + delete ctx; |
| + return nullptr; |
| + } |
| + return ctx; |
| + } |
| + static SkCommandBufferGLContext* CreateES3() { |
| + SkCommandBufferGLContext* ctx = new SkCommandBufferGLContext(kGLES3); |
| if (!ctx->isValid()) { |
| delete ctx; |
| return nullptr; |
| @@ -42,10 +50,14 @@ public: |
| int getSampleCount(); |
| private: |
| - SkCommandBufferGLContext(); |
| + enum ContextVersion { |
|
bsalomon
2016/02/12 14:03:27
Can you either add suffixes (_ContextVersion) or m
Kimmo Kinnunen
2016/02/15 08:10:14
Done.
|
| + kGLES2, |
| + kGLES3 |
| + }; |
| + SkCommandBufferGLContext(ContextVersion minContextVersion); |
| SkCommandBufferGLContext(void* nativeWindow, int msaaSampleCount); |
| - void initializeGLContext(void* nativeWindow, const int* configAttribs, |
| - const int* surfaceAttribs); |
| + void initializeGLContext(ContextVersion minContextVersion, void* nativeWindow, |
| + const int* configAttribs, const int* surfaceAttribs); |
| void destroyGLContext(); |
| void onPlatformMakeCurrent() const override; |