Add support for new glShaderSource() signature from Khronos. Disabled by default.

Review URL: https://codereview.appspot.com/6853068

git-svn-id: http://skia.googlecode.com/svn/trunk@6491 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
senorblanco@chromium.org 2012-11-19 20:43:10 +00:00
parent 15393c7f34
commit e0d44ff614
6 changed files with 30 additions and 0 deletions

View File

@ -375,6 +375,15 @@ inline void GrCrash(const char* msg) { GrPrintf(msg); GrAlwaysAssert(false); }
#define GR_DEFAULT_TEXTURE_CACHE_MB_LIMIT 96
#endif
/**
* GR_USE_NEW_GL_SHADER_SOURCE_SIGNATURE is for compatibility with the new version
* of the OpenGLES2.0 headers from Khronos. glShaderSource now takes a const char * const *,
* instead of a const char **.
*/
#if !defined(GR_USE_NEW_GL_SHADER_SOURCE_SIGNATURE)
#define GR_USE_NEW_GL_SHADER_SOURCE_SIGNATURE 0
#endif
///////////////////////////////////////////////////////////////////////////////
// tail section:
//

View File

@ -122,7 +122,11 @@ extern "C" {
typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLRenderbufferStorageMultisampleCoverageProc)(GrGLenum target, GrGLsizei coverageSamples, GrGLsizei colorSamples, GrGLenum internalformat, GrGLsizei width, GrGLsizei height);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLResolveMultisampleFramebufferProc)();
typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLScissorProc)(GrGLint x, GrGLint y, GrGLsizei width, GrGLsizei height);
#if GR_USE_NEW_GL_SHADER_SOURCE_SIGNATURE
typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLShaderSourceProc)(GrGLuint shader, GrGLsizei count, const char* const * str, const GrGLint* length);
#else
typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLShaderSourceProc)(GrGLuint shader, GrGLsizei count, const char** str, const GrGLint* length);
#endif
typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLStencilFuncProc)(GrGLenum func, GrGLint ref, GrGLuint mask);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLStencilFuncSeparateProc)(GrGLenum face, GrGLenum func, GrGLint ref, GrGLuint mask);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLStencilMaskProc)(GrGLuint mask);

View File

@ -49,7 +49,11 @@ GrGLvoid GR_GL_FUNCTION_TYPE nullGLQueryCounter(GrGLuint id, GrGLenum target) {}
GrGLvoid GR_GL_FUNCTION_TYPE nullGLReadBuffer(GrGLenum src) {}
GrGLvoid GR_GL_FUNCTION_TYPE nullGLReadPixels(GrGLint x, GrGLint y, GrGLsizei width, GrGLsizei height, GrGLenum format, GrGLenum type, GrGLvoid* pixels) {}
GrGLvoid GR_GL_FUNCTION_TYPE nullGLScissor(GrGLint x, GrGLint y, GrGLsizei width, GrGLsizei height) {}
#if GR_USE_NEW_GL_SHADER_SOURCE_SIGNATURE
GrGLvoid GR_GL_FUNCTION_TYPE nullGLShaderSource(GrGLuint shader, GrGLsizei count, const char* const * str, const GrGLint* length) {}
#else
GrGLvoid GR_GL_FUNCTION_TYPE nullGLShaderSource(GrGLuint shader, GrGLsizei count, const char** str, const GrGLint* length) {}
#endif
GrGLvoid GR_GL_FUNCTION_TYPE nullGLStencilFunc(GrGLenum func, GrGLint ref, GrGLuint mask) {}
GrGLvoid GR_GL_FUNCTION_TYPE nullGLStencilFuncSeparate(GrGLenum face, GrGLenum func, GrGLint ref, GrGLuint mask) {}
GrGLvoid GR_GL_FUNCTION_TYPE nullGLStencilMask(GrGLuint mask) {}

View File

@ -69,7 +69,11 @@ const GrGLInterface* GrGLCreateNativeInterface() {
interface->fPixelStorei = glPixelStorei;
interface->fReadPixels = glReadPixels;
interface->fScissor = glScissor;
#if GR_USE_NEW_GL_SHADER_SOURCE_SIGNATURE
interface->fShaderSource = (GrGLShaderSourceProc) glShaderSource;
#else
interface->fShaderSource = glShaderSource;
#endif
interface->fStencilFunc = glStencilFunc;
interface->fStencilFuncSeparate = glStencilFuncSeparate;
interface->fStencilMask = glStencilMask;

View File

@ -318,7 +318,11 @@ GrGLvoid GR_GL_FUNCTION_TYPE debugGLScissor(GrGLint x,
GrGLvoid GR_GL_FUNCTION_TYPE debugGLShaderSource(GrGLuint shader,
GrGLsizei count,
#if GR_USE_NEW_GL_SHADER_SOURCE_SIGNATURE
const char* const * str,
#else
const char** str,
#endif
const GrGLint* length) {
}

View File

@ -109,7 +109,12 @@ const GrGLInterface* GrGLCreateNativeInterface() {
interface->fReadBuffer = glReadBuffer;
interface->fReadPixels = glReadPixels;
interface->fScissor = glScissor;
// The new OpenGLES2 header has an extra "const" in it. :(
#if GR_USE_NEW_GL_SHADER_SOURCE_SIGNATURE
interface->fShaderSource = (GrGLShaderSourceProc) glShaderSource;
#else
interface->fShaderSource = glShaderSource;
#endif
interface->fStencilFunc = glStencilFunc;
interface->fStencilFuncSeparate = glStencilFuncSeparate;
interface->fStencilMask = glStencilMask;