summaryrefslogtreecommitdiff
path: root/external/libgltf
diff options
context:
space:
mode:
authorZolnai Tamás <tamas.zolnai@collabora.com>2014-08-17 09:26:33 +0200
committerZolnai Tamás <tamas.zolnai@collabora.com>2014-08-17 09:26:33 +0200
commitc67026f27023008d124c8ab76533169f032b04f6 (patch)
treee75c7a43fc700fb11fef8485e4f5138039a8e083 /external/libgltf
parentd4fccd7d2c22024800482ff2e3179f700fc83a9f (diff)
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. Change-Id: Ic4382266432ea474aeb3e603b32a998b9aeed280
Diffstat (limited to 'external/libgltf')
-rw-r--r--external/libgltf/UnpackedTarball_libgltf.mk1
-rw-r--r--external/libgltf/patches/append_shader_version.patch30
2 files changed, 31 insertions, 0 deletions
diff --git a/external/libgltf/UnpackedTarball_libgltf.mk b/external/libgltf/UnpackedTarball_libgltf.mk
index 861eb2e576f6..34214a2b5a4c 100644
--- a/external/libgltf/UnpackedTarball_libgltf.mk
+++ b/external/libgltf/UnpackedTarball_libgltf.mk
@@ -17,6 +17,7 @@ $(eval $(call gb_UnpackedTarball_set_patchlevel,libgltf,1))
$(eval $(call gb_UnpackedTarball_add_patches,libgltf,\
external/libgltf/patches/missing_include.patch \
+ external/libgltf/patches/append_shader_version.patch \
))
# vim: set noet sw=4 ts=4:
diff --git a/external/libgltf/patches/append_shader_version.patch b/external/libgltf/patches/append_shader_version.patch
new file mode 100644
index 000000000000..dd79515946cf
--- /dev/null
+++ b/external/libgltf/patches/append_shader_version.patch
@@ -0,0 +1,30 @@
+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
+@@ -11,6 +11,7 @@
+
+ #include <GL/glew.h>
+ #include <cstdio>
++#include <cstring>
+
+ namespace libgltf
+ {
+@@ -166,7 +167,17 @@
+ unsigned int shaderId)
+ {
+ GLint iGLSize = iSize;
+- glShaderSource(shaderId, 1, &pShader, &iGLSize);
++ const GLchar* aSources[] = {
++ "#version 130\n",
++ pShader,
++ };
++
++ const GLint aSizes[] = {
++ strlen("#version 130\n"),
++ iGLSize,
++ };
++
++ glShaderSource(shaderId, 2, &aSources[0], &aSizes[0]);
+ glCompileShader(shaderId);
+ int iStatus = 0;
+ glGetShaderiv(shaderId, GL_COMPILE_STATUS, &iStatus);