From e856edb2794cba9d321486f602a9e07b917ce949 Mon Sep 17 00:00:00 2001 From: Oliver McFadden Date: Thu, 10 May 2007 17:45:27 +0000 Subject: [PATCH] r300: Moved some more of the emit code into r300_render.c. --- src/mesa/drivers/dri/r300/r300_cmdbuf.c | 35 ----------------- src/mesa/drivers/dri/r300/r300_cmdbuf.h | 2 - src/mesa/drivers/dri/r300/r300_emit.h | 14 ------- src/mesa/drivers/dri/r300/r300_render.c | 51 +++++++++++++++++++++++-- 4 files changed, 48 insertions(+), 54 deletions(-) diff --git a/src/mesa/drivers/dri/r300/r300_cmdbuf.c b/src/mesa/drivers/dri/r300/r300_cmdbuf.c index 48f5ea4c562..1aacf69a0aa 100644 --- a/src/mesa/drivers/dri/r300/r300_cmdbuf.c +++ b/src/mesa/drivers/dri/r300/r300_cmdbuf.c @@ -659,38 +659,3 @@ void r300EmitWait(r300ContextPtr rmesa, GLuint flags) cmd[0].wait.cmd_type = R300_CMD_WAIT; cmd[0].wait.flags = flags; } - -void r300EmitAOS(r300ContextPtr rmesa, GLuint nr, GLuint offset) -{ - int sz = 1 + (nr >> 1) * 3 + (nr & 1) * 2; - int i; - int cmd_reserved = 0; - int cmd_written = 0; - drm_radeon_cmd_header_t *cmd = NULL; - - if (RADEON_DEBUG & DEBUG_VERTS) - fprintf(stderr, "%s: nr=%d, ofs=0x%08x\n", __func__, nr, - offset); - - start_packet3(RADEON_CP_PACKET3_3D_LOAD_VBPNTR, sz - 1); - e32(nr); - for (i = 0; i + 1 < nr; i += 2) { - e32((rmesa->state.aos[i].aos_size << 0) - | (rmesa->state.aos[i].aos_stride << 8) - | (rmesa->state.aos[i + 1].aos_size << 16) - | (rmesa->state.aos[i + 1].aos_stride << 24) - ); - e32(rmesa->state.aos[i].aos_offset + - offset * 4 * rmesa->state.aos[i].aos_stride); - e32(rmesa->state.aos[i + 1].aos_offset + - offset * 4 * rmesa->state.aos[i + 1].aos_stride); - } - - if (nr & 1) { - e32((rmesa->state.aos[nr - 1].aos_size << 0) - | (rmesa->state.aos[nr - 1].aos_stride << 8) - ); - e32(rmesa->state.aos[nr - 1].aos_offset + - offset * 4 * rmesa->state.aos[nr - 1].aos_stride); - } -} diff --git a/src/mesa/drivers/dri/r300/r300_cmdbuf.h b/src/mesa/drivers/dri/r300/r300_cmdbuf.h index 3c336e1589b..bfb2eda26fe 100644 --- a/src/mesa/drivers/dri/r300/r300_cmdbuf.h +++ b/src/mesa/drivers/dri/r300/r300_cmdbuf.h @@ -46,8 +46,6 @@ extern void r300EmitState(r300ContextPtr r300); extern void r300InitCmdBuf(r300ContextPtr r300); extern void r300DestroyCmdBuf(r300ContextPtr r300); -extern void r300EmitAOS(r300ContextPtr rmesa, GLuint nr, GLuint offset); - /** * Make sure that enough space is available in the command buffer * by flushing if necessary. diff --git a/src/mesa/drivers/dri/r300/r300_emit.h b/src/mesa/drivers/dri/r300/r300_emit.h index bccb84933ad..b8242ad41e2 100644 --- a/src/mesa/drivers/dri/r300/r300_emit.h +++ b/src/mesa/drivers/dri/r300/r300_emit.h @@ -227,20 +227,6 @@ void static inline cp_wait(r300ContextPtr rmesa, unsigned char flags) cmd[0].i = cmdwait(flags); } -/** - * fire vertex buffer - */ -static void inline fire_AOS(r300ContextPtr rmesa, int vertex_count, int type) -{ - int cmd_reserved = 0; - int cmd_written = 0; - drm_radeon_cmd_header_t *cmd = NULL; - - start_packet3(RADEON_CP_PACKET3_3D_DRAW_VBUF_2, 0); - e32(R300_VAP_VF_CNTL__PRIM_WALK_VERTEX_LIST | (vertex_count << 16) - | type); -} - /** * These are followed by the corresponding data */ diff --git a/src/mesa/drivers/dri/r300/r300_render.c b/src/mesa/drivers/dri/r300/r300_render.c index a118dab7401..a5d8afd94cf 100644 --- a/src/mesa/drivers/dri/r300/r300_render.c +++ b/src/mesa/drivers/dri/r300/r300_render.c @@ -190,8 +190,8 @@ static int r300NumVerts(r300ContextPtr rmesa, int num_verts, int prim) return num_verts - verts_off; } -static void inline r300FireEB(r300ContextPtr rmesa, unsigned long addr, - int vertex_count, int type, int elt_size) +static void r300FireEB(r300ContextPtr rmesa, unsigned long addr, + int vertex_count, int type, int elt_size) { int cmd_reserved = 0; int cmd_written = 0; @@ -245,6 +245,52 @@ static void inline r300FireEB(r300ContextPtr rmesa, unsigned long addr, } } +static void r300EmitAOS(r300ContextPtr rmesa, GLuint nr, GLuint offset) +{ + int sz = 1 + (nr >> 1) * 3 + (nr & 1) * 2; + int i; + int cmd_reserved = 0; + int cmd_written = 0; + drm_radeon_cmd_header_t *cmd = NULL; + + if (RADEON_DEBUG & DEBUG_VERTS) + fprintf(stderr, "%s: nr=%d, ofs=0x%08x\n", __func__, nr, + offset); + + start_packet3(RADEON_CP_PACKET3_3D_LOAD_VBPNTR, sz - 1); + e32(nr); + for (i = 0; i + 1 < nr; i += 2) { + e32((rmesa->state.aos[i].aos_size << 0) + | (rmesa->state.aos[i].aos_stride << 8) + | (rmesa->state.aos[i + 1].aos_size << 16) + | (rmesa->state.aos[i + 1].aos_stride << 24) + ); + e32(rmesa->state.aos[i].aos_offset + + offset * 4 * rmesa->state.aos[i].aos_stride); + e32(rmesa->state.aos[i + 1].aos_offset + + offset * 4 * rmesa->state.aos[i + 1].aos_stride); + } + + if (nr & 1) { + e32((rmesa->state.aos[nr - 1].aos_size << 0) + | (rmesa->state.aos[nr - 1].aos_stride << 8) + ); + e32(rmesa->state.aos[nr - 1].aos_offset + + offset * 4 * rmesa->state.aos[nr - 1].aos_stride); + } +} + +static void fire_AOS(r300ContextPtr rmesa, int vertex_count, int type) +{ + int cmd_reserved = 0; + int cmd_written = 0; + drm_radeon_cmd_header_t *cmd = NULL; + + start_packet3(RADEON_CP_PACKET3_3D_DRAW_VBUF_2, 0); + e32(R300_VAP_VF_CNTL__PRIM_WALK_VERTEX_LIST | (vertex_count << 16) + | type); +} + static void r300RunRenderPrimitive(r300ContextPtr rmesa, GLcontext * ctx, int start, int end, int prim) { @@ -355,7 +401,6 @@ static GLboolean r300RunRender(GLcontext * ctx, for (i = 0; i < VB->PrimitiveCount; i++) { GLuint prim = _tnl_translate_prim(&VB->Primitive[i]); GLuint start = VB->Primitive[i].start; - GLuint length = VB->Primitive[i].count; GLuint end = VB->Primitive[i].start + VB->Primitive[i].count; r300RunRenderPrimitive(rmesa, ctx, start, end, prim); } -- 2.30.2