diff options
author | Samuel Pitoiset <samuel.pitoiset@gmail.com> | 2017-04-19 18:39:38 +0200 |
---|---|---|
committer | Samuel Pitoiset <samuel.pitoiset@gmail.com> | 2017-04-26 16:04:45 +0200 |
commit | 4b4aa2054d97e9190531afca4811c06403edb31b (patch) | |
tree | c484049c3e1f3eb28291b69b615287097af3bbb0 | |
parent | 5ea64d6ca6b0a4b323775b9bf27afa32ca4cf046 (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."
v3: - update spec comment formatting
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
-rw-r--r-- | src/compiler/glsl/ir.cpp | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/src/compiler/glsl/ir.cpp b/src/compiler/glsl/ir.cpp index b9c4452f83..e37289afe5 100644 --- a/src/compiler/glsl/ir.cpp +++ b/src/compiler/glsl/ir.cpp @@ -1460,9 +1460,26 @@ 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; + + /* 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; + + if (var->data.read_only) return false; /* From section 4.1.7 of the GLSL 4.40 spec: |