mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-03 01:18:06 +02:00
glsl: prevent spurious Valgrind errors when serializing NIR
It looks as if the structure fields array is fully initialized below, but in fact at least gcc in debug builds will not actually overwrite the unused bits of bit fields. Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
This commit is contained in:
parent
354b12681b
commit
68ee1d5796
1 changed files with 4 additions and 2 deletions
|
|
@ -105,8 +105,10 @@ glsl_type::glsl_type(const glsl_struct_field *fields, unsigned num_fields,
|
|||
|
||||
assert(name != NULL);
|
||||
this->name = ralloc_strdup(this->mem_ctx, name);
|
||||
this->fields.structure = ralloc_array(this->mem_ctx,
|
||||
glsl_struct_field, length);
|
||||
/* Zero-fill to prevent spurious Valgrind errors when serializing NIR
|
||||
* due to uninitialized unused bits in bit fields. */
|
||||
this->fields.structure = rzalloc_array(this->mem_ctx,
|
||||
glsl_struct_field, length);
|
||||
|
||||
for (i = 0; i < length; i++) {
|
||||
this->fields.structure[i] = fields[i];
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue