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
diff --git a/src/gpu/gl/GrGLCreateNullInterface.cpp b/src/gpu/gl/GrGLCreateNullInterface.cpp
index d0e2bb6..6cca6c8 100644
--- a/src/gpu/gl/GrGLCreateNullInterface.cpp
+++ b/src/gpu/gl/GrGLCreateNullInterface.cpp
@@ -49,7 +49,11 @@
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) {}
diff --git a/src/gpu/gl/android/GrGLCreateNativeInterface_android.cpp b/src/gpu/gl/android/GrGLCreateNativeInterface_android.cpp
index 688f00d..10792d9 100644
--- a/src/gpu/gl/android/GrGLCreateNativeInterface_android.cpp
+++ b/src/gpu/gl/android/GrGLCreateNativeInterface_android.cpp
@@ -69,7 +69,11 @@
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;
diff --git a/src/gpu/gl/debug/GrGLCreateDebugInterface.cpp b/src/gpu/gl/debug/GrGLCreateDebugInterface.cpp
index 4aff202..1af17b2 100644
--- a/src/gpu/gl/debug/GrGLCreateDebugInterface.cpp
+++ b/src/gpu/gl/debug/GrGLCreateDebugInterface.cpp
@@ -318,7 +318,11 @@
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) {
}
diff --git a/src/gpu/gl/mac/GrGLCreateNativeInterface_mac.cpp b/src/gpu/gl/mac/GrGLCreateNativeInterface_mac.cpp
index e0ecc38..17bfaeb 100644
--- a/src/gpu/gl/mac/GrGLCreateNativeInterface_mac.cpp
+++ b/src/gpu/gl/mac/GrGLCreateNativeInterface_mac.cpp
@@ -109,7 +109,12 @@
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;