Add support for glCompressedTexSubImage2D

R=bsalomon@google.com, robertphillips@google.com

Author: krajcevski@google.com

Review URL: https://codereview.chromium.org/329213002
This commit is contained in:
krajcevski 2014-06-11 10:38:47 -07:00 committed by Commit bot
parent 5926b86b90
commit 37d20f7532
11 changed files with 31 additions and 1 deletions

View File

@ -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);

View File

@ -168,6 +168,7 @@ public:
GLPtr<GrGLColorMaskProc> fColorMask;
GLPtr<GrGLCompileShaderProc> fCompileShader;
GLPtr<GrGLCompressedTexImage2DProc> fCompressedTexImage2D;
GLPtr<GrGLCompressedTexSubImage2DProc> fCompressedTexSubImage2D;
GLPtr<GrGLCopyTexSubImage2DProc> fCopyTexSubImage2D;
GLPtr<GrGLCreateProgramProc> fCreateProgram;
GLPtr<GrGLCreateShaderProc> fCreateShader;

View File

@ -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);

View File

@ -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;

View File

@ -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
}
}

View File

@ -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,

View File

@ -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,

View File

@ -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;

View File

@ -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);

View File

@ -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;

View File

@ -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;