[Mesa-dev] [PATCH v3 22/32] glsl: allow bindless samplers/images to be l-values
Nicolai Hähnle
nhaehnle at gmail.com
Thu May 4 12:38:12 UTC 2017
On 02.05.2017 22:53, Samuel Pitoiset wrote:
> 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
> - keep the read_only check
>
> Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
> ---
> src/compiler/glsl/ir.cpp | 14 ++++++++++++++
> 1 file changed, 14 insertions(+)
>
> diff --git a/src/compiler/glsl/ir.cpp b/src/compiler/glsl/ir.cpp
> index 538da8b28f..7b95c19723 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;
Have you considered inverting the logic for the default-parameter case? I.e.
if ((!state || state->has_bindless()) &&
(this->type->contains_sampler() || this->type->contains_image()))
Then you could skip the previous patch. I'd prefer that because it also
covers that assertion in opt_function_inlining.
Cheers,
Nicolai
> +
> /* From section 4.1.7 of the GLSL 4.40 spec:
> *
> * "Opaque variables cannot be treated as l-values; hence cannot
>
--
Lerne, wie die Welt wirklich ist,
Aber vergiss niemals, wie sie sein sollte.
More information about the mesa-dev
mailing list