parser: Initialize unused instruction source registers
authorIan Romanick <ian.d.romanick@intel.com>
Wed, 22 Jul 2009 19:29:48 +0000 (12:29 -0700)
committerIan Romanick <ian.d.romanick@intel.com>
Wed, 22 Jul 2009 19:29:48 +0000 (12:29 -0700)
The 965 driver expects unused source registers (e.g., SrcReg[2] of a
DP3 instruction) to have a register file of PROGRAM_UNDEFINED.
Initializing these source registers ensures that this happens.

src/mesa/shader/program_parse.tab.c
src/mesa/shader/program_parse.y

index bf48b9752fdbc47a27073db09316bcdff9f99d44..cb5fa7cd71c84727fa8825002af1b46a36466222 100644 (file)
@@ -4558,11 +4558,15 @@ asm_instruction_ctor(gl_inst_opcode op,
       if (src1 != NULL) {
         inst->Base.SrcReg[1] = src1->Base;
         inst->SrcReg[1] = *src1;
+      } else {
+        init_src_reg(& inst->SrcReg[1]);
       }
 
       if (src2 != NULL) {
         inst->Base.SrcReg[2] = src2->Base;
         inst->SrcReg[2] = *src2;
+      } else {
+        init_src_reg(& inst->SrcReg[2]);
       }
    }
 
index 0260196210ac3fc259f660a7cd2a0205364e5898..fe9022b1218c72b3f91ecc7f0b8cf5a0b030b7ff 100644 (file)
@@ -1774,11 +1774,15 @@ asm_instruction_ctor(gl_inst_opcode op,
       if (src1 != NULL) {
         inst->Base.SrcReg[1] = src1->Base;
         inst->SrcReg[1] = *src1;
+      } else {
+        init_src_reg(& inst->SrcReg[1]);
       }
 
       if (src2 != NULL) {
         inst->Base.SrcReg[2] = src2->Base;
         inst->SrcReg[2] = *src2;
+      } else {
+        init_src_reg(& inst->SrcReg[2]);
       }
    }