Mesa (master): glsl/ast: Allow redeclaration of gl_LastFragData with different precision qualifier.

Francisco Jerez currojerez at kemper.freedesktop.org
Wed Aug 24 20:31:43 UTC 2016


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

Author: Francisco Jerez <currojerez at riseup.net>
Date:   Thu Jul 14 12:52:51 2016 -0700

glsl/ast: Allow redeclaration of gl_LastFragData with different precision qualifier.

v2: No need to check the GLSL version. (Ken)

Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>

---

 src/compiler/glsl/ast_to_hir.cpp | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/src/compiler/glsl/ast_to_hir.cpp b/src/compiler/glsl/ast_to_hir.cpp
index c91ed53..581367b 100644
--- a/src/compiler/glsl/ast_to_hir.cpp
+++ b/src/compiler/glsl/ast_to_hir.cpp
@@ -3979,6 +3979,18 @@ get_variable_being_redeclared(ir_variable *var, YYLTYPE loc,
 
       earlier->data.depth_layout = var->data.depth_layout;
 
+   } else if (state->has_framebuffer_fetch() &&
+              strcmp(var->name, "gl_LastFragData") == 0 &&
+              var->type == earlier->type &&
+              var->data.mode == ir_var_auto) {
+      /* According to the EXT_shader_framebuffer_fetch spec:
+       *
+       *   "By default, gl_LastFragData is declared with the mediump precision
+       *    qualifier. This can be changed by redeclaring the corresponding
+       *    variables with the desired precision qualifier."
+       */
+      earlier->data.precision = var->data.precision;
+
    } else if (allow_all_redeclarations) {
       if (earlier->data.mode != var->data.mode) {
          _mesa_glsl_error(&loc, state,




More information about the mesa-commit mailing list