summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/mesa/swrast/s_atifragshader.c6
-rw-r--r--src/mesa/swrast/s_context.c60
-rw-r--r--src/mesa/swrast/s_context.h3
-rw-r--r--src/mesa/swrast/s_nvfragprog.c4
-rw-r--r--src/mesa/swrast/s_tcc.c4
-rw-r--r--src/mesa/swrast/s_texcombine.c4
-rw-r--r--src/mesa/swrast/s_texfilter.c150
7 files changed, 103 insertions, 128 deletions
diff --git a/src/mesa/swrast/s_atifragshader.c b/src/mesa/swrast/s_atifragshader.c
index 292f00e9465..0c695ca854d 100644
--- a/src/mesa/swrast/s_atifragshader.c
+++ b/src/mesa/swrast/s_atifragshader.c
@@ -43,9 +43,9 @@ fetch_texel(GLcontext * ctx, const GLfloat texcoord[4], GLfloat lambda,
SWcontext *swrast = SWRAST_CONTEXT(ctx);
/* XXX use a float-valued TextureSample routine here!!! */
- swrast->TextureSample[unit] (ctx, unit, ctx->Texture.Unit[unit]._Current,
- 1, (const GLfloat(*)[4]) texcoord,
- &lambda, &rgba);
+ swrast->TextureSample[unit](ctx, ctx->Texture.Unit[unit]._Current,
+ 1, (const GLfloat(*)[4]) texcoord,
+ &lambda, &rgba);
color[0] = CHAN_TO_FLOAT(rgba[0]);
color[1] = CHAN_TO_FLOAT(rgba[1]);
color[2] = CHAN_TO_FLOAT(rgba[2]);
diff --git a/src/mesa/swrast/s_context.c b/src/mesa/swrast/s_context.c
index 2b39ffce0b6..05b1d8901e2 100644
--- a/src/mesa/swrast/s_context.c
+++ b/src/mesa/swrast/s_context.c
@@ -364,44 +364,6 @@ _swrast_validate_blend_func( GLcontext *ctx, GLuint n,
}
-/**
- * Called via the swrast->TextureSample[i] function pointer.
- * Basically, given a texture object, an array of texture coords
- * and an array of level-of-detail values, return an array of colors.
- * In this case, determine the correct texture sampling routine
- * (depending on filter mode, texture dimensions, etc) then call the
- * sampler routine.
- */
-static void
-_swrast_validate_texture_sample( GLcontext *ctx, GLuint texUnit,
- const struct gl_texture_object *tObj,
- GLuint n, const GLfloat texcoords[][4],
- const GLfloat lambda[], GLchan rgba[][4] )
-{
- SWcontext *swrast = SWRAST_CONTEXT(ctx);
-
- _swrast_validate_derived( ctx );
-
- /* Compute min/mag filter threshold */
- if (tObj && tObj->MinFilter != tObj->MagFilter) {
- if (tObj->MagFilter == GL_LINEAR
- && (tObj->MinFilter == GL_NEAREST_MIPMAP_NEAREST ||
- tObj->MinFilter == GL_NEAREST_MIPMAP_LINEAR)) {
- swrast->_MinMagThresh[texUnit] = 0.5F;
- }
- else {
- swrast->_MinMagThresh[texUnit] = 0.0F;
- }
- }
-
- swrast->TextureSample[texUnit] =
- _swrast_choose_texture_sample_func( ctx, tObj );
-
- swrast->TextureSample[texUnit]( ctx, texUnit, tObj, n, texcoords,
- lambda, rgba );
-}
-
-
static void
_swrast_sleep( GLcontext *ctx, GLbitfield new_state )
{
@@ -440,7 +402,22 @@ _swrast_invalidate_state( GLcontext *ctx, GLbitfield new_state )
if (new_state & _SWRAST_NEW_TEXTURE_SAMPLE_FUNC)
for (i = 0 ; i < ctx->Const.MaxTextureUnits ; i++)
- swrast->TextureSample[i] = _swrast_validate_texture_sample;
+ swrast->TextureSample[i] = NULL;
+}
+
+
+static void
+_swrast_update_texture_samplers(GLcontext *ctx)
+{
+ SWcontext *swrast = SWRAST_CONTEXT(ctx);
+ GLuint u;
+
+ for (u = 0; u < ctx->Const.MaxTextureImageUnits; u++) {
+ const struct gl_texture_object *tObj = ctx->Texture.Unit[u]._Current;
+ if (tObj)
+ swrast->TextureSample[u] =
+ _swrast_choose_texture_sample_func(ctx, tObj);
+ }
}
@@ -468,6 +445,9 @@ _swrast_validate_derived( GLcontext *ctx )
if (swrast->NewState & _NEW_PROGRAM)
_swrast_update_fragment_program( ctx );
+ if (swrast->NewState & _NEW_TEXTURE)
+ _swrast_update_texture_samplers( ctx );
+
swrast->NewState = 0;
swrast->StateChanges = 0;
swrast->InvalidateState = _swrast_invalidate_state;
@@ -604,7 +584,7 @@ _swrast_CreateContext( GLcontext *ctx )
swrast->_IntegerAccumScaler = 0.0;
for (i = 0; i < MAX_TEXTURE_IMAGE_UNITS; i++)
- swrast->TextureSample[i] = _swrast_validate_texture_sample;
+ swrast->TextureSample[i] = NULL;
swrast->SpanArrays = MALLOC_STRUCT(span_arrays);
if (!swrast->SpanArrays) {
diff --git a/src/mesa/swrast/s_context.h b/src/mesa/swrast/s_context.h
index e4c48fab9a2..a90474102e5 100644
--- a/src/mesa/swrast/s_context.h
+++ b/src/mesa/swrast/s_context.h
@@ -209,7 +209,7 @@ do { \
} while (0)
-typedef void (*texture_sample_func)(GLcontext *ctx, GLuint texUnit,
+typedef void (*texture_sample_func)(GLcontext *ctx,
const struct gl_texture_object *tObj,
GLuint n, const GLfloat texcoords[][4],
const GLfloat lambda[], GLchan rgba[][4]);
@@ -280,7 +280,6 @@ typedef struct
* _swrast_validate_derived():
*/
GLbitfield _RasterMask;
- GLfloat _MinMagThresh[MAX_TEXTURE_IMAGE_UNITS];
GLfloat _BackfaceSign;
GLboolean _PreferPixelFog; /* Compute fog blend factor per fragment? */
GLboolean _AnyTextureCombine;
diff --git a/src/mesa/swrast/s_nvfragprog.c b/src/mesa/swrast/s_nvfragprog.c
index 5ec1ce078fe..1f9ec448c2a 100644
--- a/src/mesa/swrast/s_nvfragprog.c
+++ b/src/mesa/swrast/s_nvfragprog.c
@@ -55,7 +55,7 @@ fetch_texel( GLcontext *ctx, const GLfloat texcoord[4], GLfloat lambda,
SWcontext *swrast = SWRAST_CONTEXT(ctx);
/* XXX use a float-valued TextureSample routine here!!! */
- swrast->TextureSample[unit](ctx, unit, ctx->Texture.Unit[unit]._Current,
+ swrast->TextureSample[unit](ctx, ctx->Texture.Unit[unit]._Current,
1, (const GLfloat (*)[4]) texcoord,
&lambda, &rgba);
color[0] = CHAN_TO_FLOAT(rgba[0]);
@@ -88,7 +88,7 @@ fetch_texel_deriv( GLcontext *ctx, const GLfloat texcoord[4],
texcoord[0], texcoord[1], texcoord[3],
1.0F / texcoord[3]);
- swrast->TextureSample[unit](ctx, unit, ctx->Texture.Unit[unit]._Current,
+ swrast->TextureSample[unit](ctx, ctx->Texture.Unit[unit]._Current,
1, (const GLfloat (*)[4]) texcoord,
&lambda, &rgba);
color[0] = CHAN_TO_FLOAT(rgba[0]);
diff --git a/src/mesa/swrast/s_tcc.c b/src/mesa/swrast/s_tcc.c
index 2309275b957..d6cea8f587d 100644
--- a/src/mesa/swrast/s_tcc.c
+++ b/src/mesa/swrast/s_tcc.c
@@ -66,7 +66,7 @@ static void TEX( void *cc, const float *texcoord, int unit, float *result )
GLfloat lambda = 1.0; /* hack */
GLchan rgba[4];
- swrast->TextureSample[unit](ctx, unit, ctx->Texture.Unit[unit]._Current,
+ swrast->TextureSample[unit](ctx, ctx->Texture.Unit[unit]._Current,
1, (const GLfloat (*)[4]) texcoord,
&lambda, &rgba);
@@ -90,7 +90,7 @@ static void TXB( void *cc, const float *texcoord, int unit, float *result )
/* Is it necessary to reset texcoord[3] to 1 at this point?
*/
- swrast->TextureSample[unit](ctx, unit, ctx->Texture.Unit[unit]._Current,
+ swrast->TextureSample[unit](ctx, ctx->Texture.Unit[unit]._Current,
1, (const GLfloat (*)[4]) texcoord,
&lambda, &rgba);
diff --git a/src/mesa/swrast/s_texcombine.c b/src/mesa/swrast/s_texcombine.c
index 65eccad2e91..2bdd4efaa20 100644
--- a/src/mesa/swrast/s_texcombine.c
+++ b/src/mesa/swrast/s_texcombine.c
@@ -1123,8 +1123,8 @@ _swrast_texture_span( GLcontext *ctx, struct sw_span *span )
}
}
- /* Sample the texture (span->end fragments) */
- swrast->TextureSample[unit]( ctx, unit, texUnit->_Current, span->end,
+ /* Sample the texture (span->end = number of fragments) */
+ swrast->TextureSample[unit]( ctx, texUnit->_Current, span->end,
(const GLfloat (*)[4]) span->array->texcoords[unit],
lambda, texels );
diff --git a/src/mesa/swrast/s_texfilter.c b/src/mesa/swrast/s_texfilter.c
index 0a42e622387..59673bb978a 100644
--- a/src/mesa/swrast/s_texfilter.c
+++ b/src/mesa/swrast/s_texfilter.c
@@ -549,11 +549,25 @@ nearest_mipmap_level(const struct gl_texture_object *tObj, GLfloat lambda)
* determines the subranges in [0, n-1] that are to be minified or magnified.
*/
static INLINE void
-compute_min_mag_ranges( GLfloat minMagThresh, GLuint n, const GLfloat lambda[],
- GLuint *minStart, GLuint *minEnd,
- GLuint *magStart, GLuint *magEnd )
+compute_min_mag_ranges(const struct gl_texture_object *tObj,
+ GLuint n, const GLfloat lambda[],
+ GLuint *minStart, GLuint *minEnd,
+ GLuint *magStart, GLuint *magEnd)
{
- ASSERT(lambda != NULL);
+ GLfloat minMagThresh;
+
+ /* we shouldn't be here if minfilter == magfilter */
+ ASSERT(tObj->MinFilter != tObj->MagFilter);
+
+ /* This bit comes from the OpenGL spec: */
+ if (tObj->MagFilter == GL_LINEAR
+ && (tObj->MinFilter == GL_NEAREST_MIPMAP_NEAREST ||
+ tObj->MinFilter == GL_NEAREST_MIPMAP_LINEAR)) {
+ minMagThresh = 0.5F;
+ }
+ else {
+ minMagThresh = 0.0F;
+ }
#if 0
/* DEBUG CODE: Verify that lambda[] is monotonic.
@@ -795,14 +809,13 @@ sample_1d_linear_mipmap_linear(GLcontext *ctx,
static void
-sample_nearest_1d( GLcontext *ctx, GLuint texUnit,
+sample_nearest_1d( GLcontext *ctx,
const struct gl_texture_object *tObj, GLuint n,
const GLfloat texcoords[][4], const GLfloat lambda[],
GLchan rgba[][4] )
{
GLuint i;
struct gl_texture_image *image = tObj->Image[0][tObj->BaseLevel];
- (void) texUnit;
(void) lambda;
for (i=0;i<n;i++) {
sample_1d_nearest(ctx, tObj, image, texcoords[i], rgba[i]);
@@ -812,14 +825,13 @@ sample_nearest_1d( GLcontext *ctx, GLuint texUnit,
static void
-sample_linear_1d( GLcontext *ctx, GLuint texUnit,
+sample_linear_1d( GLcontext *ctx,
const struct gl_texture_object *tObj, GLuint n,
const GLfloat texcoords[][4], const GLfloat lambda[],
GLchan rgba[][4] )
{
GLuint i;
struct gl_texture_image *image = tObj->Image[0][tObj->BaseLevel];
- (void) texUnit;
(void) lambda;
for (i=0;i<n;i++) {
sample_1d_linear(ctx, tObj, image, texcoords[i], rgba[i]);
@@ -833,7 +845,7 @@ sample_linear_1d( GLcontext *ctx, GLuint texUnit,
*
*/
static void
-sample_lambda_1d( GLcontext *ctx, GLuint texUnit,
+sample_lambda_1d( GLcontext *ctx,
const struct gl_texture_object *tObj, GLuint n,
const GLfloat texcoords[][4],
const GLfloat lambda[], GLchan rgba[][4] )
@@ -843,8 +855,8 @@ sample_lambda_1d( GLcontext *ctx, GLuint texUnit,
GLuint i;
ASSERT(lambda != NULL);
- compute_min_mag_ranges(SWRAST_CONTEXT(ctx)->_MinMagThresh[texUnit],
- n, lambda, &minStart, &minEnd, &magStart, &magEnd);
+ compute_min_mag_ranges(tObj, n, lambda,
+ &minStart, &minEnd, &magStart, &magEnd);
if (minStart < minEnd) {
/* do the minified texels */
@@ -1159,14 +1171,13 @@ sample_2d_linear_mipmap_linear_repeat( GLcontext *ctx,
static void
-sample_nearest_2d( GLcontext *ctx, GLuint texUnit,
+sample_nearest_2d( GLcontext *ctx,
const struct gl_texture_object *tObj, GLuint n,
const GLfloat texcoords[][4],
const GLfloat lambda[], GLchan rgba[][4] )
{
GLuint i;
struct gl_texture_image *image = tObj->Image[0][tObj->BaseLevel];
- (void) texUnit;
(void) lambda;
for (i=0;i<n;i++) {
sample_2d_nearest(ctx, tObj, image, texcoords[i], rgba[i]);
@@ -1176,14 +1187,13 @@ sample_nearest_2d( GLcontext *ctx, GLuint texUnit,
static void
-sample_linear_2d( GLcontext *ctx, GLuint texUnit,
+sample_linear_2d( GLcontext *ctx,
const struct gl_texture_object *tObj, GLuint n,
const GLfloat texcoords[][4],
const GLfloat lambda[], GLchan rgba[][4] )
{
GLuint i;
struct gl_texture_image *image = tObj->Image[0][tObj->BaseLevel];
- (void) texUnit;
(void) lambda;
if (tObj->WrapS == GL_REPEAT && tObj->WrapT == GL_REPEAT) {
for (i=0;i<n;i++) {
@@ -1207,7 +1217,7 @@ sample_linear_2d( GLcontext *ctx, GLuint texUnit,
* Format = GL_RGB
*/
static void
-opt_sample_rgb_2d( GLcontext *ctx, GLuint texUnit,
+opt_sample_rgb_2d( GLcontext *ctx,
const struct gl_texture_object *tObj,
GLuint n, const GLfloat texcoords[][4],
const GLfloat lambda[], GLchan rgba[][4] )
@@ -1220,7 +1230,6 @@ opt_sample_rgb_2d( GLcontext *ctx, GLuint texUnit,
const GLint shift = img->WidthLog2;
GLuint k;
(void) ctx;
- (void) texUnit;
(void) lambda;
ASSERT(tObj->WrapS==GL_REPEAT);
ASSERT(tObj->WrapT==GL_REPEAT);
@@ -1249,7 +1258,7 @@ opt_sample_rgb_2d( GLcontext *ctx, GLuint texUnit,
* Format = GL_RGBA
*/
static void
-opt_sample_rgba_2d( GLcontext *ctx, GLuint texUnit,
+opt_sample_rgba_2d( GLcontext *ctx,
const struct gl_texture_object *tObj,
GLuint n, const GLfloat texcoords[][4],
const GLfloat lambda[], GLchan rgba[][4] )
@@ -1262,7 +1271,6 @@ opt_sample_rgba_2d( GLcontext *ctx, GLuint texUnit,
const GLint shift = img->WidthLog2;
GLuint i;
(void) ctx;
- (void) texUnit;
(void) lambda;
ASSERT(tObj->WrapS==GL_REPEAT);
ASSERT(tObj->WrapT==GL_REPEAT);
@@ -1285,7 +1293,7 @@ opt_sample_rgba_2d( GLcontext *ctx, GLuint texUnit,
* values, return an array of texture sample.
*/
static void
-sample_lambda_2d( GLcontext *ctx, GLuint texUnit,
+sample_lambda_2d( GLcontext *ctx,
const struct gl_texture_object *tObj,
GLuint n, const GLfloat texcoords[][4],
const GLfloat lambda[], GLchan rgba[][4] )
@@ -1301,8 +1309,8 @@ sample_lambda_2d( GLcontext *ctx, GLuint texUnit,
&& tImg->_IsPowerOfTwo;
ASSERT(lambda != NULL);
- compute_min_mag_ranges(SWRAST_CONTEXT(ctx)->_MinMagThresh[texUnit],
- n, lambda, &minStart, &minEnd, &magStart, &magEnd);
+ compute_min_mag_ranges(tObj, n, lambda,
+ &minStart, &minEnd, &magStart, &magEnd);
if (minStart < minEnd) {
/* do the minified texels */
@@ -1314,7 +1322,7 @@ sample_lambda_2d( GLcontext *ctx, GLuint texUnit,
case MESA_FORMAT_RGB:
case MESA_FORMAT_RGB888:
/*case MESA_FORMAT_BGR888:*/
- opt_sample_rgb_2d(ctx, texUnit, tObj, m, texcoords + minStart,
+ opt_sample_rgb_2d(ctx, tObj, m, texcoords + minStart,
NULL, rgba + minStart);
break;
case MESA_FORMAT_RGBA:
@@ -1322,21 +1330,21 @@ sample_lambda_2d( GLcontext *ctx, GLuint texUnit,
case MESA_FORMAT_ARGB8888:
/*case MESA_FORMAT_ABGR8888:*/
/*case MESA_FORMAT_BGRA8888:*/
- opt_sample_rgba_2d(ctx, texUnit, tObj, m, texcoords + minStart,
+ opt_sample_rgba_2d(ctx, tObj, m, texcoords + minStart,
NULL, rgba + minStart);
break;
default:
- sample_nearest_2d(ctx, texUnit, tObj, m, texcoords + minStart,
+ sample_nearest_2d(ctx, tObj, m, texcoords + minStart,
NULL, rgba + minStart );
}
}
else {
- sample_nearest_2d(ctx, texUnit, tObj, m, texcoords + minStart,
+ sample_nearest_2d(ctx, tObj, m, texcoords + minStart,
NULL, rgba + minStart);
}
break;
case GL_LINEAR:
- sample_linear_2d(ctx, texUnit, tObj, m, texcoords + minStart,
+ sample_linear_2d(ctx, tObj, m, texcoords + minStart,
NULL, rgba + minStart);
break;
case GL_NEAREST_MIPMAP_NEAREST:
@@ -1377,7 +1385,7 @@ sample_lambda_2d( GLcontext *ctx, GLuint texUnit,
case MESA_FORMAT_RGB:
case MESA_FORMAT_RGB888:
/*case MESA_FORMAT_BGR888:*/
- opt_sample_rgb_2d(ctx, texUnit, tObj, m, texcoords + magStart,
+ opt_sample_rgb_2d(ctx, tObj, m, texcoords + magStart,
NULL, rgba + magStart);
break;
case MESA_FORMAT_RGBA:
@@ -1385,21 +1393,21 @@ sample_lambda_2d( GLcontext *ctx, GLuint texUnit,
case MESA_FORMAT_ARGB8888:
/*case MESA_FORMAT_ABGR8888:*/
/*case MESA_FORMAT_BGRA8888:*/
- opt_sample_rgba_2d(ctx, texUnit, tObj, m, texcoords + magStart,
+ opt_sample_rgba_2d(ctx, tObj, m, texcoords + magStart,
NULL, rgba + magStart);
break;
default:
- sample_nearest_2d(ctx, texUnit, tObj, m, texcoords + magStart,
+ sample_nearest_2d(ctx, tObj, m, texcoords + magStart,
NULL, rgba + magStart );
}
}
else {
- sample_nearest_2d(ctx, texUnit, tObj, m, texcoords + magStart,
+ sample_nearest_2d(ctx, tObj, m, texcoords + magStart,
NULL, rgba + magStart);
}
break;
case GL_LINEAR:
- sample_linear_2d(ctx, texUnit, tObj, m, texcoords + magStart,
+ sample_linear_2d(ctx, tObj, m, texcoords + magStart,
NULL, rgba + magStart);
break;
default:
@@ -1629,14 +1637,13 @@ sample_3d_linear_mipmap_linear(GLcontext *ctx,
static void
-sample_nearest_3d(GLcontext *ctx, GLuint texUnit,
+sample_nearest_3d(GLcontext *ctx,
const struct gl_texture_object *tObj, GLuint n,
const GLfloat texcoords[][4], const GLfloat lambda[],
GLchan rgba[][4])
{
GLuint i;
struct gl_texture_image *image = tObj->Image[0][tObj->BaseLevel];
- (void) texUnit;
(void) lambda;
for (i=0;i<n;i++) {
sample_3d_nearest(ctx, tObj, image, texcoords[i], rgba[i]);
@@ -1646,14 +1653,13 @@ sample_nearest_3d(GLcontext *ctx, GLuint texUnit,
static void
-sample_linear_3d( GLcontext *ctx, GLuint texUnit,
+sample_linear_3d( GLcontext *ctx,
const struct gl_texture_object *tObj, GLuint n,
const GLfloat texcoords[][4],
const GLfloat lambda[], GLchan rgba[][4] )
{
GLuint i;
struct gl_texture_image *image = tObj->Image[0][tObj->BaseLevel];
- (void) texUnit;
(void) lambda;
for (i=0;i<n;i++) {
sample_3d_linear(ctx, tObj, image, texcoords[i], rgba[i]);
@@ -1666,7 +1672,7 @@ sample_linear_3d( GLcontext *ctx, GLuint texUnit,
* return a texture sample.
*/
static void
-sample_lambda_3d( GLcontext *ctx, GLuint texUnit,
+sample_lambda_3d( GLcontext *ctx,
const struct gl_texture_object *tObj, GLuint n,
const GLfloat texcoords[][4], const GLfloat lambda[],
GLchan rgba[][4] )
@@ -1676,8 +1682,8 @@ sample_lambda_3d( GLcontext *ctx, GLuint texUnit,
GLuint i;
ASSERT(lambda != NULL);
- compute_min_mag_ranges(SWRAST_CONTEXT(ctx)->_MinMagThresh[texUnit],
- n, lambda, &minStart, &minEnd, &magStart, &magEnd);
+ compute_min_mag_ranges(tObj, n, lambda,
+ &minStart, &minEnd, &magStart, &magEnd);
if (minStart < minEnd) {
/* do the minified texels */
@@ -1817,13 +1823,12 @@ choose_cube_face(const struct gl_texture_object *texObj,
static void
-sample_nearest_cube(GLcontext *ctx, GLuint texUnit,
+sample_nearest_cube(GLcontext *ctx,
const struct gl_texture_object *tObj, GLuint n,
const GLfloat texcoords[][4], const GLfloat lambda[],
GLchan rgba[][4])
{
GLuint i;
- (void) texUnit;
(void) lambda;
for (i = 0; i < n; i++) {
const struct gl_texture_image **images;
@@ -1836,13 +1841,12 @@ sample_nearest_cube(GLcontext *ctx, GLuint texUnit,
static void
-sample_linear_cube(GLcontext *ctx, GLuint texUnit,
+sample_linear_cube(GLcontext *ctx,
const struct gl_texture_object *tObj, GLuint n,
const GLfloat texcoords[][4],
const GLfloat lambda[], GLchan rgba[][4])
{
GLuint i;
- (void) texUnit;
(void) lambda;
for (i = 0; i < n; i++) {
const struct gl_texture_image **images;
@@ -1855,13 +1859,12 @@ sample_linear_cube(GLcontext *ctx, GLuint texUnit,
static void
-sample_cube_nearest_mipmap_nearest(GLcontext *ctx, GLuint texUnit,
+sample_cube_nearest_mipmap_nearest(GLcontext *ctx,
const struct gl_texture_object *tObj,
GLuint n, const GLfloat texcoord[][4],
const GLfloat lambda[], GLchan rgba[][4])
{
GLuint i;
- (void) texUnit;
ASSERT(lambda != NULL);
for (i = 0; i < n; i++) {
const struct gl_texture_image **images;
@@ -1874,13 +1877,12 @@ sample_cube_nearest_mipmap_nearest(GLcontext *ctx, GLuint texUnit,
static void
-sample_cube_linear_mipmap_nearest(GLcontext *ctx, GLuint texUnit,
+sample_cube_linear_mipmap_nearest(GLcontext *ctx,
const struct gl_texture_object *tObj,
GLuint n, const GLfloat texcoord[][4],
const GLfloat lambda[], GLchan rgba[][4])
{
GLuint i;
- (void) texUnit;
ASSERT(lambda != NULL);
for (i = 0; i < n; i++) {
const struct gl_texture_image **images;
@@ -1893,13 +1895,12 @@ sample_cube_linear_mipmap_nearest(GLcontext *ctx, GLuint texUnit,
static void
-sample_cube_nearest_mipmap_linear(GLcontext *ctx, GLuint texUnit,
+sample_cube_nearest_mipmap_linear(GLcontext *ctx,
const struct gl_texture_object *tObj,
GLuint n, const GLfloat texcoord[][4],
const GLfloat lambda[], GLchan rgba[][4])
{
GLuint i;
- (void) texUnit;
ASSERT(lambda != NULL);
for (i = 0; i < n; i++) {
const struct gl_texture_image **images;
@@ -1922,13 +1923,12 @@ sample_cube_nearest_mipmap_linear(GLcontext *ctx, GLuint texUnit,
static void
-sample_cube_linear_mipmap_linear(GLcontext *ctx, GLuint texUnit,
+sample_cube_linear_mipmap_linear(GLcontext *ctx,
const struct gl_texture_object *tObj,
GLuint n, const GLfloat texcoord[][4],
const GLfloat lambda[], GLchan rgba[][4])
{
GLuint i;
- (void) texUnit;
ASSERT(lambda != NULL);
for (i = 0; i < n; i++) {
const struct gl_texture_image **images;
@@ -1951,7 +1951,7 @@ sample_cube_linear_mipmap_linear(GLcontext *ctx, GLuint texUnit,
static void
-sample_lambda_cube( GLcontext *ctx, GLuint texUnit,
+sample_lambda_cube( GLcontext *ctx,
const struct gl_texture_object *tObj, GLuint n,
const GLfloat texcoords[][4], const GLfloat lambda[],
GLchan rgba[][4])
@@ -1960,38 +1960,38 @@ sample_lambda_cube( GLcontext *ctx, GLuint texUnit,
GLuint magStart, magEnd; /* texels with magnification */
ASSERT(lambda != NULL);
- compute_min_mag_ranges(SWRAST_CONTEXT(ctx)->_MinMagThresh[texUnit],
- n, lambda, &minStart, &minEnd, &magStart, &magEnd);
+ compute_min_mag_ranges(tObj, n, lambda,
+ &minStart, &minEnd, &magStart, &magEnd);
if (minStart < minEnd) {
/* do the minified texels */
const GLuint m = minEnd - minStart;
switch (tObj->MinFilter) {
case GL_NEAREST:
- sample_nearest_cube(ctx, texUnit, tObj, m, texcoords + minStart,
+ sample_nearest_cube(ctx, tObj, m, texcoords + minStart,
lambda + minStart, rgba + minStart);
break;
case GL_LINEAR:
- sample_linear_cube(ctx, texUnit, tObj, m, texcoords + minStart,
+ sample_linear_cube(ctx, tObj, m, texcoords + minStart,
lambda + minStart, rgba + minStart);
break;
case GL_NEAREST_MIPMAP_NEAREST:
- sample_cube_nearest_mipmap_nearest(ctx, texUnit, tObj, m,
+ sample_cube_nearest_mipmap_nearest(ctx, tObj, m,
texcoords + minStart,
lambda + minStart, rgba + minStart);
break;
case GL_LINEAR_MIPMAP_NEAREST:
- sample_cube_linear_mipmap_nearest(ctx, texUnit, tObj, m,
+ sample_cube_linear_mipmap_nearest(ctx, tObj, m,
texcoords + minStart,
lambda + minStart, rgba + minStart);
break;
case GL_NEAREST_MIPMAP_LINEAR:
- sample_cube_nearest_mipmap_linear(ctx, texUnit, tObj, m,
+ sample_cube_nearest_mipmap_linear(ctx, tObj, m,
texcoords + minStart,
lambda + minStart, rgba + minStart);
break;
case GL_LINEAR_MIPMAP_LINEAR:
- sample_cube_linear_mipmap_linear(ctx, texUnit, tObj, m,
+ sample_cube_linear_mipmap_linear(ctx, tObj, m,
texcoords + minStart,
lambda + minStart, rgba + minStart);
break;
@@ -2005,11 +2005,11 @@ sample_lambda_cube( GLcontext *ctx, GLuint texUnit,
const GLuint m = magEnd - magStart;
switch (tObj->MagFilter) {
case GL_NEAREST:
- sample_nearest_cube(ctx, texUnit, tObj, m, texcoords + magStart,
+ sample_nearest_cube(ctx, tObj, m, texcoords + magStart,
lambda + magStart, rgba + magStart);
break;
case GL_LINEAR:
- sample_linear_cube(ctx, texUnit, tObj, m, texcoords + magStart,
+ sample_linear_cube(ctx, tObj, m, texcoords + magStart,
lambda + magStart, rgba + magStart);
break;
default:
@@ -2024,7 +2024,7 @@ sample_lambda_cube( GLcontext *ctx, GLuint texUnit,
/**********************************************************************/
static void
-sample_nearest_rect(GLcontext *ctx, GLuint texUnit,
+sample_nearest_rect(GLcontext *ctx,
const struct gl_texture_object *tObj, GLuint n,
const GLfloat texcoords[][4], const GLfloat lambda[],
GLchan rgba[][4])
@@ -2037,7 +2037,6 @@ sample_nearest_rect(GLcontext *ctx, GLuint texUnit,
GLuint i;
(void) ctx;
- (void) texUnit;
(void) lambda;
ASSERT(tObj->WrapS == GL_CLAMP ||
@@ -2080,7 +2079,7 @@ sample_nearest_rect(GLcontext *ctx, GLuint texUnit,
static void
-sample_linear_rect(GLcontext *ctx, GLuint texUnit,
+sample_linear_rect(GLcontext *ctx,
const struct gl_texture_object *tObj, GLuint n,
const GLfloat texcoords[][4],
const GLfloat lambda[], GLchan rgba[][4])
@@ -2093,7 +2092,6 @@ sample_linear_rect(GLcontext *ctx, GLuint texUnit,
GLuint i;
(void) ctx;
- (void) texUnit;
(void) lambda;
ASSERT(tObj->WrapS == GL_CLAMP ||
@@ -2194,7 +2192,7 @@ sample_linear_rect(GLcontext *ctx, GLuint texUnit,
static void
-sample_lambda_rect( GLcontext *ctx, GLuint texUnit,
+sample_lambda_rect( GLcontext *ctx,
const struct gl_texture_object *tObj, GLuint n,
const GLfloat texcoords[][4], const GLfloat lambda[],
GLchan rgba[][4])
@@ -2204,26 +2202,26 @@ sample_lambda_rect( GLcontext *ctx, GLuint texUnit,
/* We only need lambda to decide between minification and magnification.
* There is no mipmapping with rectangular textures.
*/
- compute_min_mag_ranges(SWRAST_CONTEXT(ctx)->_MinMagThresh[texUnit],
- n, lambda, &minStart, &minEnd, &magStart, &magEnd);
+ compute_min_mag_ranges(tObj, n, lambda,
+ &minStart, &minEnd, &magStart, &magEnd);
if (minStart < minEnd) {
if (tObj->MinFilter == GL_NEAREST) {
- sample_nearest_rect( ctx, texUnit, tObj, minEnd - minStart,
+ sample_nearest_rect( ctx, tObj, minEnd - minStart,
texcoords + minStart, NULL, rgba + minStart);
}
else {
- sample_linear_rect( ctx, texUnit, tObj, minEnd - minStart,
+ sample_linear_rect( ctx, tObj, minEnd - minStart,
texcoords + minStart, NULL, rgba + minStart);
}
}
if (magStart < magEnd) {
if (tObj->MagFilter == GL_NEAREST) {
- sample_nearest_rect( ctx, texUnit, tObj, magEnd - magStart,
+ sample_nearest_rect( ctx, tObj, magEnd - magStart,
texcoords + magStart, NULL, rgba + magStart);
}
else {
- sample_linear_rect( ctx, texUnit, tObj, magEnd - magStart,
+ sample_linear_rect( ctx, tObj, magEnd - magStart,
texcoords + magStart, NULL, rgba + magStart);
}
}
@@ -2235,7 +2233,7 @@ sample_lambda_rect( GLcontext *ctx, GLuint texUnit,
* Sample a shadow/depth texture.
*/
static void
-sample_depth_texture( GLcontext *ctx, GLuint unit,
+sample_depth_texture( GLcontext *ctx,
const struct gl_texture_object *tObj, GLuint n,
const GLfloat texcoords[][4], const GLfloat lambda[],
GLchan texel[][4] )
@@ -2249,7 +2247,6 @@ sample_depth_texture( GLcontext *ctx, GLuint unit,
GLchan result;
(void) lambda;
- (void) unit;
ASSERT(tObj->Image[0][tObj->BaseLevel]->Format == GL_DEPTH_COMPONENT);
ASSERT(tObj->Target == GL_TEXTURE_1D ||
@@ -2617,14 +2614,13 @@ sample_depth_texture2(const GLcontext *ctx,
* Note: fragment programss don't observe the texture enable/disable flags.
*/
static void
-null_sample_func( GLcontext *ctx, GLuint texUnit,
+null_sample_func( GLcontext *ctx,
const struct gl_texture_object *tObj, GLuint n,
const GLfloat texcoords[][4], const GLfloat lambda[],
GLchan rgba[][4])
{
GLuint i;
(void) ctx;
- (void) texUnit;
(void) tObj;
(void) texcoords;
(void) lambda;