[Mesa-dev] [PATCH] i965: Don't allocate uniform space for samplers
Samuel Pitoiset
samuel.pitoiset at gmail.com
Mon May 1 09:57:59 UTC 2017
Thanks for fixing this. I guess "glsl: set vector_elements to 1 for
samplers" can now be applied without breaking the world? :-)
On 04/30/2017 08:55 AM, 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>
> ---
> 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