From 37d20f75320e8182f4cdbce5f3d59a339f915e05 Mon Sep 17 00:00:00 2001 From: krajcevski Date: Wed, 11 Jun 2014 10:38:47 -0700 Subject: [PATCH] Add support for glCompressedTexSubImage2D R=bsalomon@google.com, robertphillips@google.com Author: krajcevski@google.com Review URL: https://codereview.chromium.org/329213002 --- include/gpu/gl/GrGLFunctions.h | 1 + include/gpu/gl/GrGLInterface.h | 1 + src/gpu/gl/GrGLAssembleInterface.cpp | 1 + src/gpu/gl/GrGLCreateNullInterface.cpp | 1 + src/gpu/gl/GrGLInterface.cpp | 3 ++- src/gpu/gl/GrGLNoOpInterface.cpp | 11 +++++++++++ src/gpu/gl/GrGLNoOpInterface.h | 10 ++++++++++ src/gpu/gl/android/GrGLCreateNativeInterface_android.cpp | 1 + src/gpu/gl/angle/GrGLCreateANGLEInterface.cpp | 1 + src/gpu/gl/debug/GrGLCreateDebugInterface.cpp | 1 + src/gpu/gl/iOS/GrGLCreateNativeInterface_iOS.cpp | 1 + 11 files changed, 31 insertions(+), 1 deletion(-) diff --git a/include/gpu/gl/GrGLFunctions.h b/include/gpu/gl/GrGLFunctions.h index 51db053..5ac77a2 100644 --- a/include/gpu/gl/GrGLFunctions.h +++ b/include/gpu/gl/GrGLFunctions.h @@ -87,6 +87,7 @@ extern "C" { 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* GrGLCreateShaderProc)(GrGLenum type); diff --git a/include/gpu/gl/GrGLInterface.h b/include/gpu/gl/GrGLInterface.h index 2b33e8e..6c5ab24 100644 --- a/include/gpu/gl/GrGLInterface.h +++ b/include/gpu/gl/GrGLInterface.h @@ -168,6 +168,7 @@ public: GLPtr fColorMask; GLPtr fCompileShader; GLPtr fCompressedTexImage2D; + GLPtr fCompressedTexSubImage2D; GLPtr fCopyTexSubImage2D; GLPtr fCreateProgram; GLPtr fCreateShader; diff --git a/src/gpu/gl/GrGLAssembleInterface.cpp b/src/gpu/gl/GrGLAssembleInterface.cpp index e433725..98dabff 100644 --- a/src/gpu/gl/GrGLAssembleInterface.cpp +++ b/src/gpu/gl/GrGLAssembleInterface.cpp @@ -65,6 +65,7 @@ const GrGLInterface* GrGLAssembleGLInterface(void* ctx, GrGLGetProc get) { GET_PROC(ColorMask); GET_PROC(CompileShader); GET_PROC(CompressedTexImage2D); + GET_PROC(CompressedTexSubImage2D); GET_PROC(CopyTexSubImage2D); GET_PROC(CreateProgram); GET_PROC(CreateShader); diff --git a/src/gpu/gl/GrGLCreateNullInterface.cpp b/src/gpu/gl/GrGLCreateNullInterface.cpp index 6cfa8c2..d047e73 100644 --- a/src/gpu/gl/GrGLCreateNullInterface.cpp +++ b/src/gpu/gl/GrGLCreateNullInterface.cpp @@ -308,6 +308,7 @@ const GrGLInterface* GrGLCreateNullInterface() { functions->fColorMask = noOpGLColorMask; functions->fCompileShader = noOpGLCompileShader; functions->fCompressedTexImage2D = noOpGLCompressedTexImage2D; + functions->fCompressedTexSubImage2D = noOpGLCompressedTexSubImage2D; functions->fCopyTexSubImage2D = noOpGLCopyTexSubImage2D; functions->fCreateProgram = nullGLCreateProgram; functions->fCreateShader = nullGLCreateShader; diff --git a/src/gpu/gl/GrGLInterface.cpp b/src/gpu/gl/GrGLInterface.cpp index ee184d0..5062d92 100644 --- a/src/gpu/gl/GrGLInterface.cpp +++ b/src/gpu/gl/GrGLInterface.cpp @@ -357,7 +357,8 @@ bool GrGLInterface::validate() const { if (kGL_GrGLStandard != fStandard || (glVer >= GR_GL_VER(1,3)) || fExtensions.has("GL_ARB_texture_compression")) { - if (NULL == fFunctions.fCompressedTexImage2D) { + if (NULL == fFunctions.fCompressedTexImage2D || + NULL == fFunctions.fCompressedTexSubImage2D) { RETURN_FALSE_INTERFACE } } diff --git a/src/gpu/gl/GrGLNoOpInterface.cpp b/src/gpu/gl/GrGLNoOpInterface.cpp index a433c0e..df32d2a 100644 --- a/src/gpu/gl/GrGLNoOpInterface.cpp +++ b/src/gpu/gl/GrGLNoOpInterface.cpp @@ -100,6 +100,17 @@ GrGLvoid GR_GL_FUNCTION_TYPE noOpGLCompressedTexImage2D(GrGLenum target, const GrGLvoid* data) { } +GrGLvoid GR_GL_FUNCTION_TYPE noOpGLCompressedTexSubImage2D(GrGLenum target, + GrGLint level, + GrGLint xoffset, + GrGLint yoffset, + GrGLsizei width, + GrGLsizei height, + GrGLenum format, + GrGLsizei imageSize, + const GrGLvoid* data) { +} + GrGLvoid GR_GL_FUNCTION_TYPE noOpGLCopyTexSubImage2D(GrGLenum target, GrGLint level, GrGLint xoffset, diff --git a/src/gpu/gl/GrGLNoOpInterface.h b/src/gpu/gl/GrGLNoOpInterface.h index 2efc113..3e146d3 100644 --- a/src/gpu/gl/GrGLNoOpInterface.h +++ b/src/gpu/gl/GrGLNoOpInterface.h @@ -55,6 +55,16 @@ GrGLvoid GR_GL_FUNCTION_TYPE noOpGLCompressedTexImage2D(GrGLenum target, GrGLsizei imageSize, const GrGLvoid* data); +GrGLvoid GR_GL_FUNCTION_TYPE noOpGLCompressedTexSubImage2D(GrGLenum target, + GrGLint level, + GrGLint xoffset, + GrGLint yoffset, + GrGLsizei width, + GrGLsizei height, + GrGLenum format, + GrGLsizei imageSize, + const GrGLvoid* data); + GrGLvoid GR_GL_FUNCTION_TYPE noOpGLCopyTexSubImage2D(GrGLenum target, GrGLint level, GrGLint xoffset, diff --git a/src/gpu/gl/android/GrGLCreateNativeInterface_android.cpp b/src/gpu/gl/android/GrGLCreateNativeInterface_android.cpp index 85341ac..781e29b 100644 --- a/src/gpu/gl/android/GrGLCreateNativeInterface_android.cpp +++ b/src/gpu/gl/android/GrGLCreateNativeInterface_android.cpp @@ -44,6 +44,7 @@ static GrGLInterface* create_es_interface(GrGLVersion version, functions->fColorMask = glColorMask; functions->fCompileShader = glCompileShader; functions->fCompressedTexImage2D = glCompressedTexImage2D; + functions->fCompressedTexSubImage2D = glCompressedTexSubImage2D; functions->fCopyTexSubImage2D = glCopyTexSubImage2D; functions->fCreateProgram = glCreateProgram; functions->fCreateShader = glCreateShader; diff --git a/src/gpu/gl/angle/GrGLCreateANGLEInterface.cpp b/src/gpu/gl/angle/GrGLCreateANGLEInterface.cpp index cb2fc95..6552f7c 100644 --- a/src/gpu/gl/angle/GrGLCreateANGLEInterface.cpp +++ b/src/gpu/gl/angle/GrGLCreateANGLEInterface.cpp @@ -55,6 +55,7 @@ const GrGLInterface* GrGLCreateANGLEInterface() { GET_PROC(ColorMask); GET_PROC(CompileShader); GET_PROC(CompressedTexImage2D); + GET_PROC(CompressedTexSubImage2D); GET_PROC(CopyTexSubImage2D); GET_PROC(CreateProgram); GET_PROC(CreateShader); diff --git a/src/gpu/gl/debug/GrGLCreateDebugInterface.cpp b/src/gpu/gl/debug/GrGLCreateDebugInterface.cpp index 7c430b4..788179c 100644 --- a/src/gpu/gl/debug/GrGLCreateDebugInterface.cpp +++ b/src/gpu/gl/debug/GrGLCreateDebugInterface.cpp @@ -855,6 +855,7 @@ const GrGLInterface* GrGLCreateDebugInterface() { functions->fColorMask = noOpGLColorMask; functions->fCompileShader = noOpGLCompileShader; functions->fCompressedTexImage2D = noOpGLCompressedTexImage2D; + functions->fCompressedTexSubImage2D = noOpGLCompressedTexSubImage2D; functions->fCopyTexSubImage2D = noOpGLCopyTexSubImage2D; functions->fCreateProgram = debugGLCreateProgram; functions->fCreateShader = debugGLCreateShader; diff --git a/src/gpu/gl/iOS/GrGLCreateNativeInterface_iOS.cpp b/src/gpu/gl/iOS/GrGLCreateNativeInterface_iOS.cpp index 08e7ac8..d853e36 100644 --- a/src/gpu/gl/iOS/GrGLCreateNativeInterface_iOS.cpp +++ b/src/gpu/gl/iOS/GrGLCreateNativeInterface_iOS.cpp @@ -31,6 +31,7 @@ const GrGLInterface* GrGLCreateNativeInterface() { functions->fColorMask = glColorMask; functions->fCompileShader = glCompileShader; functions->fCompressedTexImage2D = glCompressedTexImage2D; + functions->fCompressedTexSubImage2D = glCompressedTexSubImage2D; functions->fCopyTexSubImage2D = glCopyTexSubImage2D; functions->fCreateProgram = glCreateProgram; functions->fCreateShader = glCreateShader; -- 2.7.4