OLD | NEW |
(Empty) | |
| 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 GLContext_command_buffer_DEFINED |
| 10 #define GLContext_command_buffer_DEFINED |
| 11 |
| 12 #include "gl/GLContext.h" |
| 13 |
| 14 namespace sk_gpu_test { |
| 15 class CommandBufferGLContext : public GLContext { |
| 16 public: |
| 17 ~CommandBufferGLContext() override; |
| 18 |
| 19 static CommandBufferGLContext *Create() { |
| 20 CommandBufferGLContext *ctx = new CommandBufferGLContext; |
| 21 if (!ctx->isValid()) { |
| 22 delete ctx; |
| 23 return nullptr; |
| 24 } |
| 25 return ctx; |
| 26 } |
| 27 |
| 28 static CommandBufferGLContext *Create(void *nativeWindow, int msaaSampleCoun
t) { |
| 29 CommandBufferGLContext *ctx = new CommandBufferGLContext(nativeWindow, m
saaSampleCount); |
| 30 if (!ctx->isValid()) { |
| 31 delete ctx; |
| 32 return nullptr; |
| 33 } |
| 34 return ctx; |
| 35 } |
| 36 |
| 37 void presentCommandBuffer(); |
| 38 |
| 39 bool makeCurrent(); |
| 40 |
| 41 int getStencilBits(); |
| 42 |
| 43 int getSampleCount(); |
| 44 |
| 45 private: |
| 46 CommandBufferGLContext(); |
| 47 |
| 48 CommandBufferGLContext(void *nativeWindow, int msaaSampleCount); |
| 49 |
| 50 void initializeGLContext(void *nativeWindow, const int *configAttribs, |
| 51 const int *surfaceAttribs); |
| 52 |
| 53 void destroyGLContext(); |
| 54 |
| 55 void onPlatformMakeCurrent() const override; |
| 56 |
| 57 void onPlatformSwapBuffers() const override; |
| 58 |
| 59 GrGLFuncPtr onPlatformGetProcAddress(const char *name) const override; |
| 60 |
| 61 void *fContext; |
| 62 void *fDisplay; |
| 63 void *fSurface; |
| 64 void *fConfig; |
| 65 }; |
| 66 } // namespace sk_gpu_test |
| 67 |
| 68 #endif |
OLD | NEW |