summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVladimir Dergachev <[email protected]>2005-01-22 03:33:10 +0000
committerVladimir Dergachev <[email protected]>2005-01-22 03:33:10 +0000
commit8fca9bdc35bfb5220012cfa5041504b0a05d2440 (patch)
tree153b2c85cab39c1b7ff105b4cb7bee0402d6c5d2
parentf4cafc8d13ed196388bfb27edeccdf3a67cec046 (diff)
Properly configure routing - based on advice by Keith Whitwell.
-rw-r--r--src/mesa/drivers/dri/r300/r300_context.h4
-rw-r--r--src/mesa/drivers/dri/r300/r300_emit.h4
-rw-r--r--src/mesa/drivers/dri/r300/r300_render.c30
-rw-r--r--src/mesa/drivers/dri/r300/r300_state.c23
4 files changed, 49 insertions, 12 deletions
diff --git a/src/mesa/drivers/dri/r300/r300_context.h b/src/mesa/drivers/dri/r300/r300_context.h
index 068fdfcdca4..2cd7479a31d 100644
--- a/src/mesa/drivers/dri/r300/r300_context.h
+++ b/src/mesa/drivers/dri/r300/r300_context.h
@@ -475,8 +475,12 @@ struct r300_depthbuffer_state {
struct r300_vap_reg_state {
/* input register assigments */
int i_coords;
+ int i_normal;
int i_color[2];
+ int i_fog;
int i_tex[R300_MAX_TEXTURE_UNITS];
+ int i_index;
+ int i_pointsize;
};
/* Vertex shader state */
diff --git a/src/mesa/drivers/dri/r300/r300_emit.h b/src/mesa/drivers/dri/r300/r300_emit.h
index 6433944e190..65ed7ff0ec6 100644
--- a/src/mesa/drivers/dri/r300/r300_emit.h
+++ b/src/mesa/drivers/dri/r300/r300_emit.h
@@ -139,8 +139,8 @@ static __inline__ uint32_t cmdcpdelay(unsigned short count)
cmd[cmd_written].i=(dword); \
cmd_written++; \
} else { \
- fprintf(stderr, "e32 but no previous packet declaration.. Aborting! in %s::%s at line %d\n", \
- __FILE__, __FUNCTION__, __LINE__); \
+ fprintf(stderr, "e32 but no previous packet declaration.. Aborting! in %s::%s at line %d, cmd_written=%d cmd_reserved=%d\n", \
+ __FILE__, __FUNCTION__, __LINE__, cmd_written, cmd_reserved); \
exit(-1); \
} \
}
diff --git a/src/mesa/drivers/dri/r300/r300_render.c b/src/mesa/drivers/dri/r300/r300_render.c
index 2f832d27513..35b67aeaa05 100644
--- a/src/mesa/drivers/dri/r300/r300_render.c
+++ b/src/mesa/drivers/dri/r300/r300_render.c
@@ -210,10 +210,12 @@ static void r300_render_immediate_primitive(r300ContextPtr rmesa,
/* A packet cannot have more than 16383 data words.. */
if(((end-start)*8+4*rmesa->state.texture.tc_count)>16380){
fprintf(stderr, "%s:%s: Too many vertices to paint. Fix me !\n");
- return;
- }
+ return;
+ }
- start_immediate_packet(end-start, type, 8+4*rmesa->state.texture.tc_count);
+ //fprintf(stderr, "aos_count=%d start=%d end=%d\n", rmesa->state.aos_count, start, end);
+
+ start_immediate_packet(end-start, type, 4*rmesa->state.aos_count);
for(i=start;i<end;i++){
#if 0
@@ -232,15 +234,29 @@ static void r300_render_immediate_primitive(r300ContextPtr rmesa,
/* coordinates */
- output_vector(VB->ObjPtr, i);
+ if(tnl->render_inputs & _TNL_BIT_POS)
+ output_vector(VB->ObjPtr, i);
+ if(tnl->render_inputs & _TNL_BIT_NORMAL)
+ output_vector(VB->NormalPtr, i);
/* color components */
- output_vector(VB->ColorPtr[0], i);
-
+ if(tnl->render_inputs & _TNL_BIT_COLOR0)
+ output_vector(VB->ColorPtr[0], i);
+ if(tnl->render_inputs & _TNL_BIT_COLOR1)
+ output_vector(VB->ColorPtr[1], i);
+
+ if(tnl->render_inputs & _TNL_BIT_FOG)
+ output_vector(VB->FogCoordPtr, i);
+
/* texture coordinates */
for(k=0;k < ctx->Const.MaxTextureUnits;k++)
- if(ctx->Texture.Unit[k].Enabled)
+ if(tnl->render_inputs & (_TNL_BIT_TEX0<<k))
output_vector(VB->TexCoordPtr[k], i);
+
+ if(tnl->render_inputs & _TNL_BIT_INDEX)
+ output_vector(VB->IndexPtr[0], i);
+ if(tnl->render_inputs & _TNL_BIT_POINTSIZE)
+ output_vector(VB->PointSizePtr, i);
}
}
diff --git a/src/mesa/drivers/dri/r300/r300_state.c b/src/mesa/drivers/dri/r300/r300_state.c
index 048f62572cd..f650a9189fa 100644
--- a/src/mesa/drivers/dri/r300/r300_state.c
+++ b/src/mesa/drivers/dri/r300/r300_state.c
@@ -815,6 +815,7 @@ void r300_setup_routing(GLcontext *ctx, GLboolean immediate)
#define CONFIGURE_AOS(v, o, r, f) \
{\
+ if (RADEON_DEBUG & DEBUG_STATE)fprintf(stderr, "Enabling "#r "\n"); \
if(immediate){ \
r300->state.aos[count].element_size=4; \
r300->state.aos[count].stride=4; \
@@ -834,11 +835,27 @@ void r300_setup_routing(GLcontext *ctx, GLboolean immediate)
/* All offsets are 0 - for use by immediate mode.
Should change later to handle vertex buffers */
- CONFIGURE_AOS(VB->ObjPtr, 0, i_coords, AOS_FORMAT_FLOAT);
- CONFIGURE_AOS(VB->ColorPtr[0], 0, i_color[0], AOS_FORMAT_FLOAT_COLOR);
+ if(tnl->render_inputs & _TNL_BIT_POS)
+ CONFIGURE_AOS(VB->ObjPtr, 0, i_coords, AOS_FORMAT_FLOAT);
+ if(tnl->render_inputs & _TNL_BIT_NORMAL)
+ CONFIGURE_AOS(VB->NormalPtr, 0, i_normal, AOS_FORMAT_FLOAT);
+
+ if(tnl->render_inputs & _TNL_BIT_COLOR0)
+ CONFIGURE_AOS(VB->ColorPtr[0], 0, i_color[0], AOS_FORMAT_FLOAT_COLOR);
+ if(tnl->render_inputs & _TNL_BIT_COLOR1)
+ CONFIGURE_AOS(VB->ColorPtr[1], 0, i_color[1], AOS_FORMAT_FLOAT_COLOR);
+
+ if(tnl->render_inputs & _TNL_BIT_FOG)
+ CONFIGURE_AOS(VB->FogCoordPtr, 0, i_fog, AOS_FORMAT_FLOAT);
+
for(i=0;i < ctx->Const.MaxTextureUnits;i++)
- if(ctx->Texture.Unit[i].Enabled)
+ if(tnl->render_inputs & (_TNL_BIT_TEX0<<i))
CONFIGURE_AOS(VB->TexCoordPtr[i], 0, i_tex[i], AOS_FORMAT_FLOAT);
+
+ if(tnl->render_inputs & _TNL_BIT_INDEX)
+ CONFIGURE_AOS(VB->IndexPtr[0], 0, i_index, AOS_FORMAT_FLOAT);
+ if(tnl->render_inputs & _TNL_BIT_POINTSIZE)
+ CONFIGURE_AOS(VB->PointSizePtr, 0, i_pointsize, AOS_FORMAT_FLOAT);
r300->state.aos_count=count;