[Mesa-dev] [PATCH] i965: Don't allocate uniform space for samplers
Jason Ekstrand
jason at jlekstrand.net
Sun Apr 30 07:09:08 UTC 2017
Seems reasonable
Reviewed-by: Jason Ekstrand <jason at jlekstrand.net>
On April 30, 2017 8:59:03 AM Timothy Arceri <tarceri at itsqueeze.com> wrote:
> 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()) {
>>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
More information about the mesa-dev
mailing list