[Mesa-dev] [PATCH 06.2] i965/fs: Preserve the source register type when doing color writes.

Kenneth Graunke kenneth at whitecape.org
Tue Nov 8 19:26:39 PST 2011


From: Eric Anholt <eric at anholt.net>

When rendering to integer color buffers, we need to be careful to use
MRFs of the correct type when emitting color writes.

Signed-off-by: Eric Anholt <eric at anholt.net>
Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
---
 src/mesa/drivers/dri/i965/brw_fs_visitor.cpp |   11 +++++++----
 1 files changed, 7 insertions(+), 4 deletions(-)

(Feel free to change my Signed-off-by to a Reviewed-by if you prefer.)

diff --git a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
index 15009dc..3e2feaf 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
@@ -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();
-- 
1.7.7.2



More information about the mesa-dev mailing list