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 "gl/GLTestContext.h"
13
14namespace sk_gpu_test {
15class CommandBufferGLTestContext : public GLTestContext {
16public:
17    ~CommandBufferGLTestContext() override;
18
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
38private:
39    CommandBufferGLTestContext(CommandBufferGLTestContext* shareContext);
40
41    void destroyGLContext();
42
43    void onPlatformMakeCurrent() const override;
44
45    void onPlatformSwapBuffers() const override;
46
47    GrGLFuncPtr onPlatformGetProcAddress(const char *name) const override;
48
49    void *fContext;
50    void *fDisplay;
51    void *fSurface;
52    void *fConfig;
53};
54}   // namespace sk_gpu_test
55
56#endif
57