mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-25 08:40:11 +01:00
v3d/compiler: Fix ub when using memcmp for texture comparisons.
We need to zero out all memory in the struct otherwise memcmp ends up comparing padding bytes. Cc: mesa-stable Reviewed-by: Jose Maria Casanova Crespo <jmcasanova@igalia.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34945>
This commit is contained in:
parent
22fb7eaa8c
commit
be3ce07f58
1 changed files with 14 additions and 13 deletions
|
|
@ -252,14 +252,14 @@ v3d_vir_emit_tex(struct v3d_compile *c, nir_tex_instr *instr)
|
|||
(components_read & 0xf): (components_read & 0x3);
|
||||
assert(p0_unpacked.return_words_of_texture_data != 0);
|
||||
|
||||
struct V3D42_TMU_CONFIG_PARAMETER_2 p2_unpacked = {
|
||||
.op = V3D_TMU_OP_REGULAR,
|
||||
.gather_mode = instr->op == nir_texop_tg4,
|
||||
.gather_component = instr->component,
|
||||
.coefficient_mode = instr->op == nir_texop_txd,
|
||||
.disable_autolod = instr->op == nir_texop_tg4,
|
||||
.lod_query = instr->op == nir_texop_lod,
|
||||
};
|
||||
struct V3D42_TMU_CONFIG_PARAMETER_2 p2_unpacked;
|
||||
memset(&p2_unpacked, 0, sizeof(p2_unpacked));
|
||||
p2_unpacked.op = V3D_TMU_OP_REGULAR;
|
||||
p2_unpacked.gather_mode = instr->op == nir_texop_tg4;
|
||||
p2_unpacked.gather_component = instr->component;
|
||||
p2_unpacked.coefficient_mode = instr->op == nir_texop_txd;
|
||||
p2_unpacked.disable_autolod = instr->op == nir_texop_tg4;
|
||||
p2_unpacked.lod_query = instr->op == nir_texop_lod;
|
||||
|
||||
const unsigned tmu_writes = get_required_tex_tmu_writes(c, instr);
|
||||
|
||||
|
|
@ -564,12 +564,13 @@ v3d_vir_emit_image_load_store(struct v3d_compile *c,
|
|||
struct V3D42_TMU_CONFIG_PARAMETER_0 p0_unpacked = {
|
||||
};
|
||||
|
||||
struct V3D42_TMU_CONFIG_PARAMETER_1 p1_unpacked = {
|
||||
.per_pixel_mask_enable = true,
|
||||
.output_type_32_bit = v3d_gl_format_is_return_32(format),
|
||||
};
|
||||
struct V3D42_TMU_CONFIG_PARAMETER_1 p1_unpacked;
|
||||
memset(&p1_unpacked, 0, sizeof(p1_unpacked));
|
||||
p1_unpacked.per_pixel_mask_enable = true;
|
||||
p1_unpacked.output_type_32_bit = v3d_gl_format_is_return_32(format);
|
||||
|
||||
struct V3D42_TMU_CONFIG_PARAMETER_2 p2_unpacked = { 0 };
|
||||
struct V3D42_TMU_CONFIG_PARAMETER_2 p2_unpacked;
|
||||
memset(&p2_unpacked, 0, sizeof(p2_unpacked));
|
||||
|
||||
/* Limit the number of channels to those that are actually used */
|
||||
uint32_t return_channels =
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue