diff options
author | Zolnai Tamás <tamas.zolnai@collabora.com> | 2014-08-18 09:31:06 +0200 |
---|---|---|
committer | David Tardon <dtardon@redhat.com> | 2014-08-18 12:20:54 -0500 |
commit | cf2afb05dd571bd85d75385a8254454da99951ee (patch) | |
tree | 733813fedcda6469039cdca2bbc1d82bfb074509 /external/libgltf/pathces/append_shader_version.patch | |
parent | Updated core (diff) | |
download | core-cf2afb05dd571bd85d75385a8254454da99951ee.tar.gz core-cf2afb05dd571bd85d75385a8254454da99951ee.zip |
libgltf: Append shader language version to the shader files
In general glTF shader files does not contain version
directives and in some case it make shader compiler
using GLSL 1.1 which leads to that the shader compiler
fails.
So we need to append the choosen version number which is
GLSL 1.3 in case of libgltf, but this also means that
from that point OpenGL 3.0 is the new reuirements since
GLSL 1.3 is available only from that version.
(cherry picked from commit c67026f27023008d124c8ab76533169f032b04f6)
Conflicts:
external/libgltf/UnpackedTarball_libgltf.mk
Change-Id: Ic4382266432ea474aeb3e603b32a998b9aeed280
Reviewed-on: https://gerrit.libreoffice.org/10948
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
Reviewed-by: David Tardon <dtardon@redhat.com>
Tested-by: David Tardon <dtardon@redhat.com>
Diffstat (limited to 'external/libgltf/pathces/append_shader_version.patch')
-rw-r--r-- | external/libgltf/pathces/append_shader_version.patch | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/external/libgltf/pathces/append_shader_version.patch b/external/libgltf/pathces/append_shader_version.patch new file mode 100644 index 000000000000..27f0cc66ee36 --- /dev/null +++ b/external/libgltf/pathces/append_shader_version.patch @@ -0,0 +1,37 @@ +diff -ur libgltf.org/src/Shaders.cpp libgltf/src/Shaders.cpp +--- 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> + #include <cstdio> ++#include <cstring> + + namespace libgltf + { +@@ -166,7 +167,24 @@ + unsigned int shaderId) + { + GLint iGLSize = iSize; +- glShaderSource(shaderId, 1, &pShader, &iGLSize); ++ if( strstr(pShader,"#version") == 0 ) ++ { ++ const GLchar* aSources[] = { ++ "#version 130\n", ++ pShader, ++ }; ++ ++ const GLint aSizes[] = { ++ strlen("#version 130\n"), ++ iGLSize, ++ }; ++ ++ glShaderSource(shaderId, 2, &aSources[0], &aSizes[0]); ++ } ++ else ++ { ++ glShaderSource(shaderId, 1, &pShader, &iGLSize); ++ } + glCompileShader(shaderId); + int iStatus = 0; + glGetShaderiv(shaderId, GL_COMPILE_STATUS, &iStatus); |