[PATCH 5/9] Bug 807500 - Add a bunch of required GL wrapper methods to GLContext for use with Skia-GL r=mattwoodrow

From 280a6de21b11d92c287ec8d35daffd34179b6e94 Mon Sep 17 00:00:00 2001
---
 gfx/gl/GLContext.cpp      | 26 +++++++++++++++++
 gfx/gl/GLContext.h        | 73 +++++++++++++++++++++++++++++++++++++++++++++++
 gfx/gl/GLContextSymbols.h | 20 +++++++++++++
 3 files changed, 119 insertions(+)
This commit is contained in:
George Wright 2012-11-01 12:11:42 -04:00
parent 9a7d9e3192
commit 213bee6efd
3 changed files with 119 additions and 0 deletions

View File

@ -171,6 +171,7 @@ GLContext::InitWithPrefix(const char *prefix, bool trygl)
{ (PRFuncPtr*) &mSymbols.fGetProgramiv, { "GetProgramiv", "GetProgramivARB", NULL } },
{ (PRFuncPtr*) &mSymbols.fGetProgramInfoLog, { "GetProgramInfoLog", "GetProgramInfoLogARB", NULL } },
{ (PRFuncPtr*) &mSymbols.fTexParameteri, { "TexParameteri", NULL } },
{ (PRFuncPtr*) &mSymbols.fTexParameteriv, { "TexParameteriv", NULL } },
{ (PRFuncPtr*) &mSymbols.fTexParameterf, { "TexParameterf", NULL } },
{ (PRFuncPtr*) &mSymbols.fGetString, { "GetString", NULL } },
{ (PRFuncPtr*) &mSymbols.fGetTexParameterfv, { "GetTexParameterfv", NULL } },
@ -295,6 +296,15 @@ GLContext::InitWithPrefix(const char *prefix, bool trygl)
{ (PRFuncPtr*) &mSymbols.fMapBuffer, { "MapBuffer", NULL } },
{ (PRFuncPtr*) &mSymbols.fUnmapBuffer, { "UnmapBuffer", NULL } },
{ (PRFuncPtr*) &mSymbols.fPointParameterf, { "PointParameterf", NULL } },
{ (PRFuncPtr*) &mSymbols.fBeginQuery, { "BeginQuery", NULL } },
{ (PRFuncPtr*) &mSymbols.fGetQueryObjectuiv, { "GetQueryObjectuiv", NULL } },
{ (PRFuncPtr*) &mSymbols.fGenQueries, { "GenQueries", NULL } },
{ (PRFuncPtr*) &mSymbols.fDeleteQueries, { "DeleteQueries", NULL } },
{ (PRFuncPtr*) &mSymbols.fGetQueryiv, { "GetQueryiv", NULL } },
{ (PRFuncPtr*) &mSymbols.fGetQueryObjectiv, { "GetQueryObjectiv", NULL } },
{ (PRFuncPtr*) &mSymbols.fEndQuery, { "EndQuery", NULL } },
{ (PRFuncPtr*) &mSymbols.fDrawBuffer, { "DrawBuffer", NULL } },
{ (PRFuncPtr*) &mSymbols.fDrawBuffers, { "DrawBuffers", NULL } },
{ NULL, { NULL } },
};
@ -2691,6 +2701,14 @@ GLContext::CreatedBuffers(GLContext *aOrigin, GLsizei aCount, GLuint *aNames)
}
}
void
GLContext::CreatedQueries(GLContext *aOrigin, GLsizei aCount, GLuint *aNames)
{
for (GLsizei i = 0; i < aCount; ++i) {
mTrackedQueries.AppendElement(NamedResource(aOrigin, aNames[i]));
}
}
void
GLContext::CreatedTextures(GLContext *aOrigin, GLsizei aCount, GLuint *aNames)
{
@ -2751,6 +2769,12 @@ GLContext::DeletedBuffers(GLContext *aOrigin, GLsizei aCount, GLuint *aNames)
RemoveNamesFromArray(aOrigin, aCount, aNames, mTrackedBuffers);
}
void
GLContext::DeletedQueries(GLContext *aOrigin, GLsizei aCount, GLuint *aNames)
{
RemoveNamesFromArray(aOrigin, aCount, aNames, mTrackedQueries);
}
void
GLContext::DeletedTextures(GLContext *aOrigin, GLsizei aCount, GLuint *aNames)
{
@ -2787,6 +2811,7 @@ GLContext::SharedContextDestroyed(GLContext *aChild)
MarkContextDestroyedInArray(aChild, mTrackedFramebuffers);
MarkContextDestroyedInArray(aChild, mTrackedRenderbuffers);
MarkContextDestroyedInArray(aChild, mTrackedBuffers);
MarkContextDestroyedInArray(aChild, mTrackedQueries);
}
static void
@ -2823,6 +2848,7 @@ GLContext::ReportOutstandingNames()
ReportArrayContents("Outstanding Textures", mTrackedTextures);
ReportArrayContents("Outstanding Buffers", mTrackedBuffers);
ReportArrayContents("Outstanding Queries", mTrackedQueries);
ReportArrayContents("Outstanding Programs", mTrackedPrograms);
ReportArrayContents("Outstanding Shaders", mTrackedShaders);
ReportArrayContents("Outstanding Framebuffers", mTrackedFramebuffers);

View File

@ -1626,6 +1626,12 @@ public:
AFTER_GL_CALL;
}
void fBeginQuery(GLenum target, GLuint id) {
BEFORE_GL_CALL;
mSymbols.fBeginQuery(target, id);
AFTER_GL_CALL;
}
void fBindAttribLocation(GLuint program, GLuint index, const GLchar* name) {
BEFORE_GL_CALL;
mSymbols.fBindAttribLocation(program, index, name);
@ -1775,6 +1781,18 @@ public:
AFTER_GL_CALL;
}
void fDrawBuffer(GLenum mode) {
BEFORE_GL_CALL;
mSymbols.fDrawBuffer(mode);
AFTER_GL_CALL;
}
void fDrawBuffers(GLsizei n, GLenum* bufs) {
BEFORE_GL_CALL;
mSymbols.fDrawBuffers(n, bufs);
AFTER_GL_CALL;
}
private:
void raw_fDrawArrays(GLenum mode, GLint first, GLsizei count) {
BEFORE_GL_CALL;
@ -1801,6 +1819,12 @@ public:
AFTER_GL_CALL;
}
void fEndQuery(GLenum target) {
BEFORE_GL_CALL;
mSymbols.fEndQuery(target);
AFTER_GL_CALL;
}
void fFinish() {
BEFORE_GL_CALL;
mSymbols.fFinish();
@ -1844,6 +1868,24 @@ public:
return retval;
}
void fGetQueryiv(GLenum target, GLenum pname, GLint* params) {
BEFORE_GL_CALL;
mSymbols.fGetQueryiv(target, pname, params);
AFTER_GL_CALL;
}
void fGetQueryObjectiv(GLuint id, GLenum pname, GLint* params) {
BEFORE_GL_CALL;
mSymbols.fGetQueryObjectiv(id, pname, params);
AFTER_GL_CALL;
}
void fGetQueryObjectuiv(GLuint id, GLenum pname, GLuint* params) {
BEFORE_GL_CALL;
mSymbols.fGetQueryObjectuiv(id, pname, params);
AFTER_GL_CALL;
}
private:
void raw_fGetIntegerv(GLenum pname, GLint *params) {
BEFORE_GL_CALL;
@ -1898,6 +1940,12 @@ public:
AFTER_GL_CALL;
}
void fTexParameteriv(GLenum target, GLenum pname, GLint* params) {
BEFORE_GL_CALL;
mSymbols.fTexParameteriv(target, pname, params);
AFTER_GL_CALL;
}
void fTexParameterf(GLenum target, GLenum pname, GLfloat param) {
BEFORE_GL_CALL;
mSymbols.fTexParameterf(target, pname, param);
@ -2573,6 +2621,12 @@ private:
AFTER_GL_CALL;
}
void GLAPIENTRY raw_fGenQueries(GLsizei n, GLuint* names) {
BEFORE_GL_CALL;
mSymbols.fGenQueries(n, names);
AFTER_GL_CALL;
}
void GLAPIENTRY raw_fGenRenderbuffers(GLsizei n, GLuint* names) {
BEFORE_GL_CALL;
mSymbols.fGenRenderbuffers(n, names);
@ -2608,6 +2662,11 @@ public:
TRACKING_CONTEXT(CreatedFramebuffers(this, n, names));
}
void fGenQueries(GLsizei n, GLuint* names) {
raw_fGenQueries(n, names);
TRACKING_CONTEXT(CreatedQueries(this, n, names));
}
void fGenRenderbuffers(GLsizei n, GLuint* names) {
raw_fGenRenderbuffers(n, names);
TRACKING_CONTEXT(CreatedRenderbuffers(this, n, names));
@ -2655,7 +2714,18 @@ private:
AFTER_GL_CALL;
}
void GLAPIENTRY raw_fDeleteQueries(GLsizei n, GLuint* names) {
BEFORE_GL_CALL;
mSymbols.fDeleteQueries(n, names);
AFTER_GL_CALL;
}
public:
void GLAPIENTRY fDeleteQueries(GLsizei n, GLuint* names) {
raw_fDeleteQueries(n, names);
TRACKING_CONTEXT(DeletedQueries(this, n, names));
}
void fDeleteProgram(GLuint program) {
raw_fDeleteProgram(program);
TRACKING_CONTEXT(DeletedProgram(this, program));
@ -2783,12 +2853,14 @@ public:
void THEBES_API CreatedProgram(GLContext *aOrigin, GLuint aName);
void THEBES_API CreatedShader(GLContext *aOrigin, GLuint aName);
void THEBES_API CreatedBuffers(GLContext *aOrigin, GLsizei aCount, GLuint *aNames);
void THEBES_API CreatedQueries(GLContext *aOrigin, GLsizei aCount, GLuint *aNames);
void THEBES_API CreatedTextures(GLContext *aOrigin, GLsizei aCount, GLuint *aNames);
void THEBES_API CreatedFramebuffers(GLContext *aOrigin, GLsizei aCount, GLuint *aNames);
void THEBES_API CreatedRenderbuffers(GLContext *aOrigin, GLsizei aCount, GLuint *aNames);
void THEBES_API DeletedProgram(GLContext *aOrigin, GLuint aName);
void THEBES_API DeletedShader(GLContext *aOrigin, GLuint aName);
void THEBES_API DeletedBuffers(GLContext *aOrigin, GLsizei aCount, GLuint *aNames);
void THEBES_API DeletedQueries(GLContext *aOrigin, GLsizei aCount, GLuint *aNames);
void THEBES_API DeletedTextures(GLContext *aOrigin, GLsizei aCount, GLuint *aNames);
void THEBES_API DeletedFramebuffers(GLContext *aOrigin, GLsizei aCount, GLuint *aNames);
void THEBES_API DeletedRenderbuffers(GLContext *aOrigin, GLsizei aCount, GLuint *aNames);
@ -2830,6 +2902,7 @@ public:
nsTArray<NamedResource> mTrackedFramebuffers;
nsTArray<NamedResource> mTrackedRenderbuffers;
nsTArray<NamedResource> mTrackedBuffers;
nsTArray<NamedResource> mTrackedQueries;
#endif
public:

View File

@ -39,6 +39,8 @@ struct GLContextSymbols
PFNGLACTIVETEXTUREPROC fActiveTexture;
typedef void (GLAPIENTRY * PFNGLATTACHSHADERPROC) (GLuint program, GLuint shader);
PFNGLATTACHSHADERPROC fAttachShader;
typedef void (GLAPIENTRY * PFNGLBEGINQUERYPROC) (GLenum target, GLuint id);
PFNGLBEGINQUERYPROC fBeginQuery;
typedef void (GLAPIENTRY * PFNGLBINDATTRIBLOCATIONPROC) (GLuint program, GLuint index, const GLchar* name);
PFNGLBINDATTRIBLOCATIONPROC fBindAttribLocation;
typedef void (GLAPIENTRY * PFNGLBINDBUFFERPROC) (GLenum target, GLuint buffer);
@ -85,6 +87,10 @@ struct GLContextSymbols
PFNGLDISABLEVERTEXATTRIBARRAYPROC fDisableVertexAttribArray;
typedef void (GLAPIENTRY * PFNGLDRAWARRAYSPROC) (GLenum mode, GLint first, GLsizei count);
PFNGLDRAWARRAYSPROC fDrawArrays;
typedef void (GLAPIENTRY * PFNGLDRAWBUFFERPROC) (GLenum mode);
PFNGLDRAWBUFFERPROC fDrawBuffer;
typedef void (GLAPIENTRY * PFNGLDRAWBUFFERSPROC) (GLsizei n, const GLenum* bufs);
PFNGLDRAWBUFFERSPROC fDrawBuffers;
typedef void (GLAPIENTRY * PFNGLDRAWELEMENTSPROC) (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices);
PFNGLDRAWELEMENTSPROC fDrawElements;
typedef void (GLAPIENTRY * PFNGLENABLEPROC) (GLenum);
@ -93,6 +99,8 @@ struct GLContextSymbols
PFNGLENABLEVERTEXATTRIBARRAYPROC fEnableVertexAttribArray;
typedef void (GLAPIENTRY * PFNGLFINISHPROC) (void);
PFNGLFINISHPROC fFinish;
typedef void (GLAPIENTRY * PFNGLENDQUERYPROC) (GLenum target);
PFNGLENDQUERYPROC fEndQuery;
typedef void (GLAPIENTRY * PFNGLFLUSHPROC) (void);
PFNGLFLUSHPROC fFlush;
typedef void (GLAPIENTRY * PFNGLFRONTFACEPROC) (GLenum);
@ -121,8 +129,16 @@ struct GLContextSymbols
PFNGLGETPROGRAMIVPROC fGetProgramiv;
typedef void (GLAPIENTRY * PFNGLGETPROGRAMINFOLOGPROC) (GLuint program, GLsizei bufSize, GLsizei* length, GLchar* infoLog);
PFNGLGETPROGRAMINFOLOGPROC fGetProgramInfoLog;
typedef void (GLAPIENTRY * PFNGLGETQUERYIVPROC) (GLenum target, GLenum pname, GLint* params);
PFNGLGETQUERYIVPROC fGetQueryiv;
typedef void (GLAPIENTRY * PFNGLGETQUERYOBJECTIVPROC) (GLuint id, GLenum pname, GLint* params);
PFNGLGETQUERYOBJECTIVPROC fGetQueryObjectiv;
typedef void (GLAPIENTRY * PFNGLGETQUERYOBJECTUIVPROC) (GLuint id, GLenum pname, GLuint* params);
PFNGLGETQUERYOBJECTUIVPROC fGetQueryObjectuiv;
typedef void (GLAPIENTRY * PFNGLTEXPARAMETERIPROC) (GLenum target, GLenum pname, GLint param);
PFNGLTEXPARAMETERIPROC fTexParameteri;
typedef void (GLAPIENTRY * PFNGLTEXPARAMETERIVPROC) (GLenum target, GLenum pname, GLint* param);
PFNGLTEXPARAMETERIVPROC fTexParameteriv;
typedef void (GLAPIENTRY * PFNGLTEXPARAMETERFPROC) (GLenum target, GLenum pname, GLfloat param);
PFNGLTEXPARAMETERFPROC fTexParameterf;
typedef GLubyte* (GLAPIENTRY * PFNGLGETSTRINGPROC) (GLenum);
@ -330,6 +346,8 @@ struct GLContextSymbols
PFNGLCREATESHADERPROC fCreateShader;
typedef void (GLAPIENTRY * PFNGLGENBUFFERSPROC) (GLsizei n, GLuint* buffers);
PFNGLGENBUFFERSPROC fGenBuffers;
typedef void (GLAPIENTRY * PFNGLGENQUERIESPROC) (GLsizei n, GLuint* queries);
PFNGLGENQUERIESPROC fGenQueries;
typedef void (GLAPIENTRY * PFNGLGENTEXTURESPROC) (GLsizei n, GLuint *textures);
PFNGLGENTEXTURESPROC fGenTextures;
typedef void (GLAPIENTRY * PFNGLGENFRAMEBUFFERS) (GLsizei n, GLuint* ids);
@ -343,6 +361,8 @@ struct GLContextSymbols
PFNGLDELETESHADERPROC fDeleteShader;
typedef void (GLAPIENTRY * PFNGLDELETEBUFFERSPROC) (GLsizei n, const GLuint* buffers);
PFNGLDELETEBUFFERSPROC fDeleteBuffers;
typedef void (GLAPIENTRY * PFNGLDELETEQUERIESPROC) (GLsizei n, const GLuint* queries);
PFNGLDELETEQUERIESPROC fDeleteQueries;
typedef void (GLAPIENTRY * PFNGLDELETETEXTURESPROC) (GLsizei n, const GLuint* textures);
PFNGLDELETETEXTURESPROC fDeleteTextures;
typedef void (GLAPIENTRY * PFNGLDELETEFRAMEBUFFERS) (GLsizei n, const GLuint* ids);