From 4c54f059150c197da3941b1b20efa70ba2f06e1f Mon Sep 17 00:00:00 2001 From: Samuel Pitoiset Date: Tue, 6 Oct 2020 18:58:45 +0200 Subject: [PATCH] nir/constant_folding: init nir_const_value to zero To avoid NIR validation failures. Fixes: 9df1ff36781 ("nir/constant_folding: Use the builder") Signed-off-by: Samuel Pitoiset Reviewed-by: Jason Ekstrand Part-of: --- src/compiler/nir/nir_opt_constant_folding.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/compiler/nir/nir_opt_constant_folding.c b/src/compiler/nir/nir_opt_constant_folding.c index 6f8e3a86a5c..47dde5c3b4c 100644 --- a/src/compiler/nir/nir_opt_constant_folding.c +++ b/src/compiler/nir/nir_opt_constant_folding.c @@ -230,6 +230,7 @@ try_fold_intrinsic(nir_builder *b, nir_intrinsic_instr *instr, instr->dest.ssa.bit_size); } else { nir_const_value imm[NIR_MAX_VEC_COMPONENTS]; + memset(imm, 0, sizeof(imm)); uint8_t *data = (uint8_t*)b->shader->constant_data + base; for (unsigned i = 0; i < instr->num_components; i++) { unsigned bytes = instr->dest.ssa.bit_size / 8;