diff options
author | Zolnai Tamás <tamas.zolnai@collabora.com> | 2014-08-18 09:24:23 +0200 |
---|---|---|
committer | Zolnai Tamás <tamas.zolnai@collabora.com> | 2014-08-18 09:24:43 +0200 |
commit | 6be202585f201deaf07c57e0f2cf722cce91165e (patch) | |
tree | 5e71564433edc3aca737949e8b9b527c92f6764c /external/libgltf | |
parent | e379401618268ed7f7f5885a36b90e1f4f6cd4af (diff) |
libgltf: check for #version string in the shader before add an own one.
Change-Id: I69dbbabc5774cbce7943e77f41bb42ed7a118bcf
Diffstat (limited to 'external/libgltf')
-rw-r--r-- | external/libgltf/patches/append_shader_version.patch | 31 |
1 files changed, 19 insertions, 12 deletions
diff --git a/external/libgltf/patches/append_shader_version.patch b/external/libgltf/patches/append_shader_version.patch index dd79515946cf..27f0cc66ee36 100644 --- a/external/libgltf/patches/append_shader_version.patch +++ b/external/libgltf/patches/append_shader_version.patch @@ -1,6 +1,6 @@ diff -ur libgltf.org/src/Shaders.cpp libgltf/src/Shaders.cpp ---- libgltf.org/src/Shaders.cpp 2014-08-17 09:15:17.379255115 +0200 -+++ libgltf/src/Shaders.cpp 2014-08-17 09:16:43.323258781 +0200 +--- libgltf.org/src/Shaders.cpp 2014-08-18 09:19:48.323955939 +0200 ++++ libgltf/src/Shaders.cpp 2014-08-18 09:20:46.711953465 +0200 @@ -11,6 +11,7 @@ #include <GL/glew.h> @@ -9,22 +9,29 @@ diff -ur libgltf.org/src/Shaders.cpp libgltf/src/Shaders.cpp namespace libgltf { -@@ -166,7 +167,17 @@ +@@ -166,7 +167,24 @@ unsigned int shaderId) { GLint iGLSize = iSize; - glShaderSource(shaderId, 1, &pShader, &iGLSize); -+ const GLchar* aSources[] = { -+ "#version 130\n", -+ pShader, -+ }; ++ if( strstr(pShader,"#version") == 0 ) ++ { ++ const GLchar* aSources[] = { ++ "#version 130\n", ++ pShader, ++ }; + -+ const GLint aSizes[] = { -+ strlen("#version 130\n"), -+ iGLSize, -+ }; ++ const GLint aSizes[] = { ++ strlen("#version 130\n"), ++ iGLSize, ++ }; + -+ glShaderSource(shaderId, 2, &aSources[0], &aSizes[0]); ++ glShaderSource(shaderId, 2, &aSources[0], &aSizes[0]); ++ } ++ else ++ { ++ glShaderSource(shaderId, 1, &pShader, &iGLSize); ++ } glCompileShader(shaderId); int iStatus = 0; glGetShaderiv(shaderId, GL_COMPILE_STATUS, &iStatus); |