Add glCopyTexSubImage2D to GrGLInterface

Author: bsalomon@google.com

Reviewed By: robertphillips@google.com

Review URL: https://chromiumcodereview.appspot.com/13941006

git-svn-id: http://skia.googlecode.com/svn/trunk@8634 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
commit-bot@chromium.org 2013-04-11 22:00:34 +00:00
parent 63150afcc0
commit 98168bb394
14 changed files with 130 additions and 99 deletions

View File

@ -64,6 +64,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* 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);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLCullFaceProc)(GrGLenum mode);

View File

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

View File

@ -179,6 +179,7 @@ const GrGLInterface* GrGLCreateNullInterface() {
interface->fColorMask = noOpGLColorMask;
interface->fCompileShader = noOpGLCompileShader;
interface->fCompressedTexImage2D = noOpGLCompressedTexImage2D;
interface->fCopyTexSubImage2D = noOpGLCopyTexSubImage2D;
interface->fCreateProgram = nullGLCreateProgram;
interface->fCreateShader = nullGLCreateShader;
interface->fCullFace = noOpGLCullFace;

View File

@ -59,6 +59,9 @@ bool GrGLInterface::validate(GrGLBinding binding) const {
NULL == fClearStencil ||
NULL == fColorMask ||
NULL == fCompileShader ||
#if 0 // FIXME: Remove this once Chromium is updated to provide this function
NULL == fCopyTexSubImage2D ||
#endif
NULL == fCreateProgram ||
NULL == fCreateShader ||
NULL == fCullFace ||

View File

@ -100,6 +100,16 @@ GrGLvoid GR_GL_FUNCTION_TYPE noOpGLCompressedTexImage2D(GrGLenum target,
const GrGLvoid* data) {
}
GrGLvoid GR_GL_FUNCTION_TYPE noOpGLCopyTexSubImage2D(GrGLenum target,
GrGLint level,
GrGLint xoffset,
GrGLint yoffset,
GrGLint x,
GrGLint y,
GrGLsizei width,
GrGLsizei height) {
}
GrGLvoid GR_GL_FUNCTION_TYPE noOpGLCullFace(GrGLenum mode) {
}

View File

@ -55,6 +55,15 @@ GrGLvoid GR_GL_FUNCTION_TYPE noOpGLCompressedTexImage2D(GrGLenum target,
GrGLsizei imageSize,
const GrGLvoid* data);
GrGLvoid GR_GL_FUNCTION_TYPE noOpGLCopyTexSubImage2D(GrGLenum target,
GrGLint level,
GrGLint xoffset,
GrGLint yoffset,
GrGLint x,
GrGLint y,
GrGLsizei width,
GrGLsizei height);
GrGLvoid GR_GL_FUNCTION_TYPE noOpGLCullFace(GrGLenum mode);
GrGLvoid GR_GL_FUNCTION_TYPE noOpGLDepthMask(GrGLboolean flag);

View File

@ -37,6 +37,7 @@ const GrGLInterface* GrGLCreateNativeInterface() {
interface->fColorMask = glColorMask;
interface->fCompileShader = glCompileShader;
interface->fCompressedTexImage2D = glCompressedTexImage2D;
interface->fCopyTexSubImage2D = glCopyTexSubImage2D;
interface->fCreateProgram = glCreateProgram;
interface->fCreateShader = glCreateShader;
interface->fCullFace = glCullFace;

View File

@ -17,8 +17,8 @@
#include "GLES2/gl2ext.h"
#include "EGL/egl.h"
#define GR_GET_PROC(procType, baseName) \
interface->f ## baseName = (procType) GetProcAddress(ghANGLELib, "gl" #baseName);
#define GET_PROC(name) \
interface->f ## name = (GrGL ## name ## Proc) GetProcAddress(ghANGLELib, "gl" #name);
const GrGLInterface* GrGLCreateANGLEInterface() {
@ -39,117 +39,116 @@ const GrGLInterface* GrGLCreateANGLEInterface() {
glInterface.reset(interface);
interface->fBindingsExported = kES2_GrGLBinding;
GR_GET_PROC(GrGLActiveTextureProc, ActiveTexture);
GR_GET_PROC(GrGLAttachShaderProc, AttachShader);
GR_GET_PROC(GrGLBindAttribLocationProc, BindAttribLocation);
GR_GET_PROC(GrGLBindBufferProc, BindBuffer);
GR_GET_PROC(GrGLBindTextureProc, BindTexture);
GET_PROC(ActiveTexture);
GET_PROC(AttachShader);
GET_PROC(BindAttribLocation);
GET_PROC(BindBuffer);
GET_PROC(BindTexture);
interface->fBindVertexArray =
(GrGLBindVertexArrayProc) eglGetProcAddress("glBindVertexArrayOES");
GR_GET_PROC(GrGLBlendColorProc, BlendColor);
GR_GET_PROC(GrGLBlendFuncProc, BlendFunc);
GR_GET_PROC(GrGLBufferDataProc, BufferData);
GR_GET_PROC(GrGLBufferSubDataProc, BufferSubData);
GR_GET_PROC(GrGLClearProc, Clear);
GR_GET_PROC(GrGLClearColorProc, ClearColor);
GR_GET_PROC(GrGLClearStencilProc, ClearStencil);
GR_GET_PROC(GrGLColorMaskProc, ColorMask);
GR_GET_PROC(GrGLCompileShaderProc, CompileShader);
GR_GET_PROC(GrGLCompressedTexImage2DProc, CompressedTexImage2D);
GR_GET_PROC(GrGLCreateProgramProc, CreateProgram);
GR_GET_PROC(GrGLCreateShaderProc, CreateShader);
GR_GET_PROC(GrGLCullFaceProc, CullFace);
GR_GET_PROC(GrGLDeleteBuffersProc, DeleteBuffers);
GR_GET_PROC(GrGLDeleteProgramProc, DeleteProgram);
GR_GET_PROC(GrGLDeleteShaderProc, DeleteShader);
GR_GET_PROC(GrGLDeleteTexturesProc, DeleteTextures);
GET_PROC(BlendColor);
GET_PROC(BlendFunc);
GET_PROC(BufferData);
GET_PROC(BufferSubData);
GET_PROC(Clear);
GET_PROC(ClearColor);
GET_PROC(ClearStencil);
GET_PROC(ColorMask);
GET_PROC(CompileShader);
GET_PROC(CompressedTexImage2D);
GET_PROC(CopyTexSubImage2D);
GET_PROC(CreateProgram);
GET_PROC(CreateShader);
GET_PROC(CullFace);
GET_PROC(DeleteBuffers);
GET_PROC(DeleteProgram);
GET_PROC(DeleteShader);
GET_PROC(DeleteTextures);
interface->fDeleteVertexArrays =
(GrGLDeleteVertexArraysProc) eglGetProcAddress("glDeleteVertexArraysOES");
GR_GET_PROC(GrGLDepthMaskProc, DepthMask);
GR_GET_PROC(GrGLDisableProc, Disable);
GR_GET_PROC(GrGLDisableVertexAttribArrayProc, DisableVertexAttribArray);
GR_GET_PROC(GrGLDrawArraysProc, DrawArrays);
GR_GET_PROC(GrGLDrawElementsProc, DrawElements);
GR_GET_PROC(GrGLEnableProc, Enable);
GR_GET_PROC(GrGLEnableVertexAttribArrayProc, EnableVertexAttribArray);
GR_GET_PROC(GrGLFinishProc, Finish);
GR_GET_PROC(GrGLFlushProc, Flush);
GR_GET_PROC(GrGLFrontFaceProc, FrontFace);
GR_GET_PROC(GrGLGenBuffersProc, GenBuffers);
GR_GET_PROC(GrGLGenTexturesProc, GenTextures);
GET_PROC(DepthMask);
GET_PROC(Disable);
GET_PROC(DisableVertexAttribArray);
GET_PROC(DrawArrays);
GET_PROC(DrawElements);
GET_PROC(Enable);
GET_PROC(EnableVertexAttribArray);
GET_PROC(Finish);
GET_PROC(Flush);
GET_PROC(FrontFace);
GET_PROC(GenBuffers);
GET_PROC(GenTextures);
interface->fGenVertexArrays =
(GrGLGenVertexArraysProc) eglGetProcAddress("glGenVertexArraysOES");
GR_GET_PROC(GrGLGetBufferParameterivProc, GetBufferParameteriv);
GR_GET_PROC(GrGLGetErrorProc, GetError);
GR_GET_PROC(GrGLGetIntegervProc, GetIntegerv);
GR_GET_PROC(GrGLGetProgramInfoLogProc, GetProgramInfoLog);
GR_GET_PROC(GrGLGetProgramivProc, GetProgramiv);
GR_GET_PROC(GrGLGetShaderInfoLogProc, GetShaderInfoLog);
GR_GET_PROC(GrGLGetShaderivProc, GetShaderiv);
GR_GET_PROC(GrGLGetStringProc, GetString);
GR_GET_PROC(GrGLGetUniformLocationProc, GetUniformLocation);
GR_GET_PROC(GrGLLineWidthProc, LineWidth);
GR_GET_PROC(GrGLLinkProgramProc, LinkProgram);
GR_GET_PROC(GrGLPixelStoreiProc, PixelStorei);
GR_GET_PROC(GrGLReadPixelsProc, ReadPixels);
GR_GET_PROC(GrGLScissorProc, Scissor);
GR_GET_PROC(GrGLShaderSourceProc, ShaderSource);
GR_GET_PROC(GrGLStencilFuncProc, StencilFunc);
GR_GET_PROC(GrGLStencilFuncSeparateProc, StencilFuncSeparate);
GR_GET_PROC(GrGLStencilMaskProc, StencilMask);
GR_GET_PROC(GrGLStencilMaskSeparateProc, StencilMaskSeparate);
GR_GET_PROC(GrGLStencilOpProc, StencilOp);
GR_GET_PROC(GrGLStencilOpSeparateProc, StencilOpSeparate);
GR_GET_PROC(GrGLTexImage2DProc, TexImage2D);
GR_GET_PROC(GrGLTexParameteriProc, TexParameteri);
GR_GET_PROC(GrGLTexParameterivProc, TexParameteriv);
GR_GET_PROC(GrGLTexSubImage2DProc, TexSubImage2D);
GET_PROC(GetBufferParameteriv);
GET_PROC(GetError);
GET_PROC(GetIntegerv);
GET_PROC(GetProgramInfoLog);
GET_PROC(GetProgramiv);
GET_PROC(GetShaderInfoLog);
GET_PROC(GetShaderiv);
GET_PROC(GetString);
GET_PROC(GetUniformLocation);
GET_PROC(LineWidth);
GET_PROC(LinkProgram);
GET_PROC(PixelStorei);
GET_PROC(ReadPixels);
GET_PROC(Scissor);
GET_PROC(ShaderSource);
GET_PROC(StencilFunc);
GET_PROC(StencilFuncSeparate);
GET_PROC(StencilMask);
GET_PROC(StencilMaskSeparate);
GET_PROC(StencilOp);
GET_PROC(StencilOpSeparate);
GET_PROC(TexImage2D);
GET_PROC(TexParameteri);
GET_PROC(TexParameteriv);
GET_PROC(TexSubImage2D);
#if GL_ARB_texture_storage
GR_GET_PROC(GrGLTexStorage2DProc, TexStorage2D);
GET_PROC(TexStorage2D);
#elif GL_EXT_texture_storage
interface->fTexStorage2D = (GrGLTexStorage2DProc) eglGetProcAddress("glTexStorage2DEXT");
#endif
GR_GET_PROC(GrGLUniform1fProc, Uniform1f);
GR_GET_PROC(GrGLUniform1iProc, Uniform1i);
GR_GET_PROC(GrGLUniform1fvProc, Uniform1fv);
GR_GET_PROC(GrGLUniform1ivProc, Uniform1iv);
GET_PROC(Uniform1f);
GET_PROC(Uniform1i);
GET_PROC(Uniform1fv);
GET_PROC(Uniform1iv);
GR_GET_PROC(GrGLUniform2fProc, Uniform2f);
GR_GET_PROC(GrGLUniform2iProc, Uniform2i);
GR_GET_PROC(GrGLUniform2fvProc, Uniform2fv);
GR_GET_PROC(GrGLUniform2ivProc, Uniform2iv);
GET_PROC(Uniform2f);
GET_PROC(Uniform2i);
GET_PROC(Uniform2fv);
GET_PROC(Uniform2iv);
GR_GET_PROC(GrGLUniform3fProc, Uniform3f);
GR_GET_PROC(GrGLUniform3iProc, Uniform3i);
GR_GET_PROC(GrGLUniform3fvProc, Uniform3fv);
GR_GET_PROC(GrGLUniform3ivProc, Uniform3iv);
GET_PROC(Uniform3f);
GET_PROC(Uniform3i);
GET_PROC(Uniform3fv);
GET_PROC(Uniform3iv);
GR_GET_PROC(GrGLUniform4fProc, Uniform4f);
GR_GET_PROC(GrGLUniform4iProc, Uniform4i);
GR_GET_PROC(GrGLUniform4fvProc, Uniform4fv);
GR_GET_PROC(GrGLUniform4ivProc, Uniform4iv);
GET_PROC(Uniform4f);
GET_PROC(Uniform4i);
GET_PROC(Uniform4fv);
GET_PROC(Uniform4iv);
GR_GET_PROC(GrGLUniformMatrix2fvProc, UniformMatrix2fv);
GR_GET_PROC(GrGLUniformMatrix3fvProc, UniformMatrix3fv);
GR_GET_PROC(GrGLUniformMatrix4fvProc, UniformMatrix4fv);
GR_GET_PROC(GrGLUseProgramProc, UseProgram);
GR_GET_PROC(GrGLVertexAttrib4fvProc, VertexAttrib4fv);
GR_GET_PROC(GrGLVertexAttribPointerProc, VertexAttribPointer);
GR_GET_PROC(GrGLViewportProc, Viewport);
GR_GET_PROC(GrGLBindFramebufferProc, BindFramebuffer);
GR_GET_PROC(GrGLBindRenderbufferProc, BindRenderbuffer);
GR_GET_PROC(GrGLCheckFramebufferStatusProc, CheckFramebufferStatus);
GR_GET_PROC(GrGLDeleteFramebuffersProc, DeleteFramebuffers);
GR_GET_PROC(GrGLDeleteRenderbuffersProc, DeleteRenderbuffers);
GR_GET_PROC(GrGLFramebufferRenderbufferProc, FramebufferRenderbuffer);
GR_GET_PROC(GrGLFramebufferTexture2DProc, FramebufferTexture2D);
GR_GET_PROC(GrGLGenFramebuffersProc, GenFramebuffers);
GR_GET_PROC(GrGLGenRenderbuffersProc, GenRenderbuffers);
GR_GET_PROC(GrGLGetFramebufferAttachmentParameterivProc,
GetFramebufferAttachmentParameteriv);
GR_GET_PROC(GrGLGetRenderbufferParameterivProc,
GetRenderbufferParameteriv);
GR_GET_PROC(GrGLRenderbufferStorageProc, RenderbufferStorage);
GET_PROC(UniformMatrix2fv);
GET_PROC(UniformMatrix3fv);
GET_PROC(UniformMatrix4fv);
GET_PROC(UseProgram);
GET_PROC(VertexAttrib4fv);
GET_PROC(VertexAttribPointer);
GET_PROC(Viewport);
GET_PROC(BindFramebuffer);
GET_PROC(BindRenderbuffer);
GET_PROC(CheckFramebufferStatus);
GET_PROC(DeleteFramebuffers);
GET_PROC(DeleteRenderbuffers);
GET_PROC(FramebufferRenderbuffer);
GET_PROC(FramebufferTexture2D);
GET_PROC(GenFramebuffers);
GET_PROC(GenRenderbuffers);
GET_PROC(GetFramebufferAttachmentParameteriv);
GET_PROC(GetRenderbufferParameteriv);
GET_PROC(RenderbufferStorage);
interface->fMapBuffer = (GrGLMapBufferProc) eglGetProcAddress("glMapBufferOES");
interface->fUnmapBuffer = (GrGLUnmapBufferProc) eglGetProcAddress("glUnmapBufferOES");

View File

@ -797,6 +797,7 @@ const GrGLInterface* GrGLCreateDebugInterface() {
interface->fColorMask = noOpGLColorMask;
interface->fCompileShader = noOpGLCompileShader;
interface->fCompressedTexImage2D = noOpGLCompressedTexImage2D;
interface->fCopyTexSubImage2D = noOpGLCopyTexSubImage2D;
interface->fCreateProgram = debugGLCreateProgram;
interface->fCreateShader = debugGLCreateShader;
interface->fCullFace = noOpGLCullFace;

View File

@ -33,6 +33,7 @@ const GrGLInterface* GrGLCreateNativeInterface() {
interface->fColorMask = glColorMask;
interface->fCompileShader = glCompileShader;
interface->fCompressedTexImage2D = glCompressedTexImage2D;
interface->fCopyTexSubImage2D = glCopyTexSubImage2D;
interface->fCreateProgram = glCreateProgram;
interface->fCreateShader = glCreateShader;
interface->fCullFace = glCullFace;

View File

@ -87,6 +87,7 @@ const GrGLInterface* GrGLCreateNativeInterface() {
GET_PROC(ColorMask);
GET_PROC(CompileShader);
GET_PROC(CompressedTexImage2D);
GET_PROC(CopyTexSubImage2D);
GET_PROC(CreateProgram);
GET_PROC(CreateShader);
GET_PROC(CullFace);

View File

@ -66,6 +66,7 @@ const GrGLInterface* GrGLCreateMesaInterface() {
GR_GL_GET_PROC(ColorMask);
GR_GL_GET_PROC(CompileShader);
GR_GL_GET_PROC(CompressedTexImage2D);
GR_GL_GET_PROC(CopyTexSubImage2D);
GR_GL_GET_PROC(CreateProgram);
GR_GL_GET_PROC(CreateShader);
GR_GL_GET_PROC(CullFace);

View File

@ -66,6 +66,7 @@ const GrGLInterface* GrGLCreateNativeInterface() {
interface->fColorMask = glColorMask;
GR_GL_GET_PROC(CompileShader);
interface->fCompressedTexImage2D = glCompressedTexImage2D;
interface->fCopyTexSubImage2D = glCopyTexSubImage2D;
GR_GL_GET_PROC(CreateProgram);
GR_GL_GET_PROC(CreateShader);
interface->fCullFace = glCullFace;

View File

@ -92,6 +92,7 @@ const GrGLInterface* GrGLCreateNativeInterface() {
SET_PROC(ClearColor)
SET_PROC(ClearStencil)
SET_PROC(ColorMask)
SET_PROC(CopyTexSubImage2D)
SET_PROC(CullFace)
SET_PROC(DeleteTextures)
SET_PROC(DepthMask)