Mesa (master): r600g: cleanup some magic numbers

Marek Olšák mareko at kemper.freedesktop.org
Tue Oct 25 10:14:50 PDT 2011


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

Author: Marek Olšák <maraeo at gmail.com>
Date:   Tue Oct 25 17:44:55 2011 +0200

r600g: cleanup some magic numbers

---

 src/gallium/drivers/r600/r600_state_common.c |   14 ++++++++++----
 src/gallium/drivers/r600/r600d.h             |    6 ++++++
 2 files changed, 16 insertions(+), 4 deletions(-)

diff --git a/src/gallium/drivers/r600/r600_state_common.c b/src/gallium/drivers/r600/r600_state_common.c
index 8cb70de..49c576c 100644
--- a/src/gallium/drivers/r600/r600_state_common.c
+++ b/src/gallium/drivers/r600/r600_state_common.c
@@ -658,10 +658,16 @@ void r600_draw_vbo(struct pipe_context *ctx, const struct pipe_draw_info *info)
 
 	rdraw.vgt_num_indices = draw.info.count;
 	rdraw.vgt_num_instances = draw.info.instance_count;
-	rdraw.vgt_index_type = ((draw.index_size == 4) ? 1 : 0);
-	if (R600_BIG_ENDIAN)
-		rdraw.vgt_index_type |= (draw.index_size >> 1) << 2;
-	rdraw.vgt_draw_initiator = draw.index_size ? 0 : 2;
+
+	rdraw.vgt_index_type = draw.index_size == 4 ? VGT_INDEX_32 : VGT_INDEX_16;
+	if (R600_BIG_ENDIAN) {
+		rdraw.vgt_index_type |= draw.index_size == 4 ? VGT_DMA_SWAP_32_BIT
+							     : VGT_DMA_SWAP_16_BIT;
+	}
+
+	rdraw.vgt_draw_initiator = draw.index_size ? V_0287F0_DI_SRC_SEL_DMA
+						   : V_0287F0_DI_SRC_SEL_AUTO_INDEX;
+
 	rdraw.indices = NULL;
 	if (draw.index_buffer) {
 		rbuffer = (struct r600_resource*)draw.index_buffer;
diff --git a/src/gallium/drivers/r600/r600d.h b/src/gallium/drivers/r600/r600d.h
index 6eb44d9..441c981 100644
--- a/src/gallium/drivers/r600/r600d.h
+++ b/src/gallium/drivers/r600/r600d.h
@@ -65,6 +65,12 @@
 #define PKT3_CONTEXT_CONTROL                   0x28
 #define PKT3_DRAW_INDEX_IMMD_BE                0x29
 #define PKT3_INDEX_TYPE                        0x2A
+#define		VGT_INDEX_16                   0
+#define		VGT_INDEX_32                   1
+#define         VGT_DMA_SWAP_NONE	       (0 << 2)
+#define         VGT_DMA_SWAP_16_BIT	       (1 << 2)
+#define         VGT_DMA_SWAP_32_BIT	       (2 << 2)
+#define         VGT_DMA_SWAP_WORD	       (3 << 2)
 #define PKT3_DRAW_INDEX                        0x2B
 #define PKT3_DRAW_INDEX_AUTO                   0x2D
 #define PKT3_DRAW_INDEX_IMMD                   0x2E



More information about the mesa-commit mailing list