From ffec105109f5b16bfe8282bd477d4aa32b550015 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 31 Oct 2005 21:52:56 +0000 Subject: [PATCH] fix problems found with gcc 2.96 (bug 4934) --- src/mesa/drivers/dri/r200/r200_swtcl.c | 6 ++- src/mesa/drivers/dri/r300/r300_cmdbuf.c | 5 ++- src/mesa/drivers/dri/r300/r300_fragprog.c | 4 +- src/mesa/drivers/dri/radeon/radeon_swtcl.c | 2 +- src/mesa/drivers/dri/s3v/s3v_tritmp.h | 45 ++++++++++++++++++---- src/mesa/drivers/dri/savage/savageioctl.c | 4 +- src/mesa/drivers/dri/savage/savagerender.c | 10 ++--- 7 files changed, 55 insertions(+), 21 deletions(-) diff --git a/src/mesa/drivers/dri/r200/r200_swtcl.c b/src/mesa/drivers/dri/r200/r200_swtcl.c index 826c668b8d1..58879a59011 100644 --- a/src/mesa/drivers/dri/r200/r200_swtcl.c +++ b/src/mesa/drivers/dri/r200/r200_swtcl.c @@ -219,6 +219,8 @@ void r200ChooseVertexState( GLcontext *ctx ) { r200ContextPtr rmesa = R200_CONTEXT( ctx ); TNLcontext *tnl = TNL_CONTEXT(ctx); + GLuint vte; + GLuint vap; /* We must ensure that we don't do _tnl_need_projected_coords while in a * rasterization fallback. As this function will be called again when we @@ -227,8 +229,8 @@ void r200ChooseVertexState( GLcontext *ctx ) if (rmesa->Fallback != 0) return; - GLuint vte = rmesa->hw.vte.cmd[VTE_SE_VTE_CNTL]; - GLuint vap = rmesa->hw.vap.cmd[VAP_SE_VAP_CNTL]; + vte = rmesa->hw.vte.cmd[VTE_SE_VTE_CNTL]; + vap = rmesa->hw.vap.cmd[VAP_SE_VAP_CNTL]; /* HW perspective divide is a win, but tiny vertex formats are a * bigger one. diff --git a/src/mesa/drivers/dri/r300/r300_cmdbuf.c b/src/mesa/drivers/dri/r300/r300_cmdbuf.c index c2733f3db3c..376f6805033 100644 --- a/src/mesa/drivers/dri/r300/r300_cmdbuf.c +++ b/src/mesa/drivers/dri/r300/r300_cmdbuf.c @@ -620,12 +620,13 @@ void r300EmitWait(r300ContextPtr rmesa, GLuint flags) void r300EmitAOS(r300ContextPtr rmesa, GLuint nr, GLuint offset) { - if (RADEON_DEBUG & DEBUG_VERTS) - fprintf(stderr, "%s: nr=%d, ofs=0x%08x\n", __func__, nr, offset); int sz = 1 + (nr >> 1) * 3 + (nr & 1) * 2; int i; LOCAL_VARS + 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+1param_nr++; r.index = rp->const_nr++; if (pidx >= PFS_NUM_CONST_REGS || r.index >= PFS_NUM_CONST_REGS) { @@ -626,6 +626,7 @@ static void emit_arith(struct r300_fragment_program *rp, int op, int argc; int vop, sop; int i; + int str; if (!dest.valid || !src0.valid || !src1.valid || !src2.valid) { ERROR("invalid register. dest/src0/src1/src2 valid = %d/%d/%d/%d\n", @@ -657,7 +658,6 @@ static void emit_arith(struct r300_fragment_program *rp, int op, return; } - int str; for (i=0;i<3;i++) { if (idma.current.ptr == rmesa->dma.current.start); } -#define LOCAL_VARS radeonContextPtr rmesa = RADEON_CONTEXT(ctx); (void)rmesa +#define LOCAL_VARS radeonContextPtr rmesa = RADEON_CONTEXT(ctx) #define INIT( prim ) radeonDmaPrimitive( rmesa, prim ) #define FLUSH() RADEON_NEWPRIM( rmesa ) #define GET_CURRENT_VB_MAX_VERTS() \ diff --git a/src/mesa/drivers/dri/s3v/s3v_tritmp.h b/src/mesa/drivers/dri/s3v/s3v_tritmp.h index b2136fcb384..16318f4c402 100644 --- a/src/mesa/drivers/dri/s3v/s3v_tritmp.h +++ b/src/mesa/drivers/dri/s3v/s3v_tritmp.h @@ -17,7 +17,8 @@ int start02, end01; \ int ystart, y01y12; \ int i, tmp, tmp2, tmp3; \ - GLfloat ydiff, fy[3]; \ + GLfloat ydiff, fy[3] +#define LINE_VERT_VARS_VOIDS \ (void) v; (void) vvv; (void) x; (void) y; (void) z; (void) idx; \ (void) dx01; (void) dy01; (void) delt02; (void) deltzy; \ (void) zstart; (void) start02; (void) ystart; (void) y01y12; \ @@ -26,7 +27,8 @@ #define LINE_FLAT_VARS \ int arstart, gbstart; \ int deltarx, deltgbx, deltary, deltgby; \ - GLubyte *(col)[3]; \ + GLubyte *(col)[3] +#define LINE_FLAT_VARS_VOIDS \ (void) arstart; (void) gbstart; (void) deltarx; (void) deltgbx; \ (void) deltary; (void) deltgby; (void) col @@ -34,7 +36,8 @@ int arstart, gbstart; \ int deltary, deltgby; \ int ctmp, ctmp2, ctmp3, ctmp4; \ - GLubyte *(col)[3]; \ + GLubyte *(col)[3] +#define LINE_GOURAUD_VARS_VOIDS \ (void) arstart; (void) gbstart; (void) deltary; (void) deltgby; \ (void) ctmp; (void) ctmp2; (void) ctmp3; (void) ctmp4; (void) col @@ -207,7 +210,8 @@ do { \ int start02, end01, end12; \ int ystart, y01y12; \ int i, tmp, lr; \ - GLfloat ydiff, fy[3]; \ + GLfloat ydiff, fy[3] +#define VERT_VARS_VOIDS \ (void) v; (void) x; (void) y; (void) z; (void) idx; (void) dx01; \ (void) dy01; (void) dx02; (void) dy02; (void) dx12; (void) dy12; \ (void) delt01; (void) delt02; (void) delt12; (void) deltzx; \ @@ -219,7 +223,8 @@ do { \ int arstart, gbstart; \ int deltarx, deltgbx, deltary, deltgby; \ int ctmp, ctmp2, ctmp3, ctmp4; \ - GLubyte *(col)[3]; \ + GLubyte *(col)[3] +#define GOURAUD_VARS_VOIDS \ (void) arstart; (void) gbstart; (void) deltarx; (void) deltgbx; \ (void) deltary; (void) deltgby; (void) ctmp; (void) ctmp2; \ (void) ctmp3; (void) ctmp4; (void) col @@ -227,7 +232,8 @@ do { \ #define FLAT_VARS \ int arstart, gbstart; \ int deltarx, deltgbx, deltary, deltgby; \ - GLubyte *(col)[3]; \ + GLubyte *(col)[3] +#define FLAT_VARS_VOIDS \ (void) arstart; (void) gbstart; (void) deltarx; (void) deltgbx; \ (void) deltary; (void) deltgby; (void) col @@ -245,7 +251,8 @@ do { \ int rbaseu, rbasev; \ int dstart, ustart, wstart, vstart; \ static int stmp = 0; \ - s3vTextureObjectPtr t; \ + s3vTextureObjectPtr t +#define TEX_VARS_VOIDS \ (void) u0; (void) u1; (void) u2; (void) ru0; (void) ru1; (void) ru2; \ (void) v0; (void) v1; (void) v2; (void) rv0; (void) rv1; (void) rv2; \ (void) w0; (void) w1; (void) w2; (void) rw0; (void) rw1; (void) rw2; \ @@ -620,6 +627,12 @@ static void TAG(s3v_line)( s3vContextPtr vmesa, GLfloat cull; (void) cull; #endif + LINE_VERT_VARS_VOIDS; +#if (IND & S3V_RAST_FLAT_BIT) + LINE_FLAT_VARS_VOIDS; +#else + LINE_GOURAUD_VARS_VOIDS; +#endif DEBUG(("*** s3v_line: ")); #if (IND & S3V_RAST_CULL_BIT) @@ -684,6 +697,15 @@ static void TAG(s3v_triangle)( s3vContextPtr vmesa, #if (IND & S3V_RAST_CULL_BIT) GLfloat cull; #endif + VERT_VARS_VOIDS; +#if (IND & S3v_RAST_FLAT_BIT) + FLAT_VARS_VOIDS; +#else + GOURAUD_VARS_VOIDS; +#endif +#if (IND & S3V_RAST_TEX_BIT) + TEX_VARS_VOIDS; +#endif DEBUG(("*** s3v_triangle: ")); #if (IND & S3V_RAST_CULL_BIT) @@ -774,6 +796,15 @@ static void TAG(s3v_quad)( s3vContextPtr vmesa, #if (IND & S3V_RAST_CULL_BIT) GLfloat cull; #endif + VERT_VARS_VOIDS; +#if (IND & S3v_RAST_FLAT_BIT) + FLAT_VARS_VOIDS; +#else + GOURAUD_VARS_VOIDS; +#endif +#if (IND & S3V_RAST_TEX_BIT) + TEX_VARS_VOIDS; +#endif DEBUG(("*** s3v_quad: ")); #if (IND & S3V_RAST_CULL_BIT) diff --git a/src/mesa/drivers/dri/savage/savageioctl.c b/src/mesa/drivers/dri/savage/savageioctl.c index 1906c78cc34..244959d64f9 100644 --- a/src/mesa/drivers/dri/savage/savageioctl.c +++ b/src/mesa/drivers/dri/savage/savageioctl.c @@ -632,18 +632,18 @@ void savageFlushCmdBuf( savageContextPtr imesa, GLboolean discard ) static void savageDDFlush( GLcontext *ctx ) { + savageContextPtr imesa = SAVAGE_CONTEXT(ctx); if (SAVAGE_DEBUG & DEBUG_VERBOSE_MSG) fprintf (stderr, "%s\n", __FUNCTION__); - savageContextPtr imesa = SAVAGE_CONTEXT(ctx); savageFlushVertices (imesa); savageFlushCmdBuf(imesa, GL_FALSE); } static void savageDDFinish( GLcontext *ctx ) { + savageContextPtr imesa = SAVAGE_CONTEXT(ctx); if (SAVAGE_DEBUG & DEBUG_VERBOSE_MSG) fprintf (stderr, "%s\n", __FUNCTION__); - savageContextPtr imesa = SAVAGE_CONTEXT(ctx); savageFlushVertices (imesa); savageFlushCmdBuf(imesa, GL_FALSE); WAIT_IDLE_EMPTY(imesa); diff --git a/src/mesa/drivers/dri/savage/savagerender.c b/src/mesa/drivers/dri/savage/savagerender.c index 9eda9a591e0..22e3f133962 100644 --- a/src/mesa/drivers/dri/savage/savagerender.c +++ b/src/mesa/drivers/dri/savage/savagerender.c @@ -246,11 +246,6 @@ static GLboolean run_texnorm_stage( GLcontext *ctx, return GL_TRUE; for (i = 0 ; i < ctx->Const.MaxTextureUnits ; i++) { - if (!ctx->Texture.Unit[i]._ReallyEnabled || - VB->TexCoordPtr[i]->size == 4) - /* Never try to normalize homogenous tex coords! */ - continue; - GLuint reallyEnabled = ctx->Texture.Unit[i]._ReallyEnabled; struct gl_texture_object *texObj = ctx->Texture.Unit[i]._Current; GLboolean normalizeS = (texObj->WrapS == GL_REPEAT); @@ -261,6 +256,11 @@ static GLboolean run_texnorm_stage( GLcontext *ctx, GLfloat (*out)[4] = store->texcoord[i].data; GLint j; + if (!ctx->Texture.Unit[i]._ReallyEnabled || + VB->TexCoordPtr[i]->size == 4) + /* Never try to normalize homogenous tex coords! */ + continue; + if (normalizeS && normalizeT) { /* take first texcoords as rough estimate of mean value */ GLfloat correctionS = -floor(in[0]+0.5); -- 2.30.2