Add GL_ARB_invalidate_subdata functions to GrGLInterface.

BUG=skia:1541
R=egdaniel@google.com

Review URL: https://codereview.chromium.org/217503003

git-svn-id: http://skia.googlecode.com/svn/trunk@14004 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
bsalomon@google.com 2014-04-01 13:07:29 +00:00
parent 58d69d8460
commit a34bb60c4e
10 changed files with 114 additions and 4 deletions

View File

@ -141,6 +141,12 @@ extern "C" {
typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLGetTexLevelParameterivProc)(GrGLenum target, GrGLint level, GrGLenum pname, GrGLint* params);
typedef GrGLint (GR_GL_FUNCTION_TYPE* GrGLGetUniformLocationProc)(GrGLuint program, const char* name);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLInsertEventMarkerProc)(GrGLsizei length, const char* marker);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLInvalidateBufferDataProc)(GrGLuint buffer);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLInvalidateBufferSubDataProc)(GrGLuint buffer, GrGLintptr offset, GrGLsizeiptr length);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLInvalidateFramebufferProc)(GrGLenum target, GrGLsizei numAttachments, const GrGLenum *attachments);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLInvalidateSubFramebufferProc)(GrGLenum target, GrGLsizei numAttachments, const GrGLenum *attachments, GrGLint x, GrGLint y, GrGLsizei width, GrGLsizei height);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLInvalidateTexImageProc)(GrGLuint texture, GrGLint level);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLInvalidateTexSubImageProc)(GrGLuint texture, GrGLint level, GrGLint xoffset, GrGLint yoffset, GrGLint zoffset, GrGLsizei width, GrGLsizei height, GrGLsizei depth);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLLineWidthProc)(GrGLfloat width);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLLinkProgramProc)(GrGLuint program);
typedef GrGLvoid* (GR_GL_FUNCTION_TYPE* GrGLMapBufferProc)(GrGLenum target, GrGLenum access);

View File

@ -222,6 +222,12 @@ public:
GLPtr<GrGLGetTexLevelParameterivProc> fGetTexLevelParameteriv;
GLPtr<GrGLGetUniformLocationProc> fGetUniformLocation;
GLPtr<GrGLInsertEventMarkerProc> fInsertEventMarker;
GLPtr<GrGLInvalidateBufferDataProc> fInvalidateBufferData;
GLPtr<GrGLInvalidateBufferSubDataProc> fInvalidateBufferSubData;
GLPtr<GrGLInvalidateFramebufferProc> fInvalidateFramebuffer;
GLPtr<GrGLInvalidateSubFramebufferProc> fInvalidateSubFramebuffer;
GLPtr<GrGLInvalidateTexImageProc> fInvalidateTexImage;
GLPtr<GrGLInvalidateTexSubImageProc> fInvalidateTexSubImage;
GLPtr<GrGLLineWidthProc> fLineWidth;
GLPtr<GrGLLinkProgramProc> fLinkProgram;
GLPtr<GrGLLoadIdentityProc> fLoadIdentity;

View File

@ -486,5 +486,25 @@ bool GrGLInterface::validate() const {
RETURN_FALSE_INTERFACE
}
}
#if 0 // This can be enabled once Chromium is updated to set these functions pointers.
if ((kGL_GrGLStandard == fStandard) || fExtensions.has("GL_ARB_invalidate_subdata")) {
if (NULL == fFunctions.fInvalidateBufferData ||
NULL == fFunctions.fInvalidateBufferSubData ||
NULL == fFunctions.fInvalidateFramebuffer ||
NULL == fFunctions.fInvalidateSubFramebuffer ||
NULL == fFunctions.fInvalidateTexImage ||
NULL == fFunctions.fInvalidateTexSubImage) {
RETURN_FALSE_INTERFACE;
}
} else if (glVer >= GR_GL_VER(3,0)) {
// ES 3.0 adds the framebuffer functions but not the others.
if (NULL == fFunctions.fInvalidateFramebuffer ||
NULL == fFunctions.fInvalidateSubFramebuffer) {
RETURN_FALSE_INTERFACE;
}
}
#endif
return true;
}

View File

@ -203,6 +203,18 @@ static GrGLInterface* create_es_interface(GrGLVersion version,
}
}
#if GL_ES_VERSION_3_0
functions->fInvalidateFramebuffer = glInvalidateFramebuffer;
functions->fInvalidateSubFramebuffer = glInvalidateSubFramebuffer;
#else
functions->fInvalidateFramebuffer = (GrGLInvalidateFramebufferProc) eglGetProcAddress("glInvalidateFramebuffer");
functions->fInvalidateSubFramebuffer = (GrGLInvalidateSubFramebufferProc) eglGetProcAddress("glInvalidateSubFramebuffer");
#endif
functions->fInvalidateBufferData = (GrGLInvalidateBufferDataProc) eglGetProcAddress("glInvalidateBufferData");
functions->fInvalidateBufferSubData = (GrGLInvalidateBufferSubDataProc) eglGetProcAddress("glInvalidateBufferSubData");
functions->fInvalidateTexImage = (GrGLInvalidateTexImageProc) eglGetProcAddress("glInvalidateTexImage");
functions->fInvalidateTexSubImage = (GrGLInvalidateTexSubImageProc) eglGetProcAddress("glInvalidateTexSubImage");
return interface;
}
@ -403,6 +415,13 @@ static GrGLInterface* create_desktop_interface(GrGLVersion version,
functions->fPopGroupMarker = (GrGLPopGroupMarkerProc) eglGetProcAddress("glPopGroupMarkerEXT");
}
functions->fInvalidateBufferData = (GrGLInvalidateBufferDataProc) eglGetProcAddress("glInvalidateBufferData");
functions->fInvalidateBufferSubData = (GrGLInvalidateBufferSubDataProc) eglGetProcAddress("glInvalidateBufferSubData");
functions->fInvalidateFramebuffer = (GrGLInvalidateFramebufferProc) eglGetProcAddress("glInvalidateFramebuffer");
functions->fInvalidateSubFramebuffer = (GrGLInvalidateSubFramebufferProc) eglGetProcAddress("glInvalidateSubFramebuffer");
functions->fInvalidateTexImage = (GrGLInvalidateTexImageProc) eglGetProcAddress("glInvalidateTexImage");
functions->fInvalidateTexSubImage = (GrGLInvalidateTexSubImageProc) eglGetProcAddress("glInvalidateTexSubImage");
return interface;
}

View File

@ -88,6 +88,7 @@ const GrGLInterface* GrGLCreateANGLEInterface() {
GET_PROC(GetShaderInfoLog);
GET_PROC(GetShaderiv);
GET_PROC(GetString);
GET_PROC(GetStringi);
GET_PROC(GetUniformLocation);
GET_PROC(LineWidth);
GET_PROC(LinkProgram);
@ -153,15 +154,25 @@ const GrGLInterface* GrGLCreateANGLEInterface() {
functions->fMapBuffer = (GrGLMapBufferProc) eglGetProcAddress("glMapBufferOES");
functions->fUnmapBuffer = (GrGLUnmapBufferProc) eglGetProcAddress("glUnmapBufferOES");
#if GL_EXT_debug_marker
functions->fInsertEventMarker = (GrGLInsertEventMarkerProc) eglGetProcAddress("glInsertEventMarkerEXT");
functions->fPushGroupMarker = (GrGLInsertEventMarkerProc) eglGetProcAddress("glPushGroupMarkerEXT");
functions->fPopGroupMarker = (GrGLPopGroupMarkerProc) eglGetProcAddress("glPopGroupMarkerEXT");
#if GL_ES_VERSION_3_0
GET_PROC(InvalidateFramebuffer);
GET_PROC(InvalidateSubFramebuffer);
#else
functions->fInvalidateFramebuffer = (GrGLInvalidateFramebufferProc) eglGetProcAddress("glInvalidateFramebuffer");
functions->fInvalidateSubFramebuffer = (GrGLInvalidateSubFramebufferProc) eglGetProcAddress("glInvalidateSubFramebuffer");
#endif
functions->fInvalidateBufferData = (GrGLInvalidateBufferDataProc) eglGetProcAddress("glInvalidateBufferData");
functions->fInvalidateBufferSubData = (GrGLInvalidateBufferSubDataProc) eglGetProcAddress("glInvalidateBufferSubData");
functions->fInvalidateTexImage = (GrGLInvalidateTexImageProc) eglGetProcAddress("glInvalidateTexImage");
functions->fInvalidateTexSubImage = (GrGLInvalidateTexSubImageProc) eglGetProcAddress("glInvalidateTexSubImage");
interface->fExtensions.init(kGLES_GrGLStandard,
interface->fFunctions.fGetString,
interface->fFunctions.fGetStringi,
interface->fFunctions.fGetIntegerv);
functions->fGetString,
functions->fGetStringi,
functions->fGetIntegerv);
return interface;
}

View File

@ -150,6 +150,18 @@ const GrGLInterface* GrGLCreateNativeInterface() {
functions->fPopGroupMarker = glPopGroupMarkerEXT;
#endif
#if GL_ES_VERSION_3_0 || GL_ARB_invalidate_subdata
functions->fInvalidateFramebuffer = glInvalidateFramebuffer;
functions->fInvalidateSubFramebuffer = glInvalidateSubFramebuffer;
#endif
#if GL_ARB_invalidate_subdata
functions->fInvalidateBufferData = glInvalidateBufferData;
functions->fInvalidateBufferSubData = glInvalidateBufferSubData;
functions->fInvalidateTexImage = glInvalidateTexImage;
functions->fInvalidateTexSubImage = glInvalidateTexSubImage;
#endif
interface->fStandard = kGLES_GrGLStandard;
interface->fExtensions.init(kGLES_GrGLStandard, glGetString, NULL, glGetIntegerv);

View File

@ -242,6 +242,15 @@ const GrGLInterface* GrGLCreateNativeInterface() {
GET_PROC_SUFFIX(PopGroupMarker, EXT);
}
if (ver >= GR_GL_VER(4,3) || extensions.has("GL_ARB_invalidate_subdata")) {
GET_PROC(InvalidateBufferData);
GET_PROC(InvalidateBufferSubData);
GET_PROC(InvalidateFramebuffer);
GET_PROC(InvalidateSubFramebuffer);
GET_PROC(InvalidateTexImage);
GET_PROC(InvalidateTexSubImage);
}
interface->fExtensions.swap(&extensions);
return interface;
}

View File

@ -224,6 +224,15 @@ const GrGLInterface* GrGLCreateMesaInterface() {
GR_GL_GET_PROC_SUFFIX(PushGroupMarker, EXT);
}
if (glVer >= GR_GL_VER(4,3) || extensions.has("GL_ARB_invalidate_subdata")) {
GR_GL_GET_PROC(InvalidateBufferData);
GR_GL_GET_PROC(InvalidateBufferSubData);
GR_GL_GET_PROC(InvalidateFramebuffer);
GR_GL_GET_PROC(InvalidateSubFramebuffer);
GR_GL_GET_PROC(InvalidateTexImage);
GR_GL_GET_PROC(InvalidateTexSubImage);
}
interface->fStandard = kGL_GrGLStandard;
interface->fExtensions.swap(&extensions);

View File

@ -278,6 +278,15 @@ const GrGLInterface* GrGLCreateNativeInterface() {
GR_GL_GET_PROC_SUFFIX(PopGroupMarker, EXT);
}
if (glVer >= GR_GL_VER(4,3) || extensions.has("GL_ARB_invalidate_subdata")) {
GR_GL_GET_PROC(InvalidateBufferData);
GR_GL_GET_PROC(InvalidateBufferSubData);
GR_GL_GET_PROC(InvalidateFramebuffer);
GR_GL_GET_PROC(InvalidateSubFramebuffer);
GR_GL_GET_PROC(InvalidateTexImage);
GR_GL_GET_PROC(InvalidateTexSubImage);
}
interface->fStandard = kGL_GrGLStandard;
interface->fExtensions.swap(&extensions);

View File

@ -305,6 +305,15 @@ const GrGLInterface* GrGLCreateNativeInterface() {
WGL_SET_PROC_SUFFIX(PopGroupMarker, EXT);
}
if (glVer >= GR_GL_VER(4,3) || extensions.has("GL_ARB_invalidate_subdata")) {
WGL_SET_PROC(InvalidateBufferData);
WGL_SET_PROC(InvalidateBufferSubData);
WGL_SET_PROC(InvalidateFramebuffer);
WGL_SET_PROC(InvalidateSubFramebuffer);
WGL_SET_PROC(InvalidateTexImage);
WGL_SET_PROC(InvalidateTexSubImage);
}
interface->fStandard = kGL_GrGLStandard;
interface->fExtensions.swap(&extensions);