Mesa (master): i965/fs: Preserve the source register type when doing color writes.

Eric Anholt anholt at kemper.freedesktop.org
Thu Nov 10 00:11:58 UTC 2011


Module: Mesa
Branch: master
Commit: e988d816e16f9c0844424472d689486a833931c3
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=e988d816e16f9c0844424472d689486a833931c3

Author: Eric Anholt <eric at anholt.net>
Date:   Tue Nov  8 19:26:39 2011 -0800

i965/fs: Preserve the source register type when doing color writes.

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 at whitecape.org>

---

 src/mesa/drivers/dri/i965/brw_fs_visitor.cpp |   11 +++++++----
 1 files changed, 7 insertions(+), 4 deletions(-)

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();




More information about the mesa-commit mailing list