2016-03-31 01:56:19 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Copyright 2015 Google Inc.
|
|
|
|
*
|
|
|
|
* Use of this source code is governed by a BSD-style license that can be
|
|
|
|
* found in the LICENSE file.
|
|
|
|
*/
|
|
|
|
|
2016-03-31 17:59:06 +00:00
|
|
|
#ifndef GLTestContext_command_buffer_DEFINED
|
|
|
|
#define GLTestContext_command_buffer_DEFINED
|
2016-03-31 01:56:19 +00:00
|
|
|
|
2016-03-31 17:59:06 +00:00
|
|
|
#include "gl/GLTestContext.h"
|
2016-03-31 01:56:19 +00:00
|
|
|
|
|
|
|
namespace sk_gpu_test {
|
2016-03-31 17:59:06 +00:00
|
|
|
class CommandBufferGLTestContext : public GLTestContext {
|
2016-03-31 01:56:19 +00:00
|
|
|
public:
|
2016-03-31 17:59:06 +00:00
|
|
|
~CommandBufferGLTestContext() override;
|
2016-03-31 01:56:19 +00:00
|
|
|
|
2017-02-21 21:58:08 +00:00
|
|
|
static CommandBufferGLTestContext *Create(GLTestContext* shareContext) {
|
|
|
|
CommandBufferGLTestContext* cbShareContext =
|
|
|
|
reinterpret_cast<CommandBufferGLTestContext*>(shareContext);
|
|
|
|
CommandBufferGLTestContext *ctx = new CommandBufferGLTestContext(cbShareContext);
|
2016-03-31 01:56:19 +00:00
|
|
|
if (!ctx->isValid()) {
|
|
|
|
delete ctx;
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
return ctx;
|
|
|
|
}
|
|
|
|
|
|
|
|
void presentCommandBuffer();
|
|
|
|
|
|
|
|
bool makeCurrent();
|
|
|
|
|
|
|
|
int getStencilBits();
|
|
|
|
|
|
|
|
int getSampleCount();
|
|
|
|
|
|
|
|
private:
|
2017-02-21 21:58:08 +00:00
|
|
|
CommandBufferGLTestContext(CommandBufferGLTestContext* shareContext);
|
2016-03-31 01:56:19 +00:00
|
|
|
|
|
|
|
void destroyGLContext();
|
|
|
|
|
|
|
|
void onPlatformMakeCurrent() const override;
|
|
|
|
|
2017-11-17 14:25:23 +00:00
|
|
|
std::function<void()> onPlatformGetAutoContextRestore() const override;
|
|
|
|
|
2016-03-31 01:56:19 +00:00
|
|
|
void onPlatformSwapBuffers() const override;
|
|
|
|
|
|
|
|
GrGLFuncPtr onPlatformGetProcAddress(const char *name) const override;
|
|
|
|
|
|
|
|
void *fContext;
|
|
|
|
void *fDisplay;
|
|
|
|
void *fSurface;
|
|
|
|
void *fConfig;
|
|
|
|
};
|
|
|
|
} // namespace sk_gpu_test
|
|
|
|
|
|
|
|
#endif
|