[Mesa-dev] [PATCH] i965: Don't allocate uniform space for samplers

Timothy Arceri tarceri at itsqueeze.com
Sun Apr 30 06:58:53 UTC 2017


On 30/04/17 16:55, Timothy Arceri wrote:
> Samplers are encoded into the instruction word, so there's no need to
> make space in the uniform file.
> 
> Previously matrix_columns and vector_elements were set to 0, making this
> else case a no-op. Commit 75a31a20af26 changed that, causing malloc
> corruption in thousands of tests on i965.
> 
> Fixes: 75a31a20af26 ("glsl: set vector_elements to 1 for samplers")
> 
> Cc: Matt Turner <mattst88 at gmail.com>
> Cc: Samuel Pitoiset <samuel.pitoiset at gmail.com>

Forgot to add:


Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=100871

> ---
>   src/mesa/drivers/dri/i965/brw_nir_uniforms.cpp | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/mesa/drivers/dri/i965/brw_nir_uniforms.cpp b/src/mesa/drivers/dri/i965/brw_nir_uniforms.cpp
> index f35e8f8..f0bccac 100644
> --- a/src/mesa/drivers/dri/i965/brw_nir_uniforms.cpp
> +++ b/src/mesa/drivers/dri/i965/brw_nir_uniforms.cpp
> @@ -128,21 +128,21 @@ brw_nir_setup_glsl_uniform(gl_shader_stage stage, nir_variable *var,
>       * gl_uniform_storage structs for each subcomponent that
>       * glGetUniformLocation() could name.  We know it's been set up in the same
>       * order we'd walk the type, so walk the list of storage and find anything
>       * with our name, or the prefix of a component that starts with our name.
>       */
>      unsigned uniform_index = var->data.driver_location / 4;
>      for (unsigned u = 0; u < prog->sh.data->NumUniformStorage; u++) {
>         struct gl_uniform_storage *storage =
>            &prog->sh.data->UniformStorage[u];
>   
> -      if (storage->builtin)
> +      if (storage->builtin || storage->type->is_sampler())
>            continue;
>   
>         if (strncmp(var->name, storage->name, namelen) != 0 ||
>             (storage->name[namelen] != 0 &&
>              storage->name[namelen] != '.' &&
>              storage->name[namelen] != '[')) {
>            continue;
>         }
>   
>         if (storage->type->is_image()) {
> 


More information about the mesa-dev mailing list