mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 05:18:08 +02: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>
(cherry picked from commit be3ce07f58)
This commit is contained in:
parent
ad4fa97597
commit
c8f0e53a90
2 changed files with 15 additions and 14 deletions
|
|
@ -4004,7 +4004,7 @@
|
|||
"description": "v3d/compiler: Fix ub when using memcmp for texture comparisons.",
|
||||
"nominated": true,
|
||||
"nomination_type": 1,
|
||||
"resolution": 0,
|
||||
"resolution": 1,
|
||||
"main_sha": null,
|
||||
"because_sha": null,
|
||||
"notes": null
|
||||
|
|
|
|||
|
|
@ -253,14 +253,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);
|
||||
|
||||
|
|
@ -565,12 +565,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