Fix SOP in fragment shader, brick is ok now.
authorZou Nan hai <nanhai.zou@intel.com>
Tue, 17 Jul 2007 08:52:03 +0000 (16:52 +0800)
committerZou Nan hai <nanhai.zou@intel.com>
Tue, 17 Jul 2007 08:52:03 +0000 (16:52 +0800)
progs/glsl/CH06-brick.frag.txt
src/mesa/drivers/dri/i965/brw_wm_glsl.c

index 388c5f9e660adaef0ec269c82c999cec162adef3..06ef04e3afb0e317f4f2eb7d0f66b2c5aa110e09 100644 (file)
@@ -23,11 +23,7 @@ void main()
     
     position = MCposition / BrickSize;
 
-//    if (fract(position.y * 0.5) > 0.5)
-//        position.x += 0.5;
-    float tmp;
-    tmp  = fract(position.y * 0.5);
-    if (tmp > 0.5)
+    if (fract(position.y * 0.5) > 0.5)
         position.x += 0.5;
 
     position = fract(position);
index 4988df2b0e42b9830131b554a854bba85596f94e..09e7590367688d33cb24b69ea744f7707bb555b9 100644 (file)
@@ -811,18 +811,20 @@ static void emit_sop(struct brw_wm_compile *c,
     struct brw_reg dst, src0, src1;
     int i;
 
+    brw_push_insn_state(p);
     for (i = 0; i < 4; i++) {
        if (mask & (1<<i)) {
            dst = get_dst_reg(c, inst, i, 1);
            src0 = get_src_reg(c, &inst->SrcReg[0], i, 1);
            src1 = get_src_reg(c, &inst->SrcReg[1], i, 1);
-           brw_MOV(p, dst, brw_imm_f(0));
            brw_CMP(p, brw_null_reg(), cond, src0, src1);
+           brw_set_predicate_control(p, BRW_PREDICATE_NONE);
+           brw_MOV(p, dst, brw_imm_f(0.0));
            brw_set_predicate_control(p, BRW_PREDICATE_NORMAL);
            brw_MOV(p, dst, brw_imm_f(1.0));
-           brw_set_predicate_control_flag_value(p, 0xff);
        }
     }
+    brw_pop_insn_state(p);
 }
 
 static void emit_slt(struct brw_wm_compile *c,