1 2 /* 3 * Copyright 2015 Google Inc. 4 * 5 * Use of this source code is governed by a BSD-style license that can be 6 * found in the LICENSE file. 7 */ 8 9 #ifndef GLTestContext_command_buffer_DEFINED 10 #define GLTestContext_command_buffer_DEFINED 11 12 #include "tools/gpu/gl/GLTestContext.h" 13 14 namespace sk_gpu_test { 15 class CommandBufferGLTestContext : public GLTestContext { 16 public: 17 ~CommandBufferGLTestContext() override; 18 Create(GLTestContext * shareContext)19 static CommandBufferGLTestContext *Create(GLTestContext* shareContext) { 20 CommandBufferGLTestContext* cbShareContext = 21 reinterpret_cast<CommandBufferGLTestContext*>(shareContext); 22 CommandBufferGLTestContext *ctx = new CommandBufferGLTestContext(cbShareContext); 23 if (!ctx->isValid()) { 24 delete ctx; 25 return nullptr; 26 } 27 return ctx; 28 } 29 30 void presentCommandBuffer(); 31 32 bool makeCurrent(); 33 34 int getStencilBits(); 35 36 int getSampleCount(); 37 38 private: 39 CommandBufferGLTestContext(CommandBufferGLTestContext* shareContext); 40 41 void destroyGLContext(); 42 43 void onPlatformMakeCurrent() const override; 44 45 std::function<void()> onPlatformGetAutoContextRestore() const override; 46 47 void onPlatformSwapBuffers() const override; 48 49 GrGLFuncPtr onPlatformGetProcAddress(const char *name) const override; 50 51 void *fContext; 52 void *fDisplay; 53 void *fSurface; 54 void *fConfig; 55 }; 56 } // namespace sk_gpu_test 57 58 #endif 59