From 5f61c6f21f08be622112630dba2cbdc05e118022 Mon Sep 17 00:00:00 2001 From: Vladimir Dergachev Date: Mon, 10 Jan 2005 03:22:54 +0000 Subject: [PATCH] Clean up the code and make it unnecessary to issue extra calls to Setup*Shaders in the r300_run_immediate_render function. Bumps up glxgears fps count by about 100 points. --- src/mesa/drivers/dri/r300/r300_ioctl.c | 2 ++ src/mesa/drivers/dri/r300/r300_render.c | 24 +----------------------- src/mesa/drivers/dri/r300/r300_state.c | 11 ++++++++--- 3 files changed, 11 insertions(+), 26 deletions(-) diff --git a/src/mesa/drivers/dri/r300/r300_ioctl.c b/src/mesa/drivers/dri/r300/r300_ioctl.c index b4b1aeb..80d059d 100644 --- a/src/mesa/drivers/dri/r300/r300_ioctl.c +++ b/src/mesa/drivers/dri/r300/r300_ioctl.c @@ -301,6 +301,8 @@ static void r300Clear(GLcontext * ctx, GLbitfield mask, GLboolean all, * but do keep it like this for now. */ r300ResetHwState(r300); + /* r300ClearBuffer has trampled all over the hardware state.. */ + r300->hw.all_dirty=GL_TRUE; } void r300Flush(GLcontext * ctx) diff --git a/src/mesa/drivers/dri/r300/r300_render.c b/src/mesa/drivers/dri/r300/r300_render.c index eb1df1d..198ced1 100644 --- a/src/mesa/drivers/dri/r300/r300_render.c +++ b/src/mesa/drivers/dri/r300/r300_render.c @@ -242,25 +242,6 @@ static void r300_render_immediate_primitive(r300ContextPtr rmesa, } -static void assign_pipeline(r300ContextPtr rmesa, R300_PIPELINE *p) -{ - /* Watch out ! This is buggy .. but will do for now */ - - /* At least one sanity check is in order */ - if(sizeof(rmesa->state.vertex_shader) != sizeof(p->vertex_shader)){ - fprintf(stderr, "Aieee ! vertex_shader sizes don't match.\n"); - exit(-1); - } - if(sizeof(rmesa->state.pixel_shader) != sizeof(p->pixel_shader)){ - fprintf(stderr, "Aieee ! vertex_shader sizes don't match.\n"); - exit(-1); - } - - memcpy(&rmesa->state.vertex_shader, &(p->vertex_shader), sizeof(rmesa->state.vertex_shader)); - memcpy(&rmesa->state.pixel_shader, &(p->pixel_shader), sizeof(rmesa->state.pixel_shader)); - -} - static GLboolean r300_run_immediate_render(GLcontext *ctx, struct tnl_pipeline_stage *stage) { @@ -277,7 +258,7 @@ static GLboolean r300_run_immediate_render(GLcontext *ctx, /* Update texture state - needs to be done only when actually changed.. All the time for now.. */ /* Flush state - make sure command buffer is nice and large */ - r300Flush(ctx); + //r300Flush(ctx); if (RADEON_DEBUG == DEBUG_PRIMS) @@ -310,9 +291,6 @@ static GLboolean r300_run_immediate_render(GLcontext *ctx, } - r300SetupVertexShader(rmesa); - r300SetupPixelShader(rmesa); - r300EmitState(rmesa); #if 0 diff --git a/src/mesa/drivers/dri/r300/r300_state.c b/src/mesa/drivers/dri/r300/r300_state.c index 994a445..70dff07 100644 --- a/src/mesa/drivers/dri/r300/r300_state.c +++ b/src/mesa/drivers/dri/r300/r300_state.c @@ -1351,11 +1351,12 @@ void r300ResetHwState(r300ContextPtr r300) r300->hw.vof.cmd[R300_VOF_CNTL_0] = R300_VAP_OUTPUT_VTX_FMT_0__POS_PRESENT | R300_VAP_OUTPUT_VTX_FMT_0__COLOR_PRESENT; r300->hw.vof.cmd[R300_VOF_CNTL_1] = 0; /* no textures */ - #endif + r300->hw.pvs.cmd[R300_PVS_CNTL_1] = 0; r300->hw.pvs.cmd[R300_PVS_CNTL_2] = 0; r300->hw.pvs.cmd[R300_PVS_CNTL_3] = 0; + #endif r300->hw.gb_enable.cmd[1] = R300_GB_POINT_STUFF_ENABLE | R300_GB_LINE_STUFF_ENABLE @@ -1418,6 +1419,7 @@ void r300ResetHwState(r300ContextPtr r300) r300->hw.unk43E8.cmd[1] = 0x00FFFFFF; + #if 0 r300->hw.fp.cmd[R300_FP_CNTL0] = 0; r300->hw.fp.cmd[R300_FP_CNTL1] = 0; r300->hw.fp.cmd[R300_FP_CNTL2] = 0; @@ -1425,13 +1427,15 @@ void r300ResetHwState(r300ContextPtr r300) r300->hw.fp.cmd[R300_FP_NODE1] = 0; r300->hw.fp.cmd[R300_FP_NODE2] = 0; r300->hw.fp.cmd[R300_FP_NODE3] = 0; - + #endif + r300->hw.unk46A4.cmd[1] = 0x00001B01; r300->hw.unk46A4.cmd[2] = 0x00001B0F; r300->hw.unk46A4.cmd[3] = 0x00001B0F; r300->hw.unk46A4.cmd[4] = 0x00001B0F; r300->hw.unk46A4.cmd[5] = 0x00000001; + #if 0 for(i = 1; i <= 64; ++i) { /* create NOP instructions */ r300->hw.fpi[0].cmd[i] = FP_INSTRC(MAD, FP_ARGC(SRC0C_XYZ), FP_ARGC(ONE), FP_ARGC(ZERO)); @@ -1439,7 +1443,8 @@ void r300ResetHwState(r300ContextPtr r300) r300->hw.fpi[2].cmd[i] = FP_INSTRA(MAD, FP_ARGA(SRC0A), FP_ARGA(ONE), FP_ARGA(ZERO)); r300->hw.fpi[3].cmd[i] = FP_SELA(0,W,NO,FP_TMP(0),0,0); } - + #endif + r300->hw.unk4BC0.cmd[1] = 0; r300->hw.unk4BC8.cmd[1] = 0; -- 2.7.4