[Mesa-dev] [PATCH v2 21/31] glsl: allow bindless samplers/images to be l-values

Samuel Pitoiset samuel.pitoiset at gmail.com
Mon Apr 24 10:35:52 UTC 2017


The ARB_bindless_texture spec says:

   "Replace Section 4.1.7 (Samplers), p. 25"

   "Samplers can be used as l-values, so can be assigned into and
   used as "out" and "inout" function parameters."

   "Replace Section 4.1.X, (Images)"

   "Images can be used as l-values, so can be assigned into and
    used as "out" and "inout" function parameters."

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

diff --git a/src/compiler/glsl/ir.cpp b/src/compiler/glsl/ir.cpp
index b9c4452f83..2b0d3522e5 100644
--- a/src/compiler/glsl/ir.cpp
+++ b/src/compiler/glsl/ir.cpp
@@ -1460,9 +1460,28 @@ ir_dereference::is_lvalue(const struct _mesa_glsl_parse_state *state) const
 {
    ir_variable *var = this->variable_referenced();
 
-   /* Every l-value derference chain eventually ends in a variable.
+   /* Every l-value dereference chain eventually ends in a variable.
     */
-   if ((var == NULL) || var->data.read_only)
+   if (!var)
+      return false;
+
+   /* The ARB_bindless_texture spec says:
+    *
+    * "Replace Section 4.1.7 (Samplers), p. 25"
+    *
+    * "Samplers can be used as l-values, so can be assigned into and used as
+    *  "out" and "inout" function parameters."
+    *
+    * "Replace Section 4.1.X, (Images)"
+    *
+    * "Images can be used as l-values, so can be assigned into and used as
+    *  "out" and "inout" function parameters."
+    */
+   if (state && state->has_bindless() &&
+       (this->type->contains_sampler() || this->type->contains_image()))
+      return true;
+
+   if (var->data.read_only)
       return false;
 
    /* From section 4.1.7 of the GLSL 4.40 spec:
-- 
2.12.2



More information about the mesa-dev mailing list