diff options
author | Emmanuel Gil Peyrot <emmanuel.peyrot@collabora.com> | 2016-02-24 20:21:11 +0000 |
---|---|---|
committer | Tomaž Vajngerl <quikee@gmail.com> | 2016-02-25 11:11:57 +0000 |
commit | 06404309026b8e5aeb4c47ea68aea7ef21c6654e (patch) | |
tree | 131abc9b5eafa8ced9bce18fb4f8862d373035e2 /slideshow/opengl/vortexGeometryShader.glsl | |
parent | 9adeebadd5d1728e9abaec67aa4dd8a0c300c98f (diff) |
slideshow: Move Vortex calculations to the geometry stage, fixes Intel
Their Windows driver was failing due to too many varyings being used
between the vertex and the geometry stages.
Change-Id: Iec69a2ef29e6ed4ba5ce6e46c7a5eb7db5098d1b
Reviewed-on: https://gerrit.libreoffice.org/22469
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'slideshow/opengl/vortexGeometryShader.glsl')
-rw-r--r-- | slideshow/opengl/vortexGeometryShader.glsl | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/slideshow/opengl/vortexGeometryShader.glsl b/slideshow/opengl/vortexGeometryShader.glsl index 312babac1c2f..5d64a1249c90 100644 --- a/slideshow/opengl/vortexGeometryShader.glsl +++ b/slideshow/opengl/vortexGeometryShader.glsl @@ -12,11 +12,14 @@ layout(triangles) in; layout(triangle_strip, max_vertices=11) out; +uniform float shadow; +uniform mat4 u_projectionMatrix; +uniform mat4 orthoProjectionMatrix; +uniform mat4 orthoViewMatrix; + in vec2 g_texturePosition[]; in vec3 g_normal[]; -in mat4 projectionMatrix[]; in mat4 modelViewMatrix[]; -in mat4 shadowMatrix[]; in mat4 transform[]; in float nTime[]; in float startTime[]; @@ -52,6 +55,17 @@ mat4 translationMatrix(vec3 axis) void emitHexagonVertex(int index, vec3 translation, float fdsq) { + mat4 projectionMatrix; + mat4 shadowMatrix; + + if (shadow < 0.5) { + projectionMatrix = u_projectionMatrix; + shadowMatrix = orthoProjectionMatrix * orthoViewMatrix; + } else { + projectionMatrix = orthoProjectionMatrix * orthoViewMatrix; + shadowMatrix = mat4(0.0); + } + mat4 normalMatrix = transpose(inverse(modelViewMatrix[index])); vec4 pos = gl_in[index].gl_Position + vec4(translation, 0.0); @@ -62,8 +76,8 @@ void emitHexagonVertex(int index, vec3 translation, float fdsq) v_normal = normalize(vec3(normalMatrix * transform[index] * vec4(g_normal[index], 0.0))); v_normal.z *= fdsq; - gl_Position = projectionMatrix[index] * modelViewMatrix[index] * pos; - shadowCoordinate = translationMatrix(vec3(0.5, 0.5, 0.5)) * scaleMatrix(vec3(0.5, 0.5, 0.5)) * shadowMatrix[index] * modelViewMatrix[index] * pos; + gl_Position = projectionMatrix * modelViewMatrix[index] * pos; + shadowCoordinate = translationMatrix(vec3(0.5, 0.5, 0.5)) * scaleMatrix(vec3(0.5, 0.5, 0.5)) * shadowMatrix * modelViewMatrix[index] * pos; v_texturePosition = g_texturePosition[index]; EmitVertex(); } |