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(int version,GLTestContext * shareContext)19 static CommandBufferGLTestContext *Create(int version, GLTestContext* shareContext) { 20 CommandBufferGLTestContext* cbShareContext = 21 reinterpret_cast<CommandBufferGLTestContext*>(shareContext); 22 CommandBufferGLTestContext *ctx = new CommandBufferGLTestContext(version, 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(int version, CommandBufferGLTestContext* shareContext); 40 41 void destroyGLContext(); 42 43 void onPlatformMakeNotCurrent() const override; 44 void onPlatformMakeCurrent() const override; 45 46 std::function<void()> onPlatformGetAutoContextRestore() const override; 47 48 GrGLFuncPtr onPlatformGetProcAddress(const char *name) const override; 49 50 void *fContext; 51 void *fDisplay; 52 void *fSurface; 53 void *fConfig; 54 }; 55 } // namespace sk_gpu_test 56 57 #endif 58