[Mesa-dev] [RFC PATCH 13/26] glsl: apply image qualifiers to bindless images

Samuel Pitoiset samuel.pitoiset at gmail.com
Tue Apr 11 16:48:24 UTC 2017


The ARB_bindless_texture spec says:

   "Replace Section 4.1.X, (Images)"

   "Images may be declared as shader inputs and outputs, as uniform
    variables, as temporary variables, and as function parameters."

Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
---
 src/compiler/glsl/ast_to_hir.cpp | 27 +++++++++++++++++++++------
 1 file changed, 21 insertions(+), 6 deletions(-)

diff --git a/src/compiler/glsl/ast_to_hir.cpp b/src/compiler/glsl/ast_to_hir.cpp
index 4a0f3fe315..f52ba8181a 100644
--- a/src/compiler/glsl/ast_to_hir.cpp
+++ b/src/compiler/glsl/ast_to_hir.cpp
@@ -3383,12 +3383,27 @@ apply_image_qualifier_to_variable(const struct ast_type_qualifier *qual,
 {
    const glsl_type *base_type = var->type->without_array();
 
-   if (base_type->is_image()) {
-      if (var->data.mode != ir_var_uniform &&
-          var->data.mode != ir_var_function_in) {
-         _mesa_glsl_error(loc, state, "image variables may only be declared as "
-                          "function parameters or uniform-qualified "
-                          "global variables");
+   if (base_type->is_image() || base_type->is_bindless_image()) {
+      if (base_type->is_bindless_image()) {
+         if (var->data.mode != ir_var_auto &&
+             var->data.mode != ir_var_uniform &&
+             var->data.mode != ir_var_shader_in &&
+             var->data.mode != ir_var_shader_out &&
+             var->data.mode != ir_var_function_in &&
+             var->data.mode != ir_var_function_out &&
+             var->data.mode != ir_var_function_inout) {
+            _mesa_glsl_error(loc, state, "bindless image variables may only be "
+                             "declared as shader inputs and outputs, as "
+                             "uniform variables, as temporary variables and as "
+                             "function parameters");
+         }
+      } else {
+         if (var->data.mode != ir_var_uniform &&
+             var->data.mode != ir_var_function_in) {
+            _mesa_glsl_error(loc, state, "image variables may only be declared "
+                             "as function parameters or uniform-qualified "
+                             "global variables");
+         }
       }
 
       var->data.image_read_only |= qual->flags.q.read_only;
-- 
2.12.2



More information about the mesa-dev mailing list