[Libreoffice-commits] core.git: 2 commits - avmedia/source external/collada2gltf external/libgltf

Zolnai Tamás tamas.zolnai at collabora.com
Sun Aug 17 01:02:39 PDT 2014


 avmedia/source/opengl/oglplayer.cxx                        |   13 -----
 external/collada2gltf/patches/shader_compatibility.patch.1 |   10 ++--
 external/libgltf/UnpackedTarball_libgltf.mk                |    1 
 external/libgltf/patches/append_shader_version.patch       |   30 +++++++++++++
 4 files changed, 38 insertions(+), 16 deletions(-)

New commits:
commit c67026f27023008d124c8ab76533169f032b04f6
Author: Zolnai Tamás <tamas.zolnai at collabora.com>
Date:   Sun Aug 17 09:26:33 2014 +0200

    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

diff --git a/avmedia/source/opengl/oglplayer.cxx b/avmedia/source/opengl/oglplayer.cxx
index 431bdb8..ff766e3 100644
--- a/avmedia/source/opengl/oglplayer.cxx
+++ b/avmedia/source/opengl/oglplayer.cxx
@@ -234,18 +234,7 @@ awt::Size SAL_CALL OGLPlayer::getPreferredPlayerWindowSize() throw ( uno::Runtim
 
 static bool lcl_CheckOpenGLRequirements()
 {
-    float fVersion = OpenGLHelper::getGLVersion();
-
-    if( fVersion >= 3.0 )
-    {
-        return true;
-    }
-    else if( fVersion >= 2.1 )
-    {
-        return glewIsSupported("GL_ARB_framebuffer_object GL_ARB_vertex_array_object");
-    }
-
-    return false;
+    return OpenGLHelper::getGLVersion() >= 3.0;
 }
 
 uno::Reference< media::XPlayerWindow > SAL_CALL OGLPlayer::createPlayerWindow( const uno::Sequence< uno::Any >& rArguments )
diff --git a/external/libgltf/UnpackedTarball_libgltf.mk b/external/libgltf/UnpackedTarball_libgltf.mk
index 861eb2e..34214a2 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 0000000..dd79515
--- /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);
commit d4fccd7d2c22024800482ff2e3179f700fc83a9f
Author: Zolnai Tamás <tamas.zolnai at collabora.com>
Date:   Sun Aug 17 09:11:05 2014 +0200

    collada2gltf: it seems better not to add #version to glTF shader files
    
    Here only handle precision. Using precision unconditionally
    causing problems when shader source is compiled with GLSL 1.2.
    The #version dircetives can be added by the glTF parser.
    For example libgltf implementation:
    https://gerrit.libreoffice.org/gitweb?p=libgltf.git;a=commit;
    h=e4544a8b5ca8470a96bf28c6ccdb7461e78ca293
    
    Change-Id: I934cdfa8651a8787fbcd476cea9892bf7e89dd11

diff --git a/external/collada2gltf/patches/shader_compatibility.patch.1 b/external/collada2gltf/patches/shader_compatibility.patch.1
index 8541336..948d8ca 100644
--- a/external/collada2gltf/patches/shader_compatibility.patch.1
+++ b/external/collada2gltf/patches/shader_compatibility.patch.1
@@ -1,12 +1,14 @@
 diff -ur collada2gltf.org/shaders/commonProfileShaders.cpp collada2gltf/shaders/commonProfileShaders.cpp
---- collada2gltf.org/shaders/commonProfileShaders.cpp	2014-08-15 15:21:51.839323947 +0200
-+++ collada2gltf/shaders/commonProfileShaders.cpp	2014-08-15 15:23:36.931327850 +0200
-@@ -367,7 +367,7 @@
+--- collada2gltf.org/shaders/commonProfileShaders.cpp	2014-08-17 08:57:52.187210533 +0200
++++ collada2gltf/shaders/commonProfileShaders.cpp	2014-08-17 08:59:48.427215491 +0200
+@@ -367,7 +367,9 @@
      public:
          
          GLSLShader(shared_ptr <GLTFProfile> profile) {
 -            this->_declarations = "precision highp float;\n";;
-+            this->_declarations = "#ifdef GL_ES_VERSION_2_0\n#version 100\n#else\n#version 130\n#endif\nprecision highp float;\n";
++            this->_declarations = "#ifdef GL_ES_VERSION_2_0\n";
++            this->_declarations += "precision highp float;\n";
++            this->_declarations += "#endif\n";
              this->_body = "void main(void) {\n";
              this->_profile = profile;
          }


More information about the Libreoffice-commits mailing list