summaryrefslogtreecommitdiffstats
path: root/src/compiler
diff options
context:
space:
mode:
authorSamuel Pitoiset <samuel.pitoiset@gmail.com>2017-04-19 18:39:38 +0200
committerSamuel Pitoiset <samuel.pitoiset@gmail.com>2017-05-06 16:40:19 +0200
commitefb668fb293e0cf8401e9a541c67615827974808 (patch)
tree81a420405b1be604d74a4e46cd7e9f7ae83c83e3 /src/compiler
parentfa4ebf6b8d93bdf5c47bdaa5d5b3df060d260c6d (diff)
glsl: allow bindless samplers/images to be l-values
From section 4.1.7 of the ARB_bindless_texture spec: "Samplers can be used as l-values, so can be assigned into and used as "out" and "inout" function parameters." From section 4.1.X of the ARB_bindless_texture spec: "Images can be used as l-values, so can be assigned into and used as "out" and "inout" function parameters." v4: - invert the logic v3: - update spec comment formatting - keep the read_only check Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com> Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Diffstat (limited to 'src/compiler')
-rw-r--r--src/compiler/glsl/ir.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/compiler/glsl/ir.cpp b/src/compiler/glsl/ir.cpp
index 22853f0ef38..4ae23e92f1e 100644
--- a/src/compiler/glsl/ir.cpp
+++ b/src/compiler/glsl/ir.cpp
@@ -1447,6 +1447,20 @@ ir_dereference::is_lvalue(const struct _mesa_glsl_parse_state *state) const
if ((var == NULL) || var->data.read_only)
return false;
+ /* From section 4.1.7 of the ARB_bindless_texture spec:
+ *
+ * "Samplers can be used as l-values, so can be assigned into and used as
+ * "out" and "inout" function parameters."
+ *
+ * From section 4.1.X of the ARB_bindless_texture spec:
+ *
+ * "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;
+
/* From section 4.1.7 of the GLSL 4.40 spec:
*
* "Opaque variables cannot be treated as l-values; hence cannot