Mesa (master): glsl: Initialize ir_variable_data::fb_fetch_output earlier for GL(ES) 2.

Francisco Jerez currojerez at kemper.freedesktop.org
Sun Feb 25 00:34:15 UTC 2018


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

Author: Francisco Jerez <currojerez at riseup.net>
Date:   Mon Feb 12 15:24:39 2018 -0800

glsl: Initialize ir_variable_data::fb_fetch_output earlier for GL(ES) 2.

At the same point where it is initialized on GL(ES) 3.0+ so we can
implement some common layout qualifier handling in a future commit.
Until now the fb_fetch_output flag would be inherited from the
original implicit gl_LastFragData declaration at a later point in the
AST to GLSL IR translation.

Reviewed-by: Plamena Manolova <plamena.manolova at intel.com>

---

 src/compiler/glsl/ast_to_hir.cpp | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/compiler/glsl/ast_to_hir.cpp b/src/compiler/glsl/ast_to_hir.cpp
index 41e74815f3..966450ca78 100644
--- a/src/compiler/glsl/ast_to_hir.cpp
+++ b/src/compiler/glsl/ast_to_hir.cpp
@@ -3994,8 +3994,13 @@ apply_type_qualifier_to_variable(const struct ast_type_qualifier *qual,
    else if (qual->flags.q.shared_storage)
       var->data.mode = ir_var_shader_shared;
 
-   var->data.fb_fetch_output = state->stage == MESA_SHADER_FRAGMENT &&
-                               qual->flags.q.in && qual->flags.q.out;
+   if (!is_parameter && state->has_framebuffer_fetch() &&
+       state->stage == MESA_SHADER_FRAGMENT) {
+      if (state->is_version(130, 300))
+         var->data.fb_fetch_output = qual->flags.q.in && qual->flags.q.out;
+      else
+         var->data.fb_fetch_output = (strcmp(var->name, "gl_LastFragData") == 0);
+   }
 
    if (!is_parameter && is_varying_var(var, state->stage)) {
       /* User-defined ins/outs are not permitted in compute shaders. */




More information about the mesa-commit mailing list