[Mesa-dev] [PATCH] glsl: uniform sampler should occupy 1 location

Tapani Pälli tapani.palli at intel.com
Thu Aug 21 22:31:53 PDT 2014


On 08/22/2014 02:25 AM, Micael Dias wrote:
> ---
> If samplers occupy zero locations we can run into a lot of issues. See #82921.
> I briefly tested this with my own code (which was previously crashing and
> misbehaving) and also ran other apps and everything seems to work fine.
> I'm not used to contributing code in this fashion, so please forgive me if I'm
> making some mistake. Thanks.

Thanks for the patch, I sent a bit different fix to be sure all possible
types will consume at least 1 loc, this is just to be future-proof.

>  src/glsl/glsl_types.cpp | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/src/glsl/glsl_types.cpp b/src/glsl/glsl_types.cpp
> index 66e9b13..cc05193 100644
> --- a/src/glsl/glsl_types.cpp
> +++ b/src/glsl/glsl_types.cpp
> @@ -691,6 +691,8 @@ glsl_type::uniform_locations() const
>        return size;
>     case GLSL_TYPE_ARRAY:
>        return this->length * this->fields.array->uniform_locations();
> +   case GLSL_TYPE_SAMPLER:
> +      return 1;
>     default:
>        break;
>     }

// Tapani



More information about the mesa-dev mailing list