summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorOliver McFadden <z3ro.geek@gmail.com>2007-05-08 18:28:04 +0000
committerOliver McFadden <z3ro.geek@gmail.com>2007-05-08 18:28:04 +0000
commit6c036812be53b741b9801a14aad8163775150ca7 (patch)
tree1f451505b656bd5a68e31690b1a43e053e804fd1 /src
parentc6abbbfd0296ca0f8e4eecb29fce20cd7125f98a (diff)
r300: Clean up the vertex buffer emission code and reduced code duplication.
I tested both the unoptimized and optimized versions with Quake 3 Arena; there are no problems.
Diffstat (limited to 'src')
-rw-r--r--src/mesa/drivers/dri/r300/r300_render.c37
1 files changed, 11 insertions, 26 deletions
diff --git a/src/mesa/drivers/dri/r300/r300_render.c b/src/mesa/drivers/dri/r300/r300_render.c
index 20b3302426..4b846226cc 100644
--- a/src/mesa/drivers/dri/r300/r300_render.c
+++ b/src/mesa/drivers/dri/r300/r300_render.c
@@ -209,7 +209,7 @@ static void inline fire_EB(r300ContextPtr rmesa, unsigned long addr, int vertex_
WARN_ONCE("Badly aligned buffer\n");
return ;
}
-#ifdef OPTIMIZE_ELTS
+
magic_1 = (addr % 32) / 4;
t_addr = addr & (~0x1d);
magic_2 = (vertex_count + 1 + (t_addr & 0x2)) / 2 + magic_1;
@@ -224,43 +224,28 @@ static void inline fire_EB(r300ContextPtr rmesa, unsigned long addr, int vertex_
}
start_packet3(RADEON_CP_PACKET3_INDX_BUFFER, 2);
+#ifdef OPTIMIZE_ELTS
if(elt_size == 4){
e32(R300_EB_UNK1 | (0 << 16) | R300_EB_UNK2);
- e32(addr /*& 0xffffffe3*/);
+ e32(addr);
} else {
e32(R300_EB_UNK1 | (magic_1 << 16) | R300_EB_UNK2);
e32(t_addr);
}
-
- if(elt_size == 4){
- e32(vertex_count); /* Total number of dwords needed? */
- } else {
- e32(magic_2); /* Total number of dwords needed? */
- }
- //cp_delay(rmesa, 1);
#else
- (void)magic_2, (void)magic_1, (void)t_addr;
-
- check_space(6);
-
- start_packet3(RADEON_CP_PACKET3_3D_DRAW_INDX_2, 0);
- if(elt_size == 4){
- e32(R300_VAP_VF_CNTL__PRIM_WALK_INDICES | (vertex_count<<16) | type | R300_VAP_VF_CNTL__INDEX_SIZE_32bit);
- } else {
- e32(R300_VAP_VF_CNTL__PRIM_WALK_INDICES | (vertex_count<<16) | type);
- }
-
- start_packet3(RADEON_CP_PACKET3_INDX_BUFFER, 2);
e32(R300_EB_UNK1 | (0 << 16) | R300_EB_UNK2);
- e32(addr /*& 0xffffffe3*/);
+ e32(addr);
+#endif
if(elt_size == 4){
- e32(vertex_count); /* Total number of dwords needed? */
+ e32(vertex_count);
} else {
- e32((vertex_count+1)/2); /* Total number of dwords needed? */
- }
- //cp_delay(rmesa, 1);
+#ifdef OPTIMIZE_ELTS
+ e32(magic_2);
+#else
+ e32((vertex_count+1)/2);
#endif
+ }
}
static void r300_render_vb_primitive(r300ContextPtr rmesa,