Because the variable declaration holds more information than
the dereference. Note that an image is considered bindless either
if it has been declared in the default uniform block with the
bindless_sampler layout qualifier, or when its storage is not
uniform because this is not allowed without ARB_bindless_texture.

Signed-off-by: Samuel Pitoiset <samuel.pitoi...@gmail.com>
---
 src/compiler/glsl/opt_tree_grafting.cpp | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/src/compiler/glsl/opt_tree_grafting.cpp 
b/src/compiler/glsl/opt_tree_grafting.cpp
index 28b6e1856e..d4a1ec5675 100644
--- a/src/compiler/glsl/opt_tree_grafting.cpp
+++ b/src/compiler/glsl/opt_tree_grafting.cpp
@@ -371,6 +371,15 @@ tree_grafting_basic_block(ir_instruction *bb_first,
       if (lhs_var->data.precise)
          continue;
 
+      if (lhs_var->type->is_image() &&
+          (lhs_var->data.bindless || lhs_var->data.mode != ir_var_uniform)) {
+         /* Disable tree grafting optimization for bindless image types because
+          * the variable declaration holds more information than the
+          * dereference.
+          */
+         continue;
+      }
+
       ir_variable_refcount_entry *entry = 
info->refs->get_variable_entry(lhs_var);
 
       if (!entry->declaration ||
-- 
2.12.2

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to