[Mesa-dev] [PATCH v2 03/31] glsl: make sampler/image types as 64-bit

Timothy Arceri tarceri at itsqueeze.com
Wed Apr 26 01:36:11 UTC 2017


On 24/04/17 20:35, Samuel Pitoiset wrote:
> The ARB_bindless_texture spec says:
> 
>     "Samplers are represented using 64-bit integer handles."
> 
> and,
> 
>     "Images are represented using 64-bit integer handles."
> 
> It seems simpler to always consider sampler and image types
> as 64-bit unsigned integer.
> 
> This introduces a temporary workaround in _mesa_get_uniform()
> because at this point no flag are used to distinguish between
> bound and bindless samplers. This is going to be removed in a
> separate series. This avoids to break
> arb_shader_image_load_store-state.
> 
> Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
> ---
>   src/compiler/glsl_types.h       | 4 +++-
>   src/mesa/main/uniform_query.cpp | 4 +++-
>   2 files changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/src/compiler/glsl_types.h b/src/compiler/glsl_types.h
> index 403663f7b8..a61a522b1e 100644
> --- a/src/compiler/glsl_types.h
> +++ b/src/compiler/glsl_types.h
> @@ -72,7 +72,9 @@ static inline bool glsl_base_type_is_64bit(enum glsl_base_type type)
>   {
>      return type == GLSL_TYPE_DOUBLE ||
>             type == GLSL_TYPE_UINT64 ||
> -          type == GLSL_TYPE_INT64;
> +          type == GLSL_TYPE_INT64  ||
> +          type == GLSL_TYPE_IMAGE  ||
> +          type == GLSL_TYPE_SAMPLER;
>   }
>   
>   enum glsl_sampler_dim {
> diff --git a/src/mesa/main/uniform_query.cpp b/src/mesa/main/uniform_query.cpp
> index e400d0eb00..1fbad0d00e 100644
> --- a/src/mesa/main/uniform_query.cpp
> +++ b/src/mesa/main/uniform_query.cpp
> @@ -323,7 +323,9 @@ _mesa_get_uniform(struct gl_context *ctx, GLuint program, GLint location,
>      {
>         unsigned elements = (uni->type->is_sampler())
>   	 ? 1 : uni->type->components();
> -      const int dmul = uni->type->is_64bit() ? 2 : 1;
> +      /* XXX: Remove this workaround when bindless is fully implemented. */

You should probably be more explicit here about what is to be removed. 
Maybe:

Remove the sampler/image check workarounds when bindless is fully 
implemented.

It's not ideal to see code like this land. Out of interest how large is 
the series that removes this?

> +      const int dmul =
> +         (uni->type->is_64bit() && !uni->type->is_sampler() && !uni->type->is_image()) ? 2 : 1;
>         const int rmul = glsl_base_type_is_64bit(returnType) ? 2 : 1;
>   
>         /* Calculate the source base address *BEFORE* modifying elements to
> 


More information about the mesa-dev mailing list