Store null GL context's state in interface object

BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1814113002

Review URL: https://codereview.chromium.org/1814113002
This commit is contained in:
bsalomon 2016-03-18 12:07:24 -07:00 committed by Commit bot
parent fd359caf0c
commit b5a94e3e24
8 changed files with 1151 additions and 970 deletions

View File

@ -351,6 +351,8 @@
'<(skia_src_path)/gpu/gl/GrGLRenderTarget.h',
'<(skia_src_path)/gpu/gl/GrGLStencilAttachment.cpp',
'<(skia_src_path)/gpu/gl/GrGLStencilAttachment.h',
'<(skia_src_path)/gpu/gl/GrGLTestInterface.cpp',
'<(skia_src_path)/gpu/gl/GrGLTestInterface.h',
'<(skia_src_path)/gpu/gl/GrGLTexture.cpp',
'<(skia_src_path)/gpu/gl/GrGLTexture.h',
'<(skia_src_path)/gpu/gl/GrGLTextureRenderTarget.cpp',

View File

@ -39,13 +39,12 @@ typedef GrGLenum (GR_GL_FUNCTION_TYPE* GrGLCheckFramebufferStatusProc)(GrGLenum
typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLClearProc)(GrGLbitfield mask);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLClearColorProc)(GrGLclampf red, GrGLclampf green, GrGLclampf blue, GrGLclampf alpha);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLClearStencilProc)(GrGLint s);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLClientActiveTextureProc)(GrGLenum texture);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLColorMaskProc)(GrGLboolean red, GrGLboolean green, GrGLboolean blue, GrGLboolean alpha);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLCompileShaderProc)(GrGLuint shader);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLCompressedTexImage2DProc)(GrGLenum target, GrGLint level, GrGLenum internalformat, GrGLsizei width, GrGLsizei height, GrGLint border, GrGLsizei imageSize, const GrGLvoid* data);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLCompressedTexSubImage2DProc)(GrGLenum target, GrGLint level, GrGLint xoffset, GrGLint yoffset, GrGLsizei width, GrGLsizei height, GrGLenum format, GrGLsizei imageSize, const GrGLvoid* data);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLCopyTexSubImage2DProc)(GrGLenum target, GrGLint level, GrGLint xoffset, GrGLint yoffset, GrGLint x, GrGLint y, GrGLsizei width, GrGLsizei height);
typedef GrGLuint (GR_GL_FUNCTION_TYPE* GrGLCreateProgramProc)(void);
typedef GrGLuint (GR_GL_FUNCTION_TYPE* GrGLCreateProgramProc)();
typedef GrGLuint (GR_GL_FUNCTION_TYPE* GrGLCreateShaderProc)(GrGLenum type);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLCullFaceProc)(GrGLenum mode);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLDeleteBuffersProc)(GrGLsizei n, const GrGLuint* buffers);
@ -67,7 +66,6 @@ typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLDrawBuffersProc)(GrGLsizei n, const G
typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLDrawElementsProc)(GrGLenum mode, GrGLsizei count, GrGLenum type, const GrGLvoid* indices);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLDrawElementsInstancedProc)(GrGLenum mode, GrGLsizei count, GrGLenum type, const GrGLvoid *indices, GrGLsizei primcount);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLDrawElementsIndirectProc)(GrGLenum mode, GrGLenum type, GrGLvoid* indirect);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLEGLImageTargetTexture2DProc)(GrGLenum target, GrGLeglImage image);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLEnableProc)(GrGLenum cap);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLEnableVertexAttribArrayProc)(GrGLuint index);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLEndQueryProc)(GrGLenum target);

View File

@ -13,24 +13,14 @@
class SK_API SkNullGLContext : public SkGLContext {
public:
~SkNullGLContext() override;
static SkNullGLContext* Create();
// FIXME: remove once Chromium has been updated.
static SkNullGLContext* Create(GrGLStandard forcedAPI) {
SkASSERT(forcedAPI == kNone_GrGLStandard);
(void)forcedAPI; return Create();
}
class ContextState;
private:
SkNullGLContext();
void onPlatformMakeCurrent() const override;
void onPlatformMakeCurrent() const override {};
void onPlatformSwapBuffers() const override {}
GrGLFuncPtr onPlatformGetProcAddress(const char*) const override { return NULL; }
ContextState* fState;
GrGLFuncPtr onPlatformGetProcAddress(const char*) const override { return nullptr; }
};
#endif

View File

@ -7,12 +7,9 @@
#include "gl/GrGLInterface.h"
#include "GrGLDefines.h"
#include "GrGLTestInterface.h"
#include "SkMutex.h"
#include "SkTDArray.h"
#include "GrGLNoOpInterface.h"
#include "SkTLS.h"
// TODO: Delete this file after chrome starts using SkNullGLContext.
// added to suppress 'no previous prototype' warning and because this code is duplicated in
// SkNullGLContext.cpp
@ -20,10 +17,7 @@ namespace {
class BufferObj {
public:
BufferObj(GrGLuint id) : fID(id), fDataPtr(nullptr), fSize(0), fMapped(false) {
}
BufferObj(GrGLuint id) : fID(id), fDataPtr(nullptr), fSize(0), fMapped(false) {}
~BufferObj() { delete[] fDataPtr; }
void allocate(GrGLsizeiptr size, const GrGLchar* dataPtr) {
@ -53,8 +47,6 @@ private:
// This class maintains a sparsely populated array of buffer pointers.
class BufferManager {
public:
BufferManager() : fFreeListHead(kFreeListEnd) {}
~BufferManager() {
@ -114,383 +106,509 @@ private:
SkTDArray<BufferObj*> fBuffers;
};
/**
* The global-to-thread state object for the null interface. All null interfaces on the
* same thread currently share one of these. This means two null contexts on the same thread
* can interfere with each other. It may make sense to more integrate this into SkNullGLContext
* and use it's makeCurrent mechanism.
*/
struct ThreadContext {
/** Null interface implementation */
class NullInterface : public GrGLTestInterface {
public:
NullInterface()
: fCurrArrayBuffer(0)
, fCurrElementArrayBuffer(0)
, fCurrPixelPackBuffer(0)
, fCurrPixelUnpackBuffer(0)
, fCurrShaderID(0)
, fCurrGenericID(0)
, fCurrUniformLocation(0) {
this->init(kGL_GrGLStandard);
}
GrGLenum checkFramebufferStatus(GrGLenum target) override {
return GR_GL_FRAMEBUFFER_COMPLETE;
}
GrGLvoid genBuffers(GrGLsizei n, GrGLuint* ids) override {
for (int i = 0; i < n; ++i) {
BufferObj* buffer = fBufferManager.create();
ids[i] = buffer->id();
}
}
GrGLvoid bufferData(GrGLenum target, GrGLsizeiptr size, const GrGLvoid* data,
GrGLenum usage) override {
GrGLuint id = 0;
switch (target) {
case GR_GL_ARRAY_BUFFER:
id = fCurrArrayBuffer;
break;
case GR_GL_ELEMENT_ARRAY_BUFFER:
id = fCurrElementArrayBuffer;
break;
case GR_GL_PIXEL_PACK_BUFFER:
id = fCurrPixelPackBuffer;
break;
case GR_GL_PIXEL_UNPACK_BUFFER:
id = fCurrPixelUnpackBuffer;
break;
default:
SkFAIL("Unexpected target to nullGLBufferData");
break;
}
if (id > 0) {
BufferObj* buffer = fBufferManager.lookUp(id);
buffer->allocate(size, (const GrGLchar*) data);
}
}
GrGLuint createProgram() override {
return ++fCurrProgramID;
}
GrGLuint createShader(GrGLenum type) override {
return ++fCurrShaderID;
}
GrGLvoid bindBuffer(GrGLenum target, GrGLuint buffer) override {
switch (target) {
case GR_GL_ARRAY_BUFFER:
fCurrArrayBuffer = buffer;
break;
case GR_GL_ELEMENT_ARRAY_BUFFER:
fCurrElementArrayBuffer = buffer;
break;
case GR_GL_PIXEL_PACK_BUFFER:
fCurrPixelPackBuffer = buffer;
break;
case GR_GL_PIXEL_UNPACK_BUFFER:
fCurrPixelUnpackBuffer = buffer;
break;
}
}
// deleting a bound buffer has the side effect of binding 0
GrGLvoid deleteBuffers(GrGLsizei n, const GrGLuint* ids) override {
for (int i = 0; i < n; ++i) {
if (ids[i] == fCurrArrayBuffer) {
fCurrArrayBuffer = 0;
}
if (ids[i] == fCurrElementArrayBuffer) {
fCurrElementArrayBuffer = 0;
}
if (ids[i] == fCurrPixelPackBuffer) {
fCurrPixelPackBuffer = 0;
}
if (ids[i] == fCurrPixelUnpackBuffer) {
fCurrPixelUnpackBuffer = 0;
}
BufferObj* buffer = fBufferManager.lookUp(ids[i]);
fBufferManager.free(buffer);
}
}
GrGLvoid genFramebuffers(GrGLsizei n, GrGLuint *framebuffers) override {
this->genGenericIds(n, framebuffers);
}
GrGLvoid genQueries(GrGLsizei n, GrGLuint *ids) override { this->genGenericIds(n, ids); }
GrGLvoid genRenderbuffers(GrGLsizei n, GrGLuint *renderbuffers) override {
this->genGenericIds(n, renderbuffers);
}
GrGLvoid genTextures(GrGLsizei n, GrGLuint *textures) override {
this->genGenericIds(n, textures);
}
GrGLvoid genVertexArrays(GrGLsizei n, GrGLuint *arrays) override {
this->genGenericIds(n, arrays);
}
GrGLenum getError() override { return GR_GL_NO_ERROR; }
GrGLvoid getIntegerv(GrGLenum pname, GrGLint* params) override {
// TODO: remove from Ganesh the #defines for gets we don't use.
// We would like to minimize gets overall due to performance issues
switch (pname) {
case GR_GL_CONTEXT_PROFILE_MASK:
*params = GR_GL_CONTEXT_COMPATIBILITY_PROFILE_BIT;
break;
case GR_GL_STENCIL_BITS:
*params = 8;
break;
case GR_GL_SAMPLES:
*params = 1;
break;
case GR_GL_FRAMEBUFFER_BINDING:
*params = 0;
break;
case GR_GL_VIEWPORT:
params[0] = 0;
params[1] = 0;
params[2] = 800;
params[3] = 600;
break;
case GR_GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS:
case GR_GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS:
case GR_GL_MAX_TEXTURE_IMAGE_UNITS:
case GR_GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS:
*params = 8;
break;
case GR_GL_MAX_TEXTURE_COORDS:
*params = 8;
break;
case GR_GL_MAX_VERTEX_UNIFORM_VECTORS:
*params = kDefaultMaxVertexUniformVectors;
break;
case GR_GL_MAX_FRAGMENT_UNIFORM_VECTORS:
*params = kDefaultMaxFragmentUniformVectors;
break;
case GR_GL_MAX_FRAGMENT_UNIFORM_COMPONENTS:
*params = 16 * 4;
break;
case GR_GL_NUM_COMPRESSED_TEXTURE_FORMATS:
*params = 0;
break;
case GR_GL_COMPRESSED_TEXTURE_FORMATS:
break;
case GR_GL_MAX_TEXTURE_SIZE:
*params = 8192;
break;
case GR_GL_MAX_RENDERBUFFER_SIZE:
*params = 8192;
break;
case GR_GL_MAX_SAMPLES:
*params = 32;
break;
case GR_GL_MAX_VERTEX_ATTRIBS:
*params = kDefaultMaxVertexAttribs;
break;
case GR_GL_MAX_VARYING_VECTORS:
*params = kDefaultMaxVaryingVectors;
break;
case GR_GL_NUM_EXTENSIONS: {
GrGLint i = 0;
while (kExtensions[i++]);
*params = i;
break;
}
default:
SkFAIL("Unexpected pname to GetIntegerv");
}
}
GrGLvoid getProgramiv(GrGLuint program, GrGLenum pname, GrGLint* params) override {
this->getShaderOrProgramiv(program, pname, params);
}
GrGLvoid getProgramInfoLog(GrGLuint program, GrGLsizei bufsize, GrGLsizei* length,
char* infolog) override {
this->getInfoLog(program, bufsize, length, infolog);
}
GrGLvoid getMultisamplefv(GrGLenum pname, GrGLuint index, GrGLfloat* val) override {
val[0] = val[1] = 0.5f;
}
GrGLvoid getQueryiv(GrGLenum GLtarget, GrGLenum pname, GrGLint *params) override {
switch (pname) {
case GR_GL_CURRENT_QUERY:
*params = 0;
break;
case GR_GL_QUERY_COUNTER_BITS:
*params = 32;
break;
default:
SkFAIL("Unexpected pname passed GetQueryiv.");
}
}
GrGLvoid getQueryObjecti64v(GrGLuint id, GrGLenum pname, GrGLint64 *params) override {
queryResult(id, pname, params);
}
GrGLvoid getQueryObjectiv(GrGLuint id, GrGLenum pname, GrGLint *params) override {
queryResult(id, pname, params);
}
GrGLvoid getQueryObjectui64v(GrGLuint id, GrGLenum pname, GrGLuint64 *params) override {
queryResult(id, pname, params);
}
GrGLvoid getQueryObjectuiv(GrGLuint id, GrGLenum pname, GrGLuint *params) override {
queryResult(id, pname, params);
}
GrGLvoid getShaderiv(GrGLuint shader, GrGLenum pname, GrGLint* params) override {
this->getShaderOrProgramiv(shader, pname, params);
}
GrGLvoid getShaderInfoLog(GrGLuint shader, GrGLsizei bufsize, GrGLsizei* length,
char* infolog) override {
this->getInfoLog(shader, bufsize, length, infolog);
}
const GrGLubyte* getString(GrGLenum name) override {
switch (name) {
case GR_GL_EXTENSIONS:
return CombinedExtensionString();
case GR_GL_VERSION:
return (const GrGLubyte*)"4.0 Debug GL";
case GR_GL_SHADING_LANGUAGE_VERSION:
return (const GrGLubyte*)"4.20.8 Debug GLSL";
case GR_GL_VENDOR:
return (const GrGLubyte*)"Debug Vendor";
case GR_GL_RENDERER:
return (const GrGLubyte*)"The Debug (Non-)Renderer";
default:
SkFAIL("Unexpected name passed to GetString");
return nullptr;
}
}
const GrGLubyte* getStringi(GrGLenum name, GrGLuint i) override {
switch (name) {
case GR_GL_EXTENSIONS: {
GrGLint count;
this->getIntegerv(GR_GL_NUM_EXTENSIONS, &count);
if ((GrGLint)i <= count) {
return (const GrGLubyte*) kExtensions[i];
} else {
return nullptr;
}
}
default:
SkFAIL("Unexpected name passed to GetStringi");
return nullptr;
}
}
GrGLvoid getTexLevelParameteriv(GrGLenum target, GrGLint level, GrGLenum pname,
GrGLint* params) override {
// we used to use this to query stuff about externally created textures,
// now we just require clients to tell us everything about the texture.
SkFAIL("Should never query texture parameters.");
}
GrGLint getUniformLocation(GrGLuint program, const char* name) override {
return ++fCurrUniformLocation;
}
GrGLvoid* mapBufferRange(GrGLenum target, GrGLintptr offset, GrGLsizeiptr length,
GrGLbitfield access) override {
GrGLuint id = 0;
switch (target) {
case GR_GL_ARRAY_BUFFER:
id = fCurrArrayBuffer;
break;
case GR_GL_ELEMENT_ARRAY_BUFFER:
id = fCurrElementArrayBuffer;
break;
case GR_GL_PIXEL_PACK_BUFFER:
id = fCurrPixelPackBuffer;
break;
case GR_GL_PIXEL_UNPACK_BUFFER:
id = fCurrPixelUnpackBuffer;
break;
}
if (id > 0) {
// We just ignore the offset and length here.
BufferObj* buffer = fBufferManager.lookUp(id);
SkASSERT(!buffer->mapped());
buffer->setMapped(true);
return buffer->dataPtr();
}
return nullptr;
}
GrGLvoid* mapBuffer(GrGLenum target, GrGLenum access) override {
GrGLuint id = 0;
switch (target) {
case GR_GL_ARRAY_BUFFER:
id = fCurrArrayBuffer;
break;
case GR_GL_ELEMENT_ARRAY_BUFFER:
id = fCurrElementArrayBuffer;
break;
case GR_GL_PIXEL_PACK_BUFFER:
id = fCurrPixelPackBuffer;
break;
case GR_GL_PIXEL_UNPACK_BUFFER:
id = fCurrPixelUnpackBuffer;
break;
}
if (id > 0) {
BufferObj* buffer = fBufferManager.lookUp(id);
SkASSERT(!buffer->mapped());
buffer->setMapped(true);
return buffer->dataPtr();
}
SkASSERT(false);
return nullptr; // no buffer bound to target
}
GrGLboolean unmapBuffer(GrGLenum target) override {
GrGLuint id = 0;
switch (target) {
case GR_GL_ARRAY_BUFFER:
id = fCurrArrayBuffer;
break;
case GR_GL_ELEMENT_ARRAY_BUFFER:
id = fCurrElementArrayBuffer;
break;
case GR_GL_PIXEL_PACK_BUFFER:
id = fCurrPixelPackBuffer;
break;
case GR_GL_PIXEL_UNPACK_BUFFER:
id = fCurrPixelUnpackBuffer;
break;
}
if (id > 0) {
BufferObj* buffer = fBufferManager.lookUp(id);
SkASSERT(buffer->mapped());
buffer->setMapped(false);
return GR_GL_TRUE;
}
GrAlwaysAssert(false);
return GR_GL_FALSE; // GR_GL_INVALID_OPERATION;
}
GrGLvoid getBufferParameteriv(GrGLenum target, GrGLenum pname, GrGLint* params) override {
switch (pname) {
case GR_GL_BUFFER_MAPPED: {
*params = GR_GL_FALSE;
GrGLuint id = 0;
switch (target) {
case GR_GL_ARRAY_BUFFER:
id = fCurrArrayBuffer;
break;
case GR_GL_ELEMENT_ARRAY_BUFFER:
id = fCurrElementArrayBuffer;
break;
case GR_GL_PIXEL_PACK_BUFFER:
id = fCurrPixelPackBuffer;
break;
case GR_GL_PIXEL_UNPACK_BUFFER:
id = fCurrPixelUnpackBuffer;
break;
}
if (id > 0) {
BufferObj* buffer = fBufferManager.lookUp(id);
if (buffer->mapped()) {
*params = GR_GL_TRUE;
}
}
break; }
default:
SkFAIL("Unexpected pname to GetBufferParamateriv");
break;
}
};
private:
BufferManager fBufferManager;
GrGLuint fCurrArrayBuffer;
GrGLuint fCurrElementArrayBuffer;
GrGLuint fCurrPixelPackBuffer;
GrGLuint fCurrPixelUnpackBuffer;
GrGLuint fCurrProgramID;
GrGLuint fCurrShaderID;
GrGLuint fCurrGenericID;
GrGLuint fCurrUniformLocation;
static ThreadContext* Get() {
return reinterpret_cast<ThreadContext*>(SkTLS::Get(Create, Delete));
}
// the OpenGLES 2.0 spec says this must be >= 128
static const GrGLint kDefaultMaxVertexUniformVectors = 128;
ThreadContext()
: fCurrArrayBuffer(0)
, fCurrElementArrayBuffer(0)
, fCurrProgramID(0)
, fCurrShaderID(0) {}
// the OpenGLES 2.0 spec says this must be >=16
static const GrGLint kDefaultMaxFragmentUniformVectors = 16;
private:
static void* Create() { return new ThreadContext; }
static void Delete(void* context) { delete reinterpret_cast<ThreadContext*>(context); }
};
// the OpenGLES 2.0 spec says this must be >= 8
static const GrGLint kDefaultMaxVertexAttribs = 8;
// Functions not declared in GrGLBogusInterface.h (not common with the Debug GL interface).
// the OpenGLES 2.0 spec says this must be >= 8
static const GrGLint kDefaultMaxVaryingVectors = 8;
GrGLvoid GR_GL_FUNCTION_TYPE nullGLActiveTexture(GrGLenum texture) {}
GrGLvoid GR_GL_FUNCTION_TYPE nullGLAttachShader(GrGLuint program, GrGLuint shader) {}
GrGLvoid GR_GL_FUNCTION_TYPE nullGLBeginQuery(GrGLenum target, GrGLuint id) {}
GrGLvoid GR_GL_FUNCTION_TYPE nullGLBindAttribLocation(GrGLuint program, GrGLuint index, const char* name) {}
GrGLvoid GR_GL_FUNCTION_TYPE nullGLBindTexture(GrGLenum target, GrGLuint texture) {}
GrGLvoid GR_GL_FUNCTION_TYPE nullGLBindVertexArray(GrGLuint id) {}
static const char* kExtensions[];
GrGLvoid GR_GL_FUNCTION_TYPE nullGLGenBuffers(GrGLsizei n, GrGLuint* ids) {
ThreadContext* ctx = ThreadContext::Get();
for (int i = 0; i < n; ++i) {
BufferObj* buffer = ctx->fBufferManager.create();
ids[i] = buffer->id();
}
}
GrGLvoid GR_GL_FUNCTION_TYPE nullGLGenerateMipmap(GrGLenum target) {}
GrGLvoid GR_GL_FUNCTION_TYPE nullGLBufferData(GrGLenum target,
GrGLsizeiptr size,
const GrGLvoid* data,
GrGLenum usage) {
ThreadContext* ctx = ThreadContext::Get();
GrGLuint id = 0;
switch (target) {
case GR_GL_ARRAY_BUFFER:
id = ctx->fCurrArrayBuffer;
break;
case GR_GL_ELEMENT_ARRAY_BUFFER:
id = ctx->fCurrElementArrayBuffer;
break;
default:
SkFAIL("Unexpected target to nullGLBufferData");
break;
}
if (id > 0) {
BufferObj* buffer = ctx->fBufferManager.lookUp(id);
buffer->allocate(size, (const GrGLchar*) data);
}
}
GrGLvoid GR_GL_FUNCTION_TYPE nullGLPixelStorei(GrGLenum pname, GrGLint param) {}
GrGLvoid GR_GL_FUNCTION_TYPE nullGLReadPixels(GrGLint x, GrGLint y, GrGLsizei width, GrGLsizei height, GrGLenum format, GrGLenum type, GrGLvoid* pixels) {}
GrGLvoid GR_GL_FUNCTION_TYPE nullGLUseProgram(GrGLuint program) {}
GrGLvoid GR_GL_FUNCTION_TYPE nullGLViewport(GrGLint x, GrGLint y, GrGLsizei width, GrGLsizei height) {}
GrGLvoid GR_GL_FUNCTION_TYPE nullGLBindFramebuffer(GrGLenum target, GrGLuint framebuffer) {}
GrGLvoid GR_GL_FUNCTION_TYPE nullGLBindRenderbuffer(GrGLenum target, GrGLuint renderbuffer) {}
GrGLvoid GR_GL_FUNCTION_TYPE nullGLDeleteFramebuffers(GrGLsizei n, const GrGLuint *framebuffers) {}
GrGLvoid GR_GL_FUNCTION_TYPE nullGLDeleteRenderbuffers(GrGLsizei n, const GrGLuint *renderbuffers) {}
GrGLvoid GR_GL_FUNCTION_TYPE nullGLFramebufferRenderbuffer(GrGLenum target, GrGLenum attachment, GrGLenum renderbuffertarget, GrGLuint renderbuffer) {}
GrGLvoid GR_GL_FUNCTION_TYPE nullGLFramebufferTexture2D(GrGLenum target, GrGLenum attachment, GrGLenum textarget, GrGLuint texture, GrGLint level) {}
GrGLuint GR_GL_FUNCTION_TYPE nullGLCreateProgram() {
return ++ThreadContext::Get()->fCurrProgramID;
}
GrGLuint GR_GL_FUNCTION_TYPE nullGLCreateShader(GrGLenum type) {
return ++ThreadContext::Get()->fCurrShaderID;
}
// same delete used for shaders and programs
GrGLvoid GR_GL_FUNCTION_TYPE nullGLDelete(GrGLuint program) {
}
GrGLvoid GR_GL_FUNCTION_TYPE nullGLBindBuffer(GrGLenum target, GrGLuint buffer) {
ThreadContext* ctx = ThreadContext::Get();
switch (target) {
case GR_GL_ARRAY_BUFFER:
ctx->fCurrArrayBuffer = buffer;
break;
case GR_GL_ELEMENT_ARRAY_BUFFER:
ctx->fCurrElementArrayBuffer = buffer;
break;
}
}
// deleting a bound buffer has the side effect of binding 0
GrGLvoid GR_GL_FUNCTION_TYPE nullGLDeleteBuffers(GrGLsizei n, const GrGLuint* ids) {
ThreadContext* ctx = ThreadContext::Get();
for (int i = 0; i < n; ++i) {
if (ids[i] == ctx->fCurrArrayBuffer) {
ctx->fCurrArrayBuffer = 0;
}
if (ids[i] == ctx->fCurrElementArrayBuffer) {
ctx->fCurrElementArrayBuffer = 0;
}
BufferObj* buffer = ctx->fBufferManager.lookUp(ids[i]);
ctx->fBufferManager.free(buffer);
}
}
GrGLvoid* GR_GL_FUNCTION_TYPE nullGLMapBufferRange(GrGLenum target, GrGLintptr offset,
GrGLsizeiptr length, GrGLbitfield access) {
ThreadContext* ctx = ThreadContext::Get();
GrGLuint id = 0;
switch (target) {
case GR_GL_ARRAY_BUFFER:
id = ctx->fCurrArrayBuffer;
break;
case GR_GL_ELEMENT_ARRAY_BUFFER:
id = ctx->fCurrElementArrayBuffer;
break;
}
if (id > 0) {
// We just ignore the offset and length here.
BufferObj* buffer = ctx->fBufferManager.lookUp(id);
SkASSERT(!buffer->mapped());
buffer->setMapped(true);
return buffer->dataPtr();
}
return nullptr;
}
GrGLvoid* GR_GL_FUNCTION_TYPE nullGLMapBuffer(GrGLenum target, GrGLenum access) {
ThreadContext* ctx = ThreadContext::Get();
GrGLuint id = 0;
switch (target) {
case GR_GL_ARRAY_BUFFER:
id = ctx->fCurrArrayBuffer;
break;
case GR_GL_ELEMENT_ARRAY_BUFFER:
id = ctx->fCurrElementArrayBuffer;
break;
}
if (id > 0) {
BufferObj* buffer = ctx->fBufferManager.lookUp(id);
SkASSERT(!buffer->mapped());
buffer->setMapped(true);
return buffer->dataPtr();
}
SkASSERT(false);
return nullptr; // no buffer bound to target
}
GrGLvoid GR_GL_FUNCTION_TYPE nullGLFlushMappedBufferRange(GrGLenum target,
GrGLintptr offset,
GrGLsizeiptr length) {}
GrGLboolean GR_GL_FUNCTION_TYPE nullGLUnmapBuffer(GrGLenum target) {
ThreadContext* ctx = ThreadContext::Get();
GrGLuint id = 0;
switch (target) {
case GR_GL_ARRAY_BUFFER:
id = ctx->fCurrArrayBuffer;
break;
case GR_GL_ELEMENT_ARRAY_BUFFER:
id = ctx->fCurrElementArrayBuffer;
break;
}
if (id > 0) {
BufferObj* buffer = ctx->fBufferManager.lookUp(id);
SkASSERT(buffer->mapped());
buffer->setMapped(false);
return GR_GL_TRUE;
}
GrAlwaysAssert(false);
return GR_GL_FALSE; // GR_GL_INVALID_OPERATION;
}
GrGLvoid GR_GL_FUNCTION_TYPE nullGLGetBufferParameteriv(GrGLenum target, GrGLenum pname, GrGLint* params) {
ThreadContext* ctx = ThreadContext::Get();
switch (pname) {
case GR_GL_BUFFER_MAPPED: {
*params = GR_GL_FALSE;
GrGLuint id = 0;
switch (target) {
case GR_GL_ARRAY_BUFFER:
id = ctx->fCurrArrayBuffer;
break;
case GR_GL_ELEMENT_ARRAY_BUFFER:
id = ctx->fCurrElementArrayBuffer;
break;
}
if (id > 0) {
BufferObj* buffer = ctx->fBufferManager.lookUp(id);
if (buffer->mapped()) {
*params = GR_GL_TRUE;
static const GrGLubyte* CombinedExtensionString() {
static SkString gExtString;
static SkMutex gMutex;
gMutex.acquire();
if (0 == gExtString.size()) {
int i = 0;
while (kExtensions[i]) {
if (i > 0) {
gExtString.append(" ");
}
gExtString.append(kExtensions[i]);
++i;
}
break; }
default:
SkFAIL("Unexpected pname to GetBufferParamateriv");
break;
}
gMutex.release();
return (const GrGLubyte*) gExtString.c_str();
}
GrGLvoid genGenericIds(GrGLsizei n, GrGLuint* ids) {
for (int i = 0; i < n; ++i) {
ids[i] = ++fCurrGenericID;
}
}
GrGLvoid getInfoLog(GrGLuint object, GrGLsizei bufsize, GrGLsizei* length,
char* infolog) {
if (length) {
*length = 0;
}
if (bufsize > 0) {
*infolog = 0;
}
}
GrGLvoid getShaderOrProgramiv(GrGLuint object, GrGLenum pname, GrGLint* params) {
switch (pname) {
case GR_GL_LINK_STATUS: // fallthru
case GR_GL_COMPILE_STATUS:
*params = GR_GL_TRUE;
break;
case GR_GL_INFO_LOG_LENGTH:
*params = 0;
break;
// we don't expect any other pnames
default:
SkFAIL("Unexpected pname to GetProgramiv");
break;
}
}
template <typename T>
void queryResult(GrGLenum GLtarget, GrGLenum pname, T *params) {
switch (pname) {
case GR_GL_QUERY_RESULT_AVAILABLE:
*params = GR_GL_TRUE;
break;
case GR_GL_QUERY_RESULT:
*params = 0;
break;
default:
SkFAIL("Unexpected pname passed to GetQueryObject.");
break;
}
}
};
} // end anonymous namespace
const char* NullInterface::kExtensions[] = {
"GL_ARB_framebuffer_object",
"GL_ARB_blend_func_extended",
"GL_ARB_timer_query",
"GL_ARB_draw_buffers",
"GL_ARB_occlusion_query",
"GL_EXT_stencil_wrap",
nullptr, // signifies the end of the array.
};
const GrGLInterface* GrGLCreateNullInterface() {
GrGLInterface* interface = new GrGLInterface;
} // anonymous namespace
interface->fStandard = kGL_GrGLStandard;
GrGLInterface::Functions* functions = &interface->fFunctions;
functions->fActiveTexture = nullGLActiveTexture;
functions->fAttachShader = nullGLAttachShader;
functions->fBeginQuery = nullGLBeginQuery;
functions->fBindAttribLocation = nullGLBindAttribLocation;
functions->fBindBuffer = nullGLBindBuffer;
functions->fBindFragDataLocation = noOpGLBindFragDataLocation;
functions->fBindTexture = nullGLBindTexture;
functions->fBindVertexArray = nullGLBindVertexArray;
functions->fBlendColor = noOpGLBlendColor;
functions->fBlendEquation = noOpGLBlendEquation;
functions->fBlendFunc = noOpGLBlendFunc;
functions->fBufferData = nullGLBufferData;
functions->fBufferSubData = noOpGLBufferSubData;
functions->fClear = noOpGLClear;
functions->fClearColor = noOpGLClearColor;
functions->fClearStencil = noOpGLClearStencil;
functions->fColorMask = noOpGLColorMask;
functions->fCompileShader = noOpGLCompileShader;
functions->fCompressedTexImage2D = noOpGLCompressedTexImage2D;
functions->fCompressedTexSubImage2D = noOpGLCompressedTexSubImage2D;
functions->fCopyTexSubImage2D = noOpGLCopyTexSubImage2D;
functions->fCreateProgram = nullGLCreateProgram;
functions->fCreateShader = nullGLCreateShader;
functions->fCullFace = noOpGLCullFace;
functions->fDeleteBuffers = nullGLDeleteBuffers;
functions->fDeleteProgram = nullGLDelete;
functions->fDeleteQueries = noOpGLDeleteIds;
functions->fDeleteShader = nullGLDelete;
functions->fDeleteTextures = noOpGLDeleteIds;
functions->fDeleteVertexArrays = noOpGLDeleteIds;
functions->fDepthMask = noOpGLDepthMask;
functions->fDisable = noOpGLDisable;
functions->fDisableVertexAttribArray = noOpGLDisableVertexAttribArray;
functions->fDrawArrays = noOpGLDrawArrays;
functions->fDrawArraysInstanced = noOpGLDrawArraysInstanced;
functions->fDrawBuffer = noOpGLDrawBuffer;
functions->fDrawBuffers = noOpGLDrawBuffers;
functions->fDrawElements = noOpGLDrawElements;
functions->fDrawElementsInstanced = noOpGLDrawElementsInstanced;
functions->fEnable = noOpGLEnable;
functions->fEnableVertexAttribArray = noOpGLEnableVertexAttribArray;
functions->fEndQuery = noOpGLEndQuery;
functions->fFinish = noOpGLFinish;
functions->fFlush = noOpGLFlush;
functions->fFlushMappedBufferRange = nullGLFlushMappedBufferRange;
functions->fFrontFace = noOpGLFrontFace;
functions->fGenBuffers = nullGLGenBuffers;
functions->fGenerateMipmap = nullGLGenerateMipmap;
functions->fGenQueries = noOpGLGenIds;
functions->fGenTextures = noOpGLGenIds;
functions->fGenVertexArrays = noOpGLGenIds;
functions->fGetBufferParameteriv = nullGLGetBufferParameteriv;
functions->fGetError = noOpGLGetError;
functions->fGetIntegerv = noOpGLGetIntegerv;
functions->fGetMultisamplefv = noOpGLGetMultisamplefv;
functions->fGetQueryObjecti64v = noOpGLGetQueryObjecti64v;
functions->fGetQueryObjectiv = noOpGLGetQueryObjectiv;
functions->fGetQueryObjectui64v = noOpGLGetQueryObjectui64v;
functions->fGetQueryObjectuiv = noOpGLGetQueryObjectuiv;
functions->fGetQueryiv = noOpGLGetQueryiv;
functions->fGetProgramInfoLog = noOpGLGetInfoLog;
functions->fGetProgramiv = noOpGLGetShaderOrProgramiv;
functions->fGetShaderInfoLog = noOpGLGetInfoLog;
functions->fGetShaderiv = noOpGLGetShaderOrProgramiv;
functions->fGetString = noOpGLGetString;
functions->fGetStringi = noOpGLGetStringi;
functions->fGetTexLevelParameteriv = noOpGLGetTexLevelParameteriv;
functions->fGetUniformLocation = noOpGLGetUniformLocation;
functions->fInsertEventMarker = noOpGLInsertEventMarker;
functions->fLineWidth = noOpGLLineWidth;
functions->fLinkProgram = noOpGLLinkProgram;
functions->fMapBuffer = nullGLMapBuffer;
functions->fMapBufferRange = nullGLMapBufferRange;
functions->fPixelStorei = nullGLPixelStorei;
functions->fPopGroupMarker = noOpGLPopGroupMarker;
functions->fPushGroupMarker = noOpGLPushGroupMarker;
functions->fQueryCounter = noOpGLQueryCounter;
functions->fReadBuffer = noOpGLReadBuffer;
functions->fReadPixels = nullGLReadPixels;
functions->fScissor = noOpGLScissor;
functions->fShaderSource = noOpGLShaderSource;
functions->fStencilFunc = noOpGLStencilFunc;
functions->fStencilFuncSeparate = noOpGLStencilFuncSeparate;
functions->fStencilMask = noOpGLStencilMask;
functions->fStencilMaskSeparate = noOpGLStencilMaskSeparate;
functions->fStencilOp = noOpGLStencilOp;
functions->fStencilOpSeparate = noOpGLStencilOpSeparate;
functions->fTexBuffer = noOpGLTexBuffer;
functions->fTexImage2D = noOpGLTexImage2D;
functions->fTexParameteri = noOpGLTexParameteri;
functions->fTexParameteriv = noOpGLTexParameteriv;
functions->fTexSubImage2D = noOpGLTexSubImage2D;
functions->fTexStorage2D = noOpGLTexStorage2D;
functions->fDiscardFramebuffer = noOpGLDiscardFramebuffer;
functions->fUniform1f = noOpGLUniform1f;
functions->fUniform1i = noOpGLUniform1i;
functions->fUniform1fv = noOpGLUniform1fv;
functions->fUniform1iv = noOpGLUniform1iv;
functions->fUniform2f = noOpGLUniform2f;
functions->fUniform2i = noOpGLUniform2i;
functions->fUniform2fv = noOpGLUniform2fv;
functions->fUniform2iv = noOpGLUniform2iv;
functions->fUniform3f = noOpGLUniform3f;
functions->fUniform3i = noOpGLUniform3i;
functions->fUniform3fv = noOpGLUniform3fv;
functions->fUniform3iv = noOpGLUniform3iv;
functions->fUniform4f = noOpGLUniform4f;
functions->fUniform4i = noOpGLUniform4i;
functions->fUniform4fv = noOpGLUniform4fv;
functions->fUniform4iv = noOpGLUniform4iv;
functions->fUniformMatrix2fv = noOpGLUniformMatrix2fv;
functions->fUniformMatrix3fv = noOpGLUniformMatrix3fv;
functions->fUniformMatrix4fv = noOpGLUniformMatrix4fv;
functions->fUnmapBuffer = nullGLUnmapBuffer;
functions->fUseProgram = nullGLUseProgram;
functions->fVertexAttrib1f = noOpGLVertexAttrib1f;
functions->fVertexAttrib2fv = noOpGLVertexAttrib2fv;
functions->fVertexAttrib3fv = noOpGLVertexAttrib3fv;
functions->fVertexAttrib4fv = noOpGLVertexAttrib4fv;
functions->fVertexAttribDivisor = noOpGLVertexAttribDivisor;
functions->fVertexAttribIPointer = noOpGLVertexAttribIPointer;
functions->fVertexAttribPointer = noOpGLVertexAttribPointer;
functions->fViewport = nullGLViewport;
functions->fBindFramebuffer = nullGLBindFramebuffer;
functions->fBindRenderbuffer = nullGLBindRenderbuffer;
functions->fCheckFramebufferStatus = noOpGLCheckFramebufferStatus;
functions->fDeleteFramebuffers = nullGLDeleteFramebuffers;
functions->fDeleteRenderbuffers = nullGLDeleteRenderbuffers;
functions->fFramebufferRenderbuffer = nullGLFramebufferRenderbuffer;
functions->fFramebufferTexture2D = nullGLFramebufferTexture2D;
functions->fGenFramebuffers = noOpGLGenIds;
functions->fGenRenderbuffers = noOpGLGenIds;
functions->fGetFramebufferAttachmentParameteriv = noOpGLGetFramebufferAttachmentParameteriv;
functions->fGetRenderbufferParameteriv = noOpGLGetRenderbufferParameteriv;
functions->fRenderbufferStorage = noOpGLRenderbufferStorage;
functions->fRenderbufferStorageMultisample = noOpGLRenderbufferStorageMultisample;
functions->fBlitFramebuffer = noOpGLBlitFramebuffer;
functions->fResolveMultisampleFramebuffer = noOpGLResolveMultisampleFramebuffer;
functions->fMatrixLoadf = noOpGLMatrixLoadf;
functions->fMatrixLoadIdentity = noOpGLMatrixLoadIdentity;
functions->fBindFragDataLocationIndexed = noOpGLBindFragDataLocationIndexed;
interface->fExtensions.init(kGL_GrGLStandard, functions->fGetString, functions->fGetStringi,
functions->fGetIntegerv, nullptr, GR_EGL_NO_DISPLAY);
return interface;
}
const GrGLInterface* GrGLCreateNullInterface() { return new NullInterface; }

View File

@ -0,0 +1,320 @@
/*
* Copyright 2016 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#include <functional>
#include "GrGLTestInterface.h"
namespace {
template<typename R, typename... A>
std::function<R(A...)> bind_to_member(GrGLTestInterface* interface, R (GrGLTestInterface::*member)(A...)) {
return [interface, member] (A... a) -> R { return (interface->*member)(a...); };
}
} // anonymous namespace
GrGLTestInterface::GrGLTestInterface() {
fFunctions.fActiveTexture = bind_to_member(this, &GrGLTestInterface::activeTexture);
fFunctions.fAttachShader = bind_to_member(this, &GrGLTestInterface::attachShader);
fFunctions.fBeginQuery = bind_to_member(this, &GrGLTestInterface::beginQuery);
fFunctions.fBindAttribLocation = bind_to_member(this, &GrGLTestInterface::bindAttribLocation);
fFunctions.fBindBuffer = bind_to_member(this, &GrGLTestInterface::bindBuffer);
fFunctions.fBindFramebuffer = bind_to_member(this, &GrGLTestInterface::bindFramebuffer);
fFunctions.fBindRenderbuffer = bind_to_member(this, &GrGLTestInterface::bindRenderbuffer);
fFunctions.fBindTexture = bind_to_member(this, &GrGLTestInterface::bindTexture);
fFunctions.fBindFragDataLocation = bind_to_member(this, &GrGLTestInterface::bindFragDataLocation);
fFunctions.fBindFragDataLocationIndexed = bind_to_member(this, &GrGLTestInterface::bindFragDataLocationIndexed);
fFunctions.fBindVertexArray = bind_to_member(this, &GrGLTestInterface::bindVertexArray);
fFunctions.fBlendBarrier = bind_to_member(this, &GrGLTestInterface::blendBarrier);
fFunctions.fBlendColor = bind_to_member(this, &GrGLTestInterface::blendColor);
fFunctions.fBlendEquation = bind_to_member(this, &GrGLTestInterface::blendEquation);
fFunctions.fBlendFunc = bind_to_member(this, &GrGLTestInterface::blendFunc);
fFunctions.fBlitFramebuffer = bind_to_member(this, &GrGLTestInterface::blitFramebuffer);
fFunctions.fBufferData = bind_to_member(this, &GrGLTestInterface::bufferData);
fFunctions.fBufferSubData = bind_to_member(this, &GrGLTestInterface::bufferSubData);
fFunctions.fCheckFramebufferStatus = bind_to_member(this, &GrGLTestInterface::checkFramebufferStatus);
fFunctions.fClear = bind_to_member(this, &GrGLTestInterface::clear);
fFunctions.fClearColor = bind_to_member(this, &GrGLTestInterface::clearColor);
fFunctions.fClearStencil = bind_to_member(this, &GrGLTestInterface::clearStencil);
fFunctions.fColorMask = bind_to_member(this, &GrGLTestInterface::colorMask);
fFunctions.fCompileShader = bind_to_member(this, &GrGLTestInterface::compileShader);
fFunctions.fCompressedTexImage2D = bind_to_member(this, &GrGLTestInterface::compressedTexImage2D);
fFunctions.fCompressedTexSubImage2D = bind_to_member(this, &GrGLTestInterface::compressedTexSubImage2D);
fFunctions.fCopyTexSubImage2D = bind_to_member(this, &GrGLTestInterface::copyTexSubImage2D);
fFunctions.fCreateProgram = bind_to_member(this, &GrGLTestInterface::createProgram);
fFunctions.fCreateShader = bind_to_member(this, &GrGLTestInterface::createShader);
fFunctions.fCullFace = bind_to_member(this, &GrGLTestInterface::cullFace);
fFunctions.fDeleteBuffers = bind_to_member(this, &GrGLTestInterface::deleteBuffers);
fFunctions.fDeleteFramebuffers = bind_to_member(this, &GrGLTestInterface::deleteFramebuffers);
fFunctions.fDeleteProgram = bind_to_member(this, &GrGLTestInterface::deleteProgram);
fFunctions.fDeleteQueries = bind_to_member(this, &GrGLTestInterface::deleteQueries);
fFunctions.fDeleteRenderbuffers = bind_to_member(this, &GrGLTestInterface::deleteRenderbuffers);
fFunctions.fDeleteShader = bind_to_member(this, &GrGLTestInterface::deleteShader);
fFunctions.fDeleteTextures = bind_to_member(this, &GrGLTestInterface::deleteTextures);
fFunctions.fDeleteVertexArrays = bind_to_member(this, &GrGLTestInterface::deleteVertexArrays);
fFunctions.fDepthMask = bind_to_member(this, &GrGLTestInterface::depthMask);
fFunctions.fDisable = bind_to_member(this, &GrGLTestInterface::disable);
fFunctions.fDisableVertexAttribArray = bind_to_member(this, &GrGLTestInterface::disableVertexAttribArray);
fFunctions.fDrawArrays = bind_to_member(this, &GrGLTestInterface::drawArrays);
fFunctions.fDrawArraysInstanced = bind_to_member(this, &GrGLTestInterface::drawArraysInstanced);
fFunctions.fDrawArraysIndirect = bind_to_member(this, &GrGLTestInterface::drawArraysIndirect);
fFunctions.fDrawBuffer = bind_to_member(this, &GrGLTestInterface::drawBuffer);
fFunctions.fDrawBuffers = bind_to_member(this, &GrGLTestInterface::drawBuffers);
fFunctions.fDrawElements = bind_to_member(this, &GrGLTestInterface::drawElements);
fFunctions.fDrawElementsInstanced = bind_to_member(this, &GrGLTestInterface::drawElementsInstanced);
fFunctions.fDrawElementsIndirect = bind_to_member(this, &GrGLTestInterface::drawElementsIndirect);
fFunctions.fEnable = bind_to_member(this, &GrGLTestInterface::enable);
fFunctions.fEnableVertexAttribArray = bind_to_member(this, &GrGLTestInterface::enableVertexAttribArray);
fFunctions.fEndQuery = bind_to_member(this, &GrGLTestInterface::endQuery);
fFunctions.fFinish = bind_to_member(this, &GrGLTestInterface::finish);
fFunctions.fFlush = bind_to_member(this, &GrGLTestInterface::flush);
fFunctions.fFlushMappedBufferRange = bind_to_member(this, &GrGLTestInterface::flushMappedBufferRange);
fFunctions.fFramebufferRenderbuffer = bind_to_member(this, &GrGLTestInterface::framebufferRenderbuffer);
fFunctions.fFramebufferTexture2D = bind_to_member(this, &GrGLTestInterface::framebufferTexture2D);
fFunctions.fFramebufferTexture2DMultisample = bind_to_member(this, &GrGLTestInterface::framebufferTexture2DMultisample);
fFunctions.fFrontFace = bind_to_member(this, &GrGLTestInterface::frontFace);
fFunctions.fGenBuffers = bind_to_member(this, &GrGLTestInterface::genBuffers);
fFunctions.fGenFramebuffers = bind_to_member(this, &GrGLTestInterface::genFramebuffers);
fFunctions.fGenerateMipmap = bind_to_member(this, &GrGLTestInterface::generateMipmap);
fFunctions.fGenQueries = bind_to_member(this, &GrGLTestInterface::genQueries);
fFunctions.fGenRenderbuffers = bind_to_member(this, &GrGLTestInterface::genRenderbuffers);
fFunctions.fGenTextures = bind_to_member(this, &GrGLTestInterface::genTextures);
fFunctions.fGenVertexArrays = bind_to_member(this, &GrGLTestInterface::genVertexArrays);
fFunctions.fGetBufferParameteriv = bind_to_member(this, &GrGLTestInterface::getBufferParameteriv);
fFunctions.fGetError = bind_to_member(this, &GrGLTestInterface::getError);
fFunctions.fGetFramebufferAttachmentParameteriv = bind_to_member(this, &GrGLTestInterface::getFramebufferAttachmentParameteriv);
fFunctions.fGetIntegerv = bind_to_member(this, &GrGLTestInterface::getIntegerv);
fFunctions.fGetMultisamplefv = bind_to_member(this, &GrGLTestInterface::getMultisamplefv);
fFunctions.fGetProgramInfoLog = bind_to_member(this, &GrGLTestInterface::getProgramInfoLog);
fFunctions.fGetProgramiv = bind_to_member(this, &GrGLTestInterface::getProgramiv);
fFunctions.fGetQueryiv = bind_to_member(this, &GrGLTestInterface::getQueryiv);
fFunctions.fGetQueryObjecti64v = bind_to_member(this, &GrGLTestInterface::getQueryObjecti64v);
fFunctions.fGetQueryObjectiv = bind_to_member(this, &GrGLTestInterface::getQueryObjectiv);
fFunctions.fGetQueryObjectui64v = bind_to_member(this, &GrGLTestInterface::getQueryObjectui64v);
fFunctions.fGetQueryObjectuiv = bind_to_member(this, &GrGLTestInterface::getQueryObjectuiv);
fFunctions.fGetRenderbufferParameteriv = bind_to_member(this, &GrGLTestInterface::getRenderbufferParameteriv);
fFunctions.fGetShaderInfoLog = bind_to_member(this, &GrGLTestInterface::getShaderInfoLog);
fFunctions.fGetShaderiv = bind_to_member(this, &GrGLTestInterface::getShaderiv);
fFunctions.fGetShaderPrecisionFormat = bind_to_member(this, &GrGLTestInterface::getShaderPrecisionFormat);
fFunctions.fGetString = bind_to_member(this, &GrGLTestInterface::getString);
fFunctions.fGetStringi = bind_to_member(this, &GrGLTestInterface::getStringi);
fFunctions.fGetTexLevelParameteriv = bind_to_member(this, &GrGLTestInterface::getTexLevelParameteriv);
fFunctions.fGetUniformLocation = bind_to_member(this, &GrGLTestInterface::getUniformLocation);
fFunctions.fInsertEventMarker = bind_to_member(this, &GrGLTestInterface::insertEventMarker);
fFunctions.fInvalidateBufferData = bind_to_member(this, &GrGLTestInterface::invalidateBufferData);
fFunctions.fInvalidateBufferSubData = bind_to_member(this, &GrGLTestInterface::invalidateBufferSubData);
fFunctions.fInvalidateFramebuffer = bind_to_member(this, &GrGLTestInterface::invalidateFramebuffer);
fFunctions.fInvalidateSubFramebuffer = bind_to_member(this, &GrGLTestInterface::invalidateSubFramebuffer);
fFunctions.fInvalidateTexImage = bind_to_member(this, &GrGLTestInterface::invalidateTexImage);
fFunctions.fInvalidateTexSubImage = bind_to_member(this, &GrGLTestInterface::invalidateTexSubImage);
fFunctions.fIsTexture = bind_to_member(this, &GrGLTestInterface::isTexture);
fFunctions.fLineWidth = bind_to_member(this, &GrGLTestInterface::lineWidth);
fFunctions.fLinkProgram = bind_to_member(this, &GrGLTestInterface::linkProgram);
fFunctions.fMapBuffer = bind_to_member(this, &GrGLTestInterface::mapBuffer);
fFunctions.fMapBufferRange = bind_to_member(this, &GrGLTestInterface::mapBufferRange);
fFunctions.fMapBufferSubData = bind_to_member(this, &GrGLTestInterface::mapBufferSubData);
fFunctions.fMapTexSubImage2D = bind_to_member(this, &GrGLTestInterface::mapTexSubImage2D);
fFunctions.fPixelStorei = bind_to_member(this, &GrGLTestInterface::pixelStorei);
fFunctions.fPopGroupMarker = bind_to_member(this, &GrGLTestInterface::popGroupMarker);
fFunctions.fPushGroupMarker = bind_to_member(this, &GrGLTestInterface::pushGroupMarker);
fFunctions.fQueryCounter = bind_to_member(this, &GrGLTestInterface::queryCounter);
fFunctions.fRasterSamples = bind_to_member(this, &GrGLTestInterface::rasterSamples);
fFunctions.fReadBuffer = bind_to_member(this, &GrGLTestInterface::readBuffer);
fFunctions.fReadPixels = bind_to_member(this, &GrGLTestInterface::readPixels);
fFunctions.fRenderbufferStorage = bind_to_member(this, &GrGLTestInterface::renderbufferStorage);
fFunctions.fRenderbufferStorageMultisample = bind_to_member(this, &GrGLTestInterface::renderbufferStorageMultisample);
fFunctions.fResolveMultisampleFramebuffer = bind_to_member(this, &GrGLTestInterface::resolveMultisampleFramebuffer);
fFunctions.fScissor = bind_to_member(this, &GrGLTestInterface::scissor);
fFunctions.fBindUniformLocation = bind_to_member(this, &GrGLTestInterface::bindUniformLocation);
fFunctions.fShaderSource = bind_to_member(this, &GrGLTestInterface::shaderSource);
fFunctions.fStencilFunc = bind_to_member(this, &GrGLTestInterface::stencilFunc);
fFunctions.fStencilFuncSeparate = bind_to_member(this, &GrGLTestInterface::stencilFuncSeparate);
fFunctions.fStencilMask = bind_to_member(this, &GrGLTestInterface::stencilMask);
fFunctions.fStencilMaskSeparate = bind_to_member(this, &GrGLTestInterface::stencilMaskSeparate);
fFunctions.fStencilOp = bind_to_member(this, &GrGLTestInterface::stencilOp);
fFunctions.fStencilOpSeparate = bind_to_member(this, &GrGLTestInterface::stencilOpSeparate);
fFunctions.fTexBuffer = bind_to_member(this, &GrGLTestInterface::texBuffer);
fFunctions.fTexImage2D = bind_to_member(this, &GrGLTestInterface::texImage2D);
fFunctions.fTexParameteri = bind_to_member(this, &GrGLTestInterface::texParameteri);
fFunctions.fTexParameteriv = bind_to_member(this, &GrGLTestInterface::texParameteriv);
fFunctions.fTexStorage2D = bind_to_member(this, &GrGLTestInterface::texStorage2D);
fFunctions.fDiscardFramebuffer = bind_to_member(this, &GrGLTestInterface::discardFramebuffer);
fFunctions.fTexSubImage2D = bind_to_member(this, &GrGLTestInterface::texSubImage2D);
fFunctions.fTextureBarrier = bind_to_member(this, &GrGLTestInterface::textureBarrier);
fFunctions.fUniform1f = bind_to_member(this, &GrGLTestInterface::uniform1f);
fFunctions.fUniform1i = bind_to_member(this, &GrGLTestInterface::uniform1i);
fFunctions.fUniform1fv = bind_to_member(this, &GrGLTestInterface::uniform1fv);
fFunctions.fUniform1iv = bind_to_member(this, &GrGLTestInterface::uniform1iv);
fFunctions.fUniform2f = bind_to_member(this, &GrGLTestInterface::uniform2f);
fFunctions.fUniform2i = bind_to_member(this, &GrGLTestInterface::uniform2i);
fFunctions.fUniform2fv = bind_to_member(this, &GrGLTestInterface::uniform2fv);
fFunctions.fUniform2iv = bind_to_member(this, &GrGLTestInterface::uniform2iv);
fFunctions.fUniform3f = bind_to_member(this, &GrGLTestInterface::uniform3f);
fFunctions.fUniform3i = bind_to_member(this, &GrGLTestInterface::uniform3i);
fFunctions.fUniform3fv = bind_to_member(this, &GrGLTestInterface::uniform3fv);
fFunctions.fUniform3iv = bind_to_member(this, &GrGLTestInterface::uniform3iv);
fFunctions.fUniform4f = bind_to_member(this, &GrGLTestInterface::uniform4f);
fFunctions.fUniform4i = bind_to_member(this, &GrGLTestInterface::uniform4i);
fFunctions.fUniform4fv = bind_to_member(this, &GrGLTestInterface::uniform4fv);
fFunctions.fUniform4iv = bind_to_member(this, &GrGLTestInterface::uniform4iv);
fFunctions.fUniformMatrix2fv = bind_to_member(this, &GrGLTestInterface::uniformMatrix2fv);
fFunctions.fUniformMatrix3fv = bind_to_member(this, &GrGLTestInterface::uniformMatrix3fv);
fFunctions.fUniformMatrix4fv = bind_to_member(this, &GrGLTestInterface::uniformMatrix4fv);
fFunctions.fUnmapBuffer = bind_to_member(this, &GrGLTestInterface::unmapBuffer);
fFunctions.fUnmapBufferSubData = bind_to_member(this, &GrGLTestInterface::unmapBufferSubData);
fFunctions.fUnmapTexSubImage2D = bind_to_member(this, &GrGLTestInterface::unmapTexSubImage2D);
fFunctions.fUseProgram = bind_to_member(this, &GrGLTestInterface::useProgram);
fFunctions.fVertexAttrib1f = bind_to_member(this, &GrGLTestInterface::vertexAttrib1f);
fFunctions.fVertexAttrib2fv = bind_to_member(this, &GrGLTestInterface::vertexAttrib2fv);
fFunctions.fVertexAttrib3fv = bind_to_member(this, &GrGLTestInterface::vertexAttrib3fv);
fFunctions.fVertexAttrib4fv = bind_to_member(this, &GrGLTestInterface::vertexAttrib4fv);
fFunctions.fVertexAttribDivisor = bind_to_member(this, &GrGLTestInterface::vertexAttribDivisor);
fFunctions.fVertexAttribIPointer = bind_to_member(this, &GrGLTestInterface::vertexAttribIPointer);
fFunctions.fVertexAttribPointer = bind_to_member(this, &GrGLTestInterface::vertexAttribPointer);
fFunctions.fViewport = bind_to_member(this, &GrGLTestInterface::viewport);
fFunctions.fMatrixLoadf = bind_to_member(this, &GrGLTestInterface::matrixLoadf);
fFunctions.fMatrixLoadIdentity = bind_to_member(this, &GrGLTestInterface::matrixLoadIdentity);
fFunctions.fPathCommands = bind_to_member(this, &GrGLTestInterface::pathCommands);
fFunctions.fPathParameteri = bind_to_member(this, &GrGLTestInterface::pathParameteri);
fFunctions.fPathParameterf = bind_to_member(this, &GrGLTestInterface::pathParameterf);
fFunctions.fGenPaths = bind_to_member(this, &GrGLTestInterface::genPaths);
fFunctions.fDeletePaths = bind_to_member(this, &GrGLTestInterface::deletePaths);
fFunctions.fIsPath = bind_to_member(this, &GrGLTestInterface::isPath);
fFunctions.fPathStencilFunc = bind_to_member(this, &GrGLTestInterface::pathStencilFunc);
fFunctions.fStencilFillPath = bind_to_member(this, &GrGLTestInterface::stencilFillPath);
fFunctions.fStencilStrokePath = bind_to_member(this, &GrGLTestInterface::stencilStrokePath);
fFunctions.fStencilFillPathInstanced = bind_to_member(this, &GrGLTestInterface::stencilFillPathInstanced);
fFunctions.fStencilStrokePathInstanced = bind_to_member(this, &GrGLTestInterface::stencilStrokePathInstanced);
fFunctions.fCoverFillPath = bind_to_member(this, &GrGLTestInterface::coverFillPath);
fFunctions.fCoverStrokePath = bind_to_member(this, &GrGLTestInterface::coverStrokePath);
fFunctions.fCoverFillPathInstanced = bind_to_member(this, &GrGLTestInterface::coverFillPathInstanced);
fFunctions.fCoverStrokePathInstanced = bind_to_member(this, &GrGLTestInterface::coverStrokePathInstanced);
fFunctions.fStencilThenCoverFillPath = bind_to_member(this, &GrGLTestInterface::stencilThenCoverFillPath);
fFunctions.fStencilThenCoverStrokePath = bind_to_member(this, &GrGLTestInterface::stencilThenCoverStrokePath);
fFunctions.fStencilThenCoverFillPathInstanced = bind_to_member(this, &GrGLTestInterface::stencilThenCoverFillPathInstanced);
fFunctions.fStencilThenCoverStrokePathInstanced = bind_to_member(this, &GrGLTestInterface::stencilThenCoverStrokePathInstanced);
fFunctions.fProgramPathFragmentInputGen = bind_to_member(this, &GrGLTestInterface::programPathFragmentInputGen);
fFunctions.fBindFragmentInputLocation = bind_to_member(this, &GrGLTestInterface::bindFragmentInputLocation);
fFunctions.fGetProgramResourceLocation = bind_to_member(this, &GrGLTestInterface::getProgramResourceLocation);
fFunctions.fCoverageModulation = bind_to_member(this, &GrGLTestInterface::coverageModulation);
fFunctions.fMultiDrawArraysIndirect = bind_to_member(this, &GrGLTestInterface::multiDrawArraysIndirect);
fFunctions.fMultiDrawElementsIndirect = bind_to_member(this, &GrGLTestInterface::multiDrawElementsIndirect);
fFunctions.fGetTextureHandle = bind_to_member(this, &GrGLTestInterface::getTextureHandle);
fFunctions.fGetTextureSamplerHandle = bind_to_member(this, &GrGLTestInterface::getTextureSamplerHandle);
fFunctions.fMakeTextureHandleResident = bind_to_member(this, &GrGLTestInterface::makeTextureHandleResident);
fFunctions.fMakeTextureHandleNonResident = bind_to_member(this, &GrGLTestInterface::makeTextureHandleNonResident);
fFunctions.fGetImageHandle = bind_to_member(this, &GrGLTestInterface::getImageHandle);
fFunctions.fMakeImageHandleResident = bind_to_member(this, &GrGLTestInterface::makeImageHandleResident);
fFunctions.fMakeImageHandleNonResident = bind_to_member(this, &GrGLTestInterface::makeImageHandleNonResident);
fFunctions.fIsTextureHandleResident = bind_to_member(this, &GrGLTestInterface::isTextureHandleResident);
fFunctions.fIsImageHandleResident = bind_to_member(this, &GrGLTestInterface::isImageHandleResident);
fFunctions.fUniformHandleui64 = bind_to_member(this, &GrGLTestInterface::uniformHandleui64);
fFunctions.fUniformHandleui64v = bind_to_member(this, &GrGLTestInterface::uniformHandleui64v);
fFunctions.fProgramUniformHandleui64 = bind_to_member(this, &GrGLTestInterface::programUniformHandleui64);
fFunctions.fProgramUniformHandleui64v = bind_to_member(this, &GrGLTestInterface::programUniformHandleui64v);
fFunctions.fTextureParameteri = bind_to_member(this, &GrGLTestInterface::textureParameteri);
fFunctions.fTextureParameteriv = bind_to_member(this, &GrGLTestInterface::textureParameteriv);
fFunctions.fTextureParameterf = bind_to_member(this, &GrGLTestInterface::textureParameterf);
fFunctions.fTextureParameterfv = bind_to_member(this, &GrGLTestInterface::textureParameterfv);
fFunctions.fTextureImage1D = bind_to_member(this, &GrGLTestInterface::textureImage1D);
fFunctions.fTextureImage2D = bind_to_member(this, &GrGLTestInterface::textureImage2D);
fFunctions.fTextureSubImage1D = bind_to_member(this, &GrGLTestInterface::textureSubImage1D);
fFunctions.fTextureSubImage2D = bind_to_member(this, &GrGLTestInterface::textureSubImage2D);
fFunctions.fCopyTextureImage1D = bind_to_member(this, &GrGLTestInterface::copyTextureImage1D);
fFunctions.fCopyTextureImage2D = bind_to_member(this, &GrGLTestInterface::copyTextureImage2D);
fFunctions.fCopyTextureSubImage1D = bind_to_member(this, &GrGLTestInterface::copyTextureSubImage1D);
fFunctions.fCopyTextureSubImage2D = bind_to_member(this, &GrGLTestInterface::copyTextureSubImage2D);
fFunctions.fGetTextureImage = bind_to_member(this, &GrGLTestInterface::getTextureImage);
fFunctions.fGetTextureParameterfv = bind_to_member(this, &GrGLTestInterface::getTextureParameterfv);
fFunctions.fGetTextureParameteriv = bind_to_member(this, &GrGLTestInterface::getTextureParameteriv);
fFunctions.fGetTextureLevelParameterfv = bind_to_member(this, &GrGLTestInterface::getTextureLevelParameterfv);
fFunctions.fGetTextureLevelParameteriv = bind_to_member(this, &GrGLTestInterface::getTextureLevelParameteriv);
fFunctions.fTextureImage3D = bind_to_member(this, &GrGLTestInterface::textureImage3D);
fFunctions.fTextureSubImage3D = bind_to_member(this, &GrGLTestInterface::textureSubImage3D);
fFunctions.fCopyTextureSubImage3D = bind_to_member(this, &GrGLTestInterface::copyTextureSubImage3D);
fFunctions.fCompressedTextureImage3D = bind_to_member(this, &GrGLTestInterface::compressedTextureImage3D);
fFunctions.fCompressedTextureImage2D = bind_to_member(this, &GrGLTestInterface::compressedTextureImage2D);
fFunctions.fCompressedTextureImage1D = bind_to_member(this, &GrGLTestInterface::compressedTextureImage1D);
fFunctions.fCompressedTextureSubImage3D = bind_to_member(this, &GrGLTestInterface::compressedTextureSubImage3D);
fFunctions.fCompressedTextureSubImage2D = bind_to_member(this, &GrGLTestInterface::compressedTextureSubImage2D);
fFunctions.fCompressedTextureSubImage1D = bind_to_member(this, &GrGLTestInterface::compressedTextureSubImage1D);
fFunctions.fGetCompressedTextureImage = bind_to_member(this, &GrGLTestInterface::getCompressedTextureImage);
fFunctions.fNamedBufferData = bind_to_member(this, &GrGLTestInterface::namedBufferData);
fFunctions.fNamedBufferSubData = bind_to_member(this, &GrGLTestInterface::namedBufferSubData);
fFunctions.fMapNamedBuffer = bind_to_member(this, &GrGLTestInterface::mapNamedBuffer);
fFunctions.fUnmapNamedBuffer = bind_to_member(this, &GrGLTestInterface::unmapNamedBuffer);
fFunctions.fGetNamedBufferParameteriv = bind_to_member(this, &GrGLTestInterface::getNamedBufferParameteriv);
fFunctions.fGetNamedBufferPointerv = bind_to_member(this, &GrGLTestInterface::getNamedBufferPointerv);
fFunctions.fGetNamedBufferSubData = bind_to_member(this, &GrGLTestInterface::getNamedBufferSubData);
fFunctions.fProgramUniform1f = bind_to_member(this, &GrGLTestInterface::programUniform1f);
fFunctions.fProgramUniform2f = bind_to_member(this, &GrGLTestInterface::programUniform2f);
fFunctions.fProgramUniform3f = bind_to_member(this, &GrGLTestInterface::programUniform3f);
fFunctions.fProgramUniform4f = bind_to_member(this, &GrGLTestInterface::programUniform4f);
fFunctions.fProgramUniform1i = bind_to_member(this, &GrGLTestInterface::programUniform1i);
fFunctions.fProgramUniform2i = bind_to_member(this, &GrGLTestInterface::programUniform2i);
fFunctions.fProgramUniform3i = bind_to_member(this, &GrGLTestInterface::programUniform3i);
fFunctions.fProgramUniform4i = bind_to_member(this, &GrGLTestInterface::programUniform4i);
fFunctions.fProgramUniform1fv = bind_to_member(this, &GrGLTestInterface::programUniform1fv);
fFunctions.fProgramUniform2fv = bind_to_member(this, &GrGLTestInterface::programUniform2fv);
fFunctions.fProgramUniform3fv = bind_to_member(this, &GrGLTestInterface::programUniform3fv);
fFunctions.fProgramUniform4fv = bind_to_member(this, &GrGLTestInterface::programUniform4fv);
fFunctions.fProgramUniform1iv = bind_to_member(this, &GrGLTestInterface::programUniform1iv);
fFunctions.fProgramUniform2iv = bind_to_member(this, &GrGLTestInterface::programUniform2iv);
fFunctions.fProgramUniform3iv = bind_to_member(this, &GrGLTestInterface::programUniform3iv);
fFunctions.fProgramUniform4iv = bind_to_member(this, &GrGLTestInterface::programUniform4iv);
fFunctions.fProgramUniformMatrix2fv = bind_to_member(this, &GrGLTestInterface::programUniformMatrix2fv);
fFunctions.fProgramUniformMatrix3fv = bind_to_member(this, &GrGLTestInterface::programUniformMatrix3fv);
fFunctions.fProgramUniformMatrix4fv = bind_to_member(this, &GrGLTestInterface::programUniformMatrix4fv);
fFunctions.fProgramUniformMatrix2x3fv = bind_to_member(this, &GrGLTestInterface::programUniformMatrix2x3fv);
fFunctions.fProgramUniformMatrix3x2fv = bind_to_member(this, &GrGLTestInterface::programUniformMatrix3x2fv);
fFunctions.fProgramUniformMatrix2x4fv = bind_to_member(this, &GrGLTestInterface::programUniformMatrix2x4fv);
fFunctions.fProgramUniformMatrix4x2fv = bind_to_member(this, &GrGLTestInterface::programUniformMatrix4x2fv);
fFunctions.fProgramUniformMatrix3x4fv = bind_to_member(this, &GrGLTestInterface::programUniformMatrix3x4fv);
fFunctions.fProgramUniformMatrix4x3fv = bind_to_member(this, &GrGLTestInterface::programUniformMatrix4x3fv);
fFunctions.fNamedRenderbufferStorage = bind_to_member(this, &GrGLTestInterface::namedRenderbufferStorage);
fFunctions.fGetNamedRenderbufferParameteriv = bind_to_member(this, &GrGLTestInterface::getNamedRenderbufferParameteriv);
fFunctions.fNamedRenderbufferStorageMultisample = bind_to_member(this, &GrGLTestInterface::namedRenderbufferStorageMultisample);
fFunctions.fCheckNamedFramebufferStatus = bind_to_member(this, &GrGLTestInterface::checkNamedFramebufferStatus);
fFunctions.fNamedFramebufferTexture1D = bind_to_member(this, &GrGLTestInterface::namedFramebufferTexture1D);
fFunctions.fNamedFramebufferTexture2D = bind_to_member(this, &GrGLTestInterface::namedFramebufferTexture2D);
fFunctions.fNamedFramebufferTexture3D = bind_to_member(this, &GrGLTestInterface::namedFramebufferTexture3D);
fFunctions.fNamedFramebufferRenderbuffer = bind_to_member(this, &GrGLTestInterface::namedFramebufferRenderbuffer);
fFunctions.fGetNamedFramebufferAttachmentParameteriv = bind_to_member(this, &GrGLTestInterface::getNamedFramebufferAttachmentParameteriv);
fFunctions.fGenerateTextureMipmap = bind_to_member(this, &GrGLTestInterface::generateTextureMipmap);
fFunctions.fFramebufferDrawBuffer = bind_to_member(this, &GrGLTestInterface::framebufferDrawBuffer);
fFunctions.fFramebufferDrawBuffers = bind_to_member(this, &GrGLTestInterface::framebufferDrawBuffers);
fFunctions.fFramebufferReadBuffer = bind_to_member(this, &GrGLTestInterface::framebufferReadBuffer);
fFunctions.fGetFramebufferParameteriv = bind_to_member(this, &GrGLTestInterface::getFramebufferParameteriv);
fFunctions.fNamedCopyBufferSubData = bind_to_member(this, &GrGLTestInterface::namedCopyBufferSubData);
fFunctions.fVertexArrayVertexOffset = bind_to_member(this, &GrGLTestInterface::vertexArrayVertexOffset);
fFunctions.fVertexArrayColorOffset = bind_to_member(this, &GrGLTestInterface::vertexArrayColorOffset);
fFunctions.fVertexArrayEdgeFlagOffset = bind_to_member(this, &GrGLTestInterface::vertexArrayEdgeFlagOffset);
fFunctions.fVertexArrayIndexOffset = bind_to_member(this, &GrGLTestInterface::vertexArrayIndexOffset);
fFunctions.fVertexArrayNormalOffset = bind_to_member(this, &GrGLTestInterface::vertexArrayNormalOffset);
fFunctions.fVertexArrayTexCoordOffset = bind_to_member(this, &GrGLTestInterface::vertexArrayTexCoordOffset);
fFunctions.fVertexArrayMultiTexCoordOffset = bind_to_member(this, &GrGLTestInterface::vertexArrayMultiTexCoordOffset);
fFunctions.fVertexArrayFogCoordOffset = bind_to_member(this, &GrGLTestInterface::vertexArrayFogCoordOffset);
fFunctions.fVertexArraySecondaryColorOffset = bind_to_member(this, &GrGLTestInterface::vertexArraySecondaryColorOffset);
fFunctions.fVertexArrayVertexAttribOffset = bind_to_member(this, &GrGLTestInterface::vertexArrayVertexAttribOffset);
fFunctions.fVertexArrayVertexAttribIOffset = bind_to_member(this, &GrGLTestInterface::vertexArrayVertexAttribIOffset);
fFunctions.fEnableVertexArray = bind_to_member(this, &GrGLTestInterface::enableVertexArray);
fFunctions.fDisableVertexArray = bind_to_member(this, &GrGLTestInterface::disableVertexArray);
fFunctions.fEnableVertexArrayAttrib = bind_to_member(this, &GrGLTestInterface::enableVertexArrayAttrib);
fFunctions.fDisableVertexArrayAttrib = bind_to_member(this, &GrGLTestInterface::disableVertexArrayAttrib);
fFunctions.fGetVertexArrayIntegerv = bind_to_member(this, &GrGLTestInterface::getVertexArrayIntegerv);
fFunctions.fGetVertexArrayPointerv = bind_to_member(this, &GrGLTestInterface::getVertexArrayPointerv);
fFunctions.fGetVertexArrayIntegeri_v = bind_to_member(this, &GrGLTestInterface::getVertexArrayIntegeri_v);
fFunctions.fGetVertexArrayPointeri_v = bind_to_member(this, &GrGLTestInterface::getVertexArrayPointeri_v);
fFunctions.fMapNamedBufferRange = bind_to_member(this, &GrGLTestInterface::mapNamedBufferRange);
fFunctions.fFlushMappedNamedBufferRange = bind_to_member(this, &GrGLTestInterface::flushMappedNamedBufferRange);
fFunctions.fTextureBuffer = bind_to_member(this, &GrGLTestInterface::textureBuffer);
fFunctions.fDebugMessageControl = bind_to_member(this, &GrGLTestInterface::debugMessageControl);
fFunctions.fDebugMessageInsert = bind_to_member(this, &GrGLTestInterface::debugMessageInsert);
fFunctions.fDebugMessageCallback = bind_to_member(this, &GrGLTestInterface::debugMessageCallback);
fFunctions.fGetDebugMessageLog = bind_to_member(this, &GrGLTestInterface::getDebugMessageLog);
fFunctions.fPushDebugGroup = bind_to_member(this, &GrGLTestInterface::pushDebugGroup);
fFunctions.fPopDebugGroup = bind_to_member(this, &GrGLTestInterface::popDebugGroup);
fFunctions.fObjectLabel = bind_to_member(this, &GrGLTestInterface::objectLabel);
}

View File

@ -0,0 +1,332 @@
/*
* Copyright 2016 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#ifndef GrGLTestInterface_DEFINED
#define GrGLTestInterface_DEFINED
#include "gl/GrGLInterface.h"
#include "GrGLDefines.h"
class GrGLTestInterface : public GrGLInterface {
public:
virtual GrGLvoid activeTexture(GrGLenum texture) {}
virtual GrGLvoid attachShader(GrGLuint program, GrGLuint shader) {}
virtual GrGLvoid beginQuery(GrGLenum target, GrGLuint id) {}
virtual GrGLvoid bindAttribLocation(GrGLuint program, GrGLuint index, const char* name) {}
virtual GrGLvoid bindBuffer(GrGLenum target, GrGLuint buffer) {}
virtual GrGLvoid bindFramebuffer(GrGLenum target, GrGLuint framebuffer) {}
virtual GrGLvoid bindRenderbuffer(GrGLenum target, GrGLuint renderbuffer) {}
virtual GrGLvoid bindTexture(GrGLenum target, GrGLuint texture) {}
virtual GrGLvoid bindFragDataLocation(GrGLuint program, GrGLuint colorNumber, const GrGLchar* name) {}
virtual GrGLvoid bindFragDataLocationIndexed(GrGLuint program, GrGLuint colorNumber, GrGLuint index, const GrGLchar * name) {}
virtual GrGLvoid bindVertexArray(GrGLuint array) {}
virtual GrGLvoid blendBarrier() {}
virtual GrGLvoid blendColor(GrGLclampf red, GrGLclampf green, GrGLclampf blue, GrGLclampf alpha) {}
virtual GrGLvoid blendEquation(GrGLenum mode) {}
virtual GrGLvoid blendFunc(GrGLenum sfactor, GrGLenum dfactor) {}
virtual GrGLvoid blitFramebuffer(GrGLint srcX0, GrGLint srcY0, GrGLint srcX1, GrGLint srcY1, GrGLint dstX0, GrGLint dstY0, GrGLint dstX1, GrGLint dstY1, GrGLbitfield mask, GrGLenum filter) {}
virtual GrGLvoid bufferData(GrGLenum target, GrGLsizeiptr size, const GrGLvoid* data, GrGLenum usage) {}
virtual GrGLvoid bufferSubData(GrGLenum target, GrGLintptr offset, GrGLsizeiptr size, const GrGLvoid* data) {}
virtual GrGLenum checkFramebufferStatus(GrGLenum target) { return GR_GL_FRAMEBUFFER_COMPLETE; }
virtual GrGLvoid clear(GrGLbitfield mask) {}
virtual GrGLvoid clearColor(GrGLclampf red, GrGLclampf green, GrGLclampf blue, GrGLclampf alpha) {}
virtual GrGLvoid clearStencil(GrGLint s) {}
virtual GrGLvoid colorMask(GrGLboolean red, GrGLboolean green, GrGLboolean blue, GrGLboolean alpha) {}
virtual GrGLvoid compileShader(GrGLuint shader) {}
virtual GrGLvoid compressedTexImage2D(GrGLenum target, GrGLint level, GrGLenum internalformat, GrGLsizei width, GrGLsizei height, GrGLint border, GrGLsizei imageSize, const GrGLvoid* data) {}
virtual GrGLvoid compressedTexSubImage2D(GrGLenum target, GrGLint level, GrGLint xoffset, GrGLint yoffset, GrGLsizei width, GrGLsizei height, GrGLenum format, GrGLsizei imageSize, const GrGLvoid* data) {}
virtual GrGLvoid copyTexSubImage2D(GrGLenum target, GrGLint level, GrGLint xoffset, GrGLint yoffset, GrGLint x, GrGLint y, GrGLsizei width, GrGLsizei height) {}
virtual GrGLuint createProgram() { return 0; }
virtual GrGLuint createShader(GrGLenum type) { return 0; }
virtual GrGLvoid cullFace(GrGLenum mode) {}
virtual GrGLvoid deleteBuffers(GrGLsizei n, const GrGLuint* buffers) {}
virtual GrGLvoid deleteFramebuffers(GrGLsizei n, const GrGLuint *framebuffers) {}
virtual GrGLvoid deleteProgram(GrGLuint program) {}
virtual GrGLvoid deleteQueries(GrGLsizei n, const GrGLuint *ids) {}
virtual GrGLvoid deleteRenderbuffers(GrGLsizei n, const GrGLuint *renderbuffers) {}
virtual GrGLvoid deleteShader(GrGLuint shader) {}
virtual GrGLvoid deleteTextures(GrGLsizei n, const GrGLuint* textures) {}
virtual GrGLvoid deleteVertexArrays(GrGLsizei n, const GrGLuint *arrays) {}
virtual GrGLvoid depthMask(GrGLboolean flag) {}
virtual GrGLvoid disable(GrGLenum cap) {}
virtual GrGLvoid disableVertexAttribArray(GrGLuint index) {}
virtual GrGLvoid drawArrays(GrGLenum mode, GrGLint first, GrGLsizei count) {}
virtual GrGLvoid drawArraysInstanced(GrGLenum mode, GrGLint first, GrGLsizei count, GrGLsizei primcount) {}
virtual GrGLvoid drawArraysIndirect(GrGLenum mode, GrGLvoid* indirect) {}
virtual GrGLvoid drawBuffer(GrGLenum mode) {}
virtual GrGLvoid drawBuffers(GrGLsizei n, const GrGLenum* bufs) {}
virtual GrGLvoid drawElements(GrGLenum mode, GrGLsizei count, GrGLenum type, const GrGLvoid* indices) {}
virtual GrGLvoid drawElementsInstanced(GrGLenum mode, GrGLsizei count, GrGLenum type, const GrGLvoid *indices, GrGLsizei primcount) {}
virtual GrGLvoid drawElementsIndirect(GrGLenum mode, GrGLenum type, GrGLvoid* indirect) {}
virtual GrGLvoid enable(GrGLenum cap) {}
virtual GrGLvoid enableVertexAttribArray(GrGLuint index) {}
virtual GrGLvoid endQuery(GrGLenum target) {}
virtual GrGLvoid finish() {}
virtual GrGLvoid flush() {}
virtual GrGLvoid flushMappedBufferRange(GrGLenum target, GrGLintptr offset, GrGLsizeiptr length) {}
virtual GrGLvoid framebufferRenderbuffer(GrGLenum target, GrGLenum attachment, GrGLenum renderbuffertarget, GrGLuint renderbuffer) {}
virtual GrGLvoid framebufferTexture2D(GrGLenum target, GrGLenum attachment, GrGLenum textarget, GrGLuint texture, GrGLint level) {}
virtual GrGLvoid framebufferTexture2DMultisample(GrGLenum target, GrGLenum attachment, GrGLenum textarget, GrGLuint texture, GrGLint level, GrGLsizei samples) {}
virtual GrGLvoid frontFace(GrGLenum mode) {}
virtual GrGLvoid genBuffers(GrGLsizei n, GrGLuint* buffers) {}
virtual GrGLvoid genFramebuffers(GrGLsizei n, GrGLuint *framebuffers) {}
virtual GrGLvoid generateMipmap(GrGLenum target) {}
virtual GrGLvoid genQueries(GrGLsizei n, GrGLuint *ids) {}
virtual GrGLvoid genRenderbuffers(GrGLsizei n, GrGLuint *renderbuffers) {}
virtual GrGLvoid genTextures(GrGLsizei n, GrGLuint* textures) {}
virtual GrGLvoid genVertexArrays(GrGLsizei n, GrGLuint *arrays) {}
virtual GrGLvoid getBufferParameteriv(GrGLenum target, GrGLenum pname, GrGLint* params) {}
virtual GrGLenum getError() { return GR_GL_NO_ERROR; }
virtual GrGLvoid getFramebufferAttachmentParameteriv(GrGLenum target, GrGLenum attachment, GrGLenum pname, GrGLint* params) {}
virtual GrGLvoid getIntegerv(GrGLenum pname, GrGLint* params) {}
virtual GrGLvoid getMultisamplefv(GrGLenum pname, GrGLuint index, GrGLfloat* val) {}
virtual GrGLvoid getProgramInfoLog(GrGLuint program, GrGLsizei bufsize, GrGLsizei* length, char* infolog) {}
virtual GrGLvoid getProgramiv(GrGLuint program, GrGLenum pname, GrGLint* params) {}
virtual GrGLvoid getQueryiv(GrGLenum GLtarget, GrGLenum pname, GrGLint *params) {}
virtual GrGLvoid getQueryObjecti64v(GrGLuint id, GrGLenum pname, GrGLint64 *params) {}
virtual GrGLvoid getQueryObjectiv(GrGLuint id, GrGLenum pname, GrGLint *params) {}
virtual GrGLvoid getQueryObjectui64v(GrGLuint id, GrGLenum pname, GrGLuint64 *params) {}
virtual GrGLvoid getQueryObjectuiv(GrGLuint id, GrGLenum pname, GrGLuint *params) {}
virtual GrGLvoid getRenderbufferParameteriv(GrGLenum target, GrGLenum pname, GrGLint* params) {}
virtual GrGLvoid getShaderInfoLog(GrGLuint shader, GrGLsizei bufsize, GrGLsizei* length, char* infolog) {}
virtual GrGLvoid getShaderiv(GrGLuint shader, GrGLenum pname, GrGLint* params) {}
virtual GrGLvoid getShaderPrecisionFormat(GrGLenum shadertype, GrGLenum precisiontype, GrGLint *range, GrGLint *precision) {}
virtual const GrGLubyte* getString(GrGLenum name) { return nullptr; }
virtual const GrGLubyte* getStringi(GrGLenum name, GrGLuint index) { return nullptr; }
virtual GrGLvoid getTexLevelParameteriv(GrGLenum target, GrGLint level, GrGLenum pname, GrGLint* params) {}
virtual GrGLint getUniformLocation(GrGLuint program, const char* name) { return 0; }
virtual GrGLvoid insertEventMarker(GrGLsizei length, const char* marker) {}
virtual GrGLvoid invalidateBufferData(GrGLuint buffer) {}
virtual GrGLvoid invalidateBufferSubData(GrGLuint buffer, GrGLintptr offset, GrGLsizeiptr length) {}
virtual GrGLvoid invalidateFramebuffer(GrGLenum target, GrGLsizei numAttachments, const GrGLenum *attachments) {}
virtual GrGLvoid invalidateSubFramebuffer(GrGLenum target, GrGLsizei numAttachments, const GrGLenum *attachments, GrGLint x, GrGLint y, GrGLsizei width, GrGLsizei height) {}
virtual GrGLvoid invalidateTexImage(GrGLuint texture, GrGLint level) {}
virtual GrGLvoid invalidateTexSubImage(GrGLuint texture, GrGLint level, GrGLint xoffset, GrGLint yoffset, GrGLint zoffset, GrGLsizei width, GrGLsizei height, GrGLsizei depth) {}
virtual GrGLboolean isTexture(GrGLuint texture) { return GR_GL_FALSE; }
virtual GrGLvoid lineWidth(GrGLfloat width) {}
virtual GrGLvoid linkProgram(GrGLuint program) {}
virtual GrGLvoid* mapBuffer(GrGLenum target, GrGLenum access) { return nullptr; }
virtual GrGLvoid* mapBufferRange(GrGLenum target, GrGLintptr offset, GrGLsizeiptr length, GrGLbitfield access) { return nullptr; }
virtual GrGLvoid* mapBufferSubData(GrGLuint target, GrGLintptr offset, GrGLsizeiptr size, GrGLenum access) { return nullptr; }
virtual GrGLvoid* mapTexSubImage2D(GrGLenum target, GrGLint level, GrGLint xoffset, GrGLint yoffset, GrGLsizei width, GrGLsizei height, GrGLenum format, GrGLenum type, GrGLenum access) { return nullptr; }
virtual GrGLvoid pixelStorei(GrGLenum pname, GrGLint param) {}
virtual GrGLvoid popGroupMarker() {}
virtual GrGLvoid pushGroupMarker(GrGLsizei length, const char* marker) {}
virtual GrGLvoid queryCounter(GrGLuint id, GrGLenum target) {}
virtual GrGLvoid rasterSamples(GrGLuint samples, GrGLboolean fixedsamplelocations) {}
virtual GrGLvoid readBuffer(GrGLenum src) {}
virtual GrGLvoid readPixels(GrGLint x, GrGLint y, GrGLsizei width, GrGLsizei height, GrGLenum format, GrGLenum type, GrGLvoid* pixels) {}
virtual GrGLvoid renderbufferStorage(GrGLenum target, GrGLenum internalformat, GrGLsizei width, GrGLsizei height) {}
virtual GrGLvoid renderbufferStorageMultisample(GrGLenum target, GrGLsizei samples, GrGLenum internalformat, GrGLsizei width, GrGLsizei height) {}
virtual GrGLvoid resolveMultisampleFramebuffer() {}
virtual GrGLvoid scissor(GrGLint x, GrGLint y, GrGLsizei width, GrGLsizei height) {}
virtual GrGLvoid bindUniformLocation(GrGLuint program, GrGLint location, const char* name) {}
#if GR_GL_USE_NEW_SHADER_SOURCE_SIGNATURE
virtual GrGLvoid shaderSource(GrGLuint shader, GrGLsizei count, const char* const * str, const GrGLint* length) {}
#else
virtual GrGLvoid shaderSource(GrGLuint shader, GrGLsizei count, const char** str, const GrGLint* length) {}
#endif
virtual GrGLvoid stencilFunc(GrGLenum func, GrGLint ref, GrGLuint mask) {}
virtual GrGLvoid stencilFuncSeparate(GrGLenum face, GrGLenum func, GrGLint ref, GrGLuint mask) {}
virtual GrGLvoid stencilMask(GrGLuint mask) {}
virtual GrGLvoid stencilMaskSeparate(GrGLenum face, GrGLuint mask) {}
virtual GrGLvoid stencilOp(GrGLenum fail, GrGLenum zfail, GrGLenum zpass) {}
virtual GrGLvoid stencilOpSeparate(GrGLenum face, GrGLenum fail, GrGLenum zfail, GrGLenum zpass) {}
virtual GrGLvoid texBuffer(GrGLenum target, GrGLenum internalformat, GrGLuint buffer) {}
virtual GrGLvoid texImage2D(GrGLenum target, GrGLint level, GrGLint internalformat, GrGLsizei width, GrGLsizei height, GrGLint border, GrGLenum format, GrGLenum type, const GrGLvoid* pixels) {}
virtual GrGLvoid texParameteri(GrGLenum target, GrGLenum pname, GrGLint param) {}
virtual GrGLvoid texParameteriv(GrGLenum target, GrGLenum pname, const GrGLint* params) {}
virtual GrGLvoid texStorage2D(GrGLenum target, GrGLsizei levels, GrGLenum internalformat, GrGLsizei width, GrGLsizei height) {}
virtual GrGLvoid discardFramebuffer(GrGLenum target, GrGLsizei numAttachments, const GrGLenum* attachments) {}
virtual GrGLvoid texSubImage2D(GrGLenum target, GrGLint level, GrGLint xoffset, GrGLint yoffset, GrGLsizei width, GrGLsizei height, GrGLenum format, GrGLenum type, const GrGLvoid* pixels) {}
virtual GrGLvoid textureBarrier() {}
virtual GrGLvoid uniform1f(GrGLint location, GrGLfloat v0) {}
virtual GrGLvoid uniform1i(GrGLint location, GrGLint v0) {}
virtual GrGLvoid uniform1fv(GrGLint location, GrGLsizei count, const GrGLfloat* v) {}
virtual GrGLvoid uniform1iv(GrGLint location, GrGLsizei count, const GrGLint* v) {}
virtual GrGLvoid uniform2f(GrGLint location, GrGLfloat v0, GrGLfloat v1) {}
virtual GrGLvoid uniform2i(GrGLint location, GrGLint v0, GrGLint v1) {}
virtual GrGLvoid uniform2fv(GrGLint location, GrGLsizei count, const GrGLfloat* v) {}
virtual GrGLvoid uniform2iv(GrGLint location, GrGLsizei count, const GrGLint* v) {}
virtual GrGLvoid uniform3f(GrGLint location, GrGLfloat v0, GrGLfloat v1, GrGLfloat v2) {}
virtual GrGLvoid uniform3i(GrGLint location, GrGLint v0, GrGLint v1, GrGLint v2) {}
virtual GrGLvoid uniform3fv(GrGLint location, GrGLsizei count, const GrGLfloat* v) {}
virtual GrGLvoid uniform3iv(GrGLint location, GrGLsizei count, const GrGLint* v) {}
virtual GrGLvoid uniform4f(GrGLint location, GrGLfloat v0, GrGLfloat v1, GrGLfloat v2, GrGLfloat v3) {}
virtual GrGLvoid uniform4i(GrGLint location, GrGLint v0, GrGLint v1, GrGLint v2, GrGLint v3) {}
virtual GrGLvoid uniform4fv(GrGLint location, GrGLsizei count, const GrGLfloat* v) {}
virtual GrGLvoid uniform4iv(GrGLint location, GrGLsizei count, const GrGLint* v) {}
virtual GrGLvoid uniformMatrix2fv(GrGLint location, GrGLsizei count, GrGLboolean transpose, const GrGLfloat* value) {}
virtual GrGLvoid uniformMatrix3fv(GrGLint location, GrGLsizei count, GrGLboolean transpose, const GrGLfloat* value) {}
virtual GrGLvoid uniformMatrix4fv(GrGLint location, GrGLsizei count, GrGLboolean transpose, const GrGLfloat* value) {}
virtual GrGLboolean unmapBuffer(GrGLenum target) { return GR_GL_TRUE; }
virtual GrGLvoid unmapBufferSubData(const GrGLvoid* mem) {}
virtual GrGLvoid unmapTexSubImage2D(const GrGLvoid* mem) {}
virtual GrGLvoid useProgram(GrGLuint program) {}
virtual GrGLvoid vertexAttrib1f(GrGLuint indx, const GrGLfloat value) {}
virtual GrGLvoid vertexAttrib2fv(GrGLuint indx, const GrGLfloat* values) {}
virtual GrGLvoid vertexAttrib3fv(GrGLuint indx, const GrGLfloat* values) {}
virtual GrGLvoid vertexAttrib4fv(GrGLuint indx, const GrGLfloat* values) {}
virtual GrGLvoid vertexAttribDivisor(GrGLuint index, GrGLuint divisor) {}
virtual GrGLvoid vertexAttribIPointer(GrGLuint indx, GrGLint size, GrGLenum type, GrGLsizei stride, const GrGLvoid* ptr) {}
virtual GrGLvoid vertexAttribPointer(GrGLuint indx, GrGLint size, GrGLenum type, GrGLboolean normalized, GrGLsizei stride, const GrGLvoid* ptr) {}
virtual GrGLvoid viewport(GrGLint x, GrGLint y, GrGLsizei width, GrGLsizei height) {}
virtual GrGLvoid matrixLoadf(GrGLenum matrixMode, const GrGLfloat* m) {}
virtual GrGLvoid matrixLoadIdentity(GrGLenum) {}
virtual GrGLvoid pathCommands(GrGLuint path, GrGLsizei numCommands, const GrGLubyte *commands, GrGLsizei numCoords, GrGLenum coordType, const GrGLvoid *coords) {}
virtual GrGLvoid pathParameteri(GrGLuint path, GrGLenum pname, GrGLint value) {}
virtual GrGLvoid pathParameterf(GrGLuint path, GrGLenum pname, GrGLfloat value) {}
virtual GrGLuint genPaths(GrGLsizei range) { return 0; }
virtual GrGLvoid deletePaths(GrGLuint path, GrGLsizei range) {}
virtual GrGLboolean isPath(GrGLuint path) { return true; }
virtual GrGLvoid pathStencilFunc(GrGLenum func, GrGLint ref, GrGLuint mask) {}
virtual GrGLvoid stencilFillPath(GrGLuint path, GrGLenum fillMode, GrGLuint mask) {}
virtual GrGLvoid stencilStrokePath(GrGLuint path, GrGLint reference, GrGLuint mask) {}
virtual GrGLvoid stencilFillPathInstanced(GrGLsizei numPaths, GrGLenum pathNameType, const GrGLvoid *paths, GrGLuint pathBase, GrGLenum fillMode, GrGLuint mask, GrGLenum transformType, const GrGLfloat *transformValues) {}
virtual GrGLvoid stencilStrokePathInstanced(GrGLsizei numPaths, GrGLenum pathNameType, const GrGLvoid *paths, GrGLuint pathBase, GrGLint reference, GrGLuint mask, GrGLenum transformType, const GrGLfloat *transformValues) {}
virtual GrGLvoid coverFillPath(GrGLuint path, GrGLenum coverMode) {}
virtual GrGLvoid coverStrokePath(GrGLuint name, GrGLenum coverMode) {}
virtual GrGLvoid coverFillPathInstanced(GrGLsizei numPaths, GrGLenum pathNameType, const GrGLvoid *paths, GrGLuint pathBase, GrGLenum coverMode, GrGLenum transformType, const GrGLfloat *transformValues) {}
virtual GrGLvoid coverStrokePathInstanced(GrGLsizei numPaths, GrGLenum pathNameType, const GrGLvoid *paths, GrGLuint pathBase, GrGLenum coverMode, GrGLenum transformType, const GrGLfloat* transformValues) {}
virtual GrGLvoid stencilThenCoverFillPath(GrGLuint path, GrGLenum fillMode, GrGLuint mask, GrGLenum coverMode) {}
virtual GrGLvoid stencilThenCoverStrokePath(GrGLuint path, GrGLint reference, GrGLuint mask, GrGLenum coverMode) {}
virtual GrGLvoid stencilThenCoverFillPathInstanced(GrGLsizei numPaths, GrGLenum pathNameType, const GrGLvoid *paths, GrGLuint pathBase, GrGLenum fillMode, GrGLuint mask, GrGLenum coverMode, GrGLenum transformType, const GrGLfloat *transformValues) {}
virtual GrGLvoid stencilThenCoverStrokePathInstanced(GrGLsizei numPaths, GrGLenum pathNameType, const GrGLvoid *paths, GrGLuint pathBase, GrGLint reference, GrGLuint mask, GrGLenum coverMode, GrGLenum transformType, const GrGLfloat *transformValues) {}
virtual GrGLvoid programPathFragmentInputGen(GrGLuint program, GrGLint location, GrGLenum genMode, GrGLint components,const GrGLfloat *coeffs) {}
virtual GrGLvoid bindFragmentInputLocation(GrGLuint program, GrGLint location, const GrGLchar* name) {}
virtual GrGLint getProgramResourceLocation(GrGLuint program, GrGLenum programInterface, const GrGLchar *name) { return 0; }
virtual GrGLvoid coverageModulation(GrGLenum components) {}
virtual GrGLvoid multiDrawArraysIndirect(GrGLenum mode, const GrGLvoid *indirect, GrGLsizei drawcount, GrGLsizei stride) {}
virtual GrGLvoid multiDrawElementsIndirect(GrGLenum mode, GrGLenum type, const GrGLvoid *indirect, GrGLsizei drawcount, GrGLsizei stride) {}
virtual GrGLuint64 getTextureHandle(GrGLuint texture) { return 0; }
virtual GrGLuint64 getTextureSamplerHandle(GrGLuint texture, GrGLuint sampler) { return 0; }
virtual GrGLvoid makeTextureHandleResident(GrGLuint64 handle) {}
virtual GrGLvoid makeTextureHandleNonResident(GrGLuint64 handle) {}
virtual GrGLuint64 getImageHandle(GrGLuint texture, GrGLint level, GrGLboolean layered, GrGLint layer, GrGLint format) { return 0; }
virtual GrGLvoid makeImageHandleResident(GrGLuint64 handle, GrGLenum access) {}
virtual GrGLvoid makeImageHandleNonResident(GrGLuint64 handle) {}
virtual GrGLboolean isTextureHandleResident(GrGLuint64 handle) { return GR_GL_FALSE; }
virtual GrGLboolean isImageHandleResident(GrGLuint64 handle) { return GR_GL_FALSE; }
virtual GrGLvoid uniformHandleui64(GrGLint location, GrGLuint64 v0) {}
virtual GrGLvoid uniformHandleui64v(GrGLint location, GrGLsizei count, const GrGLuint64 *value) {}
virtual GrGLvoid programUniformHandleui64(GrGLuint program, GrGLint location, GrGLuint64 v0) {}
virtual GrGLvoid programUniformHandleui64v(GrGLuint program, GrGLint location, GrGLsizei count, const GrGLuint64 *value) {}
virtual GrGLvoid textureParameteri(GrGLuint texture, GrGLenum target, GrGLenum pname, GrGLint param) {}
virtual GrGLvoid textureParameteriv(GrGLuint texture, GrGLenum target, GrGLenum pname, const GrGLint *param) {}
virtual GrGLvoid textureParameterf(GrGLuint texture, GrGLenum target, GrGLenum pname, float param) {}
virtual GrGLvoid textureParameterfv(GrGLuint texture, GrGLenum target, GrGLenum pname, const float *param) {}
virtual GrGLvoid textureImage1D(GrGLuint texture, GrGLenum target, GrGLint level, GrGLint GrGLinternalformat, GrGLsizei width, GrGLint border, GrGLenum format, GrGLenum type, const GrGLvoid *pixels) {}
virtual GrGLvoid textureImage2D(GrGLuint texture, GrGLenum target, GrGLint level, GrGLint GrGLinternalformat, GrGLsizei width, GrGLsizei height, GrGLint border, GrGLenum format, GrGLenum type, const GrGLvoid *pixels) {}
virtual GrGLvoid textureSubImage1D(GrGLuint texture, GrGLenum target, GrGLint level, GrGLint xoffset, GrGLsizei width, GrGLenum format, GrGLenum type, const GrGLvoid *pixels) {}
virtual GrGLvoid textureSubImage2D(GrGLuint texture, GrGLenum target, GrGLint level, GrGLint xoffset, GrGLint yoffset, GrGLsizei width, GrGLsizei height, GrGLenum format, GrGLenum type, const GrGLvoid *pixels) {}
virtual GrGLvoid copyTextureImage1D(GrGLuint texture, GrGLenum target, GrGLint level, GrGLenum GrGLinternalformat, GrGLint x, GrGLint y, GrGLsizei width, GrGLint border) {}
virtual GrGLvoid copyTextureImage2D(GrGLuint texture, GrGLenum target, GrGLint level, GrGLenum GrGLinternalformat, GrGLint x, GrGLint y, GrGLsizei width, GrGLsizei height, GrGLint border) {}
virtual GrGLvoid copyTextureSubImage1D(GrGLuint texture, GrGLenum target, GrGLint level, GrGLint xoffset, GrGLint x, GrGLint y, GrGLsizei width) {}
virtual GrGLvoid copyTextureSubImage2D(GrGLuint texture, GrGLenum target, GrGLint level, GrGLint xoffset, GrGLint yoffset, GrGLint x, GrGLint y, GrGLsizei width, GrGLsizei height) {}
virtual GrGLvoid getTextureImage(GrGLuint texture, GrGLenum target, GrGLint level, GrGLenum format, GrGLenum type, GrGLvoid *pixels) {}
virtual GrGLvoid getTextureParameterfv(GrGLuint texture, GrGLenum target, GrGLenum pname, float *params) {}
virtual GrGLvoid getTextureParameteriv(GrGLuint texture, GrGLenum target, GrGLenum pname, GrGLint *params) {}
virtual GrGLvoid getTextureLevelParameterfv(GrGLuint texture, GrGLenum target, GrGLint level, GrGLenum pname, float *params) {}
virtual GrGLvoid getTextureLevelParameteriv(GrGLuint texture, GrGLenum target, GrGLint level, GrGLenum pname, GrGLint *params) {}
virtual GrGLvoid textureImage3D(GrGLuint texture, GrGLenum target, GrGLint level, GrGLint GrGLinternalformat, GrGLsizei width, GrGLsizei height, GrGLsizei depth, GrGLint border, GrGLenum format, GrGLenum type, const GrGLvoid *pixels) {}
virtual GrGLvoid textureSubImage3D(GrGLuint texture, GrGLenum target, GrGLint level, GrGLint xoffset, GrGLint yoffset, GrGLint zoffset, GrGLsizei width, GrGLsizei height, GrGLsizei depth, GrGLenum format, GrGLenum type, const GrGLvoid *pixels) {}
virtual GrGLvoid copyTextureSubImage3D(GrGLuint texture, GrGLenum target, GrGLint level, GrGLint xoffset, GrGLint yoffset, GrGLint zoffset, GrGLint x, GrGLint y, GrGLsizei width, GrGLsizei height) {}
virtual GrGLvoid compressedTextureImage3D(GrGLuint texture, GrGLenum target, GrGLint level, GrGLenum GrGLinternalformat, GrGLsizei width, GrGLsizei height, GrGLsizei depth, GrGLint border, GrGLsizei imageSize, const GrGLvoid *data) {}
virtual GrGLvoid compressedTextureImage2D(GrGLuint texture, GrGLenum target, GrGLint level, GrGLenum GrGLinternalformat, GrGLsizei width, GrGLsizei height, GrGLint border, GrGLsizei imageSize, const GrGLvoid *data) {}
virtual GrGLvoid compressedTextureImage1D(GrGLuint texture, GrGLenum target, GrGLint level, GrGLenum GrGLinternalformat, GrGLsizei width, GrGLint border, GrGLsizei imageSize, const GrGLvoid *data) {}
virtual GrGLvoid compressedTextureSubImage3D(GrGLuint texture, GrGLenum target, GrGLint level, GrGLint xoffset, GrGLint yoffset, GrGLint zoffset, GrGLsizei width, GrGLsizei height, GrGLsizei depth, GrGLenum format, GrGLsizei imageSize, const GrGLvoid *data) {}
virtual GrGLvoid compressedTextureSubImage2D(GrGLuint texture, GrGLenum target, GrGLint level, GrGLint xoffset, GrGLint yoffset, GrGLsizei width, GrGLsizei height, GrGLenum format, GrGLsizei imageSize, const GrGLvoid *data) {}
virtual GrGLvoid compressedTextureSubImage1D(GrGLuint texture, GrGLenum target, GrGLint level, GrGLint xoffset, GrGLsizei width, GrGLenum format, GrGLsizei imageSize, const GrGLvoid *data) {}
virtual GrGLvoid getCompressedTextureImage(GrGLuint texture, GrGLenum target, GrGLint level, GrGLvoid *img) {}
virtual GrGLvoid namedBufferData(GrGLuint buffer, GrGLsizeiptr size, const GrGLvoid *data, GrGLenum usage) {}
virtual GrGLvoid namedBufferSubData(GrGLuint buffer, GrGLintptr offset, GrGLsizeiptr size, const GrGLvoid *data) {}
virtual GrGLvoid* mapNamedBuffer(GrGLuint buffer, GrGLenum access) { return nullptr; }
virtual GrGLboolean unmapNamedBuffer(GrGLuint buffer) { return GR_GL_FALSE; }
virtual GrGLvoid getNamedBufferParameteriv(GrGLuint buffer, GrGLenum pname, GrGLint *params) {}
virtual GrGLvoid getNamedBufferPointerv(GrGLuint buffer, GrGLenum pname, GrGLvoid* *params) {}
virtual GrGLvoid getNamedBufferSubData(GrGLuint buffer, GrGLintptr offset, GrGLsizeiptr size, GrGLvoid *data) {}
virtual GrGLvoid programUniform1f(GrGLuint program, GrGLint location, float v0) {}
virtual GrGLvoid programUniform2f(GrGLuint program, GrGLint location, float v0, float v1) {}
virtual GrGLvoid programUniform3f(GrGLuint program, GrGLint location, float v0, float v1, float v2) {}
virtual GrGLvoid programUniform4f(GrGLuint program, GrGLint location, float v0, float v1, float v2, float v3) {}
virtual GrGLvoid programUniform1i(GrGLuint program, GrGLint location, GrGLint v0) {}
virtual GrGLvoid programUniform2i(GrGLuint program, GrGLint location, GrGLint v0, GrGLint v1) {}
virtual GrGLvoid programUniform3i(GrGLuint program, GrGLint location, GrGLint v0, GrGLint v1, GrGLint v2) {}
virtual GrGLvoid programUniform4i(GrGLuint program, GrGLint location, GrGLint v0, GrGLint v1, GrGLint v2, GrGLint v3) {}
virtual GrGLvoid programUniform1fv(GrGLuint program, GrGLint location, GrGLsizei count, const float *value) {}
virtual GrGLvoid programUniform2fv(GrGLuint program, GrGLint location, GrGLsizei count, const float *value) {}
virtual GrGLvoid programUniform3fv(GrGLuint program, GrGLint location, GrGLsizei count, const float *value) {}
virtual GrGLvoid programUniform4fv(GrGLuint program, GrGLint location, GrGLsizei count, const float *value) {}
virtual GrGLvoid programUniform1iv(GrGLuint program, GrGLint location, GrGLsizei count, const GrGLint *value) {}
virtual GrGLvoid programUniform2iv(GrGLuint program, GrGLint location, GrGLsizei count, const GrGLint *value) {}
virtual GrGLvoid programUniform3iv(GrGLuint program, GrGLint location, GrGLsizei count, const GrGLint *value) {}
virtual GrGLvoid programUniform4iv(GrGLuint program, GrGLint location, GrGLsizei count, const GrGLint *value) {}
virtual GrGLvoid programUniformMatrix2fv(GrGLuint program, GrGLint location, GrGLsizei count, GrGLboolean transpose, const float *value) {}
virtual GrGLvoid programUniformMatrix3fv(GrGLuint program, GrGLint location, GrGLsizei count, GrGLboolean transpose, const float *value) {}
virtual GrGLvoid programUniformMatrix4fv(GrGLuint program, GrGLint location, GrGLsizei count, GrGLboolean transpose, const float *value) {}
virtual GrGLvoid programUniformMatrix2x3fv(GrGLuint program, GrGLint location, GrGLsizei count, GrGLboolean transpose, const float *value) {}
virtual GrGLvoid programUniformMatrix3x2fv(GrGLuint program, GrGLint location, GrGLsizei count, GrGLboolean transpose, const float *value) {}
virtual GrGLvoid programUniformMatrix2x4fv(GrGLuint program, GrGLint location, GrGLsizei count, GrGLboolean transpose, const float *value) {}
virtual GrGLvoid programUniformMatrix4x2fv(GrGLuint program, GrGLint location, GrGLsizei count, GrGLboolean transpose, const float *value) {}
virtual GrGLvoid programUniformMatrix3x4fv(GrGLuint program, GrGLint location, GrGLsizei count, GrGLboolean transpose, const float *value) {}
virtual GrGLvoid programUniformMatrix4x3fv(GrGLuint program, GrGLint location, GrGLsizei count, GrGLboolean transpose, const float *value) {}
virtual GrGLvoid namedRenderbufferStorage(GrGLuint renderbuffer, GrGLenum GrGLinternalformat, GrGLsizei width, GrGLsizei height) {}
virtual GrGLvoid getNamedRenderbufferParameteriv(GrGLuint renderbuffer, GrGLenum pname, GrGLint *params) {}
virtual GrGLvoid namedRenderbufferStorageMultisample(GrGLuint renderbuffer, GrGLsizei samples, GrGLenum GrGLinternalformat, GrGLsizei width, GrGLsizei height) {}
virtual GrGLenum checkNamedFramebufferStatus(GrGLuint framebuffer, GrGLenum target) { return GR_GL_FRAMEBUFFER_COMPLETE; }
virtual GrGLvoid namedFramebufferTexture1D(GrGLuint framebuffer, GrGLenum attachment, GrGLenum textarget, GrGLuint texture, GrGLint level) {}
virtual GrGLvoid namedFramebufferTexture2D(GrGLuint framebuffer, GrGLenum attachment, GrGLenum textarget, GrGLuint texture, GrGLint level) {}
virtual GrGLvoid namedFramebufferTexture3D(GrGLuint framebuffer, GrGLenum attachment, GrGLenum textarget, GrGLuint texture, GrGLint level, GrGLint zoffset) {}
virtual GrGLvoid namedFramebufferRenderbuffer(GrGLuint framebuffer, GrGLenum attachment, GrGLenum renderbuffertarget, GrGLuint renderbuffer) {}
virtual GrGLvoid getNamedFramebufferAttachmentParameteriv(GrGLuint framebuffer, GrGLenum attachment, GrGLenum pname, GrGLint *params) {}
virtual GrGLvoid generateTextureMipmap(GrGLuint texture, GrGLenum target) {}
virtual GrGLvoid framebufferDrawBuffer(GrGLuint framebuffer, GrGLenum mode) {}
virtual GrGLvoid framebufferDrawBuffers(GrGLuint framebuffer, GrGLsizei n, const GrGLenum *bufs) {}
virtual GrGLvoid framebufferReadBuffer(GrGLuint framebuffer, GrGLenum mode) {}
virtual GrGLvoid getFramebufferParameteriv(GrGLuint framebuffer, GrGLenum pname, GrGLint *param) {}
virtual GrGLvoid namedCopyBufferSubData(GrGLuint readBuffer, GrGLuint writeBuffer, GrGLintptr readOffset, GrGLintptr writeOffset, GrGLsizeiptr size) {}
virtual GrGLvoid vertexArrayVertexOffset(GrGLuint vaobj, GrGLuint buffer, GrGLint size, GrGLenum type, GrGLsizei stride, GrGLintptr offset) {}
virtual GrGLvoid vertexArrayColorOffset(GrGLuint vaobj, GrGLuint buffer, GrGLint size, GrGLenum type, GrGLsizei stride, GrGLintptr offset) {}
virtual GrGLvoid vertexArrayEdgeFlagOffset(GrGLuint vaobj, GrGLuint buffer, GrGLsizei stride, GrGLintptr offset) {}
virtual GrGLvoid vertexArrayIndexOffset(GrGLuint vaobj, GrGLuint buffer, GrGLenum type, GrGLsizei stride, GrGLintptr offset) {}
virtual GrGLvoid vertexArrayNormalOffset(GrGLuint vaobj, GrGLuint buffer, GrGLenum type, GrGLsizei stride, GrGLintptr offset) {}
virtual GrGLvoid vertexArrayTexCoordOffset(GrGLuint vaobj, GrGLuint buffer, GrGLint size, GrGLenum type, GrGLsizei stride, GrGLintptr offset) {}
virtual GrGLvoid vertexArrayMultiTexCoordOffset(GrGLuint vaobj, GrGLuint buffer, GrGLenum texunit, GrGLint size, GrGLenum type, GrGLsizei stride, GrGLintptr offset) {}
virtual GrGLvoid vertexArrayFogCoordOffset(GrGLuint vaobj, GrGLuint buffer, GrGLenum type, GrGLsizei stride, GrGLintptr offset) {}
virtual GrGLvoid vertexArraySecondaryColorOffset(GrGLuint vaobj, GrGLuint buffer, GrGLint size, GrGLenum type, GrGLsizei stride, GrGLintptr offset) {}
virtual GrGLvoid vertexArrayVertexAttribOffset(GrGLuint vaobj, GrGLuint buffer, GrGLuint index, GrGLint size, GrGLenum type, GrGLboolean normalized, GrGLsizei stride, GrGLintptr offset) {}
virtual GrGLvoid vertexArrayVertexAttribIOffset(GrGLuint vaobj, GrGLuint buffer, GrGLuint index, GrGLint size, GrGLenum type, GrGLsizei stride, GrGLintptr offset) {}
virtual GrGLvoid enableVertexArray(GrGLuint vaobj, GrGLenum array) {}
virtual GrGLvoid disableVertexArray(GrGLuint vaobj, GrGLenum array) {}
virtual GrGLvoid enableVertexArrayAttrib(GrGLuint vaobj, GrGLuint index) {}
virtual GrGLvoid disableVertexArrayAttrib(GrGLuint vaobj, GrGLuint index) {}
virtual GrGLvoid getVertexArrayIntegerv(GrGLuint vaobj, GrGLenum pname, GrGLint *param) {}
virtual GrGLvoid getVertexArrayPointerv(GrGLuint vaobj, GrGLenum pname, GrGLvoid **param) {}
virtual GrGLvoid getVertexArrayIntegeri_v(GrGLuint vaobj, GrGLuint index, GrGLenum pname, GrGLint *param) {}
virtual GrGLvoid getVertexArrayPointeri_v(GrGLuint vaobj, GrGLuint index, GrGLenum pname, GrGLvoid **param) {}
virtual GrGLvoid* mapNamedBufferRange(GrGLuint buffer, GrGLintptr offset, GrGLsizeiptr length, GrGLbitfield access) { return nullptr; }
virtual GrGLvoid flushMappedNamedBufferRange(GrGLuint buffer, GrGLintptr offset, GrGLsizeiptr length) {}
virtual GrGLvoid textureBuffer(GrGLuint texture, GrGLenum target, GrGLenum internalformat, GrGLuint buffer) {}
virtual GrGLvoid debugMessageControl(GrGLenum source, GrGLenum type, GrGLenum severity, GrGLsizei count, const GrGLuint* ids, GrGLboolean enabled) {}
virtual GrGLvoid debugMessageInsert(GrGLenum source, GrGLenum type, GrGLuint id, GrGLenum severity, GrGLsizei length, const GrGLchar* buf) {}
virtual GrGLvoid debugMessageCallback(GRGLDEBUGPROC callback, const GrGLvoid* userParam) {}
virtual GrGLuint getDebugMessageLog(GrGLuint count, GrGLsizei bufSize, GrGLenum* sources, GrGLenum* types, GrGLuint* ids, GrGLenum* severities, GrGLsizei* lengths, GrGLchar* messageLog) { return 0; }
virtual GrGLvoid pushDebugGroup(GrGLenum source, GrGLuint id, GrGLsizei length, const GrGLchar * message) {}
virtual GrGLvoid popDebugGroup() {}
virtual GrGLvoid objectLabel(GrGLenum identifier, GrGLuint name, GrGLsizei length, const GrGLchar *label) {}
protected:
// This must be called by leaf class
void init(GrGLStandard standard) {
fStandard = standard;
fExtensions.init(standard, fFunctions.fGetString, fFunctions.fGetStringi,
fFunctions.fGetIntegerv, nullptr, GR_EGL_NO_DISPLAY);
}
GrGLTestInterface();
};
#endif

View File

@ -8,578 +8,6 @@
#include "gl/SkNullGLContext.h"
#include "gl/GrGLInterface.h"
#include "GrGLDefines.h"
#include "GrGLNoOpInterface.h"
#include "SkTDArray.h"
#include "SkTLS.h"
static SkNullGLContext::ContextState* current_context();
/////////////////////////////////////////////////////////////////////////////////////////////////
class BufferObj {
public:
BufferObj(GrGLuint id) : fID(id), fDataPtr(nullptr), fSize(0), fMapped(false) {}
~BufferObj() { delete[] fDataPtr; }
void allocate(GrGLsizeiptr size, const GrGLchar* dataPtr) {
if (fDataPtr) {
SkASSERT(0 != fSize);
delete[] fDataPtr;
}
fSize = size;
fDataPtr = new char[size];
}
GrGLuint id() const { return fID; }
GrGLchar* dataPtr() { return fDataPtr; }
GrGLsizeiptr size() const { return fSize; }
void setMapped(bool mapped) { fMapped = mapped; }
bool mapped() const { return fMapped; }
private:
GrGLuint fID;
GrGLchar* fDataPtr;
GrGLsizeiptr fSize; // size in bytes
bool fMapped;
};
// This class maintains a sparsely populated array of buffer pointers.
class BufferManager {
public:
BufferManager() : fFreeListHead(kFreeListEnd) {}
~BufferManager() {
// nullptr out the entries that are really free list links rather than ptrs before deleting.
intptr_t curr = fFreeListHead;
while (kFreeListEnd != curr) {
intptr_t next = reinterpret_cast<intptr_t>(fBuffers[SkToS32(curr)]);
fBuffers[SkToS32(curr)] = nullptr;
curr = next;
}
fBuffers.deleteAll();
}
BufferObj* lookUp(GrGLuint id) {
BufferObj* buffer = fBuffers[id];
SkASSERT(buffer && buffer->id() == id);
return buffer;
}
BufferObj* create() {
GrGLuint id;
BufferObj* buffer;
if (kFreeListEnd == fFreeListHead) {
// no free slots - create a new one
id = fBuffers.count();
buffer = new BufferObj(id);
*fBuffers.append() = buffer;
} else {
// grab the head of the free list and advance the head to the next free slot.
id = static_cast<GrGLuint>(fFreeListHead);
fFreeListHead = reinterpret_cast<intptr_t>(fBuffers[id]);
buffer = new BufferObj(id);
fBuffers[id] = buffer;
}
return buffer;
}
void free(BufferObj* buffer) {
SkASSERT(fBuffers.count() > 0);
GrGLuint id = buffer->id();
delete buffer;
fBuffers[id] = reinterpret_cast<BufferObj*>(fFreeListHead);
fFreeListHead = id;
}
private:
static const intptr_t kFreeListEnd = -1;
// Index of the first entry of fBuffers in the free list. Free slots in fBuffers are indices to
// the next free slot. The last free slot has a value of kFreeListEnd.
intptr_t fFreeListHead;
SkTDArray<BufferObj*> fBuffers;
};
/**
* The state object for the null interface.
*/
class SkNullGLContext::ContextState : public SkRefCnt {
public:
BufferManager fBufferManager;
GrGLuint fCurrArrayBuffer;
GrGLuint fCurrElementArrayBuffer;
GrGLuint fCurrPixelPackBuffer;
GrGLuint fCurrPixelUnpackBuffer;
GrGLuint fCurrProgramID;
GrGLuint fCurrShaderID;
ContextState()
: fCurrArrayBuffer(0)
, fCurrElementArrayBuffer(0)
, fCurrPixelPackBuffer(0)
, fCurrPixelUnpackBuffer(0)
, fCurrProgramID(0)
, fCurrShaderID(0) {}
static ContextState* Get() { return current_context(); }
};
typedef SkNullGLContext::ContextState State;
// Functions not declared in GrGLBogusInterface.h (not common with the Debug GL interface).
namespace { // added to suppress 'no previous prototype' warning
GrGLvoid GR_GL_FUNCTION_TYPE nullGLActiveTexture(GrGLenum texture) {}
GrGLvoid GR_GL_FUNCTION_TYPE nullGLAttachShader(GrGLuint program, GrGLuint shader) {}
GrGLvoid GR_GL_FUNCTION_TYPE nullGLBeginQuery(GrGLenum target, GrGLuint id) {}
GrGLvoid GR_GL_FUNCTION_TYPE nullGLBindAttribLocation(GrGLuint program, GrGLuint index, const char* name) {}
GrGLvoid GR_GL_FUNCTION_TYPE nullGLBindTexture(GrGLenum target, GrGLuint texture) {}
GrGLvoid GR_GL_FUNCTION_TYPE nullGLBindVertexArray(GrGLuint id) {}
GrGLvoid GR_GL_FUNCTION_TYPE nullGLGenBuffers(GrGLsizei n, GrGLuint* ids) {
State* state = State::Get();
for (int i = 0; i < n; ++i) {
BufferObj* buffer = state->fBufferManager.create();
ids[i] = buffer->id();
}
}
GrGLvoid GR_GL_FUNCTION_TYPE nullGLGenerateMipmap(GrGLenum target) {}
GrGLvoid GR_GL_FUNCTION_TYPE nullGLBufferData(GrGLenum target,
GrGLsizeiptr size,
const GrGLvoid* data,
GrGLenum usage) {
State* state = State::Get();
GrGLuint id = 0;
switch (target) {
case GR_GL_ARRAY_BUFFER:
id = state->fCurrArrayBuffer;
break;
case GR_GL_ELEMENT_ARRAY_BUFFER:
id = state->fCurrElementArrayBuffer;
break;
case GR_GL_PIXEL_PACK_BUFFER:
id = state->fCurrPixelPackBuffer;
break;
case GR_GL_PIXEL_UNPACK_BUFFER:
id = state->fCurrPixelUnpackBuffer;
break;
default:
SkFAIL("Unexpected target to nullGLBufferData");
break;
}
if (id > 0) {
BufferObj* buffer = state->fBufferManager.lookUp(id);
buffer->allocate(size, (const GrGLchar*) data);
}
}
GrGLvoid GR_GL_FUNCTION_TYPE nullGLPixelStorei(GrGLenum pname, GrGLint param) {}
GrGLvoid GR_GL_FUNCTION_TYPE nullGLReadPixels(GrGLint x, GrGLint y, GrGLsizei width, GrGLsizei height, GrGLenum format, GrGLenum type, GrGLvoid* pixels) {}
GrGLvoid GR_GL_FUNCTION_TYPE nullGLUseProgram(GrGLuint program) {}
GrGLvoid GR_GL_FUNCTION_TYPE nullGLViewport(GrGLint x, GrGLint y, GrGLsizei width, GrGLsizei height) {}
GrGLvoid GR_GL_FUNCTION_TYPE nullGLBindFramebuffer(GrGLenum target, GrGLuint framebuffer) {}
GrGLvoid GR_GL_FUNCTION_TYPE nullGLBindRenderbuffer(GrGLenum target, GrGLuint renderbuffer) {}
GrGLvoid GR_GL_FUNCTION_TYPE nullGLDeleteFramebuffers(GrGLsizei n, const GrGLuint *framebuffers) {}
GrGLvoid GR_GL_FUNCTION_TYPE nullGLDeleteRenderbuffers(GrGLsizei n, const GrGLuint *renderbuffers) {}
GrGLvoid GR_GL_FUNCTION_TYPE nullGLFramebufferRenderbuffer(GrGLenum target, GrGLenum attachment, GrGLenum renderbuffertarget, GrGLuint renderbuffer) {}
GrGLvoid GR_GL_FUNCTION_TYPE nullGLFramebufferTexture2D(GrGLenum target, GrGLenum attachment, GrGLenum textarget, GrGLuint texture, GrGLint level) {}
GrGLuint GR_GL_FUNCTION_TYPE nullGLCreateProgram() {
return ++State::Get()->fCurrProgramID;
}
GrGLuint GR_GL_FUNCTION_TYPE nullGLCreateShader(GrGLenum type) {
return ++State::Get()->fCurrShaderID;
}
// same delete used for shaders and programs
GrGLvoid GR_GL_FUNCTION_TYPE nullGLDelete(GrGLuint program) {
}
GrGLvoid GR_GL_FUNCTION_TYPE nullGLBindBuffer(GrGLenum target, GrGLuint buffer) {
State* state = State::Get();
switch (target) {
case GR_GL_ARRAY_BUFFER:
state->fCurrArrayBuffer = buffer;
break;
case GR_GL_ELEMENT_ARRAY_BUFFER:
state->fCurrElementArrayBuffer = buffer;
break;
case GR_GL_PIXEL_PACK_BUFFER:
state->fCurrPixelPackBuffer = buffer;
break;
case GR_GL_PIXEL_UNPACK_BUFFER:
state->fCurrPixelUnpackBuffer = buffer;
break;
}
}
// deleting a bound buffer has the side effect of binding 0
GrGLvoid GR_GL_FUNCTION_TYPE nullGLDeleteBuffers(GrGLsizei n, const GrGLuint* ids) {
State* state = State::Get();
for (int i = 0; i < n; ++i) {
if (ids[i] == state->fCurrArrayBuffer) {
state->fCurrArrayBuffer = 0;
}
if (ids[i] == state->fCurrElementArrayBuffer) {
state->fCurrElementArrayBuffer = 0;
}
if (ids[i] == state->fCurrPixelPackBuffer) {
state->fCurrPixelPackBuffer = 0;
}
if (ids[i] == state->fCurrPixelUnpackBuffer) {
state->fCurrPixelUnpackBuffer = 0;
}
BufferObj* buffer = state->fBufferManager.lookUp(ids[i]);
state->fBufferManager.free(buffer);
}
}
GrGLvoid* GR_GL_FUNCTION_TYPE nullGLMapBufferRange(GrGLenum target, GrGLintptr offset,
GrGLsizeiptr length, GrGLbitfield access) {
State* state = State::Get();
GrGLuint id = 0;
switch (target) {
case GR_GL_ARRAY_BUFFER:
id = state->fCurrArrayBuffer;
break;
case GR_GL_ELEMENT_ARRAY_BUFFER:
id = state->fCurrElementArrayBuffer;
break;
case GR_GL_PIXEL_PACK_BUFFER:
id = state->fCurrPixelPackBuffer;
break;
case GR_GL_PIXEL_UNPACK_BUFFER:
id = state->fCurrPixelUnpackBuffer;
break;
}
if (id > 0) {
// We just ignore the offset and length here.
BufferObj* buffer = state->fBufferManager.lookUp(id);
SkASSERT(!buffer->mapped());
buffer->setMapped(true);
return buffer->dataPtr();
}
return nullptr;
}
GrGLvoid* GR_GL_FUNCTION_TYPE nullGLMapBuffer(GrGLenum target, GrGLenum access) {
State* state = State::Get();
GrGLuint id = 0;
switch (target) {
case GR_GL_ARRAY_BUFFER:
id = state->fCurrArrayBuffer;
break;
case GR_GL_ELEMENT_ARRAY_BUFFER:
id = state->fCurrElementArrayBuffer;
break;
case GR_GL_PIXEL_PACK_BUFFER:
id = state->fCurrPixelPackBuffer;
break;
case GR_GL_PIXEL_UNPACK_BUFFER:
id = state->fCurrPixelUnpackBuffer;
break;
}
if (id > 0) {
BufferObj* buffer = state->fBufferManager.lookUp(id);
SkASSERT(!buffer->mapped());
buffer->setMapped(true);
return buffer->dataPtr();
}
SkASSERT(false);
return nullptr; // no buffer bound to target
}
GrGLvoid GR_GL_FUNCTION_TYPE nullGLFlushMappedBufferRange(GrGLenum target,
GrGLintptr offset,
GrGLsizeiptr length) {}
GrGLboolean GR_GL_FUNCTION_TYPE nullGLUnmapBuffer(GrGLenum target) {
State* state = State::Get();
GrGLuint id = 0;
switch (target) {
case GR_GL_ARRAY_BUFFER:
id = state->fCurrArrayBuffer;
break;
case GR_GL_ELEMENT_ARRAY_BUFFER:
id = state->fCurrElementArrayBuffer;
break;
case GR_GL_PIXEL_PACK_BUFFER:
id = state->fCurrPixelPackBuffer;
break;
case GR_GL_PIXEL_UNPACK_BUFFER:
id = state->fCurrPixelUnpackBuffer;
break;
}
if (id > 0) {
BufferObj* buffer = state->fBufferManager.lookUp(id);
SkASSERT(buffer->mapped());
buffer->setMapped(false);
return GR_GL_TRUE;
}
GrAlwaysAssert(false);
return GR_GL_FALSE; // GR_GL_INVALID_OPERATION;
}
GrGLvoid GR_GL_FUNCTION_TYPE nullGLGetBufferParameteriv(GrGLenum target, GrGLenum pname, GrGLint* params) {
State* state = State::Get();
switch (pname) {
case GR_GL_BUFFER_MAPPED: {
*params = GR_GL_FALSE;
GrGLuint id = 0;
switch (target) {
case GR_GL_ARRAY_BUFFER:
id = state->fCurrArrayBuffer;
break;
case GR_GL_ELEMENT_ARRAY_BUFFER:
id = state->fCurrElementArrayBuffer;
break;
case GR_GL_PIXEL_PACK_BUFFER:
id = state->fCurrPixelPackBuffer;
break;
case GR_GL_PIXEL_UNPACK_BUFFER:
id = state->fCurrPixelUnpackBuffer;
break;
}
if (id > 0) {
BufferObj* buffer = state->fBufferManager.lookUp(id);
if (buffer->mapped()) {
*params = GR_GL_TRUE;
}
}
break; }
default:
SkFAIL("Unexpected pname to GetBufferParamateriv");
break;
}
};
class NullInterface : public GrGLInterface {
public:
NullInterface(State* state) : fState(SkRef(state)) {}
~NullInterface() override {
fState->unref();
}
State* fState;
};
} // end anonymous namespace
static GrGLInterface* create_null_interface(State* state) {
GrGLInterface* interface = new NullInterface(state);
interface->fStandard = kGL_GrGLStandard;
GrGLInterface::Functions* functions = &interface->fFunctions;
functions->fActiveTexture = nullGLActiveTexture;
functions->fAttachShader = nullGLAttachShader;
functions->fBeginQuery = nullGLBeginQuery;
functions->fBindAttribLocation = nullGLBindAttribLocation;
functions->fBindBuffer = nullGLBindBuffer;
functions->fBindFragDataLocation = noOpGLBindFragDataLocation;
functions->fBindTexture = nullGLBindTexture;
functions->fBindVertexArray = nullGLBindVertexArray;
functions->fBlendColor = noOpGLBlendColor;
functions->fBlendEquation = noOpGLBlendEquation;
functions->fBlendFunc = noOpGLBlendFunc;
functions->fBufferData = nullGLBufferData;
functions->fBufferSubData = noOpGLBufferSubData;
functions->fClear = noOpGLClear;
functions->fClearColor = noOpGLClearColor;
functions->fClearStencil = noOpGLClearStencil;
functions->fColorMask = noOpGLColorMask;
functions->fCompileShader = noOpGLCompileShader;
functions->fCompressedTexImage2D = noOpGLCompressedTexImage2D;
functions->fCompressedTexSubImage2D = noOpGLCompressedTexSubImage2D;
functions->fCopyTexSubImage2D = noOpGLCopyTexSubImage2D;
functions->fCreateProgram = nullGLCreateProgram;
functions->fCreateShader = nullGLCreateShader;
functions->fCullFace = noOpGLCullFace;
functions->fDeleteBuffers = nullGLDeleteBuffers;
functions->fDeleteProgram = nullGLDelete;
functions->fDeleteQueries = noOpGLDeleteIds;
functions->fDeleteShader = nullGLDelete;
functions->fDeleteTextures = noOpGLDeleteIds;
functions->fDeleteVertexArrays = noOpGLDeleteIds;
functions->fDepthMask = noOpGLDepthMask;
functions->fDisable = noOpGLDisable;
functions->fDisableVertexAttribArray = noOpGLDisableVertexAttribArray;
functions->fDrawArrays = noOpGLDrawArrays;
functions->fDrawArraysInstanced = noOpGLDrawArraysInstanced;
functions->fDrawBuffer = noOpGLDrawBuffer;
functions->fDrawBuffers = noOpGLDrawBuffers;
functions->fDrawElements = noOpGLDrawElements;
functions->fDrawElementsInstanced = noOpGLDrawElementsInstanced;
functions->fEnable = noOpGLEnable;
functions->fEnableVertexAttribArray = noOpGLEnableVertexAttribArray;
functions->fEndQuery = noOpGLEndQuery;
functions->fFinish = noOpGLFinish;
functions->fFlush = noOpGLFlush;
functions->fFlushMappedBufferRange = nullGLFlushMappedBufferRange;
functions->fFrontFace = noOpGLFrontFace;
functions->fGenBuffers = nullGLGenBuffers;
functions->fGenerateMipmap = nullGLGenerateMipmap;
functions->fGenQueries = noOpGLGenIds;
functions->fGenTextures = noOpGLGenIds;
functions->fGenVertexArrays = noOpGLGenIds;
functions->fGetBufferParameteriv = nullGLGetBufferParameteriv;
functions->fGetError = noOpGLGetError;
functions->fGetIntegerv = noOpGLGetIntegerv;
functions->fGetMultisamplefv = noOpGLGetMultisamplefv;
functions->fGetQueryObjecti64v = noOpGLGetQueryObjecti64v;
functions->fGetQueryObjectiv = noOpGLGetQueryObjectiv;
functions->fGetQueryObjectui64v = noOpGLGetQueryObjectui64v;
functions->fGetQueryObjectuiv = noOpGLGetQueryObjectuiv;
functions->fGetQueryiv = noOpGLGetQueryiv;
functions->fGetProgramInfoLog = noOpGLGetInfoLog;
functions->fGetProgramiv = noOpGLGetShaderOrProgramiv;
functions->fGetShaderInfoLog = noOpGLGetInfoLog;
functions->fGetShaderiv = noOpGLGetShaderOrProgramiv;
functions->fGetString = noOpGLGetString;
functions->fGetStringi = noOpGLGetStringi;
functions->fGetTexLevelParameteriv = noOpGLGetTexLevelParameteriv;
functions->fGetUniformLocation = noOpGLGetUniformLocation;
functions->fInsertEventMarker = noOpGLInsertEventMarker;
functions->fLineWidth = noOpGLLineWidth;
functions->fLinkProgram = noOpGLLinkProgram;
functions->fMapBuffer = nullGLMapBuffer;
functions->fMapBufferRange = nullGLMapBufferRange;
functions->fPixelStorei = nullGLPixelStorei;
functions->fPopGroupMarker = noOpGLPopGroupMarker;
functions->fPushGroupMarker = noOpGLPushGroupMarker;
functions->fQueryCounter = noOpGLQueryCounter;
functions->fReadBuffer = noOpGLReadBuffer;
functions->fReadPixels = nullGLReadPixels;
functions->fScissor = noOpGLScissor;
functions->fShaderSource = noOpGLShaderSource;
functions->fStencilFunc = noOpGLStencilFunc;
functions->fStencilFuncSeparate = noOpGLStencilFuncSeparate;
functions->fStencilMask = noOpGLStencilMask;
functions->fStencilMaskSeparate = noOpGLStencilMaskSeparate;
functions->fStencilOp = noOpGLStencilOp;
functions->fStencilOpSeparate = noOpGLStencilOpSeparate;
functions->fTexBuffer = noOpGLTexBuffer;
functions->fTexImage2D = noOpGLTexImage2D;
functions->fTexParameteri = noOpGLTexParameteri;
functions->fTexParameteriv = noOpGLTexParameteriv;
functions->fTexSubImage2D = noOpGLTexSubImage2D;
functions->fTexStorage2D = noOpGLTexStorage2D;
functions->fDiscardFramebuffer = noOpGLDiscardFramebuffer;
functions->fUniform1f = noOpGLUniform1f;
functions->fUniform1i = noOpGLUniform1i;
functions->fUniform1fv = noOpGLUniform1fv;
functions->fUniform1iv = noOpGLUniform1iv;
functions->fUniform2f = noOpGLUniform2f;
functions->fUniform2i = noOpGLUniform2i;
functions->fUniform2fv = noOpGLUniform2fv;
functions->fUniform2iv = noOpGLUniform2iv;
functions->fUniform3f = noOpGLUniform3f;
functions->fUniform3i = noOpGLUniform3i;
functions->fUniform3fv = noOpGLUniform3fv;
functions->fUniform3iv = noOpGLUniform3iv;
functions->fUniform4f = noOpGLUniform4f;
functions->fUniform4i = noOpGLUniform4i;
functions->fUniform4fv = noOpGLUniform4fv;
functions->fUniform4iv = noOpGLUniform4iv;
functions->fUniformMatrix2fv = noOpGLUniformMatrix2fv;
functions->fUniformMatrix3fv = noOpGLUniformMatrix3fv;
functions->fUniformMatrix4fv = noOpGLUniformMatrix4fv;
functions->fUnmapBuffer = nullGLUnmapBuffer;
functions->fUseProgram = nullGLUseProgram;
functions->fVertexAttrib1f = noOpGLVertexAttrib1f;
functions->fVertexAttrib2fv = noOpGLVertexAttrib2fv;
functions->fVertexAttrib3fv = noOpGLVertexAttrib3fv;
functions->fVertexAttrib4fv = noOpGLVertexAttrib4fv;
functions->fVertexAttribDivisor = noOpGLVertexAttribDivisor;
functions->fVertexAttribIPointer = noOpGLVertexAttribIPointer;
functions->fVertexAttribPointer = noOpGLVertexAttribPointer;
functions->fViewport = nullGLViewport;
functions->fBindFramebuffer = nullGLBindFramebuffer;
functions->fBindRenderbuffer = nullGLBindRenderbuffer;
functions->fCheckFramebufferStatus = noOpGLCheckFramebufferStatus;
functions->fDeleteFramebuffers = nullGLDeleteFramebuffers;
functions->fDeleteRenderbuffers = nullGLDeleteRenderbuffers;
functions->fFramebufferRenderbuffer = nullGLFramebufferRenderbuffer;
functions->fFramebufferTexture2D = nullGLFramebufferTexture2D;
functions->fGenFramebuffers = noOpGLGenIds;
functions->fGenRenderbuffers = noOpGLGenIds;
functions->fGetFramebufferAttachmentParameteriv = noOpGLGetFramebufferAttachmentParameteriv;
functions->fGetRenderbufferParameteriv = noOpGLGetRenderbufferParameteriv;
functions->fRenderbufferStorage = noOpGLRenderbufferStorage;
functions->fRenderbufferStorageMultisample = noOpGLRenderbufferStorageMultisample;
functions->fBlitFramebuffer = noOpGLBlitFramebuffer;
functions->fResolveMultisampleFramebuffer = noOpGLResolveMultisampleFramebuffer;
functions->fMatrixLoadf = noOpGLMatrixLoadf;
functions->fMatrixLoadIdentity = noOpGLMatrixLoadIdentity;
functions->fBindFragDataLocationIndexed = noOpGLBindFragDataLocationIndexed;
interface->fExtensions.init(kGL_GrGLStandard, functions->fGetString, functions->fGetStringi,
functions->fGetIntegerv, nullptr, GR_EGL_NO_DISPLAY);
return interface;
}
//////////////////////////////////////////////////////////////////////////////
static void* create_tls() {
State** current = new State*;
*current = nullptr;
return current;
}
static void delete_tls(void* ctx) {
State** current = static_cast<State**>(ctx);
if (*current) {
(*current)->unref();
}
delete current;
}
static State* current_context() {
return *static_cast<State**>(SkTLS::Get(create_tls, delete_tls));
}
static void set_current_context(State* state) {
State** current = static_cast<State**>(SkTLS::Get(create_tls, delete_tls));
if (*current) {
(*current)->unref();
}
*current = state;
if (state) {
state->ref();
}
}
#if GR_GL_PER_GL_FUNC_CALLBACK
static void set_current_context_from_interface(const GrGLInterface* interface) {
set_current_context(reinterpret_cast<State*>(interface->fCallbackData));
}
#endif
SkNullGLContext* SkNullGLContext::Create() {
SkNullGLContext* ctx = new SkNullGLContext;
@ -591,18 +19,9 @@ SkNullGLContext* SkNullGLContext::Create() {
}
SkNullGLContext::SkNullGLContext() {
fState = new ContextState;
GrGLInterface* interface = create_null_interface(fState);
this->init(interface);
#if GR_GL_PER_GL_FUNC_CALLBACK
interface->fCallback = set_current_context_from_interface;
interface->fCallbackData = reinterpret_cast<GrGLInterfaceCallbackData>(fState);
#endif
this->init(GrGLCreateNullInterface());
}
SkNullGLContext::~SkNullGLContext() {
this->teardown();
fState->unref();
}
void SkNullGLContext::onPlatformMakeCurrent() const { set_current_context(fState); }

View File

@ -229,8 +229,10 @@ GrGLuint EGLGLContext::eglImageToExternalTexture(GrEGLImage image) const {
if (!this->gl()->hasExtension("GL_OES_EGL_image_external")) {
return 0;
}
GrGLEGLImageTargetTexture2DProc glEGLImageTargetTexture2D =
(GrGLEGLImageTargetTexture2DProc) eglGetProcAddress("glEGLImageTargetTexture2DOES");
typedef GrGLvoid (*EGLImageTargetTexture2DProc)(GrGLenum, GrGLeglImage);
EGLImageTargetTexture2DProc glEGLImageTargetTexture2D =
(EGLImageTargetTexture2DProc) eglGetProcAddress("glEGLImageTargetTexture2DOES");
if (!glEGLImageTargetTexture2D) {
return 0;
}