diff options
author | commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2014-01-21 16:09:18 +0000 |
---|---|---|
committer | commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2014-01-21 16:09:18 +0000 |
commit | c72425ae368bfcb47de7d2532eb90d305ec0d1cf (patch) | |
tree | 89199d135e0f899f726632155965dc4b3f17cfe4 /src/gpu/gl | |
parent | 91506eb0b9461a19c6fc7dc0b15edbdbd1ed094d (diff) |
Move GrGLInterface function pointers into a nested struct
BUG=skia:2042
R=robertphillips@google.com
Author: bsalomon@google.com
Review URL: https://codereview.chromium.org/133073009
git-svn-id: http://skia.googlecode.com/svn/trunk@13130 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/gpu/gl')
-rw-r--r-- | src/gpu/gl/GrGLContext.cpp | 2 | ||||
-rw-r--r-- | src/gpu/gl/GrGLCreateNullInterface.cpp | 269 | ||||
-rw-r--r-- | src/gpu/gl/GrGLInterface.cpp | 586 | ||||
-rw-r--r-- | src/gpu/gl/GrGLUniformManager.cpp | 3 | ||||
-rw-r--r-- | src/gpu/gl/GrGLUtil.cpp | 2 | ||||
-rw-r--r-- | src/gpu/gl/GrGLUtil.h | 6 | ||||
-rw-r--r-- | src/gpu/gl/android/GrGLCreateNativeInterface_android.cpp | 608 | ||||
-rw-r--r-- | src/gpu/gl/angle/GrGLCreateANGLEInterface.cpp | 16 | ||||
-rw-r--r-- | src/gpu/gl/debug/GrGLCreateDebugInterface.cpp | 268 | ||||
-rw-r--r-- | src/gpu/gl/iOS/GrGLCreateNativeInterface_iOS.cpp | 220 | ||||
-rw-r--r-- | src/gpu/gl/mac/GrGLCreateNativeInterface_mac.cpp | 4 | ||||
-rw-r--r-- | src/gpu/gl/mesa/GrGLCreateMesaInterface.cpp | 6 | ||||
-rw-r--r-- | src/gpu/gl/unix/GrGLCreateNativeInterface_unix.cpp | 93 | ||||
-rw-r--r-- | src/gpu/gl/win/GrGLCreateNativeInterface_win.cpp | 7 |
14 files changed, 1144 insertions, 946 deletions
diff --git a/src/gpu/gl/GrGLContext.cpp b/src/gpu/gl/GrGLContext.cpp index 296eaa57f4..54deb323c0 100644 --- a/src/gpu/gl/GrGLContext.cpp +++ b/src/gpu/gl/GrGLContext.cpp @@ -25,7 +25,7 @@ bool GrGLContextInfo::initialize(const GrGLInterface* interface) { this->reset(); // We haven't validated the GrGLInterface yet, so check for GetString // function pointer - if (interface->fGetString) { + if (interface->fFunctions.fGetString) { const GrGLubyte* verUByte; GR_GL_CALL_RET(interface, verUByte, GetString(GR_GL_VERSION)); const char* ver = reinterpret_cast<const char*>(verUByte); diff --git a/src/gpu/gl/GrGLCreateNullInterface.cpp b/src/gpu/gl/GrGLCreateNullInterface.cpp index d1d851dc0f..105fb0b604 100644 --- a/src/gpu/gl/GrGLCreateNullInterface.cpp +++ b/src/gpu/gl/GrGLCreateNullInterface.cpp @@ -266,140 +266,143 @@ const GrGLInterface* GrGLCreateNullInterface() { if (!glInterface.get()) { GrGLInterface* interface = SkNEW(GrGLInterface); glInterface.reset(interface); + interface->fStandard = kGL_GrGLStandard; - interface->fActiveTexture = nullGLActiveTexture; - interface->fAttachShader = nullGLAttachShader; - interface->fBeginQuery = nullGLBeginQuery; - interface->fBindAttribLocation = nullGLBindAttribLocation; - interface->fBindBuffer = nullGLBindBuffer; - interface->fBindFragDataLocation = noOpGLBindFragDataLocation; - interface->fBindTexture = nullGLBindTexture; - interface->fBindVertexArray = nullGLBindVertexArray; - interface->fBlendColor = noOpGLBlendColor; - interface->fBlendFunc = noOpGLBlendFunc; - interface->fBufferData = nullGLBufferData; - interface->fBufferSubData = noOpGLBufferSubData; - interface->fClear = noOpGLClear; - interface->fClearColor = noOpGLClearColor; - interface->fClearStencil = noOpGLClearStencil; - interface->fClientActiveTexture = nullGLClientActiveTexture; - interface->fColorMask = noOpGLColorMask; - interface->fCompileShader = noOpGLCompileShader; - interface->fCompressedTexImage2D = noOpGLCompressedTexImage2D; - interface->fCopyTexSubImage2D = noOpGLCopyTexSubImage2D; - interface->fCreateProgram = nullGLCreateProgram; - interface->fCreateShader = nullGLCreateShader; - interface->fCullFace = noOpGLCullFace; - interface->fDeleteBuffers = nullGLDeleteBuffers; - interface->fDeleteProgram = nullGLDelete; - interface->fDeleteQueries = noOpGLDeleteIds; - interface->fDeleteShader = nullGLDelete; - interface->fDeleteTextures = noOpGLDeleteIds; - interface->fDeleteVertexArrays = noOpGLDeleteIds; - interface->fDepthMask = noOpGLDepthMask; - interface->fDisable = noOpGLDisable; - interface->fDisableClientState = noOpGLDisableClientState; - interface->fDisableVertexAttribArray = noOpGLDisableVertexAttribArray; - interface->fDrawArrays = noOpGLDrawArrays; - interface->fDrawBuffer = noOpGLDrawBuffer; - interface->fDrawBuffers = noOpGLDrawBuffers; - interface->fDrawElements = noOpGLDrawElements; - interface->fEnable = noOpGLEnable; - interface->fEnableClientState = noOpGLEnableClientState; - interface->fEnableVertexAttribArray = noOpGLEnableVertexAttribArray; - interface->fEndQuery = noOpGLEndQuery; - interface->fFinish = noOpGLFinish; - interface->fFlush = noOpGLFlush; - interface->fFrontFace = noOpGLFrontFace; - interface->fGenBuffers = nullGLGenBuffers; - interface->fGenerateMipmap = nullGLGenerateMipmap; - interface->fGenQueries = noOpGLGenIds; - interface->fGenTextures = noOpGLGenIds; - interface->fGenVertexArrays = noOpGLGenIds; - interface->fGetBufferParameteriv = nullGLGetBufferParameteriv; - interface->fGetError = noOpGLGetError; - interface->fGetIntegerv = noOpGLGetIntegerv; - interface->fGetQueryObjecti64v = noOpGLGetQueryObjecti64v; - interface->fGetQueryObjectiv = noOpGLGetQueryObjectiv; - interface->fGetQueryObjectui64v = noOpGLGetQueryObjectui64v; - interface->fGetQueryObjectuiv = noOpGLGetQueryObjectuiv; - interface->fGetQueryiv = noOpGLGetQueryiv; - interface->fGetProgramInfoLog = noOpGLGetInfoLog; - interface->fGetProgramiv = noOpGLGetShaderOrProgramiv; - interface->fGetShaderInfoLog = noOpGLGetInfoLog; - interface->fGetShaderiv = noOpGLGetShaderOrProgramiv; - interface->fGetString = noOpGLGetString; - interface->fGetStringi = noOpGLGetStringi; - interface->fGetTexLevelParameteriv = noOpGLGetTexLevelParameteriv; - interface->fGetUniformLocation = noOpGLGetUniformLocation; - interface->fLoadIdentity = noOpGLLoadIdentity; - interface->fLoadMatrixf = noOpGLLoadMatrixf; - interface->fLineWidth = noOpGLLineWidth; - interface->fLinkProgram = noOpGLLinkProgram; - interface->fMatrixMode = noOpGLMatrixMode; - interface->fPixelStorei = nullGLPixelStorei; - interface->fQueryCounter = noOpGLQueryCounter; - interface->fReadBuffer = noOpGLReadBuffer; - interface->fReadPixels = nullGLReadPixels; - interface->fScissor = noOpGLScissor; - interface->fShaderSource = noOpGLShaderSource; - interface->fStencilFunc = noOpGLStencilFunc; - interface->fStencilFuncSeparate = noOpGLStencilFuncSeparate; - interface->fStencilMask = noOpGLStencilMask; - interface->fStencilMaskSeparate = noOpGLStencilMaskSeparate; - interface->fStencilOp = noOpGLStencilOp; - interface->fStencilOpSeparate = noOpGLStencilOpSeparate; - interface->fTexGenf = noOpGLTexGenf; - interface->fTexGenfv = noOpGLTexGenfv; - interface->fTexGeni = noOpGLTexGeni; - interface->fTexImage2D = noOpGLTexImage2D; - interface->fTexParameteri = noOpGLTexParameteri; - interface->fTexParameteriv = noOpGLTexParameteriv; - interface->fTexSubImage2D = noOpGLTexSubImage2D; - interface->fTexStorage2D = noOpGLTexStorage2D; - interface->fDiscardFramebuffer = noOpGLDiscardFramebuffer; - interface->fUniform1f = noOpGLUniform1f; - interface->fUniform1i = noOpGLUniform1i; - interface->fUniform1fv = noOpGLUniform1fv; - interface->fUniform1iv = noOpGLUniform1iv; - interface->fUniform2f = noOpGLUniform2f; - interface->fUniform2i = noOpGLUniform2i; - interface->fUniform2fv = noOpGLUniform2fv; - interface->fUniform2iv = noOpGLUniform2iv; - interface->fUniform3f = noOpGLUniform3f; - interface->fUniform3i = noOpGLUniform3i; - interface->fUniform3fv = noOpGLUniform3fv; - interface->fUniform3iv = noOpGLUniform3iv; - interface->fUniform4f = noOpGLUniform4f; - interface->fUniform4i = noOpGLUniform4i; - interface->fUniform4fv = noOpGLUniform4fv; - interface->fUniform4iv = noOpGLUniform4iv; - interface->fUniformMatrix2fv = noOpGLUniformMatrix2fv; - interface->fUniformMatrix3fv = noOpGLUniformMatrix3fv; - interface->fUniformMatrix4fv = noOpGLUniformMatrix4fv; - interface->fUseProgram = nullGLUseProgram; - interface->fVertexAttrib4fv = noOpGLVertexAttrib4fv; - interface->fVertexAttribPointer = noOpGLVertexAttribPointer; - interface->fVertexPointer = noOpGLVertexPointer; - interface->fViewport = nullGLViewport; - interface->fBindFramebuffer = nullGLBindFramebuffer; - interface->fBindRenderbuffer = nullGLBindRenderbuffer; - interface->fCheckFramebufferStatus = noOpGLCheckFramebufferStatus; - interface->fDeleteFramebuffers = nullGLDeleteFramebuffers; - interface->fDeleteRenderbuffers = nullGLDeleteRenderbuffers; - interface->fFramebufferRenderbuffer = nullGLFramebufferRenderbuffer; - interface->fFramebufferTexture2D = nullGLFramebufferTexture2D; - interface->fGenFramebuffers = noOpGLGenIds; - interface->fGenRenderbuffers = noOpGLGenIds; - interface->fGetFramebufferAttachmentParameteriv = noOpGLGetFramebufferAttachmentParameteriv; - interface->fGetRenderbufferParameteriv = noOpGLGetRenderbufferParameteriv; - interface->fRenderbufferStorage = noOpGLRenderbufferStorage; - interface->fRenderbufferStorageMultisample = noOpGLRenderbufferStorageMultisample; - interface->fBlitFramebuffer = noOpGLBlitFramebuffer; - interface->fResolveMultisampleFramebuffer = noOpGLResolveMultisampleFramebuffer; - interface->fMapBuffer = nullGLMapBuffer; - interface->fUnmapBuffer = nullGLUnmapBuffer; - interface->fBindFragDataLocationIndexed = noOpGLBindFragDataLocationIndexed; + + GrGLInterface::Functions* functions = &interface->fFunctions; + functions->fActiveTexture = nullGLActiveTexture; + functions->fAttachShader = nullGLAttachShader; + functions->fBeginQuery = nullGLBeginQuery; + functions->fBindAttribLocation = nullGLBindAttribLocation; + functions->fBindBuffer = nullGLBindBuffer; + functions->fBindFragDataLocation = noOpGLBindFragDataLocation; + functions->fBindTexture = nullGLBindTexture; + functions->fBindVertexArray = nullGLBindVertexArray; + functions->fBlendColor = noOpGLBlendColor; + functions->fBlendFunc = noOpGLBlendFunc; + functions->fBufferData = nullGLBufferData; + functions->fBufferSubData = noOpGLBufferSubData; + functions->fClear = noOpGLClear; + functions->fClearColor = noOpGLClearColor; + functions->fClearStencil = noOpGLClearStencil; + functions->fClientActiveTexture = nullGLClientActiveTexture; + functions->fColorMask = noOpGLColorMask; + functions->fCompileShader = noOpGLCompileShader; + functions->fCompressedTexImage2D = noOpGLCompressedTexImage2D; + functions->fCopyTexSubImage2D = noOpGLCopyTexSubImage2D; + functions->fCreateProgram = nullGLCreateProgram; + functions->fCreateShader = nullGLCreateShader; + functions->fCullFace = noOpGLCullFace; + functions->fDeleteBuffers = nullGLDeleteBuffers; + functions->fDeleteProgram = nullGLDelete; + functions->fDeleteQueries = noOpGLDeleteIds; + functions->fDeleteShader = nullGLDelete; + functions->fDeleteTextures = noOpGLDeleteIds; + functions->fDeleteVertexArrays = noOpGLDeleteIds; + functions->fDepthMask = noOpGLDepthMask; + functions->fDisable = noOpGLDisable; + functions->fDisableClientState = noOpGLDisableClientState; + functions->fDisableVertexAttribArray = noOpGLDisableVertexAttribArray; + functions->fDrawArrays = noOpGLDrawArrays; + functions->fDrawBuffer = noOpGLDrawBuffer; + functions->fDrawBuffers = noOpGLDrawBuffers; + functions->fDrawElements = noOpGLDrawElements; + functions->fEnable = noOpGLEnable; + functions->fEnableClientState = noOpGLEnableClientState; + functions->fEnableVertexAttribArray = noOpGLEnableVertexAttribArray; + functions->fEndQuery = noOpGLEndQuery; + functions->fFinish = noOpGLFinish; + functions->fFlush = noOpGLFlush; + functions->fFrontFace = noOpGLFrontFace; + functions->fGenBuffers = nullGLGenBuffers; + functions->fGenerateMipmap = nullGLGenerateMipmap; + functions->fGenQueries = noOpGLGenIds; + functions->fGenTextures = noOpGLGenIds; + functions->fGenVertexArrays = noOpGLGenIds; + functions->fGetBufferParameteriv = nullGLGetBufferParameteriv; + functions->fGetError = noOpGLGetError; + functions->fGetIntegerv = noOpGLGetIntegerv; + functions->fGetQueryObjecti64v = noOpGLGetQueryObjecti64v; + functions->fGetQueryObjectiv = noOpGLGetQueryObjectiv; + functions->fGetQueryObjectui64v = noOpGLGetQueryObjectui64v; + functions->fGetQueryObjectuiv = noOpGLGetQueryObjectuiv; + functions->fGetQueryiv = noOpGLGetQueryiv; + functions->fGetProgramInfoLog = noOpGLGetInfoLog; + functions->fGetProgramiv = noOpGLGetShaderOrProgramiv; + functions->fGetShaderInfoLog = noOpGLGetInfoLog; + functions->fGetShaderiv = noOpGLGetShaderOrProgramiv; + functions->fGetString = noOpGLGetString; + functions->fGetStringi = noOpGLGetStringi; + functions->fGetTexLevelParameteriv = noOpGLGetTexLevelParameteriv; + functions->fGetUniformLocation = noOpGLGetUniformLocation; + functions->fLoadIdentity = noOpGLLoadIdentity; + functions->fLoadMatrixf = noOpGLLoadMatrixf; + functions->fLineWidth = noOpGLLineWidth; + functions->fLinkProgram = noOpGLLinkProgram; + functions->fMatrixMode = noOpGLMatrixMode; + functions->fPixelStorei = nullGLPixelStorei; + functions->fQueryCounter = noOpGLQueryCounter; + functions->fReadBuffer = noOpGLReadBuffer; + functions->fReadPixels = nullGLReadPixels; + functions->fScissor = noOpGLScissor; + functions->fShaderSource = noOpGLShaderSource; + functions->fStencilFunc = noOpGLStencilFunc; + functions->fStencilFuncSeparate = noOpGLStencilFuncSeparate; + functions->fStencilMask = noOpGLStencilMask; + functions->fStencilMaskSeparate = noOpGLStencilMaskSeparate; + functions->fStencilOp = noOpGLStencilOp; + functions->fStencilOpSeparate = noOpGLStencilOpSeparate; + functions->fTexGenf = noOpGLTexGenf; + functions->fTexGenfv = noOpGLTexGenfv; + functions->fTexGeni = noOpGLTexGeni; + functions->fTexImage2D = noOpGLTexImage2D; + functions->fTexParameteri = noOpGLTexParameteri; + functions->fTexParameteriv = noOpGLTexParameteriv; + functions->fTexSubImage2D = noOpGLTexSubImage2D; + functions->fTexStorage2D = noOpGLTexStorage2D; + functions->fDiscardFramebuffer = noOpGLDiscardFramebuffer; + functions->fUniform1f = noOpGLUniform1f; + functions->fUniform1i = noOpGLUniform1i; + functions->fUniform1fv = noOpGLUniform1fv; + functions->fUniform1iv = noOpGLUniform1iv; + functions->fUniform2f = noOpGLUniform2f; + functions->fUniform2i = noOpGLUniform2i; + functions->fUniform2fv = noOpGLUniform2fv; + functions->fUniform2iv = noOpGLUniform2iv; + functions->fUniform3f = noOpGLUniform3f; + functions->fUniform3i = noOpGLUniform3i; + functions->fUniform3fv = noOpGLUniform3fv; + functions->fUniform3iv = noOpGLUniform3iv; + functions->fUniform4f = noOpGLUniform4f; + functions->fUniform4i = noOpGLUniform4i; + functions->fUniform4fv = noOpGLUniform4fv; + functions->fUniform4iv = noOpGLUniform4iv; + functions->fUniformMatrix2fv = noOpGLUniformMatrix2fv; + functions->fUniformMatrix3fv = noOpGLUniformMatrix3fv; + functions->fUniformMatrix4fv = noOpGLUniformMatrix4fv; + functions->fUseProgram = nullGLUseProgram; + functions->fVertexAttrib4fv = noOpGLVertexAttrib4fv; + functions->fVertexAttribPointer = noOpGLVertexAttribPointer; + functions->fVertexPointer = noOpGLVertexPointer; + functions->fViewport = nullGLViewport; + functions->fBindFramebuffer = nullGLBindFramebuffer; + functions->fBindRenderbuffer = nullGLBindRenderbuffer; + functions->fCheckFramebufferStatus = noOpGLCheckFramebufferStatus; + functions->fDeleteFramebuffers = nullGLDeleteFramebuffers; + functions->fDeleteRenderbuffers = nullGLDeleteRenderbuffers; + functions->fFramebufferRenderbuffer = nullGLFramebufferRenderbuffer; + functions->fFramebufferTexture2D = nullGLFramebufferTexture2D; + functions->fGenFramebuffers = noOpGLGenIds; + functions->fGenRenderbuffers = noOpGLGenIds; + functions->fGetFramebufferAttachmentParameteriv = noOpGLGetFramebufferAttachmentParameteriv; + functions->fGetRenderbufferParameteriv = noOpGLGetRenderbufferParameteriv; + functions->fRenderbufferStorage = noOpGLRenderbufferStorage; + functions->fRenderbufferStorageMultisample = noOpGLRenderbufferStorageMultisample; + functions->fBlitFramebuffer = noOpGLBlitFramebuffer; + functions->fResolveMultisampleFramebuffer = noOpGLResolveMultisampleFramebuffer; + functions->fMapBuffer = nullGLMapBuffer; + functions->fUnmapBuffer = nullGLUnmapBuffer; + functions->fBindFragDataLocationIndexed = noOpGLBindFragDataLocationIndexed; } glInterface.get()->ref(); return glInterface.get(); diff --git a/src/gpu/gl/GrGLInterface.cpp b/src/gpu/gl/GrGLInterface.cpp index 72c9178db4..0a0ff59408 100644 --- a/src/gpu/gl/GrGLInterface.cpp +++ b/src/gpu/gl/GrGLInterface.cpp @@ -18,7 +18,195 @@ void GrGLDefaultInterfaceCallback(const GrGLInterface*) {} } #endif -GrGLInterface::GrGLInterface() { +GrGLInterface::GrGLInterface() + // TODO: Remove this madness ASAP. + : fActiveTexture(&fFunctions.fActiveTexture) + , fAttachShader(&fFunctions.fAttachShader) + , fBeginQuery(&fFunctions.fBeginQuery) + , fBindAttribLocation(&fFunctions.fBindAttribLocation) + , fBindBuffer(&fFunctions.fBindBuffer) + , fBindFragDataLocation(&fFunctions.fBindFragDataLocation) + , fBindFragDataLocationIndexed(&fFunctions.fBindFragDataLocationIndexed) + , fBindFramebuffer(&fFunctions.fBindFramebuffer) + , fBindRenderbuffer(&fFunctions.fBindRenderbuffer) + , fBindTexture(&fFunctions.fBindTexture) + , fBindVertexArray(&fFunctions.fBindVertexArray) + , fBlendColor(&fFunctions.fBlendColor) + , fBlendFunc(&fFunctions.fBlendFunc) + , fBlitFramebuffer(&fFunctions.fBlitFramebuffer) + , fBufferData(&fFunctions.fBufferData) + , fBufferSubData(&fFunctions.fBufferSubData) + , fCheckFramebufferStatus(&fFunctions.fCheckFramebufferStatus) + , fClear(&fFunctions.fClear) + , fClearColor(&fFunctions.fClearColor) + , fClearStencil(&fFunctions.fClearStencil) + , fClientActiveTexture(&fFunctions.fClientActiveTexture) + , fColorMask(&fFunctions.fColorMask) + , fCompileShader(&fFunctions.fCompileShader) + , fCompressedTexImage2D(&fFunctions.fCompressedTexImage2D) + , fCopyTexSubImage2D(&fFunctions.fCopyTexSubImage2D) + , fCreateProgram(&fFunctions.fCreateProgram) + , fCreateShader(&fFunctions.fCreateShader) + , fCullFace(&fFunctions.fCullFace) + , fDeleteBuffers(&fFunctions.fDeleteBuffers) + , fDeleteFramebuffers(&fFunctions.fDeleteFramebuffers) + , fDeleteProgram(&fFunctions.fDeleteProgram) + , fDeleteQueries(&fFunctions.fDeleteQueries) + , fDeleteRenderbuffers(&fFunctions.fDeleteRenderbuffers) + , fDeleteShader(&fFunctions.fDeleteShader) + , fDeleteTextures(&fFunctions.fDeleteTextures) + , fDeleteVertexArrays(&fFunctions.fDeleteVertexArrays) + , fDepthMask(&fFunctions.fDepthMask) + , fDisable(&fFunctions.fDisable) + , fDisableClientState(&fFunctions.fDisableClientState) + , fDisableVertexAttribArray(&fFunctions.fDisableVertexAttribArray) + , fDrawArrays(&fFunctions.fDrawArrays) + , fDrawBuffer(&fFunctions.fDrawBuffer) + , fDrawBuffers(&fFunctions.fDrawBuffers) + , fDrawElements(&fFunctions.fDrawElements) + , fEnable(&fFunctions.fEnable) + , fEnableClientState(&fFunctions.fEnableClientState) + , fEnableVertexAttribArray(&fFunctions.fEnableVertexAttribArray) + , fEndQuery(&fFunctions.fEndQuery) + , fFinish(&fFunctions.fFinish) + , fFlush(&fFunctions.fFlush) + , fFramebufferRenderbuffer(&fFunctions.fFramebufferRenderbuffer) + , fFramebufferTexture2D(&fFunctions.fFramebufferTexture2D) + , fFramebufferTexture2DMultisample(&fFunctions.fFramebufferTexture2DMultisample) + , fFrontFace(&fFunctions.fFrontFace) + , fGenBuffers(&fFunctions.fGenBuffers) + , fGenFramebuffers(&fFunctions.fGenFramebuffers) + , fGenerateMipmap(&fFunctions.fGenerateMipmap) + , fGenQueries(&fFunctions.fGenQueries) + , fGenRenderbuffers(&fFunctions.fGenRenderbuffers) + , fGenTextures(&fFunctions.fGenTextures) + , fGenVertexArrays(&fFunctions.fGenVertexArrays) + , fGetBufferParameteriv(&fFunctions.fGetBufferParameteriv) + , fGetError(&fFunctions.fGetError) + , fGetFramebufferAttachmentParameteriv(&fFunctions.fGetFramebufferAttachmentParameteriv) + , fGetIntegerv(&fFunctions.fGetIntegerv) + , fGetQueryObjecti64v(&fFunctions.fGetQueryObjecti64v) + , fGetQueryObjectiv(&fFunctions.fGetQueryObjectiv) + , fGetQueryObjectui64v(&fFunctions.fGetQueryObjectui64v) + , fGetQueryObjectuiv(&fFunctions.fGetQueryObjectuiv) + , fGetQueryiv(&fFunctions.fGetQueryiv) + , fGetProgramInfoLog(&fFunctions.fGetProgramInfoLog) + , fGetProgramiv(&fFunctions.fGetProgramiv) + , fGetRenderbufferParameteriv(&fFunctions.fGetRenderbufferParameteriv) + , fGetShaderInfoLog(&fFunctions.fGetShaderInfoLog) + , fGetShaderiv(&fFunctions.fGetShaderiv) + , fGetString(&fFunctions.fGetString) + , fGetStringi(&fFunctions.fGetStringi) + , fGetTexLevelParameteriv(&fFunctions.fGetTexLevelParameteriv) + , fGetUniformLocation(&fFunctions.fGetUniformLocation) + , fLineWidth(&fFunctions.fLineWidth) + , fLinkProgram(&fFunctions.fLinkProgram) + , fLoadIdentity(&fFunctions.fLoadIdentity) + , fLoadMatrixf(&fFunctions.fLoadMatrixf) + , fMapBuffer(&fFunctions.fMapBuffer) + , fMatrixMode(&fFunctions.fMatrixMode) + , fPixelStorei(&fFunctions.fPixelStorei) + , fQueryCounter(&fFunctions.fQueryCounter) + , fReadBuffer(&fFunctions.fReadBuffer) + , fReadPixels(&fFunctions.fReadPixels) + , fRenderbufferStorage(&fFunctions.fRenderbufferStorage) + , fRenderbufferStorageMultisampleES2EXT(&fFunctions.fRenderbufferStorageMultisampleES2EXT) + , fRenderbufferStorageMultisampleES2APPLE(&fFunctions.fRenderbufferStorageMultisampleES2APPLE) + , fRenderbufferStorageMultisample(&fFunctions.fRenderbufferStorageMultisample) + , fBindUniformLocation(&fFunctions.fBindUniformLocation) + , fResolveMultisampleFramebuffer(&fFunctions.fResolveMultisampleFramebuffer) + , fScissor(&fFunctions.fScissor) + , fShaderSource(&fFunctions.fShaderSource) + , fStencilFunc(&fFunctions.fStencilFunc) + , fStencilFuncSeparate(&fFunctions.fStencilFuncSeparate) + , fStencilMask(&fFunctions.fStencilMask) + , fStencilMaskSeparate(&fFunctions.fStencilMaskSeparate) + , fStencilOp(&fFunctions.fStencilOp) + , fStencilOpSeparate(&fFunctions.fStencilOpSeparate) + , fTexGenf(&fFunctions.fTexGenf) + , fTexGenfv(&fFunctions.fTexGenfv) + , fTexGeni(&fFunctions.fTexGeni) + , fTexImage2D(&fFunctions.fTexImage2D) + , fTexParameteri(&fFunctions.fTexParameteri) + , fTexParameteriv(&fFunctions.fTexParameteriv) + , fTexSubImage2D(&fFunctions.fTexSubImage2D) + , fTexStorage2D(&fFunctions.fTexStorage2D) + , fDiscardFramebuffer(&fFunctions.fDiscardFramebuffer) + , fUniform1f(&fFunctions.fUniform1f) + , fUniform1i(&fFunctions.fUniform1i) + , fUniform1fv(&fFunctions.fUniform1fv) + , fUniform1iv(&fFunctions.fUniform1iv) + , fUniform2f(&fFunctions.fUniform2f) + , fUniform2i(&fFunctions.fUniform2i) + , fUniform2fv(&fFunctions.fUniform2fv) + , fUniform2iv(&fFunctions.fUniform2iv) + , fUniform3f(&fFunctions.fUniform3f) + , fUniform3i(&fFunctions.fUniform3i) + , fUniform3fv(&fFunctions.fUniform3fv) + , fUniform3iv(&fFunctions.fUniform3iv) + , fUniform4f(&fFunctions.fUniform4f) + , fUniform4i(&fFunctions.fUniform4i) + , fUniform4fv(&fFunctions.fUniform4fv) + , fUniform4iv(&fFunctions.fUniform4iv) + , fUniformMatrix2fv(&fFunctions.fUniformMatrix2fv) + , fUniformMatrix3fv(&fFunctions.fUniformMatrix3fv) + , fUniformMatrix4fv(&fFunctions.fUniformMatrix4fv) + , fUnmapBuffer(&fFunctions.fUnmapBuffer) + , fUseProgram(&fFunctions.fUseProgram) + , fVertexAttrib4fv(&fFunctions.fVertexAttrib4fv) + , fVertexAttribPointer(&fFunctions.fVertexAttribPointer) + , fVertexPointer(&fFunctions.fVertexPointer) + , fViewport(&fFunctions.fViewport) + , fPathCommands(&fFunctions.fPathCommands) + , fPathCoords(&fFunctions.fPathCoords) + , fPathSubCommands(&fFunctions.fPathSubCommands) + , fPathSubCoords(&fFunctions.fPathSubCoords) + , fPathString(&fFunctions.fPathString) + , fPathGlyphs(&fFunctions.fPathGlyphs) + , fPathGlyphRange(&fFunctions.fPathGlyphRange) + , fWeightPaths(&fFunctions.fWeightPaths) + , fCopyPath(&fFunctions.fCopyPath) + , fInterpolatePaths(&fFunctions.fInterpolatePaths) + , fTransformPath(&fFunctions.fTransformPath) + , fPathParameteriv(&fFunctions.fPathParameteriv) + , fPathParameteri(&fFunctions.fPathParameteri) + , fPathParameterfv(&fFunctions.fPathParameterfv) + , fPathParameterf(&fFunctions.fPathParameterf) + , fPathDashArray(&fFunctions.fPathDashArray) + , fGenPaths(&fFunctions.fGenPaths) + , fDeletePaths(&fFunctions.fDeletePaths) + , fIsPath(&fFunctions.fIsPath) + , fPathStencilFunc(&fFunctions.fPathStencilFunc) + , fPathStencilDepthOffset(&fFunctions.fPathStencilDepthOffset) + , fStencilFillPath(&fFunctions.fStencilFillPath) + , fStencilStrokePath(&fFunctions.fStencilStrokePath) + , fStencilFillPathInstanced(&fFunctions.fStencilFillPathInstanced) + , fStencilStrokePathInstanced(&fFunctions.fStencilStrokePathInstanced) + , fPathCoverDepthFunc(&fFunctions.fPathCoverDepthFunc) + , fPathColorGen(&fFunctions.fPathColorGen) + , fPathTexGen(&fFunctions.fPathTexGen) + , fPathFogGen(&fFunctions.fPathFogGen) + , fCoverFillPath(&fFunctions.fCoverFillPath) + , fCoverStrokePath(&fFunctions.fCoverStrokePath) + , fCoverFillPathInstanced(&fFunctions.fCoverFillPathInstanced) + , fCoverStrokePathInstanced(&fFunctions.fCoverStrokePathInstanced) + , fGetPathParameteriv(&fFunctions.fGetPathParameteriv) + , fGetPathParameterfv(&fFunctions.fGetPathParameterfv) + , fGetPathCommands(&fFunctions.fGetPathCommands) + , fGetPathCoords(&fFunctions.fGetPathCoords) + , fGetPathDashArray(&fFunctions.fGetPathDashArray) + , fGetPathMetrics(&fFunctions.fGetPathMetrics) + , fGetPathMetricRange(&fFunctions.fGetPathMetricRange) + , fGetPathSpacing(&fFunctions.fGetPathSpacing) + , fGetPathColorGeniv(&fFunctions.fGetPathColorGeniv) + , fGetPathColorGenfv(&fFunctions.fGetPathColorGenfv) + , fGetPathTexGeniv(&fFunctions.fGetPathTexGeniv) + , fGetPathTexGenfv(&fFunctions.fGetPathTexGenfv) + , fIsPointInFillPath(&fFunctions.fIsPointInFillPath) + , fIsPointInStrokePath(&fFunctions.fIsPointInStrokePath) + , fGetPathLength(&fFunctions.fGetPathLength) + , fPointAlongPath(&fFunctions.fPointAlongPath) +{ fStandard = kNone_GrGLStandard; #if GR_GL_PER_GL_FUNC_CALLBACK @@ -37,104 +225,105 @@ bool GrGLInterface::validate() const { // fExtensions. if (!fExtensions.isInitialized()) { GrGLExtensions* extensions = const_cast<GrGLExtensions*>(&fExtensions); - if (!extensions->init(fStandard, fGetString, fGetStringi, fGetIntegerv)) { + if (!extensions->init(fStandard, fFunctions.fGetString, fFunctions.fGetStringi, + fFunctions.fGetIntegerv)) { return false; } } // functions that are always required - if (NULL == fActiveTexture || - NULL == fAttachShader || - NULL == fBindAttribLocation || - NULL == fBindBuffer || - NULL == fBindTexture || - NULL == fBlendFunc || - NULL == fBlendColor || // -> GL >= 1.4, ES >= 2.0 or extension - NULL == fBufferData || - NULL == fBufferSubData || - NULL == fClear || - NULL == fClearColor || - NULL == fClearStencil || - NULL == fColorMask || - NULL == fCompileShader || - NULL == fCopyTexSubImage2D || - NULL == fCreateProgram || - NULL == fCreateShader || - NULL == fCullFace || - NULL == fDeleteBuffers || - NULL == fDeleteProgram || - NULL == fDeleteShader || - NULL == fDeleteTextures || - NULL == fDepthMask || - NULL == fDisable || - NULL == fDisableVertexAttribArray || - NULL == fDrawArrays || - NULL == fDrawElements || - NULL == fEnable || - NULL == fEnableVertexAttribArray || - NULL == fFrontFace || - NULL == fGenBuffers || - NULL == fGenTextures || - NULL == fGetBufferParameteriv || - NULL == fGenerateMipmap || - NULL == fGetError || - NULL == fGetIntegerv || - NULL == fGetProgramInfoLog || - NULL == fGetProgramiv || - NULL == fGetShaderInfoLog || - NULL == fGetShaderiv || - NULL == fGetString || - NULL == fGetUniformLocation || - NULL == fLinkProgram || - NULL == fLineWidth || - NULL == fPixelStorei || - NULL == fReadPixels || - NULL == fScissor || - NULL == fShaderSource || - NULL == fStencilFunc || - NULL == fStencilMask || - NULL == fStencilOp || - NULL == fTexImage2D || - NULL == fTexParameteri || - NULL == fTexParameteriv || - NULL == fTexSubImage2D || - NULL == fUniform1f || - NULL == fUniform1i || - NULL == fUniform1fv || - NULL == fUniform1iv || - NULL == fUniform2f || - NULL == fUniform2i || - NULL == fUniform2fv || - NULL == fUniform2iv || - NULL == fUniform3f || - NULL == fUniform3i || - NULL == fUniform3fv || - NULL == fUniform3iv || - NULL == fUniform4f || - NULL == fUniform4i || - NULL == fUniform4fv || - NULL == fUniform4iv || - NULL == fUniformMatrix2fv || - NULL == fUniformMatrix3fv || - NULL == fUniformMatrix4fv || - NULL == fUseProgram || - NULL == fVertexAttrib4fv || - NULL == fVertexAttribPointer || - NULL == fViewport || - NULL == fBindFramebuffer || - NULL == fBindRenderbuffer || - NULL == fCheckFramebufferStatus || - NULL == fDeleteFramebuffers || - NULL == fDeleteRenderbuffers || - NULL == fFinish || - NULL == fFlush || - NULL == fFramebufferRenderbuffer || - NULL == fFramebufferTexture2D || - NULL == fGetFramebufferAttachmentParameteriv || - NULL == fGetRenderbufferParameteriv || - NULL == fGenFramebuffers || - NULL == fGenRenderbuffers || - NULL == fRenderbufferStorage) { + if (NULL == fFunctions.fActiveTexture || + NULL == fFunctions.fAttachShader || + NULL == fFunctions.fBindAttribLocation || + NULL == fFunctions.fBindBuffer || + NULL == fFunctions.fBindTexture || + NULL == fFunctions.fBlendFunc || + NULL == fFunctions.fBlendColor || // -> GL >= 1.4, ES >= 2.0 or extension + NULL == fFunctions.fBufferData || + NULL == fFunctions.fBufferSubData || + NULL == fFunctions.fClear || + NULL == fFunctions.fClearColor || + NULL == fFunctions.fClearStencil || + NULL == fFunctions.fColorMask || + NULL == fFunctions.fCompileShader || + NULL == fFunctions.fCopyTexSubImage2D || + NULL == fFunctions.fCreateProgram || + NULL == fFunctions.fCreateShader || + NULL == fFunctions.fCullFace || + NULL == fFunctions.fDeleteBuffers || + NULL == fFunctions.fDeleteProgram || + NULL == fFunctions.fDeleteShader || + NULL == fFunctions.fDeleteTextures || + NULL == fFunctions.fDepthMask || + NULL == fFunctions.fDisable || + NULL == fFunctions.fDisableVertexAttribArray || + NULL == fFunctions.fDrawArrays || + NULL == fFunctions.fDrawElements || + NULL == fFunctions.fEnable || + NULL == fFunctions.fEnableVertexAttribArray || + NULL == fFunctions.fFrontFace || + NULL == fFunctions.fGenBuffers || + NULL == fFunctions.fGenTextures || + NULL == fFunctions.fGetBufferParameteriv || + NULL == fFunctions.fGenerateMipmap || + NULL == fFunctions.fGetError || + NULL == fFunctions.fGetIntegerv || + NULL == fFunctions.fGetProgramInfoLog || + NULL == fFunctions.fGetProgramiv || + NULL == fFunctions.fGetShaderInfoLog || + NULL == fFunctions.fGetShaderiv || + NULL == fFunctions.fGetString || + NULL == fFunctions.fGetUniformLocation || + NULL == fFunctions.fLinkProgram || + NULL == fFunctions.fLineWidth || + NULL == fFunctions.fPixelStorei || + NULL == fFunctions.fReadPixels || + NULL == fFunctions.fScissor || + NULL == fFunctions.fShaderSource || + NULL == fFunctions.fStencilFunc || + NULL == fFunctions.fStencilMask || + NULL == fFunctions.fStencilOp || + NULL == fFunctions.fTexImage2D || + NULL == fFunctions.fTexParameteri || + NULL == fFunctions.fTexParameteriv || + NULL == fFunctions.fTexSubImage2D || + NULL == fFunctions.fUniform1f || + NULL == fFunctions.fUniform1i || + NULL == fFunctions.fUniform1fv || + NULL == fFunctions.fUniform1iv || + NULL == fFunctions.fUniform2f || + NULL == fFunctions.fUniform2i || + NULL == fFunctions.fUniform2fv || + NULL == fFunctions.fUniform2iv || + NULL == fFunctions.fUniform3f || + NULL == fFunctions.fUniform3i || + NULL == fFunctions.fUniform3fv || + NULL == fFunctions.fUniform3iv || + NULL == fFunctions.fUniform4f || + NULL == fFunctions.fUniform4i || + NULL == fFunctions.fUniform4fv || + NULL == fFunctions.fUniform4iv || + NULL == fFunctions.fUniformMatrix2fv || + NULL == fFunctions.fUniformMatrix3fv || + NULL == fFunctions.fUniformMatrix4fv || + NULL == fFunctions.fUseProgram || + NULL == fFunctions.fVertexAttrib4fv || + NULL == fFunctions.fVertexAttribPointer || + NULL == fFunctions.fViewport || + NULL == fFunctions.fBindFramebuffer || + NULL == fFunctions.fBindRenderbuffer || + NULL == fFunctions.fCheckFramebufferStatus || + NULL == fFunctions.fDeleteFramebuffers || + NULL == fFunctions.fDeleteRenderbuffers || + NULL == fFunctions.fFinish || + NULL == fFunctions.fFlush || + NULL == fFunctions.fFramebufferRenderbuffer || + NULL == fFunctions.fFramebufferTexture2D || + NULL == fFunctions.fGetFramebufferAttachmentParameteriv || + NULL == fFunctions.fGetRenderbufferParameteriv || + NULL == fFunctions.fGenFramebuffers || + NULL == fFunctions.fGenRenderbuffers || + NULL == fFunctions.fRenderbufferStorage) { return false; } @@ -155,117 +344,117 @@ bool GrGLInterface::validate() const { // On the desktop we assume they are available if the extension // is present or GL version is high enough. if (kGLES_GrGLStandard == fStandard) { - if (NULL == fStencilFuncSeparate || - NULL == fStencilMaskSeparate || - NULL == fStencilOpSeparate) { + if (NULL == fFunctions.fStencilFuncSeparate || + NULL == fFunctions.fStencilMaskSeparate || + NULL == fFunctions.fStencilOpSeparate) { return false; } } else if (kGL_GrGLStandard == fStandard) { if (glVer >= GR_GL_VER(2,0)) { - if (NULL == fStencilFuncSeparate || - NULL == fStencilMaskSeparate || - NULL == fStencilOpSeparate) { + if (NULL == fFunctions.fStencilFuncSeparate || + NULL == fFunctions.fStencilMaskSeparate || + NULL == fFunctions.fStencilOpSeparate) { return false; } } - if (glVer >= GR_GL_VER(3,0) && NULL == fBindFragDataLocation) { + if (glVer >= GR_GL_VER(3,0) && NULL == fFunctions.fBindFragDataLocation) { return false; } if (glVer >= GR_GL_VER(2,0) || fExtensions.has("GL_ARB_draw_buffers")) { - if (NULL == fDrawBuffers) { + if (NULL == fFunctions.fDrawBuffers) { return false; } } if (glVer >= GR_GL_VER(1,5) || fExtensions.has("GL_ARB_occlusion_query")) { - if (NULL == fGenQueries || - NULL == fDeleteQueries || - NULL == fBeginQuery || - NULL == fEndQuery || - NULL == fGetQueryiv || - NULL == fGetQueryObjectiv || - NULL == fGetQueryObjectuiv) { + if (NULL == fFunctions.fGenQueries || + NULL == fFunctions.fDeleteQueries || + NULL == fFunctions.fBeginQuery || + NULL == fFunctions.fEndQuery || + NULL == fFunctions.fGetQueryiv || + NULL == fFunctions.fGetQueryObjectiv || + NULL == fFunctions.fGetQueryObjectuiv) { return false; } } if (glVer >= GR_GL_VER(3,3) || fExtensions.has("GL_ARB_timer_query") || fExtensions.has("GL_EXT_timer_query")) { - if (NULL == fGetQueryObjecti64v || - NULL == fGetQueryObjectui64v) { + if (NULL == fFunctions.fGetQueryObjecti64v || + NULL == fFunctions.fGetQueryObjectui64v) { return false; } } if (glVer >= GR_GL_VER(3,3) || fExtensions.has("GL_ARB_timer_query")) { - if (NULL == fQueryCounter) { + if (NULL == fFunctions.fQueryCounter) { return false; } } if (!isCoreProfile) { - if (NULL == fClientActiveTexture || - NULL == fDisableClientState || - NULL == fEnableClientState || - NULL == fLoadIdentity || - NULL == fLoadMatrixf || - NULL == fMatrixMode || - NULL == fTexGenf || - NULL == fTexGenfv || - NULL == fTexGeni || - NULL == fVertexPointer) { + if (NULL == fFunctions.fClientActiveTexture || + NULL == fFunctions.fDisableClientState || + NULL == fFunctions.fEnableClientState || + NULL == fFunctions.fLoadIdentity || + NULL == fFunctions.fLoadMatrixf || + NULL == fFunctions.fMatrixMode || + NULL == fFunctions.fTexGenf || + NULL == fFunctions.fTexGenfv || + NULL == fFunctions.fTexGeni || + NULL == fFunctions.fVertexPointer) { return false; } } if (false && fExtensions.has("GL_NV_path_rendering")) { - if (NULL == fPathCommands || - NULL == fPathCoords || - NULL == fPathSubCommands || - NULL == fPathSubCoords || - NULL == fPathString || - NULL == fPathGlyphs || - NULL == fPathGlyphRange || - NULL == fWeightPaths || - NULL == fCopyPath || - NULL == fInterpolatePaths || - NULL == fTransformPath || - NULL == fPathParameteriv || - NULL == fPathParameteri || - NULL == fPathParameterfv || - NULL == fPathParameterf || - NULL == fPathDashArray || - NULL == fGenPaths || - NULL == fDeletePaths || - NULL == fIsPath || - NULL == fPathStencilFunc || - NULL == fPathStencilDepthOffset || - NULL == fStencilFillPath || - NULL == fStencilStrokePath || - NULL == fStencilFillPathInstanced || - NULL == fStencilStrokePathInstanced || - NULL == fPathCoverDepthFunc || - NULL == fPathColorGen || - NULL == fPathTexGen || - NULL == fPathFogGen || - NULL == fCoverFillPath || - NULL == fCoverStrokePath || - NULL == fCoverFillPathInstanced || - NULL == fCoverStrokePathInstanced || - NULL == fGetPathParameteriv || - NULL == fGetPathParameterfv || - NULL == fGetPathCommands || - NULL == fGetPathCoords || - NULL == fGetPathDashArray || - NULL == fGetPathMetrics || - NULL == fGetPathMetricRange || - NULL == fGetPathSpacing || - NULL == fGetPathColorGeniv || - NULL == fGetPathColorGenfv || - NULL == fGetPathTexGeniv || - NULL == fGetPathTexGenfv || - NULL == fIsPointInFillPath || - NULL == fIsPointInStrokePath || - NULL == fGetPathLength || - NULL == fPointAlongPath) { + if (NULL == fFunctions.fPathCommands || + NULL == fFunctions.fPathCoords || + NULL == fFunctions.fPathSubCommands || + NULL == fFunctions.fPathSubCoords || + NULL == fFunctions.fPathString || + NULL == fFunctions.fPathGlyphs || + NULL == fFunctions.fPathGlyphRange || + NULL == fFunctions.fWeightPaths || + NULL == fFunctions.fCopyPath || + NULL == fFunctions.fInterpolatePaths || + NULL == fFunctions.fTransformPath || + NULL == fFunctions.fPathParameteriv || + NULL == fFunctions.fPathParameteri || + NULL == fFunctions.fPathParameterfv || + NULL == fFunctions.fPathParameterf || + NULL == fFunctions.fPathDashArray || + NULL == fFunctions.fGenPaths || + NULL == fFunctions.fDeletePaths || + NULL == fFunctions.fIsPath || + NULL == fFunctions.fPathStencilFunc || + NULL == fFunctions.fPathStencilDepthOffset || + NULL == fFunctions.fStencilFillPath || + NULL == fFunctions.fStencilStrokePath || + NULL == fFunctions.fStencilFillPathInstanced || + NULL == fFunctions.fStencilStrokePathInstanced || + NULL == fFunctions.fPathCoverDepthFunc || + NULL == fFunctions.fPathColorGen || + NULL == fFunctions.fPathTexGen || + NULL == fFunctions.fPathFogGen || + NULL == fFunctions.fCoverFillPath || + NULL == fFunctions.fCoverStrokePath || + NULL == fFunctions.fCoverFillPathInstanced || + NULL == fFunctions.fCoverStrokePathInstanced || + NULL == fFunctions.fGetPathParameteriv || + NULL == fFunctions.fGetPathParameterfv || + NULL == fFunctions.fGetPathCommands || + NULL == fFunctions.fGetPathCoords || + NULL == fFunctions.fGetPathDashArray || + NULL == fFunctions.fGetPathMetrics || + NULL == fFunctions.fGetPathMetricRange || + NULL == fFunctions.fGetPathSpacing || + NULL == fFunctions.fGetPathColorGeniv || + NULL == fFunctions.fGetPathColorGenfv || + NULL == fFunctions.fGetPathTexGeniv || + NULL == fFunctions.fGetPathTexGenfv || + NULL == fFunctions.fIsPointInFillPath || + NULL == fFunctions.fIsPointInStrokePath || + NULL == fFunctions.fGetPathLength || + NULL == fFunctions.fPointAlongPath) { return false; } } @@ -275,16 +464,16 @@ bool GrGLInterface::validate() const { if (kGL_GrGLStandard != fStandard || (glVer >= GR_GL_VER(1,3)) || fExtensions.has("GL_ARB_texture_compression")) { - if (NULL == fCompressedTexImage2D) { + if (NULL == fFunctions.fCompressedTexImage2D) { return false; } } // part of desktop GL, but not ES if (kGL_GrGLStandard == fStandard && - (NULL == fGetTexLevelParameteriv || - NULL == fDrawBuffer || - NULL == fReadBuffer)) { + (NULL == fFunctions.fGetTexLevelParameteriv || + NULL == fFunctions.fDrawBuffer || + NULL == fFunctions.fReadBuffer)) { return false; } @@ -294,12 +483,12 @@ bool GrGLInterface::validate() const { if (glVer >= GR_GL_VER(4,2) || fExtensions.has("GL_ARB_texture_storage") || fExtensions.has("GL_EXT_texture_storage")) { - if (NULL == fTexStorage2D) { + if (NULL == fFunctions.fTexStorage2D) { return false; } } } else if (glVer >= GR_GL_VER(3,0) || fExtensions.has("GL_EXT_texture_storage")) { - if (NULL == fTexStorage2D) { + if (NULL == fFunctions.fTexStorage2D) { return false; } } @@ -307,7 +496,7 @@ bool GrGLInterface::validate() const { if (fExtensions.has("GL_EXT_discard_framebuffer")) { // FIXME: Remove this once Chromium is updated to provide this function #if 0 - if (NULL == fDiscardFramebuffer) { + if (NULL == fFunctions.fDiscardFramebuffer) { return false; } #endif @@ -317,37 +506,37 @@ bool GrGLInterface::validate() const { if (kGL_GrGLStandard == fStandard) { // GL 3.0 and the ARB extension have multisample + blit if (glVer >= GR_GL_VER(3,0) || fExtensions.has("GL_ARB_framebuffer_object")) { - if (NULL == fRenderbufferStorageMultisample || - NULL == fBlitFramebuffer) { + if (NULL == fFunctions.fRenderbufferStorageMultisample || + NULL == fFunctions.fBlitFramebuffer) { return false; } } else { if (fExtensions.has("GL_EXT_framebuffer_blit") && - NULL == fBlitFramebuffer) { + NULL == fFunctions.fBlitFramebuffer) { return false; } if (fExtensions.has("GL_EXT_framebuffer_multisample") && - NULL == fRenderbufferStorageMultisample) { + NULL == fFunctions.fRenderbufferStorageMultisample) { return false; } } } else { if (glVer >= GR_GL_VER(3,0) || fExtensions.has("GL_CHROMIUM_framebuffer_multisample")) { - if (NULL == fRenderbufferStorageMultisample || - NULL == fBlitFramebuffer) { + if (NULL == fFunctions.fRenderbufferStorageMultisample || + NULL == fFunctions.fBlitFramebuffer) { return false; } } if (fExtensions.has("GL_APPLE_framebuffer_multisample")) { - if (NULL == fRenderbufferStorageMultisampleES2APPLE || - NULL == fResolveMultisampleFramebuffer) { + if (NULL == fFunctions.fRenderbufferStorageMultisampleES2APPLE || + NULL == fFunctions.fResolveMultisampleFramebuffer) { return false; } } if (fExtensions.has("GL_IMG_multisampled_render_to_texture") || fExtensions.has("GL_EXT_multisampled_render_to_texture")) { - if (NULL == fRenderbufferStorageMultisampleES2EXT || - NULL == fFramebufferTexture2DMultisample) { + if (NULL == fFunctions.fRenderbufferStorageMultisampleES2EXT || + NULL == fFunctions.fFramebufferTexture2DMultisample) { return false; } } @@ -357,8 +546,8 @@ bool GrGLInterface::validate() const { // buffer mapping was part of original VBO extension // which we require. if (kGL_GrGLStandard == fStandard || fExtensions.has("GL_OES_mapbuffer")) { - if (NULL == fMapBuffer || - NULL == fUnmapBuffer) { + if (NULL == fFunctions.fMapBuffer || + NULL == fFunctions.fUnmapBuffer) { return false; } } @@ -366,35 +555,34 @@ bool GrGLInterface::validate() const { // Dual source blending if (kGL_GrGLStandard == fStandard && (glVer >= GR_GL_VER(3,3) || fExtensions.has("GL_ARB_blend_func_extended"))) { - if (NULL == fBindFragDataLocationIndexed) { + if (NULL == fFunctions.fBindFragDataLocationIndexed) { return false; } } // glGetStringi was added in version 3.0 of both desktop and ES. if (glVer >= GR_GL_VER(3, 0)) { - if (NULL == fGetStringi) { + if (NULL == fFunctions.fGetStringi) { return false; } } if (kGL_GrGLStandard == fStandard) { if (glVer >= GR_GL_VER(3, 0) || fExtensions.has("GL_ARB_vertex_array_object")) { - if (NULL == fBindVertexArray || - NULL == fDeleteVertexArrays || - NULL == fGenVertexArrays) { + if (NULL == fFunctions.fBindVertexArray || + NULL == fFunctions.fDeleteVertexArrays || + NULL == fFunctions.fGenVertexArrays) { return false; } } } else { if (glVer >= GR_GL_VER(3,0) || fExtensions.has("GL_OES_vertex_array_object")) { - if (NULL == fBindVertexArray || - NULL == fDeleteVertexArrays || - NULL == fGenVertexArrays) { + if (NULL == fFunctions.fBindVertexArray || + NULL == fFunctions.fDeleteVertexArrays || + NULL == fFunctions.fGenVertexArrays) { return false; } } } - return true; } diff --git a/src/gpu/gl/GrGLUniformManager.cpp b/src/gpu/gl/GrGLUniformManager.cpp index 674118b749..29679aa409 100644 --- a/src/gpu/gl/GrGLUniformManager.cpp +++ b/src/gpu/gl/GrGLUniformManager.cpp @@ -16,7 +16,8 @@ (1 == arrayCount && GrGLShaderVar::kNonArray == uni.fArrayCount)) GrGLUniformManager::GrGLUniformManager(GrGpuGL* gpu) : fGpu(gpu) { - fUsingBindUniform = fGpu->glInterface()->fBindUniformLocation != NULL; + // skbug.com/2056 + fUsingBindUniform = fGpu->glInterface()->fFunctions.fBindUniformLocation != NULL; } GrGLUniformManager::UniformHandle GrGLUniformManager::appendUniform(GrSLType type, int arrayCount) { diff --git a/src/gpu/gl/GrGLUtil.cpp b/src/gpu/gl/GrGLUtil.cpp index 4ff645249b..886557e272 100644 --- a/src/gpu/gl/GrGLUtil.cpp +++ b/src/gpu/gl/GrGLUtil.cpp @@ -11,7 +11,7 @@ #include <stdio.h> void GrGLClearErr(const GrGLInterface* gl) { - while (GR_GL_NO_ERROR != gl->fGetError()) {} + while (GR_GL_NO_ERROR != gl->fFunctions.fGetError()) {} } namespace { diff --git a/src/gpu/gl/GrGLUtil.h b/src/gpu/gl/GrGLUtil.h index 8d3f58039a..eb49cefc42 100644 --- a/src/gpu/gl/GrGLUtil.h +++ b/src/gpu/gl/GrGLUtil.h @@ -154,7 +154,7 @@ template<int MatrixSize> void GrGLGetMatrix(GrGLfloat* dest, const SkMatrix& src #define GR_GL_CALL_NOERRCHECK(IFACE, X) \ do { \ GR_GL_CALLBACK_IMPL(IFACE); \ - (IFACE)->f##X; \ + (IFACE)->fFunctions.f##X; \ GR_GL_LOG_CALLS_IMPL(X); \ } while (false) @@ -169,11 +169,11 @@ template<int MatrixSize> void GrGLGetMatrix(GrGLfloat* dest, const SkMatrix& src #define GR_GL_CALL_RET_NOERRCHECK(IFACE, RET, X) \ do { \ GR_GL_CALLBACK_IMPL(IFACE); \ - (RET) = (IFACE)->f##X; \ + (RET) = (IFACE)->fFunctions.f##X; \ GR_GL_LOG_CALLS_IMPL(X); \ } while (false) // call glGetError without doing a redundant error check or logging. -#define GR_GL_GET_ERROR(IFACE) (IFACE)->fGetError() +#define GR_GL_GET_ERROR(IFACE) (IFACE)->fFunctions.fGetError() #endif diff --git a/src/gpu/gl/android/GrGLCreateNativeInterface_android.cpp b/src/gpu/gl/android/GrGLCreateNativeInterface_android.cpp index 35de7f4d36..1f91165304 100644 --- a/src/gpu/gl/android/GrGLCreateNativeInterface_android.cpp +++ b/src/gpu/gl/android/GrGLCreateNativeInterface_android.cpp @@ -25,168 +25,169 @@ static GrGLInterface* create_es_interface(GrGLVersion version, GrGLInterface* interface = SkNEW(GrGLInterface); interface->fStandard = kGLES_GrGLStandard; + GrGLInterface::Functions* functions = &interface->fFunctions; - interface->fActiveTexture = glActiveTexture; - interface->fAttachShader = glAttachShader; - interface->fBindAttribLocation = glBindAttribLocation; - interface->fBindBuffer = glBindBuffer; - interface->fBindTexture = glBindTexture; - interface->fBindVertexArray = glBindVertexArrayOES; - interface->fBlendColor = glBlendColor; - interface->fBlendFunc = glBlendFunc; - interface->fBufferData = glBufferData; - interface->fBufferSubData = glBufferSubData; - interface->fClear = glClear; - interface->fClearColor = glClearColor; - interface->fClearStencil = glClearStencil; - interface->fColorMask = glColorMask; - interface->fCompileShader = glCompileShader; - interface->fCompressedTexImage2D = glCompressedTexImage2D; - interface->fCopyTexSubImage2D = glCopyTexSubImage2D; - interface->fCreateProgram = glCreateProgram; - interface->fCreateShader = glCreateShader; - interface->fCullFace = glCullFace; - interface->fDeleteBuffers = glDeleteBuffers; - interface->fDeleteProgram = glDeleteProgram; - interface->fDeleteShader = glDeleteShader; - interface->fDeleteTextures = glDeleteTextures; - interface->fDeleteVertexArrays = glDeleteVertexArraysOES; - interface->fDepthMask = glDepthMask; - interface->fDisable = glDisable; - interface->fDisableVertexAttribArray = glDisableVertexAttribArray; - interface->fDrawArrays = glDrawArrays; - interface->fDrawElements = glDrawElements; - interface->fEnable = glEnable; - interface->fEnableVertexAttribArray = glEnableVertexAttribArray; - interface->fFinish = glFinish; - interface->fFlush = glFlush; - interface->fFrontFace = glFrontFace; - interface->fGenBuffers = glGenBuffers; - interface->fGenerateMipmap = glGenerateMipmap; - interface->fGenTextures = glGenTextures; - interface->fGenVertexArrays = glGenVertexArraysOES; - interface->fGetBufferParameteriv = glGetBufferParameteriv; - interface->fGetError = glGetError; - interface->fGetIntegerv = glGetIntegerv; - interface->fGetProgramInfoLog = glGetProgramInfoLog; - interface->fGetProgramiv = glGetProgramiv; - interface->fGetShaderInfoLog = glGetShaderInfoLog; - interface->fGetShaderiv = glGetShaderiv; - interface->fGetString = glGetString; + functions->fActiveTexture = glActiveTexture; + functions->fAttachShader = glAttachShader; + functions->fBindAttribLocation = glBindAttribLocation; + functions->fBindBuffer = glBindBuffer; + functions->fBindTexture = glBindTexture; + functions->fBindVertexArray = glBindVertexArrayOES; + functions->fBlendColor = glBlendColor; + functions->fBlendFunc = glBlendFunc; + functions->fBufferData = glBufferData; + functions->fBufferSubData = glBufferSubData; + functions->fClear = glClear; + functions->fClearColor = glClearColor; + functions->fClearStencil = glClearStencil; + functions->fColorMask = glColorMask; + functions->fCompileShader = glCompileShader; + functions->fCompressedTexImage2D = glCompressedTexImage2D; + functions->fCopyTexSubImage2D = glCopyTexSubImage2D; + functions->fCreateProgram = glCreateProgram; + functions->fCreateShader = glCreateShader; + functions->fCullFace = glCullFace; + functions->fDeleteBuffers = glDeleteBuffers; + functions->fDeleteProgram = glDeleteProgram; + functions->fDeleteShader = glDeleteShader; + functions->fDeleteTextures = glDeleteTextures; + functions->fDeleteVertexArrays = glDeleteVertexArraysOES; + functions->fDepthMask = glDepthMask; + functions->fDisable = glDisable; + functions->fDisableVertexAttribArray = glDisableVertexAttribArray; + functions->fDrawArrays = glDrawArrays; + functions->fDrawElements = glDrawElements; + functions->fEnable = glEnable; + functions->fEnableVertexAttribArray = glEnableVertexAttribArray; + functions->fFinish = glFinish; + functions->fFlush = glFlush; + functions->fFrontFace = glFrontFace; + functions->fGenBuffers = glGenBuffers; + functions->fGenerateMipmap = glGenerateMipmap; + functions->fGenTextures = glGenTextures; + functions->fGenVertexArrays = glGenVertexArraysOES; + functions->fGetBufferParameteriv = glGetBufferParameteriv; + functions->fGetError = glGetError; + functions->fGetIntegerv = glGetIntegerv; + functions->fGetProgramInfoLog = glGetProgramInfoLog; + functions->fGetProgramiv = glGetProgramiv; + functions->fGetShaderInfoLog = glGetShaderInfoLog; + functions->fGetShaderiv = glGetShaderiv; + functions->fGetString = glGetString; #if GL_ES_VERSION_30 - interface->fGetStringi = glGetStringi; + functions->fGetStringi = glGetStringi; #else - interface->fGetStringi = (GrGLGetStringiProc) eglGetProcAddress("glGetStringi"); + functions->fGetStringi = (GrGLGetStringiProc) eglGetProcAddress("glGetStringi"); #endif - interface->fGetUniformLocation = glGetUniformLocation; - interface->fLineWidth = glLineWidth; - interface->fLinkProgram = glLinkProgram; - interface->fPixelStorei = glPixelStorei; - interface->fReadPixels = glReadPixels; - interface->fScissor = glScissor; + functions->fGetUniformLocation = glGetUniformLocation; + functions->fLineWidth = glLineWidth; + functions->fLinkProgram = glLinkProgram; + functions->fPixelStorei = glPixelStorei; + functions->fReadPixels = glReadPixels; + functions->fScissor = glScissor; #if GR_GL_USE_NEW_SHADER_SOURCE_SIGNATURE - interface->fShaderSource = (GrGLShaderSourceProc) glShaderSource; + functions->fShaderSource = (GrGLShaderSourceProc) glShaderSource; #else - interface->fShaderSource = glShaderSource; + functions->fShaderSource = glShaderSource; #endif - interface->fStencilFunc = glStencilFunc; - interface->fStencilFuncSeparate = glStencilFuncSeparate; - interface->fStencilMask = glStencilMask; - interface->fStencilMaskSeparate = glStencilMaskSeparate; - interface->fStencilOp = glStencilOp; - interface->fStencilOpSeparate = glStencilOpSeparate; - interface->fTexImage2D = glTexImage2D; - interface->fTexParameteri = glTexParameteri; - interface->fTexParameteriv = glTexParameteriv; - interface->fTexSubImage2D = glTexSubImage2D; + functions->fStencilFunc = glStencilFunc; + functions->fStencilFuncSeparate = glStencilFuncSeparate; + functions->fStencilMask = glStencilMask; + functions->fStencilMaskSeparate = glStencilMaskSeparate; + functions->fStencilOp = glStencilOp; + functions->fStencilOpSeparate = glStencilOpSeparate; + functions->fTexImage2D = glTexImage2D; + functions->fTexParameteri = glTexParameteri; + functions->fTexParameteriv = glTexParameteriv; + functions->fTexSubImage2D = glTexSubImage2D; if (version >= GR_GL_VER(3,0)) { #if GL_ES_VERSION_3_0 - interface->fTexStorage2D = glTexStorage2D; + functions->fTexStorage2D = glTexStorage2D; #else - interface->fTexStorage2D = (GrGLTexStorage2DProc) eglGetProcAddress("glTexStorage2D"); + functions->fTexStorage2D = (GrGLTexStorage2DProc) eglGetProcAddress("glTexStorage2D"); #endif } else { #if GL_EXT_texture_storage - interface->fTexStorage2D = glTexStorage2DEXT; + functions->fTexStorage2D = glTexStorage2DEXT; #else - interface->fTexStorage2D = (GrGLTexStorage2DProc) eglGetProcAddress("glTexStorage2DEXT"); + functions->fTexStorage2D = (GrGLTexStorage2DProc) eglGetProcAddress("glTexStorage2DEXT"); #endif } #if GL_EXT_discard_framebuffer - interface->fDiscardFramebuffer = glDiscardFramebufferEXT; + functions->fDiscardFramebuffer = glDiscardFramebufferEXT; #endif - interface->fUniform1f = glUniform1f; - interface->fUniform1i = glUniform1i; - interface->fUniform1fv = glUniform1fv; - interface->fUniform1iv = glUniform1iv; - interface->fUniform2f = glUniform2f; - interface->fUniform2i = glUniform2i; - interface->fUniform2fv = glUniform2fv; - interface->fUniform2iv = glUniform2iv; - interface->fUniform3f = glUniform3f; - interface->fUniform3i = glUniform3i; - interface->fUniform3fv = glUniform3fv; - interface->fUniform3iv = glUniform3iv; - interface->fUniform4f = glUniform4f; - interface->fUniform4i = glUniform4i; - interface->fUniform4fv = glUniform4fv; - interface->fUniform4iv = glUniform4iv; - interface->fUniformMatrix2fv = glUniformMatrix2fv; - interface->fUniformMatrix3fv = glUniformMatrix3fv; - interface->fUniformMatrix4fv = glUniformMatrix4fv; - interface->fUseProgram = glUseProgram; - interface->fVertexAttrib4fv = glVertexAttrib4fv; - interface->fVertexAttribPointer = glVertexAttribPointer; - interface->fViewport = glViewport; - interface->fBindFramebuffer = glBindFramebuffer; - interface->fBindRenderbuffer = glBindRenderbuffer; - interface->fCheckFramebufferStatus = glCheckFramebufferStatus; - interface->fDeleteFramebuffers = glDeleteFramebuffers; - interface->fDeleteRenderbuffers = glDeleteRenderbuffers; - interface->fFramebufferRenderbuffer = glFramebufferRenderbuffer; - interface->fFramebufferTexture2D = glFramebufferTexture2D; + functions->fUniform1f = glUniform1f; + functions->fUniform1i = glUniform1i; + functions->fUniform1fv = glUniform1fv; + functions->fUniform1iv = glUniform1iv; + functions->fUniform2f = glUniform2f; + functions->fUniform2i = glUniform2i; + functions->fUniform2fv = glUniform2fv; + functions->fUniform2iv = glUniform2iv; + functions->fUniform3f = glUniform3f; + functions->fUniform3i = glUniform3i; + functions->fUniform3fv = glUniform3fv; + functions->fUniform3iv = glUniform3iv; + functions->fUniform4f = glUniform4f; + functions->fUniform4i = glUniform4i; + functions->fUniform4fv = glUniform4fv; + functions->fUniform4iv = glUniform4iv; + functions->fUniformMatrix2fv = glUniformMatrix2fv; + functions->fUniformMatrix3fv = glUniformMatrix3fv; + functions->fUniformMatrix4fv = glUniformMatrix4fv; + functions->fUseProgram = glUseProgram; + functions->fVertexAttrib4fv = glVertexAttrib4fv; + functions->fVertexAttribPointer = glVertexAttribPointer; + functions->fViewport = glViewport; + functions->fBindFramebuffer = glBindFramebuffer; + functions->fBindRenderbuffer = glBindRenderbuffer; + functions->fCheckFramebufferStatus = glCheckFramebufferStatus; + functions->fDeleteFramebuffers = glDeleteFramebuffers; + functions->fDeleteRenderbuffers = glDeleteRenderbuffers; + functions->fFramebufferRenderbuffer = glFramebufferRenderbuffer; + functions->fFramebufferTexture2D = glFramebufferTexture2D; if (version >= GR_GL_VER(3,0)) { #if GL_ES_VERSION_3_0 - interface->fRenderbufferStorageMultisample = glRenderbufferStorageMultisample; - interface->fBlitFramebuffer = glBlitFramebuffer; + functions->fRenderbufferStorageMultisample = glRenderbufferStorageMultisample; + functions->fBlitFramebuffer = glBlitFramebuffer; #else - interface->fRenderbufferStorageMultisample = (GrGLRenderbufferStorageMultisampleProc) eglGetProcAddress("glRenderbufferStorageMultisample"); - interface->fBlitFramebuffer = (GrGLBlitFramebufferProc) eglGetProcAddress("glBlitFramebuffer"); + functions->fRenderbufferStorageMultisample = (GrGLRenderbufferStorageMultisampleProc) eglGetProcAddress("glRenderbufferStorageMultisample"); + functions->fBlitFramebuffer = (GrGLBlitFramebufferProc) eglGetProcAddress("glBlitFramebuffer"); #endif } if (extensions.has("GL_EXT_multisampled_render_to_texture")) { #if GL_EXT_multisampled_render_to_texture - interface->fFramebufferTexture2DMultisample = glFramebufferTexture2DMultisampleEXT; - interface->fRenderbufferStorageMultisampleES2EXT = glRenderbufferStorageMultisampleEXT; + functions->fFramebufferTexture2DMultisample = glFramebufferTexture2DMultisampleEXT; + functions->fRenderbufferStorageMultisampleES2EXT = glRenderbufferStorageMultisampleEXT; #else - interface->fFramebufferTexture2DMultisample = (GrGLFramebufferTexture2DMultisampleProc) eglGetProcAddress("glFramebufferTexture2DMultisampleEXT"); - interface->fRenderbufferStorageMultisampleES2EXT = (GrGLRenderbufferStorageMultisampleProc) eglGetProcAddress("glRenderbufferStorageMultisampleEXT"); + functions->fFramebufferTexture2DMultisample = (GrGLFramebufferTexture2DMultisampleProc) eglGetProcAddress("glFramebufferTexture2DMultisampleEXT"); + functions->fRenderbufferStorageMultisampleES2EXT = (GrGLRenderbufferStorageMultisampleProc) eglGetProcAddress("glRenderbufferStorageMultisampleEXT"); #endif } else if (extensions.has("GL_IMG_multisampled_render_to_texture")) { #if GL_IMG_multisampled_render_to_texture - interface->fFramebufferTexture2DMultisample = glFramebufferTexture2DMultisampleIMG; - interface->fRenderbufferStorageMultisampleES2EXT = glRenderbufferStorageMultisampleIMG; + functions->fFramebufferTexture2DMultisample = glFramebufferTexture2DMultisampleIMG; + functions->fRenderbufferStorageMultisampleES2EXT = glRenderbufferStorageMultisampleIMG; #else - interface->fFramebufferTexture2DMultisample = (GrGLFramebufferTexture2DMultisampleProc) eglGetProcAddress("glFramebufferTexture2DMultisampleIMG"); - interface->fRenderbufferStorageMultisampleES2EXT = (GrGLRenderbufferStorageMultisampleProc) eglGetProcAddress("glRenderbufferStorageMultisampleIMG"); + functions->fFramebufferTexture2DMultisample = (GrGLFramebufferTexture2DMultisampleProc) eglGetProcAddress("glFramebufferTexture2DMultisampleIMG"); + functions->fRenderbufferStorageMultisampleES2EXT = (GrGLRenderbufferStorageMultisampleProc) eglGetProcAddress("glRenderbufferStorageMultisampleIMG"); #endif } - interface->fGenFramebuffers = glGenFramebuffers; - interface->fGenRenderbuffers = glGenRenderbuffers; - interface->fGetFramebufferAttachmentParameteriv = glGetFramebufferAttachmentParameteriv; - interface->fGetRenderbufferParameteriv = glGetRenderbufferParameteriv; - interface->fRenderbufferStorage = glRenderbufferStorage; + functions->fGenFramebuffers = glGenFramebuffers; + functions->fGenRenderbuffers = glGenRenderbuffers; + functions->fGetFramebufferAttachmentParameteriv = glGetFramebufferAttachmentParameteriv; + functions->fGetRenderbufferParameteriv = glGetRenderbufferParameteriv; + functions->fRenderbufferStorage = glRenderbufferStorage; #if GL_OES_mapbuffer - interface->fMapBuffer = glMapBufferOES; - interface->fUnmapBuffer = glUnmapBufferOES; + functions->fMapBuffer = glMapBufferOES; + functions->fUnmapBuffer = glUnmapBufferOES; #else - interface->fMapBuffer = (GrGLMapBufferProc) eglGetProcAddress("glMapBufferOES"); - interface->fUnmapBuffer = (GrGLUnmapBufferProc) eglGetProcAddress("glUnmapBufferOES"); + functions->fMapBuffer = (GrGLMapBufferProc) eglGetProcAddress("glMapBufferOES"); + functions->fUnmapBuffer = (GrGLUnmapBufferProc) eglGetProcAddress("glUnmapBufferOES"); #endif return interface; @@ -202,189 +203,190 @@ static GrGLInterface* create_desktop_interface(GrGLVersion version, GrGLInterface* interface = SkNEW(GrGLInterface); interface->fStandard = kGL_GrGLStandard; + GrGLInterface::Functions* functions = &interface->fFunctions; - interface->fActiveTexture = (GrGLActiveTextureProc) eglGetProcAddress("glActiveTexture"); - interface->fAttachShader = (GrGLAttachShaderProc) eglGetProcAddress("glAttachShader"); - interface->fBeginQuery = (GrGLBeginQueryProc) eglGetProcAddress("glBeginQuery"); - interface->fBindAttribLocation = (GrGLBindAttribLocationProc) eglGetProcAddress("glBindAttribLocation"); - interface->fBindBuffer = (GrGLBindBufferProc) eglGetProcAddress("glBindBuffer"); - interface->fBindFragDataLocation = (GrGLBindFragDataLocationProc) eglGetProcAddress("glBindFragDataLocation"); - interface->fBindFragDataLocationIndexed = (GrGLBindFragDataLocationIndexedProc) eglGetProcAddress("glBindFragDataLocationIndexed"); - interface->fBindFramebuffer = (GrGLBindFramebufferProc) eglGetProcAddress("glBindFramebuffer"); - interface->fBindRenderbuffer = (GrGLBindRenderbufferProc) eglGetProcAddress("glBindRenderbuffer"); - interface->fBindTexture = (GrGLBindTextureProc) eglGetProcAddress("glBindTexture"); - interface->fBindVertexArray = (GrGLBindVertexArrayProc) eglGetProcAddress("glBindVertexArray"); - interface->fBlendColor = (GrGLBlendColorProc) eglGetProcAddress("glBlendColor"); - interface->fBlendFunc = (GrGLBlendFuncProc) eglGetProcAddress("glBlendFunc"); - interface->fBlitFramebuffer = (GrGLBlitFramebufferProc) eglGetProcAddress("glBlitFramebuffer"); - interface->fBufferData = (GrGLBufferDataProc) eglGetProcAddress("glBufferData"); - interface->fBufferSubData = (GrGLBufferSubDataProc) eglGetProcAddress("glBufferSubData"); - interface->fCheckFramebufferStatus = (GrGLCheckFramebufferStatusProc) eglGetProcAddress("glCheckFramebufferStatus"); - interface->fClear = (GrGLClearProc) eglGetProcAddress("glClear"); - interface->fClearColor = (GrGLClearColorProc) eglGetProcAddress("glClearColor"); - interface->fClearStencil = (GrGLClearStencilProc) eglGetProcAddress("glClearStencil"); - interface->fClientActiveTexture = (GrGLClientActiveTextureProc) eglGetProcAddress("glClientActiveTexture"); - interface->fColorMask = (GrGLColorMaskProc) eglGetProcAddress("glColorMask"); - interface->fCompileShader = (GrGLCompileShaderProc) eglGetProcAddress("glCompileShader"); - interface->fCompressedTexImage2D = (GrGLCompressedTexImage2DProc) eglGetProcAddress("glCompressedTexImage2D"); - interface->fCopyTexSubImage2D = (GrGLCopyTexSubImage2DProc) eglGetProcAddress("glCopyTexSubImage2D"); - interface->fCreateProgram = (GrGLCreateProgramProc) eglGetProcAddress("glCreateProgram"); - interface->fCreateShader = (GrGLCreateShaderProc) eglGetProcAddress("glCreateShader"); - interface->fCullFace = (GrGLCullFaceProc) eglGetProcAddress("glCullFace"); - interface->fDeleteBuffers = (GrGLDeleteBuffersProc) eglGetProcAddress("glDeleteBuffers"); - interface->fDeleteFramebuffers = (GrGLDeleteFramebuffersProc) eglGetProcAddress("glDeleteFramebuffers"); - interface->fDeleteProgram = (GrGLDeleteProgramProc) eglGetProcAddress("glDeleteProgram"); - interface->fDeleteQueries = (GrGLDeleteQueriesProc) eglGetProcAddress("glDeleteQueries"); - interface->fDeleteRenderbuffers = (GrGLDeleteRenderbuffersProc) eglGetProcAddress("glDeleteRenderbuffers"); - interface->fDeleteShader = (GrGLDeleteShaderProc) eglGetProcAddress("glDeleteShader"); - interface->fDeleteTextures = (GrGLDeleteTexturesProc) eglGetProcAddress("glDeleteTextures"); - interface->fDeleteVertexArrays = (GrGLDeleteVertexArraysProc) eglGetProcAddress("glDeleteVertexArrays"); - interface->fDepthMask = (GrGLDepthMaskProc) eglGetProcAddress("glDepthMask"); - interface->fDisable = (GrGLDisableProc) eglGetProcAddress("glDisable"); - interface->fDisableClientState = (GrGLDisableClientStateProc) eglGetProcAddress("glDisableClientState"); - interface->fDisableVertexAttribArray = (GrGLDisableVertexAttribArrayProc) eglGetProcAddress("glDisableVertexAttribArray"); - interface->fDrawArrays = (GrGLDrawArraysProc) eglGetProcAddress("glDrawArrays"); - interface->fDrawBuffer = (GrGLDrawBufferProc) eglGetProcAddress("glDrawBuffer"); - interface->fDrawBuffers = (GrGLDrawBuffersProc) eglGetProcAddress("glDrawBuffers"); - interface->fDrawElements = (GrGLDrawElementsProc) eglGetProcAddress("glDrawElements"); - interface->fEnable = (GrGLEnableProc) eglGetProcAddress("glEnable"); - interface->fEnableClientState = (GrGLEnableClientStateProc) eglGetProcAddress("glEnableClientState"); - interface->fEnableVertexAttribArray = (GrGLEnableVertexAttribArrayProc) eglGetProcAddress("glEnableVertexAttribArray"); - interface->fEndQuery = (GrGLEndQueryProc) eglGetProcAddress("glEndQuery"); - interface->fFinish = (GrGLFinishProc) eglGetProcAddress("glFinish"); - interface->fFlush = (GrGLFlushProc) eglGetProcAddress("glFlush"); - interface->fFramebufferRenderbuffer = (GrGLFramebufferRenderbufferProc) eglGetProcAddress("glFramebufferRenderbuffer"); - interface->fFramebufferTexture2D = (GrGLFramebufferTexture2DProc) eglGetProcAddress("glFramebufferTexture2D"); - interface->fFrontFace = (GrGLFrontFaceProc) eglGetProcAddress("glFrontFace"); - interface->fGenBuffers = (GrGLGenBuffersProc) eglGetProcAddress("glGenBuffers"); - interface->fGenFramebuffers = (GrGLGenFramebuffersProc) eglGetProcAddress("glGenFramebuffers"); - interface->fGenerateMipmap = (GrGLGenerateMipmapProc) eglGetProcAddress("glGenerateMipmap"); - interface->fGenQueries = (GrGLGenQueriesProc) eglGetProcAddress("glGenQueries"); - interface->fGenRenderbuffers = (GrGLGenRenderbuffersProc) eglGetProcAddress("glGenRenderbuffers"); - interface->fGenTextures = (GrGLGenTexturesProc) eglGetProcAddress("glGenTextures"); - interface->fGenVertexArrays = (GrGLGenVertexArraysProc) eglGetProcAddress("glGenVertexArrays"); - interface->fGetBufferParameteriv = (GrGLGetBufferParameterivProc) eglGetProcAddress("glGetBufferParameteriv"); - interface->fGetError = (GrGLGetErrorProc) eglGetProcAddress("glGetError"); - interface->fGetFramebufferAttachmentParameteriv = (GrGLGetFramebufferAttachmentParameterivProc) eglGetProcAddress("glGetFramebufferAttachmentParameteriv"); - interface->fGetIntegerv = (GrGLGetIntegervProc) eglGetProcAddress("glGetIntegerv"); - interface->fGetQueryObjecti64v = (GrGLGetQueryObjecti64vProc) eglGetProcAddress("glGetQueryObjecti64v"); - interface->fGetQueryObjectiv = (GrGLGetQueryObjectivProc) eglGetProcAddress("glGetQueryObjectiv"); - interface->fGetQueryObjectui64v = (GrGLGetQueryObjectui64vProc) eglGetProcAddress("glGetQueryObjectui64v"); - interface->fGetQueryObjectuiv = (GrGLGetQueryObjectuivProc) eglGetProcAddress("glGetQueryObjectuiv"); - interface->fGetQueryiv = (GrGLGetQueryivProc) eglGetProcAddress("glGetQueryiv"); - interface->fGetProgramInfoLog = (GrGLGetProgramInfoLogProc) eglGetProcAddress("glGetProgramInfoLog"); - interface->fGetProgramiv = (GrGLGetProgramivProc) eglGetProcAddress("glGetProgramiv"); - interface->fGetRenderbufferParameteriv = (GrGLGetRenderbufferParameterivProc) eglGetProcAddress("glGetRenderbufferParameteriv"); - interface->fGetShaderInfoLog = (GrGLGetShaderInfoLogProc) eglGetProcAddress("glGetShaderInfoLog"); - interface->fGetShaderiv = (GrGLGetShaderivProc) eglGetProcAddress("glGetShaderiv"); - interface->fGetString = (GrGLGetStringProc) eglGetProcAddress("glGetString"); - interface->fGetStringi = (GrGLGetStringiProc) eglGetProcAddress("glGetStringi"); - interface->fGetTexLevelParameteriv = (GrGLGetTexLevelParameterivProc) eglGetProcAddress("glGetTexLevelParameteriv"); - interface->fGetUniformLocation = (GrGLGetUniformLocationProc) eglGetProcAddress("glGetUniformLocation"); - interface->fLineWidth = (GrGLLineWidthProc) eglGetProcAddress("glLineWidth"); - interface->fLinkProgram = (GrGLLinkProgramProc) eglGetProcAddress("glLinkProgram"); - interface->fLoadIdentity = (GrGLLoadIdentityProc) eglGetProcAddress("glLoadIdentity"); - interface->fLoadMatrixf = (GrGLLoadMatrixfProc) eglGetProcAddress("glLoadMatrixf"); - interface->fMapBuffer = (GrGLMapBufferProc) eglGetProcAddress("glMapBuffer"); - interface->fMatrixMode = (GrGLMatrixModeProc) eglGetProcAddress("glMatrixMode"); - interface->fPixelStorei = (GrGLPixelStoreiProc) eglGetProcAddress("glPixelStorei"); - interface->fQueryCounter = (GrGLQueryCounterProc) eglGetProcAddress("glQueryCounter"); - interface->fReadBuffer = (GrGLReadBufferProc) eglGetProcAddress("glReadBuffer"); - interface->fReadPixels = (GrGLReadPixelsProc) eglGetProcAddress("glReadPixels"); - interface->fRenderbufferStorage = (GrGLRenderbufferStorageProc) eglGetProcAddress("glRenderbufferStorage"); - interface->fRenderbufferStorageMultisample = (GrGLRenderbufferStorageMultisampleProc) eglGetProcAddress("glRenderbufferStorageMultisample"); - interface->fScissor = (GrGLScissorProc) eglGetProcAddress("glScissor"); - interface->fShaderSource = (GrGLShaderSourceProc) eglGetProcAddress("glShaderSource"); - interface->fStencilFunc = (GrGLStencilFuncProc) eglGetProcAddress("glStencilFunc"); - interface->fStencilFuncSeparate = (GrGLStencilFuncSeparateProc) eglGetProcAddress("glStencilFuncSeparate"); - interface->fStencilMask = (GrGLStencilMaskProc) eglGetProcAddress("glStencilMask"); - interface->fStencilMaskSeparate = (GrGLStencilMaskSeparateProc) eglGetProcAddress("glStencilMaskSeparate"); - interface->fStencilOp = (GrGLStencilOpProc) eglGetProcAddress("glStencilOp"); - interface->fStencilOpSeparate = (GrGLStencilOpSeparateProc) eglGetProcAddress("glStencilOpSeparate"); - interface->fTexGenf = (GrGLTexGenfProc) eglGetProcAddress("glTexGenf"); - interface->fTexGenfv = (GrGLTexGenfvProc) eglGetProcAddress("glTexGenfv"); - interface->fTexGeni = (GrGLTexGeniProc) eglGetProcAddress("glTexGeni"); - interface->fTexImage2D = (GrGLTexImage2DProc) eglGetProcAddress("glTexImage2D"); - interface->fTexParameteri = (GrGLTexParameteriProc) eglGetProcAddress("glTexParameteri"); - interface->fTexParameteriv = (GrGLTexParameterivProc) eglGetProcAddress("glTexParameteriv"); - interface->fTexSubImage2D = (GrGLTexSubImage2DProc) eglGetProcAddress("glTexSubImage2D"); - interface->fTexStorage2D = (GrGLTexStorage2DProc) eglGetProcAddress("glTexStorage2D"); - interface->fUniform1f = (GrGLUniform1fProc) eglGetProcAddress("glUniform1f"); - interface->fUniform1i = (GrGLUniform1iProc) eglGetProcAddress("glUniform1i"); - interface->fUniform1fv = (GrGLUniform1fvProc) eglGetProcAddress("glUniform1fv"); - interface->fUniform1iv = (GrGLUniform1ivProc) eglGetProcAddress("glUniform1iv"); - interface->fUniform2f = (GrGLUniform2fProc) eglGetProcAddress("glUniform2f"); - interface->fUniform2i = (GrGLUniform2iProc) eglGetProcAddress("glUniform2i"); - interface->fUniform2fv = (GrGLUniform2fvProc) eglGetProcAddress("glUniform2fv"); - interface->fUniform2iv = (GrGLUniform2ivProc) eglGetProcAddress("glUniform2iv"); - interface->fUniform3f = (GrGLUniform3fProc) eglGetProcAddress("glUniform3f"); - interface->fUniform3i = (GrGLUniform3iProc) eglGetProcAddress("glUniform3i"); - interface->fUniform3fv = (GrGLUniform3fvProc) eglGetProcAddress("glUniform3fv"); - interface->fUniform3iv = (GrGLUniform3ivProc) eglGetProcAddress("glUniform3iv"); - interface->fUniform4f = (GrGLUniform4fProc) eglGetProcAddress("glUniform4f"); - interface->fUniform4i = (GrGLUniform4iProc) eglGetProcAddress("glUniform4i"); - interface->fUniform4fv = (GrGLUniform4fvProc) eglGetProcAddress("glUniform4fv"); - interface->fUniform4iv = (GrGLUniform4ivProc) eglGetProcAddress("glUniform4iv"); - interface->fUniformMatrix2fv = (GrGLUniformMatrix2fvProc) eglGetProcAddress("glUniformMatrix2fv"); - interface->fUniformMatrix3fv = (GrGLUniformMatrix3fvProc) eglGetProcAddress("glUniformMatrix3fv"); - interface->fUniformMatrix4fv = (GrGLUniformMatrix4fvProc) eglGetProcAddress("glUniformMatrix4fv"); - interface->fUnmapBuffer = (GrGLUnmapBufferProc) eglGetProcAddress("glUnmapBuffer"); - interface->fUseProgram = (GrGLUseProgramProc) eglGetProcAddress("glUseProgram"); - interface->fVertexAttrib4fv = (GrGLVertexAttrib4fvProc) eglGetProcAddress("glVertexAttrib4fv"); - interface->fVertexAttribPointer = (GrGLVertexAttribPointerProc) eglGetProcAddress("glVertexAttribPointer"); - interface->fVertexPointer = (GrGLVertexPointerProc) eglGetProcAddress("glVertexPointer"); - interface->fViewport = (GrGLViewportProc) eglGetProcAddress("glViewport"); + functions->fActiveTexture = (GrGLActiveTextureProc) eglGetProcAddress("glActiveTexture"); + functions->fAttachShader = (GrGLAttachShaderProc) eglGetProcAddress("glAttachShader"); + functions->fBeginQuery = (GrGLBeginQueryProc) eglGetProcAddress("glBeginQuery"); + functions->fBindAttribLocation = (GrGLBindAttribLocationProc) eglGetProcAddress("glBindAttribLocation"); + functions->fBindBuffer = (GrGLBindBufferProc) eglGetProcAddress("glBindBuffer"); + functions->fBindFragDataLocation = (GrGLBindFragDataLocationProc) eglGetProcAddress("glBindFragDataLocation"); + functions->fBindFragDataLocationIndexed = (GrGLBindFragDataLocationIndexedProc) eglGetProcAddress("glBindFragDataLocationIndexed"); + functions->fBindFramebuffer = (GrGLBindFramebufferProc) eglGetProcAddress("glBindFramebuffer"); + functions->fBindRenderbuffer = (GrGLBindRenderbufferProc) eglGetProcAddress("glBindRenderbuffer"); + functions->fBindTexture = (GrGLBindTextureProc) eglGetProcAddress("glBindTexture"); + functions->fBindVertexArray = (GrGLBindVertexArrayProc) eglGetProcAddress("glBindVertexArray"); + functions->fBlendColor = (GrGLBlendColorProc) eglGetProcAddress("glBlendColor"); + functions->fBlendFunc = (GrGLBlendFuncProc) eglGetProcAddress("glBlendFunc"); + functions->fBlitFramebuffer = (GrGLBlitFramebufferProc) eglGetProcAddress("glBlitFramebuffer"); + functions->fBufferData = (GrGLBufferDataProc) eglGetProcAddress("glBufferData"); + functions->fBufferSubData = (GrGLBufferSubDataProc) eglGetProcAddress("glBufferSubData"); + functions->fCheckFramebufferStatus = (GrGLCheckFramebufferStatusProc) eglGetProcAddress("glCheckFramebufferStatus"); + functions->fClear = (GrGLClearProc) eglGetProcAddress("glClear"); + functions->fClearColor = (GrGLClearColorProc) eglGetProcAddress("glClearColor"); + functions->fClearStencil = (GrGLClearStencilProc) eglGetProcAddress("glClearStencil"); + functions->fClientActiveTexture = (GrGLClientActiveTextureProc) eglGetProcAddress("glClientActiveTexture"); + functions->fColorMask = (GrGLColorMaskProc) eglGetProcAddress("glColorMask"); + functions->fCompileShader = (GrGLCompileShaderProc) eglGetProcAddress("glCompileShader"); + functions->fCompressedTexImage2D = (GrGLCompressedTexImage2DProc) eglGetProcAddress("glCompressedTexImage2D"); + functions->fCopyTexSubImage2D = (GrGLCopyTexSubImage2DProc) eglGetProcAddress("glCopyTexSubImage2D"); + functions->fCreateProgram = (GrGLCreateProgramProc) eglGetProcAddress("glCreateProgram"); + functions->fCreateShader = (GrGLCreateShaderProc) eglGetProcAddress("glCreateShader"); + functions->fCullFace = (GrGLCullFaceProc) eglGetProcAddress("glCullFace"); + functions->fDeleteBuffers = (GrGLDeleteBuffersProc) eglGetProcAddress("glDeleteBuffers"); + functions->fDeleteFramebuffers = (GrGLDeleteFramebuffersProc) eglGetProcAddress("glDeleteFramebuffers"); + functions->fDeleteProgram = (GrGLDeleteProgramProc) eglGetProcAddress("glDeleteProgram"); + functions->fDeleteQueries = (GrGLDeleteQueriesProc) eglGetProcAddress("glDeleteQueries"); + functions->fDeleteRenderbuffers = (GrGLDeleteRenderbuffersProc) eglGetProcAddress("glDeleteRenderbuffers"); + functions->fDeleteShader = (GrGLDeleteShaderProc) eglGetProcAddress("glDeleteShader"); + functions->fDeleteTextures = (GrGLDeleteTexturesProc) eglGetProcAddress("glDeleteTextures"); + functions->fDeleteVertexArrays = (GrGLDeleteVertexArraysProc) eglGetProcAddress("glDeleteVertexArrays"); + functions->fDepthMask = (GrGLDepthMaskProc) eglGetProcAddress("glDepthMask"); + functions->fDisable = (GrGLDisableProc) eglGetProcAddress("glDisable"); + functions->fDisableClientState = (GrGLDisableClientStateProc) eglGetProcAddress("glDisableClientState"); + functions->fDisableVertexAttribArray = (GrGLDisableVertexAttribArrayProc) eglGetProcAddress("glDisableVertexAttribArray"); + functions->fDrawArrays = (GrGLDrawArraysProc) eglGetProcAddress("glDrawArrays"); + functions->fDrawBuffer = (GrGLDrawBufferProc) eglGetProcAddress("glDrawBuffer"); + functions->fDrawBuffers = (GrGLDrawBuffersProc) eglGetProcAddress("glDrawBuffers"); + functions->fDrawElements = (GrGLDrawElementsProc) eglGetProcAddress("glDrawElements"); + functions->fEnable = (GrGLEnableProc) eglGetProcAddress("glEnable"); + functions->fEnableClientState = (GrGLEnableClientStateProc) eglGetProcAddress("glEnableClientState"); + functions->fEnableVertexAttribArray = (GrGLEnableVertexAttribArrayProc) eglGetProcAddress("glEnableVertexAttribArray"); + functions->fEndQuery = (GrGLEndQueryProc) eglGetProcAddress("glEndQuery"); + functions->fFinish = (GrGLFinishProc) eglGetProcAddress("glFinish"); + functions->fFlush = (GrGLFlushProc) eglGetProcAddress("glFlush"); + functions->fFramebufferRenderbuffer = (GrGLFramebufferRenderbufferProc) eglGetProcAddress("glFramebufferRenderbuffer"); + functions->fFramebufferTexture2D = (GrGLFramebufferTexture2DProc) eglGetProcAddress("glFramebufferTexture2D"); + functions->fFrontFace = (GrGLFrontFaceProc) eglGetProcAddress("glFrontFace"); + functions->fGenBuffers = (GrGLGenBuffersProc) eglGetProcAddress("glGenBuffers"); + functions->fGenFramebuffers = (GrGLGenFramebuffersProc) eglGetProcAddress("glGenFramebuffers"); + functions->fGenerateMipmap = (GrGLGenerateMipmapProc) eglGetProcAddress("glGenerateMipmap"); + functions->fGenQueries = (GrGLGenQueriesProc) eglGetProcAddress("glGenQueries"); + functions->fGenRenderbuffers = (GrGLGenRenderbuffersProc) eglGetProcAddress("glGenRenderbuffers"); + functions->fGenTextures = (GrGLGenTexturesProc) eglGetProcAddress("glGenTextures"); + functions->fGenVertexArrays = (GrGLGenVertexArraysProc) eglGetProcAddress("glGenVertexArrays"); + functions->fGetBufferParameteriv = (GrGLGetBufferParameterivProc) eglGetProcAddress("glGetBufferParameteriv"); + functions->fGetError = (GrGLGetErrorProc) eglGetProcAddress("glGetError"); + functions->fGetFramebufferAttachmentParameteriv = (GrGLGetFramebufferAttachmentParameterivProc) eglGetProcAddress("glGetFramebufferAttachmentParameteriv"); + functions->fGetIntegerv = (GrGLGetIntegervProc) eglGetProcAddress("glGetIntegerv"); + functions->fGetQueryObjecti64v = (GrGLGetQueryObjecti64vProc) eglGetProcAddress("glGetQueryObjecti64v"); + functions->fGetQueryObjectiv = (GrGLGetQueryObjectivProc) eglGetProcAddress("glGetQueryObjectiv"); + functions->fGetQueryObjectui64v = (GrGLGetQueryObjectui64vProc) eglGetProcAddress("glGetQueryObjectui64v"); + functions->fGetQueryObjectuiv = (GrGLGetQueryObjectuivProc) eglGetProcAddress("glGetQueryObjectuiv"); + functions->fGetQueryiv = (GrGLGetQueryivProc) eglGetProcAddress("glGetQueryiv"); + functions->fGetProgramInfoLog = (GrGLGetProgramInfoLogProc) eglGetProcAddress("glGetProgramInfoLog"); + functions->fGetProgramiv = (GrGLGetProgramivProc) eglGetProcAddress("glGetProgramiv"); + functions->fGetRenderbufferParameteriv = (GrGLGetRenderbufferParameterivProc) eglGetProcAddress("glGetRenderbufferParameteriv"); + functions->fGetShaderInfoLog = (GrGLGetShaderInfoLogProc) eglGetProcAddress("glGetShaderInfoLog"); + functions->fGetShaderiv = (GrGLGetShaderivProc) eglGetProcAddress("glGetShaderiv"); + functions->fGetString = (GrGLGetStringProc) eglGetProcAddress("glGetString"); + functions->fGetStringi = (GrGLGetStringiProc) eglGetProcAddress("glGetStringi"); + functions->fGetTexLevelParameteriv = (GrGLGetTexLevelParameterivProc) eglGetProcAddress("glGetTexLevelParameteriv"); + functions->fGetUniformLocation = (GrGLGetUniformLocationProc) eglGetProcAddress("glGetUniformLocation"); + functions->fLineWidth = (GrGLLineWidthProc) eglGetProcAddress("glLineWidth"); + functions->fLinkProgram = (GrGLLinkProgramProc) eglGetProcAddress("glLinkProgram"); + functions->fLoadIdentity = (GrGLLoadIdentityProc) eglGetProcAddress("glLoadIdentity"); + functions->fLoadMatrixf = (GrGLLoadMatrixfProc) eglGetProcAddress("glLoadMatrixf"); + functions->fMapBuffer = (GrGLMapBufferProc) eglGetProcAddress("glMapBuffer"); + functions->fMatrixMode = (GrGLMatrixModeProc) eglGetProcAddress("glMatrixMode"); + functions->fPixelStorei = (GrGLPixelStoreiProc) eglGetProcAddress("glPixelStorei"); + functions->fQueryCounter = (GrGLQueryCounterProc) eglGetProcAddress("glQueryCounter"); + functions->fReadBuffer = (GrGLReadBufferProc) eglGetProcAddress("glReadBuffer"); + functions->fReadPixels = (GrGLReadPixelsProc) eglGetProcAddress("glReadPixels"); + functions->fRenderbufferStorage = (GrGLRenderbufferStorageProc) eglGetProcAddress("glRenderbufferStorage"); + functions->fRenderbufferStorageMultisample = (GrGLRenderbufferStorageMultisampleProc) eglGetProcAddress("glRenderbufferStorageMultisample"); + functions->fScissor = (GrGLScissorProc) eglGetProcAddress("glScissor"); + functions->fShaderSource = (GrGLShaderSourceProc) eglGetProcAddress("glShaderSource"); + functions->fStencilFunc = (GrGLStencilFuncProc) eglGetProcAddress("glStencilFunc"); + functions->fStencilFuncSeparate = (GrGLStencilFuncSeparateProc) eglGetProcAddress("glStencilFuncSeparate"); + functions->fStencilMask = (GrGLStencilMaskProc) eglGetProcAddress("glStencilMask"); + functions->fStencilMaskSeparate = (GrGLStencilMaskSeparateProc) eglGetProcAddress("glStencilMaskSeparate"); + functions->fStencilOp = (GrGLStencilOpProc) eglGetProcAddress("glStencilOp"); + functions->fStencilOpSeparate = (GrGLStencilOpSeparateProc) eglGetProcAddress("glStencilOpSeparate"); + functions->fTexGenf = (GrGLTexGenfProc) eglGetProcAddress("glTexGenf"); + functions->fTexGenfv = (GrGLTexGenfvProc) eglGetProcAddress("glTexGenfv"); + functions->fTexGeni = (GrGLTexGeniProc) eglGetProcAddress("glTexGeni"); + functions->fTexImage2D = (GrGLTexImage2DProc) eglGetProcAddress("glTexImage2D"); + functions->fTexParameteri = (GrGLTexParameteriProc) eglGetProcAddress("glTexParameteri"); + functions->fTexParameteriv = (GrGLTexParameterivProc) eglGetProcAddress("glTexParameteriv"); + functions->fTexSubImage2D = (GrGLTexSubImage2DProc) eglGetProcAddress("glTexSubImage2D"); + functions->fTexStorage2D = (GrGLTexStorage2DProc) eglGetProcAddress("glTexStorage2D"); + functions->fUniform1f = (GrGLUniform1fProc) eglGetProcAddress("glUniform1f"); + functions->fUniform1i = (GrGLUniform1iProc) eglGetProcAddress("glUniform1i"); + functions->fUniform1fv = (GrGLUniform1fvProc) eglGetProcAddress("glUniform1fv"); + functions->fUniform1iv = (GrGLUniform1ivProc) eglGetProcAddress("glUniform1iv"); + functions->fUniform2f = (GrGLUniform2fProc) eglGetProcAddress("glUniform2f"); + functions->fUniform2i = (GrGLUniform2iProc) eglGetProcAddress("glUniform2i"); + functions->fUniform2fv = (GrGLUniform2fvProc) eglGetProcAddress("glUniform2fv"); + functions->fUniform2iv = (GrGLUniform2ivProc) eglGetProcAddress("glUniform2iv"); + functions->fUniform3f = (GrGLUniform3fProc) eglGetProcAddress("glUniform3f"); + functions->fUniform3i = (GrGLUniform3iProc) eglGetProcAddress("glUniform3i"); + functions->fUniform3fv = (GrGLUniform3fvProc) eglGetProcAddress("glUniform3fv"); + functions->fUniform3iv = (GrGLUniform3ivProc) eglGetProcAddress("glUniform3iv"); + functions->fUniform4f = (GrGLUniform4fProc) eglGetProcAddress("glUniform4f"); + functions->fUniform4i = (GrGLUniform4iProc) eglGetProcAddress("glUniform4i"); + functions->fUniform4fv = (GrGLUniform4fvProc) eglGetProcAddress("glUniform4fv"); + functions->fUniform4iv = (GrGLUniform4ivProc) eglGetProcAddress("glUniform4iv"); + functions->fUniformMatrix2fv = (GrGLUniformMatrix2fvProc) eglGetProcAddress("glUniformMatrix2fv"); + functions->fUniformMatrix3fv = (GrGLUniformMatrix3fvProc) eglGetProcAddress("glUniformMatrix3fv"); + functions->fUniformMatrix4fv = (GrGLUniformMatrix4fvProc) eglGetProcAddress("glUniformMatrix4fv"); + functions->fUnmapBuffer = (GrGLUnmapBufferProc) eglGetProcAddress("glUnmapBuffer"); + functions->fUseProgram = (GrGLUseProgramProc) eglGetProcAddress("glUseProgram"); + functions->fVertexAttrib4fv = (GrGLVertexAttrib4fvProc) eglGetProcAddress("glVertexAttrib4fv"); + functions->fVertexAttribPointer = (GrGLVertexAttribPointerProc) eglGetProcAddress("glVertexAttribPointer"); + functions->fVertexPointer = (GrGLVertexPointerProc) eglGetProcAddress("glVertexPointer"); + functions->fViewport = (GrGLViewportProc) eglGetProcAddress("glViewport"); if (extensions.has("GL_NV_path_rendering")) { - interface->fPathCommands = (GrGLPathCommandsProc) eglGetProcAddress("glPathCommandsNV"); - interface->fPathCoords = (GrGLPathCoordsProc) eglGetProcAddress("glPathCoordsNV"); - interface->fPathSubCommands = (GrGLPathSubCommandsProc) eglGetProcAddress("glPathSubCommandsNV"); - interface->fPathSubCoords = (GrGLPathSubCoordsProc) eglGetProcAddress("glPathSubCoordsNV"); - interface->fPathString = (GrGLPathStringProc) eglGetProcAddress("glPathStringNV"); - interface->fPathGlyphs = (GrGLPathGlyphsProc) eglGetProcAddress("glPathGlyphsNV"); - interface->fPathGlyphRange = (GrGLPathGlyphRangeProc) eglGetProcAddress("glPathGlyphRangeNV"); - interface->fWeightPaths = (GrGLWeightPathsProc) eglGetProcAddress("glWeightPathsNV"); - interface->fCopyPath = (GrGLCopyPathProc) eglGetProcAddress("glCopyPathNV"); - interface->fInterpolatePaths = (GrGLInterpolatePathsProc) eglGetProcAddress("glInterpolatePathsNV"); - interface->fTransformPath = (GrGLTransformPathProc) eglGetProcAddress("glTransformPathNV"); - interface->fPathParameteriv = (GrGLPathParameterivProc) eglGetProcAddress("glPathParameterivNV"); - interface->fPathParameteri = (GrGLPathParameteriProc) eglGetProcAddress("glPathParameteriNV"); - interface->fPathParameterfv = (GrGLPathParameterfvProc) eglGetProcAddress("glPathParameterfvNV"); - interface->fPathParameterf = (GrGLPathParameterfProc) eglGetProcAddress("glPathParameterfNV"); - interface->fPathDashArray = (GrGLPathDashArrayProc) eglGetProcAddress("glPathDashArrayNV"); - interface->fGenPaths = (GrGLGenPathsProc) eglGetProcAddress("glGenPathsNV"); - interface->fDeletePaths = (GrGLDeletePathsProc) eglGetProcAddress("glDeletePathsNV"); - interface->fIsPath = (GrGLIsPathProc) eglGetProcAddress("glIsPathNV"); - interface->fPathStencilFunc = (GrGLPathStencilFuncProc) eglGetProcAddress("glPathStencilFuncNV"); - interface->fPathStencilDepthOffset = (GrGLPathStencilDepthOffsetProc) eglGetProcAddress("glPathStencilDepthOffsetNV"); - interface->fStencilFillPath = (GrGLStencilFillPathProc) eglGetProcAddress("glStencilFillPathNV"); - interface->fStencilStrokePath = (GrGLStencilStrokePathProc) eglGetProcAddress("glStencilStrokePathNV"); - interface->fStencilFillPathInstanced = (GrGLStencilFillPathInstancedProc) eglGetProcAddress("glStencilFillPathInstancedNV"); - interface->fStencilStrokePathInstanced = (GrGLStencilStrokePathInstancedProc) eglGetProcAddress("glStencilStrokePathInstancedNV"); - interface->fPathCoverDepthFunc = (GrGLPathCoverDepthFuncProc) eglGetProcAddress("glPathCoverDepthFuncNV"); - interface->fPathColorGen = (GrGLPathColorGenProc) eglGetProcAddress("glPathColorGenNV"); - interface->fPathTexGen = (GrGLPathTexGenProc) eglGetProcAddress("glPathTexGenNV"); - interface->fPathFogGen = (GrGLPathFogGenProc) eglGetProcAddress("glPathFogGenNV"); - interface->fCoverFillPath = (GrGLCoverFillPathProc) eglGetProcAddress("glCoverFillPathNV"); - interface->fCoverStrokePath = (GrGLCoverStrokePathProc) eglGetProcAddress("glCoverStrokePathNV"); - interface->fCoverFillPathInstanced = (GrGLCoverFillPathInstancedProc) eglGetProcAddress("glCoverFillPathInstancedNV"); - interface->fCoverStrokePathInstanced = (GrGLCoverStrokePathInstancedProc) eglGetProcAddress("glCoverStrokePathInstancedNV"); - interface->fGetPathParameteriv = (GrGLGetPathParameterivProc) eglGetProcAddress("glGetPathParameterivNV"); - interface->fGetPathParameterfv = (GrGLGetPathParameterfvProc) eglGetProcAddress("glGetPathParameterfvNV"); - interface->fGetPathCommands = (GrGLGetPathCommandsProc) eglGetProcAddress("glGetPathCommandsNV"); - interface->fGetPathCoords = (GrGLGetPathCoordsProc) eglGetProcAddress("glGetPathCoordsNV"); - interface->fGetPathDashArray = (GrGLGetPathDashArrayProc) eglGetProcAddress("glGetPathDashArrayNV"); - interface->fGetPathMetrics = (GrGLGetPathMetricsProc) eglGetProcAddress("glGetPathMetricsNV"); - interface->fGetPathMetricRange = (GrGLGetPathMetricRangeProc) eglGetProcAddress("glGetPathMetricRangeNV"); - interface->fGetPathSpacing = (GrGLGetPathSpacingProc) eglGetProcAddress("glGetPathSpacingNV"); - interface->fGetPathColorGeniv = (GrGLGetPathColorGenivProc) eglGetProcAddress("glGetPathColorGenivNV"); - interface->fGetPathColorGenfv = (GrGLGetPathColorGenfvProc) eglGetProcAddress("glGetPathColorGenfvNV"); - interface->fGetPathTexGeniv = (GrGLGetPathTexGenivProc) eglGetProcAddress("glGetPathTexGenivNV"); - interface->fGetPathTexGenfv = (GrGLGetPathTexGenfvProc) eglGetProcAddress("glGetPathTexGenfvNV"); - interface->fIsPointInFillPath = (GrGLIsPointInFillPathProc) eglGetProcAddress("glIsPointInFillPathNV"); - interface->fIsPointInStrokePath = (GrGLIsPointInStrokePathProc) eglGetProcAddress("glIsPointInStrokePathNV"); - interface->fGetPathLength = (GrGLGetPathLengthProc) eglGetProcAddress("glGetPathLengthNV"); - interface->fPointAlongPath = (GrGLPointAlongPathProc) eglGetProcAddress("glPointAlongPathNV"); + functions->fPathCommands = (GrGLPathCommandsProc) eglGetProcAddress("glPathCommandsNV"); + functions->fPathCoords = (GrGLPathCoordsProc) eglGetProcAddress("glPathCoordsNV"); + functions->fPathSubCommands = (GrGLPathSubCommandsProc) eglGetProcAddress("glPathSubCommandsNV"); + functions->fPathSubCoords = (GrGLPathSubCoordsProc) eglGetProcAddress("glPathSubCoordsNV"); + functions->fPathString = (GrGLPathStringProc) eglGetProcAddress("glPathStringNV"); + functions->fPathGlyphs = (GrGLPathGlyphsProc) eglGetProcAddress("glPathGlyphsNV"); + functions->fPathGlyphRange = (GrGLPathGlyphRangeProc) eglGetProcAddress("glPathGlyphRangeNV"); + functions->fWeightPaths = (GrGLWeightPathsProc) eglGetProcAddress("glWeightPathsNV"); + functions->fCopyPath = (GrGLCopyPathProc) eglGetProcAddress("glCopyPathNV"); + functions->fInterpolatePaths = (GrGLInterpolatePathsProc) eglGetProcAddress("glInterpolatePathsNV"); + functions->fTransformPath = (GrGLTransformPathProc) eglGetProcAddress("glTransformPathNV"); + functions->fPathParameteriv = (GrGLPathParameterivProc) eglGetProcAddress("glPathParameterivNV"); + functions->fPathParameteri = (GrGLPathParameteriProc) eglGetProcAddress("glPathParameteriNV"); + functions->fPathParameterfv = (GrGLPathParameterfvProc) eglGetProcAddress("glPathParameterfvNV"); + functions->fPathParameterf = (GrGLPathParameterfProc) eglGetProcAddress("glPathParameterfNV"); + functions->fPathDashArray = (GrGLPathDashArrayProc) eglGetProcAddress("glPathDashArrayNV"); + functions->fGenPaths = (GrGLGenPathsProc) eglGetProcAddress("glGenPathsNV"); + functions->fDeletePaths = (GrGLDeletePathsProc) eglGetProcAddress("glDeletePathsNV"); + functions->fIsPath = (GrGLIsPathProc) eglGetProcAddress("glIsPathNV"); + functions->fPathStencilFunc = (GrGLPathStencilFuncProc) eglGetProcAddress("glPathStencilFuncNV"); + functions->fPathStencilDepthOffset = (GrGLPathStencilDepthOffsetProc) eglGetProcAddress("glPathStencilDepthOffsetNV"); + functions->fStencilFillPath = (GrGLStencilFillPathProc) eglGetProcAddress("glStencilFillPathNV"); + functions->fStencilStrokePath = (GrGLStencilStrokePathProc) eglGetProcAddress("glStencilStrokePathNV"); + functions->fStencilFillPathInstanced = (GrGLStencilFillPathInstancedProc) eglGetProcAddress("glStencilFillPathInstancedNV"); + functions->fStencilStrokePathInstanced = (GrGLStencilStrokePathInstancedProc) eglGetProcAddress("glStencilStrokePathInstancedNV"); + functions->fPathCoverDepthFunc = (GrGLPathCoverDepthFuncProc) eglGetProcAddress("glPathCoverDepthFuncNV"); + functions->fPathColorGen = (GrGLPathColorGenProc) eglGetProcAddress("glPathColorGenNV"); + functions->fPathTexGen = (GrGLPathTexGenProc) eglGetProcAddress("glPathTexGenNV"); + functions->fPathFogGen = (GrGLPathFogGenProc) eglGetProcAddress("glPathFogGenNV"); + functions->fCoverFillPath = (GrGLCoverFillPathProc) eglGetProcAddress("glCoverFillPathNV"); + functions->fCoverStrokePath = (GrGLCoverStrokePathProc) eglGetProcAddress("glCoverStrokePathNV"); + functions->fCoverFillPathInstanced = (GrGLCoverFillPathInstancedProc) eglGetProcAddress("glCoverFillPathInstancedNV"); + functions->fCoverStrokePathInstanced = (GrGLCoverStrokePathInstancedProc) eglGetProcAddress("glCoverStrokePathInstancedNV"); + functions->fGetPathParameteriv = (GrGLGetPathParameterivProc) eglGetProcAddress("glGetPathParameterivNV"); + functions->fGetPathParameterfv = (GrGLGetPathParameterfvProc) eglGetProcAddress("glGetPathParameterfvNV"); + functions->fGetPathCommands = (GrGLGetPathCommandsProc) eglGetProcAddress("glGetPathCommandsNV"); + functions->fGetPathCoords = (GrGLGetPathCoordsProc) eglGetProcAddress("glGetPathCoordsNV"); + functions->fGetPathDashArray = (GrGLGetPathDashArrayProc) eglGetProcAddress("glGetPathDashArrayNV"); + functions->fGetPathMetrics = (GrGLGetPathMetricsProc) eglGetProcAddress("glGetPathMetricsNV"); + functions->fGetPathMetricRange = (GrGLGetPathMetricRangeProc) eglGetProcAddress("glGetPathMetricRangeNV"); + functions->fGetPathSpacing = (GrGLGetPathSpacingProc) eglGetProcAddress("glGetPathSpacingNV"); + functions->fGetPathColorGeniv = (GrGLGetPathColorGenivProc) eglGetProcAddress("glGetPathColorGenivNV"); + functions->fGetPathColorGenfv = (GrGLGetPathColorGenfvProc) eglGetProcAddress("glGetPathColorGenfvNV"); + functions->fGetPathTexGeniv = (GrGLGetPathTexGenivProc) eglGetProcAddress("glGetPathTexGenivNV"); + functions->fGetPathTexGenfv = (GrGLGetPathTexGenfvProc) eglGetProcAddress("glGetPathTexGenfvNV"); + functions->fIsPointInFillPath = (GrGLIsPointInFillPathProc) eglGetProcAddress("glIsPointInFillPathNV"); + functions->fIsPointInStrokePath = (GrGLIsPointInStrokePathProc) eglGetProcAddress("glIsPointInStrokePathNV"); + functions->fGetPathLength = (GrGLGetPathLengthProc) eglGetProcAddress("glGetPathLengthNV"); + functions->fPointAlongPath = (GrGLPointAlongPathProc) eglGetProcAddress("glPointAlongPathNV"); } return interface; diff --git a/src/gpu/gl/angle/GrGLCreateANGLEInterface.cpp b/src/gpu/gl/angle/GrGLCreateANGLEInterface.cpp index 62f760818d..2858541ed9 100644 --- a/src/gpu/gl/angle/GrGLCreateANGLEInterface.cpp +++ b/src/gpu/gl/angle/GrGLCreateANGLEInterface.cpp @@ -18,7 +18,7 @@ #include "EGL/egl.h" #define GET_PROC(name) \ - interface->f ## name = (GrGL ## name ## Proc) GetProcAddress(ghANGLELib, "gl" #name); + interface->fFunctions.f ## name = (GrGL ## name ## Proc) GetProcAddress(ghANGLELib, "gl" #name); const GrGLInterface* GrGLCreateANGLEInterface() { @@ -36,12 +36,14 @@ const GrGLInterface* GrGLCreateANGLEInterface() { GrGLInterface* interface = SkNEW(GrGLInterface); interface->fStandard = kGLES_GrGLStandard; + GrGLInterface::Functions* functions = &interface->fFunctions; + GET_PROC(ActiveTexture); GET_PROC(AttachShader); GET_PROC(BindAttribLocation); GET_PROC(BindBuffer); GET_PROC(BindTexture); - interface->fBindVertexArray = + functions->fBindVertexArray = (GrGLBindVertexArrayProc) eglGetProcAddress("glBindVertexArrayOES"); GET_PROC(BlendColor); GET_PROC(BlendFunc); @@ -61,7 +63,7 @@ const GrGLInterface* GrGLCreateANGLEInterface() { GET_PROC(DeleteProgram); GET_PROC(DeleteShader); GET_PROC(DeleteTextures); - interface->fDeleteVertexArrays = + functions->fDeleteVertexArrays = (GrGLDeleteVertexArraysProc) eglGetProcAddress("glDeleteVertexArraysOES"); GET_PROC(DepthMask); GET_PROC(Disable); @@ -76,7 +78,7 @@ const GrGLInterface* GrGLCreateANGLEInterface() { GET_PROC(GenBuffers); GET_PROC(GenerateMipmap); GET_PROC(GenTextures); - interface->fGenVertexArrays = + functions->fGenVertexArrays = (GrGLGenVertexArraysProc) eglGetProcAddress("glGenVertexArraysOES"); GET_PROC(GetBufferParameteriv); GET_PROC(GetError); @@ -106,7 +108,7 @@ const GrGLInterface* GrGLCreateANGLEInterface() { #if GL_ARB_texture_storage GET_PROC(TexStorage2D); #elif GL_EXT_texture_storage - interface->fTexStorage2D = (GrGLTexStorage2DProc) eglGetProcAddress("glTexStorage2DEXT"); + functions->fTexStorage2D = (GrGLTexStorage2DProc) eglGetProcAddress("glTexStorage2DEXT"); #endif GET_PROC(Uniform1f); GET_PROC(Uniform1i); @@ -148,7 +150,7 @@ const GrGLInterface* GrGLCreateANGLEInterface() { GET_PROC(GetRenderbufferParameteriv); GET_PROC(RenderbufferStorage); - interface->fMapBuffer = (GrGLMapBufferProc) eglGetProcAddress("glMapBufferOES"); - interface->fUnmapBuffer = (GrGLUnmapBufferProc) eglGetProcAddress("glUnmapBufferOES"); + functions->fMapBuffer = (GrGLMapBufferProc) eglGetProcAddress("glMapBufferOES"); + functions->fUnmapBuffer = (GrGLUnmapBufferProc) eglGetProcAddress("glUnmapBufferOES"); return interface; } diff --git a/src/gpu/gl/debug/GrGLCreateDebugInterface.cpp b/src/gpu/gl/debug/GrGLCreateDebugInterface.cpp index bab5f06577..97ab9c2358 100644 --- a/src/gpu/gl/debug/GrGLCreateDebugInterface.cpp +++ b/src/gpu/gl/debug/GrGLCreateDebugInterface.cpp @@ -791,142 +791,144 @@ const GrGLInterface* GrGLCreateDebugInterface() { GrGLInterface* interface = SkNEW(GrDebugGLInterface); interface->fStandard = kGL_GrGLStandard; - interface->fActiveTexture = debugGLActiveTexture; - interface->fAttachShader = debugGLAttachShader; - interface->fBeginQuery = debugGLBeginQuery; - interface->fBindAttribLocation = debugGLBindAttribLocation; - interface->fBindBuffer = debugGLBindBuffer; - interface->fBindFragDataLocation = noOpGLBindFragDataLocation; - interface->fBindTexture = debugGLBindTexture; - interface->fBindVertexArray = debugGLBindVertexArray; - interface->fBlendColor = noOpGLBlendColor; - interface->fBlendFunc = noOpGLBlendFunc; - interface->fBufferData = debugGLBufferData; - interface->fBufferSubData = noOpGLBufferSubData; - interface->fClear = noOpGLClear; - interface->fClearColor = noOpGLClearColor; - interface->fClearStencil = noOpGLClearStencil; - interface->fClientActiveTexture = debugGLClientActiveTexture; - interface->fColorMask = noOpGLColorMask; - interface->fCompileShader = noOpGLCompileShader; - interface->fCompressedTexImage2D = noOpGLCompressedTexImage2D; - interface->fCopyTexSubImage2D = noOpGLCopyTexSubImage2D; - interface->fCreateProgram = debugGLCreateProgram; - interface->fCreateShader = debugGLCreateShader; - interface->fCullFace = noOpGLCullFace; - interface->fDeleteBuffers = debugGLDeleteBuffers; - interface->fDeleteProgram = debugGLDeleteProgram; - interface->fDeleteQueries = noOpGLDeleteIds; - interface->fDeleteShader = debugGLDeleteShader; - interface->fDeleteTextures = debugGLDeleteTextures; - interface->fDeleteVertexArrays = debugGLDeleteVertexArrays; - interface->fDepthMask = noOpGLDepthMask; - interface->fDisable = noOpGLDisable; - interface->fDisableClientState = noOpGLDisableClientState; - interface->fDisableVertexAttribArray = noOpGLDisableVertexAttribArray; - interface->fDrawArrays = noOpGLDrawArrays; - interface->fDrawBuffer = noOpGLDrawBuffer; - interface->fDrawBuffers = noOpGLDrawBuffers; - interface->fDrawElements = noOpGLDrawElements; - interface->fEnable = noOpGLEnable; - interface->fEnableClientState = noOpGLEnableClientState; - interface->fEnableVertexAttribArray = noOpGLEnableVertexAttribArray; - interface->fEndQuery = noOpGLEndQuery; - interface->fFinish = noOpGLFinish; - interface->fFlush = noOpGLFlush; - interface->fFrontFace = noOpGLFrontFace; - interface->fGenerateMipmap = debugGLGenerateMipmap; - interface->fGenBuffers = debugGLGenBuffers; - interface->fGenQueries = noOpGLGenIds; - interface->fGenTextures = debugGLGenTextures; - interface->fGetBufferParameteriv = debugGLGetBufferParameteriv; - interface->fGetError = noOpGLGetError; - interface->fGetIntegerv = noOpGLGetIntegerv; - interface->fGetQueryObjecti64v = noOpGLGetQueryObjecti64v; - interface->fGetQueryObjectiv = noOpGLGetQueryObjectiv; - interface->fGetQueryObjectui64v = noOpGLGetQueryObjectui64v; - interface->fGetQueryObjectuiv = noOpGLGetQueryObjectuiv; - interface->fGetQueryiv = noOpGLGetQueryiv; - interface->fGetProgramInfoLog = noOpGLGetInfoLog; - interface->fGetProgramiv = noOpGLGetShaderOrProgramiv; - interface->fGetShaderInfoLog = noOpGLGetInfoLog; - interface->fGetShaderiv = noOpGLGetShaderOrProgramiv; - interface->fGetString = noOpGLGetString; - interface->fGetStringi = noOpGLGetStringi; - interface->fGetTexLevelParameteriv = noOpGLGetTexLevelParameteriv; - interface->fGetUniformLocation = noOpGLGetUniformLocation; - interface->fGenVertexArrays = debugGLGenVertexArrays; - interface->fLoadIdentity = noOpGLLoadIdentity; - interface->fLoadMatrixf = noOpGLLoadMatrixf; - interface->fLineWidth = noOpGLLineWidth; - interface->fLinkProgram = noOpGLLinkProgram; - interface->fMatrixMode = noOpGLMatrixMode; - interface->fPixelStorei = debugGLPixelStorei; - interface->fQueryCounter = noOpGLQueryCounter; - interface->fReadBuffer = noOpGLReadBuffer; - interface->fReadPixels = debugGLReadPixels; - interface->fScissor = noOpGLScissor; - interface->fShaderSource = noOpGLShaderSource; - interface->fStencilFunc = noOpGLStencilFunc; - interface->fStencilFuncSeparate = noOpGLStencilFuncSeparate; - interface->fStencilMask = noOpGLStencilMask; - interface->fStencilMaskSeparate = noOpGLStencilMaskSeparate; - interface->fStencilOp = noOpGLStencilOp; - interface->fStencilOpSeparate = noOpGLStencilOpSeparate; - interface->fTexGenf = noOpGLTexGenf; - interface->fTexGenfv = noOpGLTexGenfv; - interface->fTexGeni = noOpGLTexGeni; - interface->fTexImage2D = noOpGLTexImage2D; - interface->fTexParameteri = noOpGLTexParameteri; - interface->fTexParameteriv = noOpGLTexParameteriv; - interface->fTexSubImage2D = noOpGLTexSubImage2D; - interface->fTexStorage2D = noOpGLTexStorage2D; - interface->fDiscardFramebuffer = noOpGLDiscardFramebuffer; - interface->fUniform1f = noOpGLUniform1f; - interface->fUniform1i = noOpGLUniform1i; - interface->fUniform1fv = noOpGLUniform1fv; - interface->fUniform1iv = noOpGLUniform1iv; - interface->fUniform2f = noOpGLUniform2f; - interface->fUniform2i = noOpGLUniform2i; - interface->fUniform2fv = noOpGLUniform2fv; - interface->fUniform2iv = noOpGLUniform2iv; - interface->fUniform3f = noOpGLUniform3f; - interface->fUniform3i = noOpGLUniform3i; - interface->fUniform3fv = noOpGLUniform3fv; - interface->fUniform3iv = noOpGLUniform3iv; - interface->fUniform4f = noOpGLUniform4f; - interface->fUniform4i = noOpGLUniform4i; - interface->fUniform4fv = noOpGLUniform4fv; - interface->fUniform4iv = noOpGLUniform4iv; - interface->fUniformMatrix2fv = noOpGLUniformMatrix2fv; - interface->fUniformMatrix3fv = noOpGLUniformMatrix3fv; - interface->fUniformMatrix4fv = noOpGLUniformMatrix4fv; - interface->fUseProgram = debugGLUseProgram; - interface->fVertexAttrib4fv = noOpGLVertexAttrib4fv; - interface->fVertexAttribPointer = noOpGLVertexAttribPointer; - interface->fVertexPointer = noOpGLVertexPointer; - interface->fViewport = noOpGLViewport; - interface->fBindFramebuffer = debugGLBindFramebuffer; - interface->fBindRenderbuffer = debugGLBindRenderbuffer; - interface->fCheckFramebufferStatus = noOpGLCheckFramebufferStatus; - interface->fDeleteFramebuffers = debugGLDeleteFramebuffers; - interface->fDeleteRenderbuffers = debugGLDeleteRenderbuffers; - interface->fFramebufferRenderbuffer = debugGLFramebufferRenderbuffer; - interface->fFramebufferTexture2D = debugGLFramebufferTexture2D; - interface->fGenFramebuffers = debugGLGenFramebuffers; - interface->fGenRenderbuffers = debugGLGenRenderbuffers; - interface->fGetFramebufferAttachmentParameteriv = + + GrGLInterface::Functions* functions = &interface->fFunctions; + functions->fActiveTexture = debugGLActiveTexture; + functions->fAttachShader = debugGLAttachShader; + functions->fBeginQuery = debugGLBeginQuery; + functions->fBindAttribLocation = debugGLBindAttribLocation; + functions->fBindBuffer = debugGLBindBuffer; + functions->fBindFragDataLocation = noOpGLBindFragDataLocation; + functions->fBindTexture = debugGLBindTexture; + functions->fBindVertexArray = debugGLBindVertexArray; + functions->fBlendColor = noOpGLBlendColor; + functions->fBlendFunc = noOpGLBlendFunc; + functions->fBufferData = debugGLBufferData; + functions->fBufferSubData = noOpGLBufferSubData; + functions->fClear = noOpGLClear; + functions->fClearColor = noOpGLClearColor; + functions->fClearStencil = noOpGLClearStencil; + functions->fClientActiveTexture = debugGLClientActiveTexture; + functions->fColorMask = noOpGLColorMask; + functions->fCompileShader = noOpGLCompileShader; + functions->fCompressedTexImage2D = noOpGLCompressedTexImage2D; + functions->fCopyTexSubImage2D = noOpGLCopyTexSubImage2D; + functions->fCreateProgram = debugGLCreateProgram; + functions->fCreateShader = debugGLCreateShader; + functions->fCullFace = noOpGLCullFace; + functions->fDeleteBuffers = debugGLDeleteBuffers; + functions->fDeleteProgram = debugGLDeleteProgram; + functions->fDeleteQueries = noOpGLDeleteIds; + functions->fDeleteShader = debugGLDeleteShader; + functions->fDeleteTextures = debugGLDeleteTextures; + functions->fDeleteVertexArrays = debugGLDeleteVertexArrays; + functions->fDepthMask = noOpGLDepthMask; + functions->fDisable = noOpGLDisable; + functions->fDisableClientState = noOpGLDisableClientState; + functions->fDisableVertexAttribArray = noOpGLDisableVertexAttribArray; + functions->fDrawArrays = noOpGLDrawArrays; + functions->fDrawBuffer = noOpGLDrawBuffer; + functions->fDrawBuffers = noOpGLDrawBuffers; + functions->fDrawElements = noOpGLDrawElements; + functions->fEnable = noOpGLEnable; + functions->fEnableClientState = noOpGLEnableClientState; + functions->fEnableVertexAttribArray = noOpGLEnableVertexAttribArray; + functions->fEndQuery = noOpGLEndQuery; + functions->fFinish = noOpGLFinish; + functions->fFlush = noOpGLFlush; + functions->fFrontFace = noOpGLFrontFace; + functions->fGenerateMipmap = debugGLGenerateMipmap; + functions->fGenBuffers = debugGLGenBuffers; + functions->fGenQueries = noOpGLGenIds; + functions->fGenTextures = debugGLGenTextures; + functions->fGetBufferParameteriv = debugGLGetBufferParameteriv; + functions->fGetError = noOpGLGetError; + functions->fGetIntegerv = noOpGLGetIntegerv; + functions->fGetQueryObjecti64v = noOpGLGetQueryObjecti64v; + functions->fGetQueryObjectiv = noOpGLGetQueryObjectiv; + functions->fGetQueryObjectui64v = noOpGLGetQueryObjectui64v; + functions->fGetQueryObjectuiv = noOpGLGetQueryObjectuiv; + functions->fGetQueryiv = noOpGLGetQueryiv; + functions->fGetProgramInfoLog = noOpGLGetInfoLog; + functions->fGetProgramiv = noOpGLGetShaderOrProgramiv; + functions->fGetShaderInfoLog = noOpGLGetInfoLog; + functions->fGetShaderiv = noOpGLGetShaderOrProgramiv; + functions->fGetString = noOpGLGetString; + functions->fGetStringi = noOpGLGetStringi; + functions->fGetTexLevelParameteriv = noOpGLGetTexLevelParameteriv; + functions->fGetUniformLocation = noOpGLGetUniformLocation; + functions->fGenVertexArrays = debugGLGenVertexArrays; + functions->fLoadIdentity = noOpGLLoadIdentity; + functions->fLoadMatrixf = noOpGLLoadMatrixf; + functions->fLineWidth = noOpGLLineWidth; + functions->fLinkProgram = noOpGLLinkProgram; + functions->fMatrixMode = noOpGLMatrixMode; + functions->fPixelStorei = debugGLPixelStorei; + functions->fQueryCounter = noOpGLQueryCounter; + functions->fReadBuffer = noOpGLReadBuffer; + functions->fReadPixels = debugGLReadPixels; + functions->fScissor = noOpGLScissor; + functions->fShaderSource = noOpGLShaderSource; + functions->fStencilFunc = noOpGLStencilFunc; + functions->fStencilFuncSeparate = noOpGLStencilFuncSeparate; + functions->fStencilMask = noOpGLStencilMask; + functions->fStencilMaskSeparate = noOpGLStencilMaskSeparate; + functions->fStencilOp = noOpGLStencilOp; + functions->fStencilOpSeparate = noOpGLStencilOpSeparate; + functions->fTexGenf = noOpGLTexGenf; + functions->fTexGenfv = noOpGLTexGenfv; + functions->fTexGeni = noOpGLTexGeni; + functions->fTexImage2D = noOpGLTexImage2D; + functions->fTexParameteri = noOpGLTexParameteri; + functions->fTexParameteriv = noOpGLTexParameteriv; + functions->fTexSubImage2D = noOpGLTexSubImage2D; + functions->fTexStorage2D = noOpGLTexStorage2D; + functions->fDiscardFramebuffer = noOpGLDiscardFramebuffer; + functions->fUniform1f = noOpGLUniform1f; + functions->fUniform1i = noOpGLUniform1i; + functions->fUniform1fv = noOpGLUniform1fv; + functions->fUniform1iv = noOpGLUniform1iv; + functions->fUniform2f = noOpGLUniform2f; + functions->fUniform2i = noOpGLUniform2i; + functions->fUniform2fv = noOpGLUniform2fv; + functions->fUniform2iv = noOpGLUniform2iv; + functions->fUniform3f = noOpGLUniform3f; + functions->fUniform3i = noOpGLUniform3i; + functions->fUniform3fv = noOpGLUniform3fv; + functions->fUniform3iv = noOpGLUniform3iv; + functions->fUniform4f = noOpGLUniform4f; + functions->fUniform4i = noOpGLUniform4i; + functions->fUniform4fv = noOpGLUniform4fv; + functions->fUniform4iv = noOpGLUniform4iv; + functions->fUniformMatrix2fv = noOpGLUniformMatrix2fv; + functions->fUniformMatrix3fv = noOpGLUniformMatrix3fv; + functions->fUniformMatrix4fv = noOpGLUniformMatrix4fv; + functions->fUseProgram = debugGLUseProgram; + functions->fVertexAttrib4fv = noOpGLVertexAttrib4fv; + functions->fVertexAttribPointer = noOpGLVertexAttribPointer; + functions->fVertexPointer = noOpGLVertexPointer; + functions->fViewport = noOpGLViewport; + functions->fBindFramebuffer = debugGLBindFramebuffer; + functions->fBindRenderbuffer = debugGLBindRenderbuffer; + functions->fCheckFramebufferStatus = noOpGLCheckFramebufferStatus; + functions->fDeleteFramebuffers = debugGLDeleteFramebuffers; + functions->fDeleteRenderbuffers = debugGLDeleteRenderbuffers; + functions->fFramebufferRenderbuffer = debugGLFramebufferRenderbuffer; + functions->fFramebufferTexture2D = debugGLFramebufferTexture2D; + functions->fGenFramebuffers = debugGLGenFramebuffers; + functions->fGenRenderbuffers = debugGLGenRenderbuffers; + functions->fGetFramebufferAttachmentParameteriv = noOpGLGetFramebufferAttachmentParameteriv; - interface->fGetRenderbufferParameteriv = noOpGLGetRenderbufferParameteriv; - interface->fRenderbufferStorage = noOpGLRenderbufferStorage; - interface->fRenderbufferStorageMultisample = + functions->fGetRenderbufferParameteriv = noOpGLGetRenderbufferParameteriv; + functions->fRenderbufferStorage = noOpGLRenderbufferStorage; + functions->fRenderbufferStorageMultisample = noOpGLRenderbufferStorageMultisample; - interface->fBlitFramebuffer = noOpGLBlitFramebuffer; - interface->fResolveMultisampleFramebuffer = + functions->fBlitFramebuffer = noOpGLBlitFramebuffer; + functions->fResolveMultisampleFramebuffer = noOpGLResolveMultisampleFramebuffer; - interface->fMapBuffer = debugGLMapBuffer; - interface->fUnmapBuffer = debugGLUnmapBuffer; - interface->fBindFragDataLocationIndexed = + functions->fMapBuffer = debugGLMapBuffer; + functions->fUnmapBuffer = debugGLUnmapBuffer; + functions->fBindFragDataLocationIndexed = noOpGLBindFragDataLocationIndexed; return interface; diff --git a/src/gpu/gl/iOS/GrGLCreateNativeInterface_iOS.cpp b/src/gpu/gl/iOS/GrGLCreateNativeInterface_iOS.cpp index d00ffdfec8..3f3007a008 100644 --- a/src/gpu/gl/iOS/GrGLCreateNativeInterface_iOS.cpp +++ b/src/gpu/gl/iOS/GrGLCreateNativeInterface_iOS.cpp @@ -15,131 +15,131 @@ const GrGLInterface* GrGLCreateNativeInterface() { GrGLInterface* interface = SkNEW(GrGLInterface); - interface->fActiveTexture = glActiveTexture; - interface->fAttachShader = glAttachShader; - interface->fBindAttribLocation = glBindAttribLocation; - interface->fBindBuffer = glBindBuffer; - interface->fBindTexture = glBindTexture; - interface->fBlendColor = glBlendColor; - interface->fBlendFunc = glBlendFunc; - interface->fBufferData = (GrGLBufferDataProc)glBufferData; - interface->fBufferSubData = (GrGLBufferSubDataProc)glBufferSubData; - interface->fClear = glClear; - interface->fClearColor = glClearColor; - interface->fClearStencil = glClearStencil; - interface->fColorMask = glColorMask; - interface->fCompileShader = glCompileShader; - interface->fCompressedTexImage2D = glCompressedTexImage2D; - interface->fCopyTexSubImage2D = glCopyTexSubImage2D; - interface->fCreateProgram = glCreateProgram; - interface->fCreateShader = glCreateShader; - interface->fCullFace = glCullFace; - interface->fDeleteBuffers = glDeleteBuffers; - interface->fDeleteProgram = glDeleteProgram; - interface->fDeleteShader = glDeleteShader; - interface->fDeleteTextures = glDeleteTextures; - interface->fDepthMask = glDepthMask; - interface->fDisable = glDisable; - interface->fDisableVertexAttribArray = glDisableVertexAttribArray; - interface->fDrawArrays = glDrawArrays; - interface->fDrawBuffer = NULL; - interface->fDrawBuffers = NULL; - interface->fDrawElements = glDrawElements; - interface->fEnable = glEnable; - interface->fEnableVertexAttribArray = glEnableVertexAttribArray; - interface->fFinish = glFinish; - interface->fFlush = glFlush; - interface->fFrontFace = glFrontFace; - interface->fGenBuffers = glGenBuffers; - interface->fGenerateMipmap = glGenerateMipmap; - interface->fGetBufferParameteriv = glGetBufferParameteriv; - interface->fGetError = glGetError; - interface->fGetIntegerv = glGetIntegerv; - interface->fGetProgramInfoLog = glGetProgramInfoLog; - interface->fGetProgramiv = glGetProgramiv; - interface->fGetShaderInfoLog = glGetShaderInfoLog; - interface->fGetShaderiv = glGetShaderiv; - interface->fGetString = glGetString; - interface->fGenTextures = glGenTextures; - interface->fGetUniformLocation = glGetUniformLocation; - interface->fLineWidth = glLineWidth; - interface->fLinkProgram = glLinkProgram; - interface->fPixelStorei = glPixelStorei; - interface->fReadBuffer = NULL; - interface->fReadPixels = glReadPixels; - interface->fScissor = glScissor; - interface->fShaderSource = glShaderSource; - interface->fStencilFunc = glStencilFunc; - interface->fStencilFuncSeparate = glStencilFuncSeparate; - interface->fStencilMask = glStencilMask; - interface->fStencilMaskSeparate = glStencilMaskSeparate; - interface->fStencilOp = glStencilOp; - interface->fStencilOpSeparate = glStencilOpSeparate; + functions->fActiveTexture = glActiveTexture; + functions->fAttachShader = glAttachShader; + functions->fBindAttribLocation = glBindAttribLocation; + functions->fBindBuffer = glBindBuffer; + functions->fBindTexture = glBindTexture; + functions->fBlendColor = glBlendColor; + functions->fBlendFunc = glBlendFunc; + functions->fBufferData = (GrGLBufferDataProc)glBufferData; + functions->fBufferSubData = (GrGLBufferSubDataProc)glBufferSubData; + functions->fClear = glClear; + functions->fClearColor = glClearColor; + functions->fClearStencil = glClearStencil; + functions->fColorMask = glColorMask; + functions->fCompileShader = glCompileShader; + functions->fCompressedTexImage2D = glCompressedTexImage2D; + functions->fCopyTexSubImage2D = glCopyTexSubImage2D; + functions->fCreateProgram = glCreateProgram; + functions->fCreateShader = glCreateShader; + functions->fCullFace = glCullFace; + functions->fDeleteBuffers = glDeleteBuffers; + functions->fDeleteProgram = glDeleteProgram; + functions->fDeleteShader = glDeleteShader; + functions->fDeleteTextures = glDeleteTextures; + functions->fDepthMask = glDepthMask; + functions->fDisable = glDisable; + functions->fDisableVertexAttribArray = glDisableVertexAttribArray; + functions->fDrawArrays = glDrawArrays; + functions->fDrawBuffer = NULL; + functions->fDrawBuffers = NULL; + functions->fDrawElements = glDrawElements; + functions->fEnable = glEnable; + functions->fEnableVertexAttribArray = glEnableVertexAttribArray; + functions->fFinish = glFinish; + functions->fFlush = glFlush; + functions->fFrontFace = glFrontFace; + functions->fGenBuffers = glGenBuffers; + functions->fGenerateMipmap = glGenerateMipmap; + functions->fGetBufferParameteriv = glGetBufferParameteriv; + functions->fGetError = glGetError; + functions->fGetIntegerv = glGetIntegerv; + functions->fGetProgramInfoLog = glGetProgramInfoLog; + functions->fGetProgramiv = glGetProgramiv; + functions->fGetShaderInfoLog = glGetShaderInfoLog; + functions->fGetShaderiv = glGetShaderiv; + functions->fGetString = glGetString; + functions->fGenTextures = glGenTextures; + functions->fGetUniformLocation = glGetUniformLocation; + functions->fLineWidth = glLineWidth; + functions->fLinkProgram = glLinkProgram; + functions->fPixelStorei = glPixelStorei; + functions->fReadBuffer = NULL; + functions->fReadPixels = glReadPixels; + functions->fScissor = glScissor; + functions->fShaderSource = glShaderSource; + functions->fStencilFunc = glStencilFunc; + functions->fStencilFuncSeparate = glStencilFuncSeparate; + functions->fStencilMask = glStencilMask; + functions->fStencilMaskSeparate = glStencilMaskSeparate; + functions->fStencilOp = glStencilOp; + functions->fStencilOpSeparate = glStencilOpSeparate; // mac uses GLenum for internalFormat param (non-standard) // amounts to int vs. uint. - interface->fTexImage2D = (GrGLTexImage2DProc)glTexImage2D; + functions->fTexImage2D = (GrGLTexImage2DProc)glTexImage2D; #if GL_ARB_texture_storage - interface->fTexStorage2D = glTexStorage2D; + functions->fTexStorage2D = glTexStorage2D; #elif GL_EXT_texture_storage - interface->fTexStorage2D = glTexStorage2DEXT; + functions->fTexStorage2D = glTexStorage2DEXT; #endif #if GL_EXT_discard_framebuffer - interface->fDiscardFramebuffer = glDiscardFramebufferEXT; + functions->fDiscardFramebuffer = glDiscardFramebufferEXT; #endif - interface->fTexParameteri = glTexParameteri; - interface->fTexParameteriv = glTexParameteriv; - interface->fTexSubImage2D = glTexSubImage2D; - interface->fUniform1f = glUniform1f; - interface->fUniform1i = glUniform1i; - interface->fUniform1fv = glUniform1fv; - interface->fUniform1iv = glUniform1iv; - interface->fUniform2f = glUniform2f; - interface->fUniform2i = glUniform2i; - interface->fUniform2fv = glUniform2fv; - interface->fUniform2iv = glUniform2iv; - interface->fUniform3f = glUniform3f; - interface->fUniform3i = glUniform3i; - interface->fUniform3fv = glUniform3fv; - interface->fUniform3iv = glUniform3iv; - interface->fUniform4f = glUniform4f; - interface->fUniform4i = glUniform4i; - interface->fUniform4fv = glUniform4fv; - interface->fUniform4iv = glUniform4iv; - interface->fUniform4fv = glUniform4fv; - interface->fUniformMatrix2fv = glUniformMatrix2fv; - interface->fUniformMatrix3fv = glUniformMatrix3fv; - interface->fUniformMatrix4fv = glUniformMatrix4fv; - interface->fUseProgram = glUseProgram; - interface->fVertexAttrib4fv = glVertexAttrib4fv; - interface->fVertexAttribPointer = glVertexAttribPointer; - interface->fViewport = glViewport; - interface->fGenFramebuffers = glGenFramebuffers; - interface->fGetFramebufferAttachmentParameteriv = glGetFramebufferAttachmentParameteriv; - interface->fGetRenderbufferParameteriv = glGetRenderbufferParameteriv; - interface->fBindFramebuffer = glBindFramebuffer; - interface->fFramebufferTexture2D = glFramebufferTexture2D; - interface->fCheckFramebufferStatus = glCheckFramebufferStatus; - interface->fDeleteFramebuffers = glDeleteFramebuffers; - interface->fRenderbufferStorage = glRenderbufferStorage; - interface->fGenRenderbuffers = glGenRenderbuffers; - interface->fDeleteRenderbuffers = glDeleteRenderbuffers; - interface->fFramebufferRenderbuffer = glFramebufferRenderbuffer; - interface->fBindRenderbuffer = glBindRenderbuffer; + functions->fTexParameteri = glTexParameteri; + functions->fTexParameteriv = glTexParameteriv; + functions->fTexSubImage2D = glTexSubImage2D; + functions->fUniform1f = glUniform1f; + functions->fUniform1i = glUniform1i; + functions->fUniform1fv = glUniform1fv; + functions->fUniform1iv = glUniform1iv; + functions->fUniform2f = glUniform2f; + functions->fUniform2i = glUniform2i; + functions->fUniform2fv = glUniform2fv; + functions->fUniform2iv = glUniform2iv; + functions->fUniform3f = glUniform3f; + functions->fUniform3i = glUniform3i; + functions->fUniform3fv = glUniform3fv; + functions->fUniform3iv = glUniform3iv; + functions->fUniform4f = glUniform4f; + functions->fUniform4i = glUniform4i; + functions->fUniform4fv = glUniform4fv; + functions->fUniform4iv = glUniform4iv; + functions->fUniform4fv = glUniform4fv; + functions->fUniformMatrix2fv = glUniformMatrix2fv; + functions->fUniformMatrix3fv = glUniformMatrix3fv; + functions->fUniformMatrix4fv = glUniformMatrix4fv; + functions->fUseProgram = glUseProgram; + functions->fVertexAttrib4fv = glVertexAttrib4fv; + functions->fVertexAttribPointer = glVertexAttribPointer; + functions->fViewport = glViewport; + functions->fGenFramebuffers = glGenFramebuffers; + functions->fGetFramebufferAttachmentParameteriv = glGetFramebufferAttachmentParameteriv; + functions->fGetRenderbufferParameteriv = glGetRenderbufferParameteriv; + functions->fBindFramebuffer = glBindFramebuffer; + functions->fFramebufferTexture2D = glFramebufferTexture2D; + functions->fCheckFramebufferStatus = glCheckFramebufferStatus; + functions->fDeleteFramebuffers = glDeleteFramebuffers; + functions->fRenderbufferStorage = glRenderbufferStorage; + functions->fGenRenderbuffers = glGenRenderbuffers; + functions->fDeleteRenderbuffers = glDeleteRenderbuffers; + functions->fFramebufferRenderbuffer = glFramebufferRenderbuffer; + functions->fBindRenderbuffer = glBindRenderbuffer; #if GL_OES_mapbuffer - interface->fMapBuffer = glMapBufferOES; - interface->fUnmapBuffer = glUnmapBufferOES; + functions->fMapBuffer = glMapBufferOES; + functions->fUnmapBuffer = glUnmapBufferOES; #endif #if GL_APPLE_framebuffer_multisample - interface->fRenderbufferStorageMultisample = glRenderbufferStorageMultisampleAPPLE; - interface->fResolveMultisampleFramebuffer = glResolveMultisampleFramebufferAPPLE; + functions->fRenderbufferStorageMultisample = glRenderbufferStorageMultisampleAPPLE; + functions->fResolveMultisampleFramebuffer = glResolveMultisampleFramebufferAPPLE; #endif #if GL_OES_vertex_array_object - interface->fBindVertexArray = glBindVertexArrayOES; - interface->fDeleteVertexArrays = glDeleteVertexArraysOES; - interface->fGenVertexArrays = glGenVertexArraysOES; + functions->fBindVertexArray = glBindVertexArrayOES; + functions->fDeleteVertexArrays = glDeleteVertexArraysOES; + functions->fGenVertexArrays = glGenVertexArraysOES; #endif interface->fStandard = kGLES_GrGLStandard; diff --git a/src/gpu/gl/mac/GrGLCreateNativeInterface_mac.cpp b/src/gpu/gl/mac/GrGLCreateNativeInterface_mac.cpp index 96a38af539..f57b80ebc7 100644 --- a/src/gpu/gl/mac/GrGLCreateNativeInterface_mac.cpp +++ b/src/gpu/gl/mac/GrGLCreateNativeInterface_mac.cpp @@ -38,8 +38,8 @@ static void* GetProcAddress(const char* name) { return dlsym(gLoader.handle(), name); } -#define GET_PROC(name) (interface->f ## name = ((GrGL ## name ## Proc) GetProcAddress("gl" #name))) -#define GET_PROC_SUFFIX(name, suffix) (interface->f ## name = ((GrGL ## name ## Proc) GetProcAddress("gl" #name #suffix))) +#define GET_PROC(name) (interface->fFunctions.f ## name = ((GrGL ## name ## Proc) GetProcAddress("gl" #name))) +#define GET_PROC_SUFFIX(name, suffix) (interface->fFunctions.f ## name = ((GrGL ## name ## Proc) GetProcAddress("gl" #name #suffix))) const GrGLInterface* GrGLCreateNativeInterface() { diff --git a/src/gpu/gl/mesa/GrGLCreateMesaInterface.cpp b/src/gpu/gl/mesa/GrGLCreateMesaInterface.cpp index 709c3ae018..59314445b3 100644 --- a/src/gpu/gl/mesa/GrGLCreateMesaInterface.cpp +++ b/src/gpu/gl/mesa/GrGLCreateMesaInterface.cpp @@ -13,9 +13,9 @@ #define GL_GLEXT_PROTOTYPES #include "osmesa_wrapper.h" -#define GR_GL_GET_PROC(F) interface->f ## F = (GrGL ## F ## Proc) \ +#define GR_GL_GET_PROC(F) interface->fFunctions.f ## F = (GrGL ## F ## Proc) \ OSMesaGetProcAddress("gl" #F); -#define GR_GL_GET_PROC_SUFFIX(F, S) interface->f ## F = (GrGL ## F ## Proc) \ +#define GR_GL_GET_PROC_SUFFIX(F, S) interface->fFunctions.f ## F = (GrGL ## F ## Proc) \ OSMesaGetProcAddress("gl" #F #S); // We use OSMesaGetProcAddress for every gl function to avoid accidentally using @@ -141,7 +141,7 @@ const GrGLInterface* GrGLCreateMesaInterface() { GR_GL_GET_PROC(TexParameteri); GR_GL_GET_PROC(TexParameteriv); GR_GL_GET_PROC(TexStorage2D); - if (NULL == interface->fTexStorage2D) { + if (NULL == interface->fFunctions.fTexStorage2D) { GR_GL_GET_PROC_SUFFIX(TexStorage2D, EXT); } GR_GL_GET_PROC(TexSubImage2D); diff --git a/src/gpu/gl/unix/GrGLCreateNativeInterface_unix.cpp b/src/gpu/gl/unix/GrGLCreateNativeInterface_unix.cpp index a120808a3d..67d7ef5a5f 100644 --- a/src/gpu/gl/unix/GrGLCreateNativeInterface_unix.cpp +++ b/src/gpu/gl/unix/GrGLCreateNativeInterface_unix.cpp @@ -15,9 +15,9 @@ #include <GL/glext.h> #include <GL/glu.h> -#define GR_GL_GET_PROC(F) interface->f ## F = (GrGL ## F ## Proc) \ +#define GR_GL_GET_PROC(F) interface->fFunctions.f ## F = (GrGL ## F ## Proc) \ glXGetProcAddress(reinterpret_cast<const GLubyte*>("gl" #F)); -#define GR_GL_GET_PROC_SUFFIX(F, S) interface->f ## F = (GrGL ## F ## Proc) \ +#define GR_GL_GET_PROC_SUFFIX(F, S) interface->fFunctions.f ## F = (GrGL ## F ## Proc) \ glXGetProcAddress(reinterpret_cast<const GLubyte*>("gl" #F #S)); const GrGLInterface* GrGLCreateNativeInterface() { @@ -41,15 +41,16 @@ const GrGLInterface* GrGLCreateNativeInterface() { } GrGLInterface* interface = SkNEW(GrGLInterface()); + GrGLInterface::Functions* functions = &interface->fFunctions; - interface->fActiveTexture = glActiveTexture; + functions->fActiveTexture = glActiveTexture; GR_GL_GET_PROC(AttachShader); GR_GL_GET_PROC(BindAttribLocation); GR_GL_GET_PROC(BindBuffer); GR_GL_GET_PROC(BindFragDataLocation); GR_GL_GET_PROC(BeginQuery); - interface->fBindTexture = glBindTexture; - interface->fBlendFunc = glBlendFunc; + functions->fBindTexture = glBindTexture; + functions->fBlendFunc = glBlendFunc; if (glVer >= GR_GL_VER(1,4) || extensions.has("GL_ARB_imaging") || @@ -59,42 +60,42 @@ const GrGLInterface* GrGLCreateNativeInterface() { GR_GL_GET_PROC(BufferData); GR_GL_GET_PROC(BufferSubData); - interface->fClear = glClear; - interface->fClearColor = glClearColor; - interface->fClearStencil = glClearStencil; - interface->fClientActiveTexture = glClientActiveTexture; - interface->fColorMask = glColorMask; + functions->fClear = glClear; + functions->fClearColor = glClearColor; + functions->fClearStencil = glClearStencil; + functions->fClientActiveTexture = glClientActiveTexture; + functions->fColorMask = glColorMask; GR_GL_GET_PROC(CompileShader); - interface->fCompressedTexImage2D = glCompressedTexImage2D; - interface->fCopyTexSubImage2D = glCopyTexSubImage2D; + functions->fCompressedTexImage2D = glCompressedTexImage2D; + functions->fCopyTexSubImage2D = glCopyTexSubImage2D; GR_GL_GET_PROC(CreateProgram); GR_GL_GET_PROC(CreateShader); - interface->fCullFace = glCullFace; + functions->fCullFace = glCullFace; GR_GL_GET_PROC(DeleteBuffers); GR_GL_GET_PROC(DeleteProgram); GR_GL_GET_PROC(DeleteQueries); GR_GL_GET_PROC(DeleteShader); - interface->fDeleteTextures = glDeleteTextures; - interface->fDepthMask = glDepthMask; - interface->fDisable = glDisable; - interface->fDisableClientState = glDisableClientState; + functions->fDeleteTextures = glDeleteTextures; + functions->fDepthMask = glDepthMask; + functions->fDisable = glDisable; + functions->fDisableClientState = glDisableClientState; GR_GL_GET_PROC(DisableVertexAttribArray); - interface->fDrawArrays = glDrawArrays; - interface->fDrawBuffer = glDrawBuffer; + functions->fDrawArrays = glDrawArrays; + functions->fDrawBuffer = glDrawBuffer; GR_GL_GET_PROC(DrawBuffers); - interface->fDrawElements = glDrawElements; - interface->fEnable = glEnable; - interface->fEnableClientState = glEnableClientState; + functions->fDrawElements = glDrawElements; + functions->fEnable = glEnable; + functions->fEnableClientState = glEnableClientState; GR_GL_GET_PROC(EnableVertexAttribArray); GR_GL_GET_PROC(EndQuery); - interface->fFinish = glFinish; - interface->fFlush = glFlush; - interface->fFrontFace = glFrontFace; + functions->fFinish = glFinish; + functions->fFlush = glFlush; + functions->fFrontFace = glFrontFace; GR_GL_GET_PROC(GenBuffers); GR_GL_GET_PROC(GenerateMipmap); GR_GL_GET_PROC(GetBufferParameteriv); - interface->fGetError = glGetError; - interface->fGetIntegerv = glGetIntegerv; + functions->fGetError = glGetError; + functions->fGetIntegerv = glGetIntegerv; GR_GL_GET_PROC(GetQueryObjectiv); GR_GL_GET_PROC(GetQueryObjectuiv); if (glVer >= GR_GL_VER(3,3) || extensions.has("GL_ARB_timer_query")) { @@ -110,38 +111,38 @@ const GrGLInterface* GrGLCreateNativeInterface() { GR_GL_GET_PROC(GetProgramiv); GR_GL_GET_PROC(GetShaderInfoLog); GR_GL_GET_PROC(GetShaderiv); - interface->fGetString = glGetString; + functions->fGetString = glGetString; GR_GL_GET_PROC(GetStringi); - interface->fGetTexLevelParameteriv = glGetTexLevelParameteriv; + functions->fGetTexLevelParameteriv = glGetTexLevelParameteriv; GR_GL_GET_PROC(GenQueries); - interface->fGenTextures = glGenTextures; + functions->fGenTextures = glGenTextures; GR_GL_GET_PROC(GetUniformLocation); - interface->fLineWidth = glLineWidth; + functions->fLineWidth = glLineWidth; GR_GL_GET_PROC(LinkProgram); GR_GL_GET_PROC(MapBuffer); - interface->fPixelStorei = glPixelStorei; - interface->fReadBuffer = glReadBuffer; - interface->fReadPixels = glReadPixels; - interface->fScissor = glScissor; + functions->fPixelStorei = glPixelStorei; + functions->fReadBuffer = glReadBuffer; + functions->fReadPixels = glReadPixels; + functions->fScissor = glScissor; GR_GL_GET_PROC(ShaderSource); - interface->fStencilFunc = glStencilFunc; + functions->fStencilFunc = glStencilFunc; GR_GL_GET_PROC(StencilFuncSeparate); - interface->fStencilMask = glStencilMask; + functions->fStencilMask = glStencilMask; GR_GL_GET_PROC(StencilMaskSeparate); - interface->fStencilOp = glStencilOp; + functions->fStencilOp = glStencilOp; GR_GL_GET_PROC(StencilOpSeparate); - interface->fTexImage2D = glTexImage2D; - interface->fTexGenf = glTexGenf; - interface->fTexGenfv = glTexGenfv; - interface->fTexGeni = glTexGeni; - interface->fTexParameteri = glTexParameteri; - interface->fTexParameteriv = glTexParameteriv; + functions->fTexImage2D = glTexImage2D; + functions->fTexGenf = glTexGenf; + functions->fTexGenfv = glTexGenfv; + functions->fTexGeni = glTexGeni; + functions->fTexParameteri = glTexParameteri; + functions->fTexParameteriv = glTexParameteriv; if (glVer >= GR_GL_VER(4,2) || extensions.has("GL_ARB_texture_storage")) { GR_GL_GET_PROC(TexStorage2D); } else if (extensions.has("GL_EXT_texture_storage")) { GR_GL_GET_PROC_SUFFIX(TexStorage2D, EXT); } - interface->fTexSubImage2D = glTexSubImage2D; + functions->fTexSubImage2D = glTexSubImage2D; GR_GL_GET_PROC(Uniform1f); GR_GL_GET_PROC(Uniform1i); GR_GL_GET_PROC(Uniform1fv); @@ -166,7 +167,7 @@ const GrGLInterface* GrGLCreateNativeInterface() { GR_GL_GET_PROC(VertexAttrib4fv); GR_GL_GET_PROC(VertexAttribPointer); GR_GL_GET_PROC(VertexPointer); - interface->fViewport = glViewport; + functions->fViewport = glViewport; GR_GL_GET_PROC(BindFragDataLocationIndexed); if (glVer >= GR_GL_VER(3,0) || extensions.has("GL_ARB_vertex_array_object")) { diff --git a/src/gpu/gl/win/GrGLCreateNativeInterface_win.cpp b/src/gpu/gl/win/GrGLCreateNativeInterface_win.cpp index e011605edf..e901b3602c 100644 --- a/src/gpu/gl/win/GrGLCreateNativeInterface_win.cpp +++ b/src/gpu/gl/win/GrGLCreateNativeInterface_win.cpp @@ -17,10 +17,9 @@ * Otherwise, a springboard would be needed that hides the calling convention. */ -#define SET_PROC(F) interface->f ## F = (GrGL ## F ## Proc) GetProcAddress(alu.get(), "gl" #F); -#define WGL_SET_PROC(F) interface->f ## F = (GrGL ## F ## Proc) wglGetProcAddress("gl" #F); -#define WGL_SET_PROC_SUFFIX(F, S) interface->f ## F = \ - (GrGL ## F ## Proc) wglGetProcAddress("gl" #F #S); +#define SET_PROC(F) interface->fFunctions.f ## F = (GrGL ## F ## Proc) GetProcAddress(alu.get(), "gl" #F); +#define WGL_SET_PROC(F) interface->fFunctions.f ## F = (GrGL ## F ## Proc) wglGetProcAddress("gl" #F); +#define WGL_SET_PROC_SUFFIX(F, S) interface->fFunctions.f ## F = (GrGL ## F ## Proc) wglGetProcAddress("gl" #F #S); class AutoLibraryUnload { public: |