nir: Zero out texture instructions when creating them.
authorEric Anholt <eric@anholt.net>
Wed, 12 Aug 2015 00:10:35 +0000 (17:10 -0700)
committerEric Anholt <eric@anholt.net>
Fri, 14 Aug 2015 18:39:18 +0000 (11:39 -0700)
There are so many flags in textures, that the CSE pass would have a hard
time referencing the correct set when figuring out if two texture ops are
the same.  By zeroing, we can avoid that fragility.

Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
src/glsl/nir/nir.c

index 78ff886218da8f05b75fdb3b9630b50c8b5339f7..2f7cbae42be9f7a582f5eced08e40b995c3b7bb1 100644 (file)
@@ -450,7 +450,7 @@ nir_call_instr_create(nir_shader *shader, nir_function_overload *callee)
 nir_tex_instr *
 nir_tex_instr_create(nir_shader *shader, unsigned num_srcs)
 {
-   nir_tex_instr *instr = ralloc(shader, nir_tex_instr);
+   nir_tex_instr *instr = rzalloc(shader, nir_tex_instr);
    instr_init(&instr->instr, nir_instr_type_tex);
 
    dest_init(&instr->dest);