i965/fs: Preserve the source register type when doing color writes.
authorEric Anholt <eric@anholt.net>
Wed, 9 Nov 2011 03:26:39 +0000 (19:26 -0800)
committerEric Anholt <eric@anholt.net>
Wed, 9 Nov 2011 20:59:20 +0000 (12:59 -0800)
When rendering to integer color buffers, we need to be careful to use
MRFs of the correct type when emitting color writes.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
src/mesa/drivers/dri/i965/brw_fs_visitor.cpp

index 15009dcc57b3aecab547b8eab082935e48dcf5f8..3e2feafec385a8901d69ff6a99810518390e27d2 100644 (file)
@@ -1853,7 +1853,7 @@ fs_visitor::emit_color_write(int index, int first_color_mrf, fs_reg color)
        * m + 7: a1
        */
       inst = emit(BRW_OPCODE_MOV,
-                 fs_reg(MRF, first_color_mrf + index * reg_width),
+                 fs_reg(MRF, first_color_mrf + index * reg_width, color.type),
                  color);
       inst->saturate = c->key.clamp_fragment_color;
    } else {
@@ -1874,19 +1874,22 @@ fs_visitor::emit_color_write(int index, int first_color_mrf, fs_reg color)
          * destination + 4.
          */
         inst = emit(BRW_OPCODE_MOV,
-                    fs_reg(MRF, BRW_MRF_COMPR4 + first_color_mrf + index),
+                    fs_reg(MRF, BRW_MRF_COMPR4 + first_color_mrf + index,
+                           color.type),
                     color);
         inst->saturate = c->key.clamp_fragment_color;
       } else {
         push_force_uncompressed();
-        inst = emit(BRW_OPCODE_MOV, fs_reg(MRF, first_color_mrf + index),
+        inst = emit(BRW_OPCODE_MOV, fs_reg(MRF, first_color_mrf + index,
+                                           color.type),
                     color);
         inst->saturate = c->key.clamp_fragment_color;
         pop_force_uncompressed();
 
         push_force_sechalf();
         color.sechalf = true;
-        inst = emit(BRW_OPCODE_MOV, fs_reg(MRF, first_color_mrf + index + 4),
+        inst = emit(BRW_OPCODE_MOV, fs_reg(MRF, first_color_mrf + index + 4,
+                                           color.type),
                     color);
         inst->saturate = c->key.clamp_fragment_color;
         pop_force_sechalf();