Mesa (master): mesa: set GLSL 1.20 for the fixed-function fragment shader

Marek Olšák mareko at kemper.freedesktop.org
Tue Jan 10 00:04:07 UTC 2017


Module: Mesa
Branch: master
Commit: 230b756f865e2d6ae17ff9568c8dcb718840c7b2
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=230b756f865e2d6ae17ff9568c8dcb718840c7b2

Author: Marek Olšák <marek.olsak at amd.com>
Date:   Sat Jan  7 15:36:45 2017 +0100

mesa: set GLSL 1.20 for the fixed-function fragment shader

This fixes broken depth texturing after:

commit 22639a6e19f95902aef23474ad672bf489231ea7
Author: Timothy Arceri <timothy.arceri at collabora.com>
Date:   Mon Nov 21 00:29:29 2016 +1100

    st/mesa: get Version from gl_program rather than gl_shader_program

Reviewed-by: Roland Scheidegger <sroland at vmware.com>

---

 src/mesa/main/ff_fragment_shader.cpp | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/src/mesa/main/ff_fragment_shader.cpp b/src/mesa/main/ff_fragment_shader.cpp
index 48b84e8..6261b9c 100644
--- a/src/mesa/main/ff_fragment_shader.cpp
+++ b/src/mesa/main/ff_fragment_shader.cpp
@@ -1222,7 +1222,19 @@ create_new_program(struct gl_context *ctx, struct state_key *key)
     */
    p.shader_program->SeparateShader = GL_TRUE;
 
-   state->language_version = 130;
+   /* The legacy GLSL shadow functions follow the depth texture
+    * mode and return vec4. The GLSL 1.30 shadow functions return float and
+    * ignore the depth texture mode. That's a shader and state dependency
+    * that's difficult to deal with. st/mesa uses a simple but not
+    * completely correct solution: if the shader declares GLSL >= 1.30 and
+    * the depth texture mode is GL_ALPHA (000X), it sets the XXXX swizzle
+    * instead. Thus, the GLSL 1.30 shadow function will get the result in .x
+    * and legacy shadow functions will get it in .w as expected.
+    * For the fixed-function fragment shader, use 120 to get correct behavior
+    * for GL_ALPHA.
+    */
+   state->language_version = 120;
+
    state->es_shader = false;
    if (_mesa_is_gles(ctx) && ctx->Extensions.OES_EGL_image_external)
       state->OES_EGL_image_external_enable = true;




More information about the mesa-commit mailing list