From 18fa367ac6e035341f5eb86ecc4231124b2921e3 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Tue, 27 Jan 2004 16:34:45 +0000 Subject: Consolidate texObj->Pos/Neg/X/Y/Z and texObj->Image into a single array, texObj->Image[face][level]. --- src/mesa/swrast/s_aalinetemp.h | 4 +- src/mesa/swrast/s_aatritemp.h | 4 +- src/mesa/swrast/s_nvfragprog.c | 2 +- src/mesa/swrast/s_span.c | 4 +- src/mesa/swrast/s_texture.c | 124 ++++++++++++++++++++--------------------- src/mesa/swrast/s_triangle.c | 70 +++++++++++------------ 6 files changed, 104 insertions(+), 104 deletions(-) (limited to 'src/mesa/swrast') diff --git a/src/mesa/swrast/s_aalinetemp.h b/src/mesa/swrast/s_aalinetemp.h index 66d127e2ddd..3a68e528a73 100644 --- a/src/mesa/swrast/s_aalinetemp.h +++ b/src/mesa/swrast/s_aalinetemp.h @@ -200,7 +200,7 @@ NAME(line)(GLcontext *ctx, const SWvertex *v0, const SWvertex *v1) #ifdef DO_TEX { const struct gl_texture_object *obj = ctx->Texture.Unit[0]._Current; - const struct gl_texture_image *texImage = obj->Image[obj->BaseLevel]; + const struct gl_texture_image *texImage = obj->Image[0][obj->BaseLevel]; const GLfloat invW0 = v0->win[3]; const GLfloat invW1 = v1->win[3]; const GLfloat s0 = v0->texcoord[0][0] * invW0; @@ -226,7 +226,7 @@ NAME(line)(GLcontext *ctx, const SWvertex *v0, const SWvertex *v1) for (u = 0; u < ctx->Const.MaxTextureUnits; u++) { if (ctx->Texture.Unit[u]._ReallyEnabled) { const struct gl_texture_object *obj = ctx->Texture.Unit[u]._Current; - const struct gl_texture_image *texImage = obj->Image[obj->BaseLevel]; + const struct gl_texture_image *texImage = obj->Image[0][obj->BaseLevel]; const GLfloat invW0 = v0->win[3]; const GLfloat invW1 = v1->win[3]; const GLfloat s0 = v0->texcoord[u][0] * invW0; diff --git a/src/mesa/swrast/s_aatritemp.h b/src/mesa/swrast/s_aatritemp.h index 2fb66faf72c..61ee6f2fbfd 100644 --- a/src/mesa/swrast/s_aatritemp.h +++ b/src/mesa/swrast/s_aatritemp.h @@ -187,7 +187,7 @@ #ifdef DO_TEX { const struct gl_texture_object *obj = ctx->Texture.Unit[0]._Current; - const struct gl_texture_image *texImage = obj->Image[obj->BaseLevel]; + const struct gl_texture_image *texImage = obj->Image[0][obj->BaseLevel]; const GLfloat invW0 = v0->win[3]; const GLfloat invW1 = v1->win[3]; const GLfloat invW2 = v2->win[3]; @@ -217,7 +217,7 @@ for (u = 0; u < ctx->Const.MaxTextureUnits; u++) { if (ctx->Texture.Unit[u]._ReallyEnabled) { const struct gl_texture_object *obj = ctx->Texture.Unit[u]._Current; - const struct gl_texture_image *texImage = obj->Image[obj->BaseLevel]; + const struct gl_texture_image *texImage = obj->Image[0][obj->BaseLevel]; const GLfloat invW0 = v0->win[3]; const GLfloat invW1 = v1->win[3]; const GLfloat invW2 = v2->win[3]; diff --git a/src/mesa/swrast/s_nvfragprog.c b/src/mesa/swrast/s_nvfragprog.c index e3679a270e1..1da14e80d18 100644 --- a/src/mesa/swrast/s_nvfragprog.c +++ b/src/mesa/swrast/s_nvfragprog.c @@ -78,7 +78,7 @@ fetch_texel_deriv( GLcontext *ctx, const GLfloat texcoord[4], { SWcontext *swrast = SWRAST_CONTEXT(ctx); const struct gl_texture_object *texObj = ctx->Texture.Unit[unit]._Current; - const struct gl_texture_image *texImg = texObj->Image[texObj->BaseLevel]; + const struct gl_texture_image *texImg = texObj->Image[0][texObj->BaseLevel]; const GLfloat texW = (GLfloat) texImg->WidthScale; const GLfloat texH = (GLfloat) texImg->HeightScale; GLchan rgba[4]; diff --git a/src/mesa/swrast/s_span.c b/src/mesa/swrast/s_span.c index 118cec47e37..ee46f323076 100644 --- a/src/mesa/swrast/s_span.c +++ b/src/mesa/swrast/s_span.c @@ -361,7 +361,7 @@ interpolate_texcoords(GLcontext *ctx, struct sw_span *span) GLfloat texW, texH; GLboolean needLambda; if (obj) { - const struct gl_texture_image *img = obj->Image[obj->BaseLevel]; + const struct gl_texture_image *img = obj->Image[0][obj->BaseLevel]; needLambda = (obj->MinFilter != obj->MagFilter) || ctx->FragmentProgram.Enabled; texW = img->WidthScale; @@ -453,7 +453,7 @@ interpolate_texcoords(GLcontext *ctx, struct sw_span *span) GLfloat texW, texH; GLboolean needLambda; if (obj) { - const struct gl_texture_image *img = obj->Image[obj->BaseLevel]; + const struct gl_texture_image *img = obj->Image[0][obj->BaseLevel]; needLambda = (obj->MinFilter != obj->MagFilter) || ctx->FragmentProgram.Enabled; texW = (GLfloat) img->WidthScale; diff --git a/src/mesa/swrast/s_texture.c b/src/mesa/swrast/s_texture.c index 2576a181c35..b5a4509c07e 100644 --- a/src/mesa/swrast/s_texture.c +++ b/src/mesa/swrast/s_texture.c @@ -886,7 +886,7 @@ sample_1d_nearest_mipmap_nearest(GLcontext *ctx, for (i = 0; i < n; i++) { GLint level; COMPUTE_NEAREST_MIPMAP_LEVEL(tObj, lambda[i], level); - sample_1d_nearest(ctx, tObj, tObj->Image[level], texcoord[i], rgba[i]); + sample_1d_nearest(ctx, tObj, tObj->Image[0][level], texcoord[i], rgba[i]); } } @@ -902,7 +902,7 @@ sample_1d_linear_mipmap_nearest(GLcontext *ctx, for (i = 0; i < n; i++) { GLint level; COMPUTE_NEAREST_MIPMAP_LEVEL(tObj, lambda[i], level); - sample_1d_linear(ctx, tObj, tObj->Image[level], texcoord[i], rgba[i]); + sample_1d_linear(ctx, tObj, tObj->Image[0][level], texcoord[i], rgba[i]); } } @@ -930,14 +930,14 @@ sample_1d_nearest_mipmap_linear(GLcontext *ctx, GLint level; COMPUTE_LINEAR_MIPMAP_LEVEL(tObj, lambda[i], level); if (level >= tObj->_MaxLevel) { - sample_1d_nearest(ctx, tObj, tObj->Image[tObj->_MaxLevel], + sample_1d_nearest(ctx, tObj, tObj->Image[0][tObj->_MaxLevel], texcoord[i], rgba[i]); } else { GLchan t0[4], t1[4]; const GLfloat f = FRAC(lambda[i]); - sample_1d_nearest(ctx, tObj, tObj->Image[level ], texcoord[i], t0); - sample_1d_nearest(ctx, tObj, tObj->Image[level+1], texcoord[i], t1); + sample_1d_nearest(ctx, tObj, tObj->Image[0][level ], texcoord[i], t0); + sample_1d_nearest(ctx, tObj, tObj->Image[0][level+1], texcoord[i], t1); rgba[i][RCOMP] = CHAN_CAST ((1.0F-f) * t0[RCOMP] + f * t1[RCOMP]); rgba[i][GCOMP] = CHAN_CAST ((1.0F-f) * t0[GCOMP] + f * t1[GCOMP]); rgba[i][BCOMP] = CHAN_CAST ((1.0F-f) * t0[BCOMP] + f * t1[BCOMP]); @@ -960,14 +960,14 @@ sample_1d_linear_mipmap_linear(GLcontext *ctx, GLint level; COMPUTE_LINEAR_MIPMAP_LEVEL(tObj, lambda[i], level); if (level >= tObj->_MaxLevel) { - sample_1d_linear(ctx, tObj, tObj->Image[tObj->_MaxLevel], + sample_1d_linear(ctx, tObj, tObj->Image[0][tObj->_MaxLevel], texcoord[i], rgba[i]); } else { GLchan t0[4], t1[4]; const GLfloat f = FRAC(lambda[i]); - sample_1d_linear(ctx, tObj, tObj->Image[level ], texcoord[i], t0); - sample_1d_linear(ctx, tObj, tObj->Image[level+1], texcoord[i], t1); + sample_1d_linear(ctx, tObj, tObj->Image[0][level ], texcoord[i], t0); + sample_1d_linear(ctx, tObj, tObj->Image[0][level+1], texcoord[i], t1); rgba[i][RCOMP] = CHAN_CAST ((1.0F-f) * t0[RCOMP] + f * t1[RCOMP]); rgba[i][GCOMP] = CHAN_CAST ((1.0F-f) * t0[GCOMP] + f * t1[GCOMP]); rgba[i][BCOMP] = CHAN_CAST ((1.0F-f) * t0[BCOMP] + f * t1[BCOMP]); @@ -985,7 +985,7 @@ sample_nearest_1d( GLcontext *ctx, GLuint texUnit, GLchan rgba[][4] ) { GLuint i; - struct gl_texture_image *image = tObj->Image[tObj->BaseLevel]; + struct gl_texture_image *image = tObj->Image[0][tObj->BaseLevel]; (void) lambda; for (i=0;iImage[tObj->BaseLevel]; + struct gl_texture_image *image = tObj->Image[0][tObj->BaseLevel]; (void) lambda; for (i=0;iMinFilter) { case GL_NEAREST: for (i = minStart; i < minEnd; i++) - sample_1d_nearest(ctx, tObj, tObj->Image[tObj->BaseLevel], + sample_1d_nearest(ctx, tObj, tObj->Image[0][tObj->BaseLevel], texcoords[i], rgba[i]); break; case GL_LINEAR: for (i = minStart; i < minEnd; i++) - sample_1d_linear(ctx, tObj, tObj->Image[tObj->BaseLevel], + sample_1d_linear(ctx, tObj, tObj->Image[0][tObj->BaseLevel], texcoords[i], rgba[i]); break; case GL_NEAREST_MIPMAP_NEAREST: @@ -1069,12 +1069,12 @@ sample_lambda_1d( GLcontext *ctx, GLuint texUnit, switch (tObj->MagFilter) { case GL_NEAREST: for (i = magStart; i < magEnd; i++) - sample_1d_nearest(ctx, tObj, tObj->Image[tObj->BaseLevel], + sample_1d_nearest(ctx, tObj, tObj->Image[0][tObj->BaseLevel], texcoords[i], rgba[i]); break; case GL_LINEAR: for (i = magStart; i < magEnd; i++) - sample_1d_linear(ctx, tObj, tObj->Image[tObj->BaseLevel], + sample_1d_linear(ctx, tObj, tObj->Image[0][tObj->BaseLevel], texcoords[i], rgba[i]); break; default: @@ -1338,7 +1338,7 @@ sample_2d_nearest_mipmap_nearest(GLcontext *ctx, for (i = 0; i < n; i++) { GLint level; COMPUTE_NEAREST_MIPMAP_LEVEL(tObj, lambda[i], level); - sample_2d_nearest(ctx, tObj, tObj->Image[level], texcoord[i], rgba[i]); + sample_2d_nearest(ctx, tObj, tObj->Image[0][level], texcoord[i], rgba[i]); } } @@ -1355,7 +1355,7 @@ sample_2d_linear_mipmap_nearest(GLcontext *ctx, for (i = 0; i < n; i++) { GLint level; COMPUTE_NEAREST_MIPMAP_LEVEL(tObj, lambda[i], level); - sample_2d_linear(ctx, tObj, tObj->Image[level], texcoord[i], rgba[i]); + sample_2d_linear(ctx, tObj, tObj->Image[0][level], texcoord[i], rgba[i]); } } @@ -1373,14 +1373,14 @@ sample_2d_nearest_mipmap_linear(GLcontext *ctx, GLint level; COMPUTE_LINEAR_MIPMAP_LEVEL(tObj, lambda[i], level); if (level >= tObj->_MaxLevel) { - sample_2d_nearest(ctx, tObj, tObj->Image[tObj->_MaxLevel], + sample_2d_nearest(ctx, tObj, tObj->Image[0][tObj->_MaxLevel], texcoord[i], rgba[i]); } else { GLchan t0[4], t1[4]; /* texels */ const GLfloat f = FRAC(lambda[i]); - sample_2d_nearest(ctx, tObj, tObj->Image[level ], texcoord[i], t0); - sample_2d_nearest(ctx, tObj, tObj->Image[level+1], texcoord[i], t1); + sample_2d_nearest(ctx, tObj, tObj->Image[0][level ], texcoord[i], t0); + sample_2d_nearest(ctx, tObj, tObj->Image[0][level+1], texcoord[i], t1); rgba[i][RCOMP] = CHAN_CAST ((1.0F-f) * t0[RCOMP] + f * t1[RCOMP]); rgba[i][GCOMP] = CHAN_CAST ((1.0F-f) * t0[GCOMP] + f * t1[GCOMP]); rgba[i][BCOMP] = CHAN_CAST ((1.0F-f) * t0[BCOMP] + f * t1[BCOMP]); @@ -1404,14 +1404,14 @@ sample_2d_linear_mipmap_linear( GLcontext *ctx, GLint level; COMPUTE_LINEAR_MIPMAP_LEVEL(tObj, lambda[i], level); if (level >= tObj->_MaxLevel) { - sample_2d_linear(ctx, tObj, tObj->Image[tObj->_MaxLevel], + sample_2d_linear(ctx, tObj, tObj->Image[0][tObj->_MaxLevel], texcoord[i], rgba[i]); } else { GLchan t0[4], t1[4]; /* texels */ const GLfloat f = FRAC(lambda[i]); - sample_2d_linear(ctx, tObj, tObj->Image[level ], texcoord[i], t0); - sample_2d_linear(ctx, tObj, tObj->Image[level+1], texcoord[i], t1); + sample_2d_linear(ctx, tObj, tObj->Image[0][level ], texcoord[i], t0); + sample_2d_linear(ctx, tObj, tObj->Image[0][level+1], texcoord[i], t1); rgba[i][RCOMP] = CHAN_CAST ((1.0F-f) * t0[RCOMP] + f * t1[RCOMP]); rgba[i][GCOMP] = CHAN_CAST ((1.0F-f) * t0[GCOMP] + f * t1[GCOMP]); rgba[i][BCOMP] = CHAN_CAST ((1.0F-f) * t0[BCOMP] + f * t1[BCOMP]); @@ -1436,14 +1436,14 @@ sample_2d_linear_mipmap_linear_repeat( GLcontext *ctx, GLint level; COMPUTE_LINEAR_MIPMAP_LEVEL(tObj, lambda[i], level); if (level >= tObj->_MaxLevel) { - sample_2d_linear_repeat(ctx, tObj, tObj->Image[tObj->_MaxLevel], + sample_2d_linear_repeat(ctx, tObj, tObj->Image[0][tObj->_MaxLevel], texcoord[i], rgba[i]); } else { GLchan t0[4], t1[4]; /* texels */ const GLfloat f = FRAC(lambda[i]); - sample_2d_linear_repeat(ctx, tObj, tObj->Image[level ], texcoord[i], t0); - sample_2d_linear_repeat(ctx, tObj, tObj->Image[level+1], texcoord[i], t1); + sample_2d_linear_repeat(ctx, tObj, tObj->Image[0][level ], texcoord[i], t0); + sample_2d_linear_repeat(ctx, tObj, tObj->Image[0][level+1], texcoord[i], t1); rgba[i][RCOMP] = CHAN_CAST ((1.0F-f) * t0[RCOMP] + f * t1[RCOMP]); rgba[i][GCOMP] = CHAN_CAST ((1.0F-f) * t0[GCOMP] + f * t1[GCOMP]); rgba[i][BCOMP] = CHAN_CAST ((1.0F-f) * t0[BCOMP] + f * t1[BCOMP]); @@ -1460,7 +1460,7 @@ sample_nearest_2d( GLcontext *ctx, GLuint texUnit, const GLfloat lambda[], GLchan rgba[][4] ) { GLuint i; - struct gl_texture_image *image = tObj->Image[tObj->BaseLevel]; + struct gl_texture_image *image = tObj->Image[0][tObj->BaseLevel]; (void) lambda; for (i=0;iImage[tObj->BaseLevel]; + struct gl_texture_image *image = tObj->Image[0][tObj->BaseLevel]; (void) lambda; for (i=0;iImage[tObj->BaseLevel]; + const struct gl_texture_image *img = tObj->Image[0][tObj->BaseLevel]; const GLfloat width = (GLfloat) img->Width; const GLfloat height = (GLfloat) img->Height; const GLint colMask = img->Width - 1; @@ -1538,7 +1538,7 @@ opt_sample_rgba_2d( GLcontext *ctx, GLuint texUnit, GLuint n, const GLfloat texcoords[][4], const GLfloat lambda[], GLchan rgba[][4] ) { - const struct gl_texture_image *img = tObj->Image[tObj->BaseLevel]; + const struct gl_texture_image *img = tObj->Image[0][tObj->BaseLevel]; const GLfloat width = (GLfloat) img->Width; const GLfloat height = (GLfloat) img->Height; const GLint colMask = img->Width - 1; @@ -1572,7 +1572,7 @@ sample_lambda_2d( GLcontext *ctx, GLuint texUnit, GLuint n, const GLfloat texcoords[][4], const GLfloat lambda[], GLchan rgba[][4] ) { - const struct gl_texture_image *tImg = tObj->Image[tObj->BaseLevel]; + const struct gl_texture_image *tImg = tObj->Image[0][tObj->BaseLevel]; GLuint minStart, minEnd; /* texels with minification */ GLuint magStart, magEnd; /* texels with magnification */ @@ -1923,7 +1923,7 @@ sample_3d_nearest_mipmap_nearest(GLcontext *ctx, for (i = 0; i < n; i++) { GLint level; COMPUTE_NEAREST_MIPMAP_LEVEL(tObj, lambda[i], level); - sample_3d_nearest(ctx, tObj, tObj->Image[level], texcoord[i], rgba[i]); + sample_3d_nearest(ctx, tObj, tObj->Image[0][level], texcoord[i], rgba[i]); } } @@ -1939,7 +1939,7 @@ sample_3d_linear_mipmap_nearest(GLcontext *ctx, for (i = 0; i < n; i++) { GLint level; COMPUTE_NEAREST_MIPMAP_LEVEL(tObj, lambda[i], level); - sample_3d_linear(ctx, tObj, tObj->Image[level], texcoord[i], rgba[i]); + sample_3d_linear(ctx, tObj, tObj->Image[0][level], texcoord[i], rgba[i]); } } @@ -1956,14 +1956,14 @@ sample_3d_nearest_mipmap_linear(GLcontext *ctx, GLint level; COMPUTE_LINEAR_MIPMAP_LEVEL(tObj, lambda[i], level); if (level >= tObj->_MaxLevel) { - sample_3d_nearest(ctx, tObj, tObj->Image[tObj->_MaxLevel], + sample_3d_nearest(ctx, tObj, tObj->Image[0][tObj->_MaxLevel], texcoord[i], rgba[i]); } else { GLchan t0[4], t1[4]; /* texels */ const GLfloat f = FRAC(lambda[i]); - sample_3d_nearest(ctx, tObj, tObj->Image[level ], texcoord[i], t0); - sample_3d_nearest(ctx, tObj, tObj->Image[level+1], texcoord[i], t1); + sample_3d_nearest(ctx, tObj, tObj->Image[0][level ], texcoord[i], t0); + sample_3d_nearest(ctx, tObj, tObj->Image[0][level+1], texcoord[i], t1); rgba[i][RCOMP] = CHAN_CAST ((1.0F-f) * t0[RCOMP] + f * t1[RCOMP]); rgba[i][GCOMP] = CHAN_CAST ((1.0F-f) * t0[GCOMP] + f * t1[GCOMP]); rgba[i][BCOMP] = CHAN_CAST ((1.0F-f) * t0[BCOMP] + f * t1[BCOMP]); @@ -1985,14 +1985,14 @@ sample_3d_linear_mipmap_linear(GLcontext *ctx, GLint level; COMPUTE_LINEAR_MIPMAP_LEVEL(tObj, lambda[i], level); if (level >= tObj->_MaxLevel) { - sample_3d_linear(ctx, tObj, tObj->Image[tObj->_MaxLevel], + sample_3d_linear(ctx, tObj, tObj->Image[0][tObj->_MaxLevel], texcoord[i], rgba[i]); } else { GLchan t0[4], t1[4]; /* texels */ const GLfloat f = FRAC(lambda[i]); - sample_3d_linear(ctx, tObj, tObj->Image[level ], texcoord[i], t0); - sample_3d_linear(ctx, tObj, tObj->Image[level+1], texcoord[i], t1); + sample_3d_linear(ctx, tObj, tObj->Image[0][level ], texcoord[i], t0); + sample_3d_linear(ctx, tObj, tObj->Image[0][level+1], texcoord[i], t1); rgba[i][RCOMP] = CHAN_CAST ((1.0F-f) * t0[RCOMP] + f * t1[RCOMP]); rgba[i][GCOMP] = CHAN_CAST ((1.0F-f) * t0[GCOMP] + f * t1[GCOMP]); rgba[i][BCOMP] = CHAN_CAST ((1.0F-f) * t0[BCOMP] + f * t1[BCOMP]); @@ -2009,7 +2009,7 @@ sample_nearest_3d(GLcontext *ctx, GLuint texUnit, GLchan rgba[][4]) { GLuint i; - struct gl_texture_image *image = tObj->Image[tObj->BaseLevel]; + struct gl_texture_image *image = tObj->Image[0][tObj->BaseLevel]; (void) lambda; for (i=0;iImage[tObj->BaseLevel]; + struct gl_texture_image *image = tObj->Image[0][tObj->BaseLevel]; (void) lambda; for (i=0;iMinFilter) { case GL_NEAREST: for (i = minStart; i < minEnd; i++) - sample_3d_nearest(ctx, tObj, tObj->Image[tObj->BaseLevel], + sample_3d_nearest(ctx, tObj, tObj->Image[0][tObj->BaseLevel], texcoords[i], rgba[i]); break; case GL_LINEAR: for (i = minStart; i < minEnd; i++) - sample_3d_linear(ctx, tObj, tObj->Image[tObj->BaseLevel], + sample_3d_linear(ctx, tObj, tObj->Image[0][tObj->BaseLevel], texcoords[i], rgba[i]); break; case GL_NEAREST_MIPMAP_NEAREST: @@ -2092,12 +2092,12 @@ sample_lambda_3d( GLcontext *ctx, GLuint texUnit, switch (tObj->MagFilter) { case GL_NEAREST: for (i = magStart; i < magEnd; i++) - sample_3d_nearest(ctx, tObj, tObj->Image[tObj->BaseLevel], + sample_3d_nearest(ctx, tObj, tObj->Image[0][tObj->BaseLevel], texcoords[i], rgba[i]); break; case GL_LINEAR: for (i = magStart; i < magEnd; i++) - sample_3d_linear(ctx, tObj, tObj->Image[tObj->BaseLevel], + sample_3d_linear(ctx, tObj, tObj->Image[0][tObj->BaseLevel], texcoords[i], rgba[i]); break; default: @@ -2141,13 +2141,13 @@ choose_cube_face(const struct gl_texture_object *texObj, if (arx > ary && arx > arz) { if (rx >= 0.0F) { - imgArray = (const struct gl_texture_image **) texObj->Image; + imgArray = (const struct gl_texture_image **) texObj->Image[FACE_POS_X]; sc = -rz; tc = -ry; ma = arx; } else { - imgArray = (const struct gl_texture_image **) texObj->NegX; + imgArray = (const struct gl_texture_image **) texObj->Image[FACE_NEG_X]; sc = rz; tc = -ry; ma = arx; @@ -2155,13 +2155,13 @@ choose_cube_face(const struct gl_texture_object *texObj, } else if (ary > arx && ary > arz) { if (ry >= 0.0F) { - imgArray = (const struct gl_texture_image **) texObj->PosY; + imgArray = (const struct gl_texture_image **) texObj->Image[FACE_POS_Y]; sc = rx; tc = rz; ma = ary; } else { - imgArray = (const struct gl_texture_image **) texObj->NegY; + imgArray = (const struct gl_texture_image **) texObj->Image[FACE_NEG_Y]; sc = rx; tc = -rz; ma = ary; @@ -2169,13 +2169,13 @@ choose_cube_face(const struct gl_texture_object *texObj, } else { if (rz > 0.0F) { - imgArray = (const struct gl_texture_image **) texObj->PosZ; + imgArray = (const struct gl_texture_image **) texObj->Image[FACE_POS_Z]; sc = rx; tc = -ry; ma = arz; } else { - imgArray = (const struct gl_texture_image **) texObj->NegZ; + imgArray = (const struct gl_texture_image **) texObj->Image[FACE_NEG_Z]; sc = -rx; tc = -ry; ma = arz; @@ -2405,7 +2405,7 @@ sample_nearest_rect(GLcontext *ctx, GLuint texUnit, const GLfloat texcoords[][4], const GLfloat lambda[], GLchan rgba[][4]) { - const struct gl_texture_image *img = tObj->Image[0]; + const struct gl_texture_image *img = tObj->Image[0][0]; const GLfloat width = (GLfloat) img->Width; const GLfloat height = (GLfloat) img->Height; const GLint width_minus_1 = img->Width - 1; @@ -2460,7 +2460,7 @@ sample_linear_rect(GLcontext *ctx, GLuint texUnit, const GLfloat texcoords[][4], const GLfloat lambda[], GLchan rgba[][4]) { - const struct gl_texture_image *img = tObj->Image[0]; + const struct gl_texture_image *img = tObj->Image[0][0]; const GLfloat width = (GLfloat) img->Width; const GLfloat height = (GLfloat) img->Height; const GLint width_minus_1 = img->Width - 1; @@ -2590,7 +2590,7 @@ sample_depth_texture( GLcontext *ctx, GLuint unit, GLchan texel[][4] ) { const GLint baseLevel = tObj->BaseLevel; - const struct gl_texture_image *texImage = tObj->Image[baseLevel]; + const struct gl_texture_image *texImage = tObj->Image[0][baseLevel]; const GLuint width = texImage->Width; const GLuint height = texImage->Height; GLchan ambient; @@ -2599,7 +2599,7 @@ sample_depth_texture( GLcontext *ctx, GLuint unit, (void) unit; - ASSERT(tObj->Image[tObj->BaseLevel]->Format == GL_DEPTH_COMPONENT); + ASSERT(tObj->Image[0][tObj->BaseLevel]->Format == GL_DEPTH_COMPONENT); ASSERT(tObj->Target == GL_TEXTURE_1D || tObj->Target == GL_TEXTURE_2D || tObj->Target == GL_TEXTURE_RECTANGLE_NV); @@ -2881,7 +2881,7 @@ sample_depth_texture2(const GLcontext *ctx, { const struct gl_texture_object *texObj = texUnit->_Current; const GLint baseLevel = texObj->BaseLevel; - const struct gl_texture_image *texImage = texObj->Image[baseLevel]; + const struct gl_texture_image *texImage = texObj->Image[0][baseLevel]; const GLuint width = texImage->Width; const GLuint height = texImage->Height; GLchan ambient; @@ -2996,7 +2996,7 @@ _swrast_choose_texture_sample_func( GLcontext *ctx, const struct gl_texture_object *t ) { const GLboolean needLambda = (GLboolean) (t->MinFilter != t->MagFilter); - const GLenum format = t->Image[t->BaseLevel]->Format; + const GLenum format = t->Image[0][t->BaseLevel]->Format; if (!t->Complete) { return &null_sample_func; @@ -3034,15 +3034,15 @@ _swrast_choose_texture_sample_func( GLcontext *ctx, if (t->WrapS == GL_REPEAT && t->WrapT == GL_REPEAT && t->_IsPowerOfTwo && - t->Image[baseLevel]->Border == 0 && - t->Image[baseLevel]->TexFormat->MesaFormat == MESA_FORMAT_RGB) { + t->Image[0][baseLevel]->Border == 0 && + t->Image[0][baseLevel]->TexFormat->MesaFormat == MESA_FORMAT_RGB) { return &opt_sample_rgb_2d; } else if (t->WrapS == GL_REPEAT && t->WrapT == GL_REPEAT && t->_IsPowerOfTwo && - t->Image[baseLevel]->Border == 0 && - t->Image[baseLevel]->TexFormat->MesaFormat == MESA_FORMAT_RGBA) { + t->Image[0][baseLevel]->Border == 0 && + t->Image[0][baseLevel]->TexFormat->MesaFormat == MESA_FORMAT_RGBA) { return &opt_sample_rgba_2d; } else { @@ -3863,9 +3863,9 @@ texture_apply( const GLcontext *ctx, ASSERT(texUnit->_Current); baseLevel = texUnit->_Current->BaseLevel; - ASSERT(texUnit->_Current->Image[baseLevel]); + ASSERT(texUnit->_Current->Image[0][baseLevel]); - format = texUnit->_Current->Image[baseLevel]->Format; + format = texUnit->_Current->Image[0][baseLevel]->Format; if (format == GL_COLOR_INDEX || format == GL_YCBCR_MESA) { format = GL_RGBA; /* a bit of a hack */ diff --git a/src/mesa/swrast/s_triangle.c b/src/mesa/swrast/s_triangle.c index 3e429664670..ebbba34af5c 100644 --- a/src/mesa/swrast/s_triangle.c +++ b/src/mesa/swrast/s_triangle.c @@ -154,12 +154,12 @@ GLboolean _swrast_culltriangle( GLcontext *ctx, SWcontext *swrast = SWRAST_CONTEXT(ctx); \ struct gl_texture_object *obj = ctx->Texture.Unit[0].Current2D; \ const GLint b = obj->BaseLevel; \ - const GLfloat twidth = (GLfloat) obj->Image[b]->Width; \ - const GLfloat theight = (GLfloat) obj->Image[b]->Height; \ - const GLint twidth_log2 = obj->Image[b]->WidthLog2; \ - const GLchan *texture = (const GLchan *) obj->Image[b]->Data; \ - const GLint smask = obj->Image[b]->Width - 1; \ - const GLint tmask = obj->Image[b]->Height - 1; \ + const GLfloat twidth = (GLfloat) obj->Image[0][b]->Width; \ + const GLfloat theight = (GLfloat) obj->Image[0][b]->Height; \ + const GLint twidth_log2 = obj->Image[0][b]->WidthLog2; \ + const GLchan *texture = (const GLchan *) obj->Image[0][b]->Data; \ + const GLint smask = obj->Image[0][b]->Width - 1; \ + const GLint tmask = obj->Image[0][b]->Height - 1; \ if (!texture) { \ /* this shouldn't happen */ \ return; \ @@ -205,12 +205,12 @@ GLboolean _swrast_culltriangle( GLcontext *ctx, SWcontext *swrast = SWRAST_CONTEXT(ctx); \ struct gl_texture_object *obj = ctx->Texture.Unit[0].Current2D; \ const GLint b = obj->BaseLevel; \ - const GLfloat twidth = (GLfloat) obj->Image[b]->Width; \ - const GLfloat theight = (GLfloat) obj->Image[b]->Height; \ - const GLint twidth_log2 = obj->Image[b]->WidthLog2; \ - const GLchan *texture = (const GLchan *) obj->Image[b]->Data; \ - const GLint smask = obj->Image[b]->Width - 1; \ - const GLint tmask = obj->Image[b]->Height - 1; \ + const GLfloat twidth = (GLfloat) obj->Image[0][b]->Width; \ + const GLfloat theight = (GLfloat) obj->Image[0][b]->Height; \ + const GLint twidth_log2 = obj->Image[0][b]->WidthLog2; \ + const GLchan *texture = (const GLchan *) obj->Image[0][b]->Data; \ + const GLint smask = obj->Image[0][b]->Width - 1; \ + const GLint tmask = obj->Image[0][b]->Height - 1; \ if (!texture) { \ /* this shouldn't happen */ \ return; \ @@ -538,13 +538,13 @@ affine_span(GLcontext *ctx, struct sw_span *span, struct gl_texture_unit *unit = ctx->Texture.Unit+0; \ struct gl_texture_object *obj = unit->Current2D; \ const GLint b = obj->BaseLevel; \ - const GLfloat twidth = (GLfloat) obj->Image[b]->Width; \ - const GLfloat theight = (GLfloat) obj->Image[b]->Height; \ - info.texture = (const GLchan *) obj->Image[b]->Data; \ - info.twidth_log2 = obj->Image[b]->WidthLog2; \ - info.smask = obj->Image[b]->Width - 1; \ - info.tmask = obj->Image[b]->Height - 1; \ - info.format = obj->Image[b]->Format; \ + const GLfloat twidth = (GLfloat) obj->Image[0][b]->Width; \ + const GLfloat theight = (GLfloat) obj->Image[0][b]->Height; \ + info.texture = (const GLchan *) obj->Image[0][b]->Data; \ + info.twidth_log2 = obj->Image[0][b]->WidthLog2; \ + info.smask = obj->Image[0][b]->Width - 1; \ + info.tmask = obj->Image[0][b]->Height - 1; \ + info.format = obj->Image[0][b]->Format; \ info.filter = obj->MinFilter; \ info.envmode = unit->EnvMode; \ span.arrayMask |= SPAN_RGBA; \ @@ -565,22 +565,22 @@ affine_span(GLcontext *ctx, struct sw_span *span, case GL_ALPHA: \ case GL_LUMINANCE: \ case GL_INTENSITY: \ - info.tbytesline = obj->Image[b]->Width; \ + info.tbytesline = obj->Image[0][b]->Width; \ break; \ case GL_LUMINANCE_ALPHA: \ - info.tbytesline = obj->Image[b]->Width * 2; \ + info.tbytesline = obj->Image[0][b]->Width * 2; \ break; \ case GL_RGB: \ - info.tbytesline = obj->Image[b]->Width * 3; \ + info.tbytesline = obj->Image[0][b]->Width * 3; \ break; \ case GL_RGBA: \ - info.tbytesline = obj->Image[b]->Width * 4; \ + info.tbytesline = obj->Image[0][b]->Width * 4; \ break; \ default: \ _mesa_problem(NULL, "Bad texture format in affine_texture_triangle");\ return; \ } \ - info.tsize = obj->Image[b]->Height * info.tbytesline; + info.tsize = obj->Image[0][b]->Height * info.tbytesline; #define RENDER_SPAN( span ) affine_span(ctx, &span, &info); @@ -808,11 +808,11 @@ fast_persp_span(GLcontext *ctx, struct sw_span *span, const struct gl_texture_unit *unit = ctx->Texture.Unit+0; \ const struct gl_texture_object *obj = unit->Current2D; \ const GLint b = obj->BaseLevel; \ - info.texture = (const GLchan *) obj->Image[b]->Data; \ - info.twidth_log2 = obj->Image[b]->WidthLog2; \ - info.smask = obj->Image[b]->Width - 1; \ - info.tmask = obj->Image[b]->Height - 1; \ - info.format = obj->Image[b]->Format; \ + info.texture = (const GLchan *) obj->Image[0][b]->Data; \ + info.twidth_log2 = obj->Image[0][b]->WidthLog2; \ + info.smask = obj->Image[0][b]->Width - 1; \ + info.tmask = obj->Image[0][b]->Height - 1; \ + info.format = obj->Image[0][b]->Format; \ info.filter = obj->MinFilter; \ info.envmode = unit->EnvMode; \ \ @@ -832,22 +832,22 @@ fast_persp_span(GLcontext *ctx, struct sw_span *span, case GL_ALPHA: \ case GL_LUMINANCE: \ case GL_INTENSITY: \ - info.tbytesline = obj->Image[b]->Width; \ + info.tbytesline = obj->Image[0][b]->Width; \ break; \ case GL_LUMINANCE_ALPHA: \ - info.tbytesline = obj->Image[b]->Width * 2; \ + info.tbytesline = obj->Image[0][b]->Width * 2; \ break; \ case GL_RGB: \ - info.tbytesline = obj->Image[b]->Width * 3; \ + info.tbytesline = obj->Image[0][b]->Width * 3; \ break; \ case GL_RGBA: \ - info.tbytesline = obj->Image[b]->Width * 4; \ + info.tbytesline = obj->Image[0][b]->Width * 4; \ break; \ default: \ _mesa_problem(NULL, "Bad texture format in persp_textured_triangle");\ return; \ } \ - info.tsize = obj->Image[b]->Height * info.tbytesline; + info.tsize = obj->Image[0][b]->Height * info.tbytesline; #define RENDER_SPAN( span ) \ span.interpMask &= ~SPAN_RGBA; \ @@ -1062,7 +1062,7 @@ _swrast_choose_triangle( GLcontext *ctx ) GLenum minFilter, magFilter, envMode; GLint format; texObj2D = ctx->Texture.Unit[0].Current2D; - texImg = texObj2D ? texObj2D->Image[texObj2D->BaseLevel] : NULL; + texImg = texObj2D ? texObj2D->Image[0][texObj2D->BaseLevel] : NULL; format = texImg ? texImg->TexFormat->MesaFormat : -1; minFilter = texObj2D ? texObj2D->MinFilter : (GLenum) 0; magFilter = texObj2D ? texObj2D->MagFilter : (GLenum) 0; -- cgit v1.2.3