Bug 910754 - Add a bunch more required OpenGL functions for SkiaGL when using desktop OpenGL r=vlad

This commit is contained in:
George Wright 2013-06-07 23:11:58 -04:00
parent afb5f9a0ee
commit 612ed9a7d5
4 changed files with 174 additions and 0 deletions

View File

@ -499,6 +499,19 @@ GLContext::InitWithPrefix(const char *prefix, bool trygl)
{ (PRFuncPtr*) &mSymbols.fUnmapBuffer, { "UnmapBuffer", nullptr } },
{ (PRFuncPtr*) &mSymbols.fPointParameterf, { "PointParameterf", nullptr } },
{ (PRFuncPtr*) &mSymbols.fDrawBuffer, { "DrawBuffer", nullptr } },
// These functions are only used by Skia/GL in desktop mode.
// Other parts of Gecko should avoid using these
{ (PRFuncPtr*) &mSymbols.fDrawBuffers, { "DrawBuffers", nullptr } },
{ (PRFuncPtr*) &mSymbols.fClientActiveTexture, { "ClientActiveTexture", nullptr } },
{ (PRFuncPtr*) &mSymbols.fDisableClientState, { "DisableClientState", nullptr } },
{ (PRFuncPtr*) &mSymbols.fEnableClientState, { "EnableClientState", nullptr } },
{ (PRFuncPtr*) &mSymbols.fLoadIdentity, { "LoadIdentity", nullptr } },
{ (PRFuncPtr*) &mSymbols.fLoadMatrixf, { "LoadMatrixf", nullptr } },
{ (PRFuncPtr*) &mSymbols.fMatrixMode, { "MatrixMode", nullptr } },
{ (PRFuncPtr*) &mSymbols.fTexGeni, { "TexGeni", nullptr } },
{ (PRFuncPtr*) &mSymbols.fTexGenf, { "TexGenf", nullptr } },
{ (PRFuncPtr*) &mSymbols.fTexGenfv, { "TexGenfv", nullptr } },
{ (PRFuncPtr*) &mSymbols.fVertexPointer, { "VertexPointer", nullptr } },
{ nullptr, { nullptr } },
};

View File

@ -862,6 +862,12 @@ public:
AFTER_GL_CALL;
}
void fClientActiveTexture(GLenum texture) {
BEFORE_GL_CALL;
mSymbols.fClientActiveTexture(texture);
AFTER_GL_CALL;
}
void fColorMask(realGLboolean red, realGLboolean green, realGLboolean blue, realGLboolean alpha) {
BEFORE_GL_CALL;
mSymbols.fColorMask(red, green, blue, alpha);
@ -954,6 +960,12 @@ public:
AFTER_GL_CALL;
}
void fDisableClientState(GLenum capability) {
BEFORE_GL_CALL;
mSymbols.fDisableClientState(capability);
AFTER_GL_CALL;
}
void fDisableVertexAttribArray(GLuint index) {
BEFORE_GL_CALL;
mSymbols.fDisableVertexAttribArray(index);
@ -998,6 +1010,12 @@ public:
AFTER_GL_CALL;
}
void fEnableClientState(GLenum capability) {
BEFORE_GL_CALL;
mSymbols.fEnableClientState(capability);
AFTER_GL_CALL;
}
void fEnableVertexAttribArray(GLuint index) {
BEFORE_GL_CALL;
mSymbols.fEnableVertexAttribArray(index);
@ -1343,6 +1361,24 @@ public:
AFTER_GL_CALL;
}
void fLoadIdentity() {
BEFORE_GL_CALL;
mSymbols.fLoadIdentity();
AFTER_GL_CALL;
}
void fLoadMatrixf(const GLfloat *matrix) {
BEFORE_GL_CALL;
mSymbols.fLoadMatrixf(matrix);
AFTER_GL_CALL;
}
void fMatrixMode(GLenum mode) {
BEFORE_GL_CALL;
mSymbols.fMatrixMode(mode);
AFTER_GL_CALL;
}
void fPixelStorei(GLenum pname, GLint param) {
BEFORE_GL_CALL;
mSymbols.fPixelStorei(pname, param);
@ -1470,6 +1506,24 @@ public:
AFTER_GL_CALL;
}
void fTexGeni(GLenum coord, GLenum pname, GLint param) {
BEFORE_GL_CALL;
mSymbols.fTexGeni(coord, pname, param);
AFTER_GL_CALL;
}
void fTexGenf(GLenum coord, GLenum pname, GLfloat param) {
BEFORE_GL_CALL;
mSymbols.fTexGenf(coord, pname, param);
AFTER_GL_CALL;
}
void fTexGenfv(GLenum coord, GLenum pname, const GLfloat *params) {
BEFORE_GL_CALL;
mSymbols.fTexGenfv(coord, pname, params);
AFTER_GL_CALL;
}
private:
void raw_fTexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels) {
BEFORE_GL_CALL;
@ -1676,6 +1730,12 @@ public:
AFTER_GL_CALL;
}
void fVertexPointer(GLint size, GLenum type, GLsizei stride, const GLvoid* pointer) {
BEFORE_GL_CALL;
mSymbols.fVertexPointer(size, type, stride, pointer);
AFTER_GL_CALL;
}
void fCompileShader(GLuint shader) {
BEFORE_GL_CALL;
mSymbols.fCompileShader(shader);

View File

@ -125,6 +125,12 @@ GrGLvoid glCompileShader_mozilla(GrGLuint shader)
return sGLContext.get()->fCompileShader(shader);
}
GrGLvoid glCopyTexSubImage2D_mozilla(GrGLenum target, GrGLint level, GrGLint xoffset, GrGLint yoffset,
GrGLint x, GrGLint y, GrGLsizei width, GrGLsizei height)
{
return sGLContext.get()->fCopyTexSubImage2D(target, level, xoffset, yoffset, x, y, width, height);
}
GrGLuint glCreateProgram_mozilla(void)
{
return sGLContext.get()->fCreateProgram();
@ -250,6 +256,11 @@ GrGLvoid glGenTextures_mozilla(GrGLsizei n, GrGLuint* textures)
return sGLContext.get()->fGenTextures(n, textures);
}
GrGLvoid glGenerateMipmap_mozilla(GrGLenum target)
{
return sGLContext.get()->fGenerateMipmap(target);
}
GrGLvoid glGetBufferParameteriv_mozilla(GrGLenum target, GrGLenum pname, GrGLint* params)
{
return sGLContext.get()->fGetBufferParameteriv(target, pname, params);
@ -710,6 +721,57 @@ GrGLvoid glGenVertexArrays_mozilla(GrGLsizei n, GrGLuint *arrays) {
return sGLContext.get()->fGenVertexArrays(n, arrays);
}
// Additional functions required for desktop GL < version 3.2
GrGLvoid glClientActiveTexture_mozilla(GrGLenum texture)
{
return sGLContext.get()->fClientActiveTexture(texture);
}
GrGLvoid glDisableClientState_mozilla(GrGLenum capability)
{
return sGLContext.get()->fDisableClientState(capability);
}
GrGLvoid glEnableClientState_mozilla(GrGLenum capability)
{
return sGLContext.get()->fEnableClientState(capability);
}
GrGLvoid glLoadMatrixf_mozilla(const GLfloat* matrix)
{
return sGLContext.get()->fLoadMatrixf(matrix);
}
GrGLvoid glLoadIdentity_mozilla()
{
return sGLContext.get()->fLoadIdentity();
}
GrGLvoid glMatrixMode_mozilla(GrGLenum mode)
{
return sGLContext.get()->fMatrixMode(mode);
}
GrGLvoid glTexGeni_mozilla(GrGLenum coord, GrGLenum pname, GrGLint param)
{
return sGLContext.get()->fTexGeni(coord, pname, param);
}
GrGLvoid glTexGenf_mozilla(GrGLenum coord, GrGLenum pname, GrGLfloat param)
{
return sGLContext.get()->fTexGenf(coord, pname, param);
}
GrGLvoid glTexGenfv_mozilla(GrGLenum coord, GrGLenum pname, const GrGLfloat* param)
{
return sGLContext.get()->fTexGenfv(coord, pname, param);
}
GrGLvoid glVertexPointer_mozilla(GrGLint size, GrGLenum type, GrGLsizei stride, const GrGLvoid* pointer)
{
return sGLContext.get()->fVertexPointer(size, type, stride, pointer);
}
} // extern "C"
@ -737,6 +799,7 @@ GrGLInterface* CreateGrGLInterfaceFromGLContext(GLContext* context)
i->fClearStencil = glClearStencil_mozilla;
i->fColorMask = glColorMask_mozilla;
i->fCompileShader = glCompileShader_mozilla;
i->fCopyTexSubImage2D = glCopyTexSubImage2D_mozilla;
i->fCreateProgram = glCreateProgram_mozilla;
i->fCreateShader = glCreateShader_mozilla;
i->fCullFace = glCullFace_mozilla;
@ -763,6 +826,7 @@ GrGLInterface* CreateGrGLInterfaceFromGLContext(GLContext* context)
i->fGenRenderbuffers = glGenRenderbuffers_mozilla;
i->fGetFramebufferAttachmentParameteriv = glGetFramebufferAttachmentParameteriv_mozilla;
i->fGenTextures = glGenTextures_mozilla;
i->fGenerateMipmap = glGenerateMipmap_mozilla;
i->fGetBufferParameteriv = glGetBufferParameteriv_mozilla;
i->fGetError = glGetError_mozilla;
i->fGetIntegerv = glGetIntegerv_mozilla;
@ -849,6 +913,18 @@ GrGLInterface* CreateGrGLInterfaceFromGLContext(GLContext* context)
// Desktop OpenGL > 2.0
i->fDrawBuffers = glDrawBuffers_mozilla;
// Desktop OpenGL < 3.2 (which we pretend to be)
i->fClientActiveTexture = glClientActiveTexture_mozilla;
i->fDisableClientState = glDisableClientState_mozilla;
i->fEnableClientState = glEnableClientState_mozilla;
i->fLoadIdentity = glLoadIdentity_mozilla;
i->fLoadMatrixf = glLoadMatrixf_mozilla;
i->fMatrixMode = glMatrixMode_mozilla;
i->fTexGenf = glTexGenf_mozilla;
i->fTexGenfv = glTexGenfv_mozilla;
i->fTexGeni = glTexGeni_mozilla;
i->fVertexPointer = glVertexPointer_mozilla;
// We support both desktop GL and GLES2
if (context->IsGLES2()) {
i->fBindingsExported = kES2_GrGLBinding;

View File

@ -313,6 +313,31 @@ struct GLContextSymbols
typedef void (GLAPIENTRY * PFNGLRENDERBUFFERSTORAGE) (GLenum target, GLenum internalFormat, GLsizei width, GLsizei height);
PFNGLRENDERBUFFERSTORAGE fRenderbufferStorage;
// These functions are only used by Skia/GL in desktop mode.
// Other parts of Gecko should avoid using these
typedef void (GLAPIENTRY * PFNGLCLIENTACTIVETEXTURE) (GLenum texture);
PFNGLCLIENTACTIVETEXTURE fClientActiveTexture;
typedef void (GLAPIENTRY * PFNDISABLECLIENTSTATE) (GLenum capability);
PFNDISABLECLIENTSTATE fDisableClientState;
typedef void (GLAPIENTRY * PFNENABLECLIENTSTATE) (GLenum capability);
PFNENABLECLIENTSTATE fEnableClientState;
typedef void (GLAPIENTRY * PFNLOADIDENTITY) (void);
PFNLOADIDENTITY fLoadIdentity;
typedef void (GLAPIENTRY * PFNLOADMATRIXD) (const GLdouble* matrix);
PFNLOADMATRIXD fLoadMatrixd;
typedef void (GLAPIENTRY * PFNLOADMATRIXF) (const GLfloat* matrix);
PFNLOADMATRIXF fLoadMatrixf;
typedef void (GLAPIENTRY * PFNMATRIXMODE) (GLenum mode);
PFNMATRIXMODE fMatrixMode;
typedef void (GLAPIENTRY * PFNTEXGENI) (GLenum coord, GLenum pname, GLint param);
PFNTEXGENI fTexGeni;
typedef void (GLAPIENTRY * PFNTEXGENF) (GLenum coord, GLenum pname, GLfloat param);
PFNTEXGENF fTexGenf;
typedef void (GLAPIENTRY * PFNTEXGENFV) (GLenum coord, GLenum pname, const GLfloat* param);
PFNTEXGENFV fTexGenfv;
typedef void (GLAPIENTRY * PFNVERTEXPOINTER) (GLint size, GLenum type, GLsizei stride, const GLvoid* pointer);
PFNVERTEXPOINTER fVertexPointer;
typedef void (GLAPIENTRY * PFNGLBLITFRAMEBUFFER) (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
PFNGLBLITFRAMEBUFFER fBlitFramebuffer;
typedef void (GLAPIENTRY * PFNGLRENDERBUFFERSTORAGEMULTISAMPLE) (GLenum target, GLsizei samples, GLenum internalFormat, GLsizei width, GLsizei height);