summaryrefslogtreecommitdiff
path: root/src/mesa
diff options
context:
space:
mode:
authorRoland Scheidegger <rscheidegger@gmx.ch>2004-05-27 16:56:47 +0000
committerRoland Scheidegger <rscheidegger@gmx.ch>2004-05-27 16:56:47 +0000
commitaaaf38d37215aa1536ff34ec370ecfc04111af22 (patch)
tree3eafbe589892dbc2e1525fa722704e432f6e0623 /src/mesa
parentd44e9e39da2663bc2fc610ba1a117ac3ea0b4c8a (diff)
change some explicit references to texture units 0/1 to unit < MaxTextureUnits (Andreas Stenglein, Ronny Vindenes)
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/drivers/dri/r200/r200_cmdbuf.c9
-rw-r--r--src/mesa/drivers/dri/r200/r200_maos_arrays.c12
-rw-r--r--src/mesa/drivers/dri/r200/r200_state.c2
-rw-r--r--src/mesa/drivers/dri/r200/r200_tcl.c25
4 files changed, 21 insertions, 27 deletions
diff --git a/src/mesa/drivers/dri/r200/r200_cmdbuf.c b/src/mesa/drivers/dri/r200/r200_cmdbuf.c
index edea2df572..26812d50b6 100644
--- a/src/mesa/drivers/dri/r200/r200_cmdbuf.c
+++ b/src/mesa/drivers/dri/r200/r200_cmdbuf.c
@@ -63,7 +63,7 @@ static void r200_emit_state_list( r200ContextPtr rmesa,
{
struct r200_state_atom *state, *tmp;
char *dest;
- int i, size;
+ int i, size, mtu;
size = 0;
foreach_s( state, tmp, list ) {
@@ -84,6 +84,7 @@ static void r200_emit_state_list( r200ContextPtr rmesa,
return;
dest = r200AllocCmdBuf( rmesa, size * 4, __FUNCTION__);
+ mtu = rmesa->glCtx->Const.MaxTextureUnits;
#define EMIT_ATOM(ATOM) \
do { \
@@ -112,13 +113,13 @@ do { \
EMIT_ATOM (fog);
EMIT_ATOM (tam);
EMIT_ATOM (tf);
- for (i = 0; i < 2; ++i) {
+ for (i = 0; i < mtu; ++i) {
EMIT_ATOM (tex[i]);
}
- for (i = 0; i < 2; ++i) {
+ for (i = 0; i < mtu; ++i) {
EMIT_ATOM (cube[i]);
}
- for (i = 0; i < 5; ++i)
+ for (i = 0; i < 3 + mtu; ++i)
EMIT_ATOM (mat[i]);
EMIT_ATOM (eye);
EMIT_ATOM (glt);
diff --git a/src/mesa/drivers/dri/r200/r200_maos_arrays.c b/src/mesa/drivers/dri/r200/r200_maos_arrays.c
index 301b265396..7bfa316836 100644
--- a/src/mesa/drivers/dri/r200/r200_maos_arrays.c
+++ b/src/mesa/drivers/dri/r200/r200_maos_arrays.c
@@ -422,7 +422,7 @@ void r200EmitArrays( GLcontext *ctx, GLuint inputs )
}
/* vtx = (rmesa->hw.tcl.cmd[TCL_OUTPUT_VTXFMT] & */
-/* ~(R200_TCL_VTX_Q0|R200_TCL_VTX_Q1)); */
+/* ~(R200_TCL_VTX_Q0|R200_TCL_VTX_Q1|R200_TCL_VTX_Q2|R200_TCL_VTX_Q3|R200_TCL_VTX_Q4|R200_TCL_VTX_Q5)); */
re_cntl = rmesa->hw.set.cmd[SET_RE_CNTL] & ~(R200_VTX_STQ0_D3D |
R200_VTX_STQ1_D3D |
@@ -468,6 +468,7 @@ void r200EmitArrays( GLcontext *ctx, GLuint inputs )
void r200ReleaseArrays( GLcontext *ctx, GLuint newinputs )
{
+ GLuint unit;
r200ContextPtr rmesa = R200_CONTEXT( ctx );
/* if (R200_DEBUG & DEBUG_VERTS) */
@@ -485,9 +486,8 @@ void r200ReleaseArrays( GLcontext *ctx, GLuint newinputs )
if (newinputs & VERT_BIT_COLOR1)
r200ReleaseDmaRegion( rmesa, &rmesa->tcl.spec, __FUNCTION__ );
- if (newinputs & VERT_BIT_TEX0)
- r200ReleaseDmaRegion( rmesa, &rmesa->tcl.tex[0], __FUNCTION__ );
-
- if (newinputs & VERT_BIT_TEX1)
- r200ReleaseDmaRegion( rmesa, &rmesa->tcl.tex[1], __FUNCTION__ );
+ for (unit = 0 ; unit < ctx->Const.MaxTextureUnits; unit++) {
+ if (newinputs & VERT_BIT_TEX(unit))
+ r200ReleaseDmaRegion( rmesa, &rmesa->tcl.tex[unit], __FUNCTION__ );
+ }
}
diff --git a/src/mesa/drivers/dri/r200/r200_state.c b/src/mesa/drivers/dri/r200/r200_state.c
index 347ee3ca40..8210d6cfbe 100644
--- a/src/mesa/drivers/dri/r200/r200_state.c
+++ b/src/mesa/drivers/dri/r200/r200_state.c
@@ -2120,7 +2120,7 @@ static void update_texturematrix( GLcontext *ctx )
rmesa->TexMatEnabled = 0;
rmesa->TexMatCompSel = 0;
- for (unit = 0 ; unit < 2; unit++) {
+ for (unit = 0 ; unit < ctx->Const.MaxTextureUnits; unit++) {
if (!ctx->Texture.Unit[unit]._ReallyEnabled)
continue;
diff --git a/src/mesa/drivers/dri/r200/r200_tcl.c b/src/mesa/drivers/dri/r200/r200_tcl.c
index daf4490608..1090666dd3 100644
--- a/src/mesa/drivers/dri/r200/r200_tcl.c
+++ b/src/mesa/drivers/dri/r200/r200_tcl.c
@@ -302,6 +302,7 @@ static void r200_check_tcl_render( GLcontext *ctx,
{
r200ContextPtr rmesa = R200_CONTEXT(ctx);
GLuint inputs = VERT_BIT_POS;
+ GLuint unit;
/* Validate state:
*/
@@ -326,23 +327,15 @@ static void r200_check_tcl_render( GLcontext *ctx,
}
}
- if (ctx->Texture.Unit[0]._ReallyEnabled) {
- if (ctx->Texture.Unit[0].TexGenEnabled) {
- if (rmesa->TexGenNeedNormals[0]) {
- inputs |= VERT_BIT_NORMAL;
+ for (unit = 0 ; unit < ctx->Const.MaxTextureUnits; unit++) {
+ if (ctx->Texture.Unit[unit]._ReallyEnabled) {
+ if (ctx->Texture.Unit[unit].TexGenEnabled) {
+ if (rmesa->TexGenNeedNormals[unit]) {
+ inputs |= VERT_BIT_NORMAL;
+ }
+ } else {
+ inputs |= VERT_BIT_TEX(unit);
}
- } else {
- inputs |= VERT_BIT_TEX0;
- }
- }
-
- if (ctx->Texture.Unit[1]._ReallyEnabled) {
- if (ctx->Texture.Unit[1].TexGenEnabled) {
- if (rmesa->TexGenNeedNormals[1]) {
- inputs |= VERT_BIT_NORMAL;
- }
- } else {
- inputs |= VERT_BIT_TEX1;
}
}