[Mesa-dev] [PATCH v2 19/31] glsl: fix explicit binding location for bindless samplers/images

Timothy Arceri tarceri at itsqueeze.com
Wed Apr 26 04:17:10 UTC 2017



On 24/04/17 20:35, Samuel Pitoiset wrote:
> The ARB_bindless_texture spec says:
> 
>     "Interactions with GLSL 4.20"
> 
>     "Without GLSL 4.20 support, sampler and image uniforms may only
>      be initialized through the OpenGL API. With GLSL 4.20, sampler
>      and image uniforms may be initialized in the shader using
> 
>      layout(binding = integer-constant)
> 
>      as described in section 4.4.4 "Opaque-Uniform Layout Qualifiers".
>      When ARB_bindless_texture is supported, these initial binding
>      values are always taken to mean a texture image or image unit
>      number, not a bindless handle."
> 
> Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
> ---
>   src/compiler/glsl/ast_to_hir.cpp | 20 ++++++++++++++++++++
>   1 file changed, 20 insertions(+)
> 
> diff --git a/src/compiler/glsl/ast_to_hir.cpp b/src/compiler/glsl/ast_to_hir.cpp
> index ae81ed95d8..943c25a224 100644
> --- a/src/compiler/glsl/ast_to_hir.cpp
> +++ b/src/compiler/glsl/ast_to_hir.cpp
> @@ -2920,6 +2920,26 @@ apply_explicit_binding(struct _mesa_glsl_parse_state *state,
>         return;
>      }
>   
> +   /* The ARB_bindless_texture_spec says:
> +    *
> +    * "Interactions with GLSL 4.20"
> +    *
> +    * "Without GLSL 4.20 support, sampler and image uniforms may only be
> +    *  initialized through the OpenGL API. With GLSL 4.20, sampler and image
> +    *  uniforms may be initialized in the shader using
> +    *
> +    *  layout(binding = integer-constant)
> +    *
> +    *  as described in section 4.4.4 "Opaque-Uniform Layout Qualifiers".  When
> +    *  ARB_bindless_texture is supported, these initial binding values are
> +    *  always taken to mean a texture image or image unit number, not a
> +    *  bindless handle."
> +    */
> +   if (state->has_bindless() &&
> +       (base_type->is_sampler() || base_type->is_image())) {
> +      var->data.bindless = false;
> +   }

You could probably just drop the has_bindless() check here. Either way:

16-19 are:

Reviewed-by: Timothy Arceri <tarceri at itsqueeze.com>

> +
>      var->data.explicit_binding = true;
>      var->data.binding = qual_binding;
>   
> 


More information about the mesa-dev mailing list