-/* $Id: s_texture.c,v 1.49 2002/02/02 21:40:34 brianp Exp $ */
+/* $Id: s_texture.c,v 1.50 2002/02/15 03:41:47 brianp Exp $ */
/*
* Mesa 3-D graphics library
sample_1d_nearest(GLcontext *ctx,
const struct gl_texture_object *tObj,
const struct gl_texture_image *img,
- GLfloat s, GLchan rgba[4])
+ const GLfloat texcoord[4], GLchan rgba[4])
{
const GLint width = img->Width2; /* without border, power of two */
GLint i;
- COMPUTE_NEAREST_TEXEL_LOCATION(tObj->WrapS, s, width, i);
+ COMPUTE_NEAREST_TEXEL_LOCATION(tObj->WrapS, texcoord[0], width, i);
/* skip over the border, if any */
i += img->Border;
sample_1d_linear(GLcontext *ctx,
const struct gl_texture_object *tObj,
const struct gl_texture_image *img,
- GLfloat s, GLchan rgba[4])
+ const GLfloat texcoord[4], GLchan rgba[4])
{
const GLint width = img->Width2;
GLint i0, i1;
GLfloat u;
GLuint useBorderColor;
- COMPUTE_LINEAR_TEXEL_LOCATIONS(tObj->WrapS, s, u, width, i0, i1);
+ COMPUTE_LINEAR_TEXEL_LOCATIONS(tObj->WrapS, texcoord[0], u, width, i0, i1);
useBorderColor = 0;
if (img->Border) {
static void
sample_1d_nearest_mipmap_nearest(GLcontext *ctx,
const struct gl_texture_object *tObj,
- GLfloat s, GLfloat lambda,
+ const GLfloat texcoord[4], GLfloat lambda,
GLchan rgba[4])
{
GLint level;
COMPUTE_NEAREST_MIPMAP_LEVEL(tObj, lambda, level);
- sample_1d_nearest(ctx, tObj, tObj->Image[level], s, rgba);
+ sample_1d_nearest(ctx, tObj, tObj->Image[level], texcoord, rgba);
}
static void
sample_1d_linear_mipmap_nearest(GLcontext *ctx,
const struct gl_texture_object *tObj,
- GLfloat s, GLfloat lambda,
+ const GLfloat texcoord[4], GLfloat lambda,
GLchan rgba[4])
{
GLint level;
COMPUTE_NEAREST_MIPMAP_LEVEL(tObj, lambda, level);
- sample_1d_linear(ctx, tObj, tObj->Image[level], s, rgba);
+ sample_1d_linear(ctx, tObj, tObj->Image[level], texcoord, rgba);
}
static void
sample_1d_nearest_mipmap_linear(GLcontext *ctx,
const struct gl_texture_object *tObj,
- GLfloat s, GLfloat lambda,
+ const GLfloat texcoord[4], GLfloat lambda,
GLchan rgba[4])
{
GLint level;
COMPUTE_LINEAR_MIPMAP_LEVEL(tObj, lambda, level);
if (level >= tObj->_MaxLevel) {
- sample_1d_nearest(ctx, tObj, tObj->Image[tObj->_MaxLevel], s, rgba);
+ sample_1d_nearest(ctx, tObj, tObj->Image[tObj->_MaxLevel], texcoord, rgba);
}
else {
GLchan t0[4], t1[4];
const GLfloat f = FRAC(lambda);
- sample_1d_nearest(ctx, tObj, tObj->Image[level ], s, t0);
- sample_1d_nearest(ctx, tObj, tObj->Image[level+1], s, t1);
+ sample_1d_nearest(ctx, tObj, tObj->Image[level ], texcoord, t0);
+ sample_1d_nearest(ctx, tObj, tObj->Image[level+1], texcoord, t1);
rgba[RCOMP] = (GLchan) INTCAST ((1.0F-f) * t0[RCOMP] + f * t1[RCOMP]);
rgba[GCOMP] = (GLchan) INTCAST ((1.0F-f) * t0[GCOMP] + f * t1[GCOMP]);
rgba[BCOMP] = (GLchan) INTCAST ((1.0F-f) * t0[BCOMP] + f * t1[BCOMP]);
static void
sample_1d_linear_mipmap_linear(GLcontext *ctx,
const struct gl_texture_object *tObj,
- GLfloat s, GLfloat lambda,
+ const GLfloat texcoord[4], GLfloat lambda,
GLchan rgba[4])
{
GLint level;
COMPUTE_LINEAR_MIPMAP_LEVEL(tObj, lambda, level);
if (level >= tObj->_MaxLevel) {
- sample_1d_linear(ctx, tObj, tObj->Image[tObj->_MaxLevel], s, rgba);
+ sample_1d_linear(ctx, tObj, tObj->Image[tObj->_MaxLevel], texcoord, rgba);
}
else {
GLchan t0[4], t1[4];
const GLfloat f = FRAC(lambda);
- sample_1d_linear(ctx, tObj, tObj->Image[level ], s, t0);
- sample_1d_linear(ctx, tObj, tObj->Image[level+1], s, t1);
+ sample_1d_linear(ctx, tObj, tObj->Image[level ], texcoord, t0);
+ sample_1d_linear(ctx, tObj, tObj->Image[level+1], texcoord, t1);
rgba[RCOMP] = (GLchan) INTCAST ((1.0F-f) * t0[RCOMP] + f * t1[RCOMP]);
rgba[GCOMP] = (GLchan) INTCAST ((1.0F-f) * t0[GCOMP] + f * t1[GCOMP]);
rgba[BCOMP] = (GLchan) INTCAST ((1.0F-f) * t0[BCOMP] + f * t1[BCOMP]);
struct gl_texture_image *image = tObj->Image[tObj->BaseLevel];
(void) lambda;
for (i=0;i<n;i++) {
- sample_1d_nearest(ctx, tObj, image, texcoords[i][0], rgba[i]);
+ sample_1d_nearest(ctx, tObj, image, texcoords[i], rgba[i]);
}
}
struct gl_texture_image *image = tObj->Image[tObj->BaseLevel];
(void) lambda;
for (i=0;i<n;i++) {
- sample_1d_linear(ctx, tObj, image, texcoords[i][0], rgba[i]);
+ sample_1d_linear(ctx, tObj, image, texcoords[i], rgba[i]);
}
}
switch (tObj->MinFilter) {
case GL_NEAREST:
sample_1d_nearest(ctx, tObj, tObj->Image[tObj->BaseLevel],
- texcoords[i][0], rgba[i]);
+ texcoords[i], rgba[i]);
break;
case GL_LINEAR:
sample_1d_linear(ctx, tObj, tObj->Image[tObj->BaseLevel],
- texcoords[i][0], rgba[i]);
+ texcoords[i], rgba[i]);
break;
case GL_NEAREST_MIPMAP_NEAREST:
- sample_1d_nearest_mipmap_nearest(ctx, tObj, lambda[i], texcoords[i][0],
- rgba[i]);
+ sample_1d_nearest_mipmap_nearest(ctx, tObj, texcoords[i],
+ lambda[i], rgba[i]);
break;
case GL_LINEAR_MIPMAP_NEAREST:
- sample_1d_linear_mipmap_nearest(ctx, tObj, texcoords[i][0], lambda[i],
- rgba[i]);
+ sample_1d_linear_mipmap_nearest(ctx, tObj, texcoords[i],
+ lambda[i], rgba[i]);
break;
case GL_NEAREST_MIPMAP_LINEAR:
- sample_1d_nearest_mipmap_linear(ctx, tObj, texcoords[i][0], lambda[i],
- rgba[i]);
+ sample_1d_nearest_mipmap_linear(ctx, tObj, texcoords[i],
+ lambda[i], rgba[i]);
break;
case GL_LINEAR_MIPMAP_LINEAR:
- sample_1d_linear_mipmap_linear(ctx, tObj, texcoords[i][0], lambda[i],
- rgba[i]);
+ sample_1d_linear_mipmap_linear(ctx, tObj, texcoords[i],
+ lambda[i], rgba[i]);
break;
default:
_mesa_problem(NULL, "Bad min filter in sample_1d_texture");
switch (tObj->MagFilter) {
case GL_NEAREST:
sample_1d_nearest(ctx, tObj, tObj->Image[tObj->BaseLevel],
- texcoords[i][0], rgba[i]);
+ texcoords[i], rgba[i]);
break;
case GL_LINEAR:
sample_1d_linear(ctx, tObj, tObj->Image[tObj->BaseLevel],
- texcoords[i][0], rgba[i]);
+ texcoords[i], rgba[i]);
break;
default:
_mesa_problem(NULL, "Bad mag filter in sample_1d_texture");
sample_2d_nearest(GLcontext *ctx,
const struct gl_texture_object *tObj,
const struct gl_texture_image *img,
- GLfloat s, GLfloat t,
+ const GLfloat texcoord[4],
GLchan rgba[])
{
const GLint width = img->Width2; /* without border, power of two */
const GLint height = img->Height2; /* without border, power of two */
GLint i, j;
- COMPUTE_NEAREST_TEXEL_LOCATION(tObj->WrapS, s, width, i);
- COMPUTE_NEAREST_TEXEL_LOCATION(tObj->WrapT, t, height, j);
+ COMPUTE_NEAREST_TEXEL_LOCATION(tObj->WrapS, texcoord[0], width, i);
+ COMPUTE_NEAREST_TEXEL_LOCATION(tObj->WrapT, texcoord[1], height, j);
/* skip over the border, if any */
i += img->Border;
sample_2d_linear(GLcontext *ctx,
const struct gl_texture_object *tObj,
const struct gl_texture_image *img,
- GLfloat s, GLfloat t,
+ const GLfloat texcoord[4],
GLchan rgba[])
{
const GLint width = img->Width2;
GLuint useBorderColor;
GLfloat u, v;
- COMPUTE_LINEAR_TEXEL_LOCATIONS(tObj->WrapS, s, u, width, i0, i1);
- COMPUTE_LINEAR_TEXEL_LOCATIONS(tObj->WrapT, t, v, height, j0, j1);
+ COMPUTE_LINEAR_TEXEL_LOCATIONS(tObj->WrapS, texcoord[0], u, width, i0, i1);
+ COMPUTE_LINEAR_TEXEL_LOCATIONS(tObj->WrapT, texcoord[1], v, height, j0, j1);
useBorderColor = 0;
if (img->Border) {
static void
sample_2d_nearest_mipmap_nearest(GLcontext *ctx,
const struct gl_texture_object *tObj,
- GLfloat s, GLfloat t, GLfloat lambda,
+ const GLfloat texcoord[4], GLfloat lambda,
GLchan rgba[4])
{
GLint level;
COMPUTE_NEAREST_MIPMAP_LEVEL(tObj, lambda, level);
- sample_2d_nearest(ctx, tObj, tObj->Image[level], s, t, rgba);
+ sample_2d_nearest(ctx, tObj, tObj->Image[level], texcoord, rgba);
}
static void
sample_2d_linear_mipmap_nearest(GLcontext *ctx,
const struct gl_texture_object *tObj,
- GLfloat s, GLfloat t, GLfloat lambda,
+ const GLfloat texcoord[4], GLfloat lambda,
GLchan rgba[4])
{
GLint level;
COMPUTE_NEAREST_MIPMAP_LEVEL(tObj, lambda, level);
- sample_2d_linear(ctx, tObj, tObj->Image[level], s, t, rgba);
+ sample_2d_linear(ctx, tObj, tObj->Image[level], texcoord, rgba);
}
static void
sample_2d_nearest_mipmap_linear(GLcontext *ctx,
const struct gl_texture_object *tObj,
- GLfloat s, GLfloat t, GLfloat lambda,
+ const GLfloat texcoord[4], GLfloat lambda,
GLchan rgba[4])
{
GLint level;
COMPUTE_LINEAR_MIPMAP_LEVEL(tObj, lambda, level);
if (level >= tObj->_MaxLevel) {
- sample_2d_nearest(ctx, tObj, tObj->Image[tObj->_MaxLevel], s, t, rgba);
+ sample_2d_nearest(ctx, tObj, tObj->Image[tObj->_MaxLevel], texcoord, rgba);
}
else {
GLchan t0[4], t1[4]; /* texels */
const GLfloat f = FRAC(lambda);
- sample_2d_nearest(ctx, tObj, tObj->Image[level ], s, t, t0);
- sample_2d_nearest(ctx, tObj, tObj->Image[level+1], s, t, t1);
+ sample_2d_nearest(ctx, tObj, tObj->Image[level ], texcoord, t0);
+ sample_2d_nearest(ctx, tObj, tObj->Image[level+1], texcoord, t1);
rgba[RCOMP] = (GLchan) INTCAST ((1.0F-f) * t0[RCOMP] + f * t1[RCOMP]);
rgba[GCOMP] = (GLchan) INTCAST ((1.0F-f) * t0[GCOMP] + f * t1[GCOMP]);
rgba[BCOMP] = (GLchan) INTCAST ((1.0F-f) * t0[BCOMP] + f * t1[BCOMP]);
static void
sample_2d_linear_mipmap_linear(GLcontext *ctx,
const struct gl_texture_object *tObj,
- GLfloat s, GLfloat t, GLfloat lambda,
+ const GLfloat texcoord[4], GLfloat lambda,
GLchan rgba[4])
{
GLint level;
COMPUTE_LINEAR_MIPMAP_LEVEL(tObj, lambda, level);
if (level >= tObj->_MaxLevel) {
- sample_2d_linear(ctx, tObj, tObj->Image[tObj->_MaxLevel], s, t, rgba);
+ sample_2d_linear(ctx, tObj, tObj->Image[tObj->_MaxLevel], texcoord, rgba);
}
else {
GLchan t0[4], t1[4]; /* texels */
const GLfloat f = FRAC(lambda);
- sample_2d_linear(ctx, tObj, tObj->Image[level ], s, t, t0);
- sample_2d_linear(ctx, tObj, tObj->Image[level+1], s, t, t1);
+ sample_2d_linear(ctx, tObj, tObj->Image[level ], texcoord, t0);
+ sample_2d_linear(ctx, tObj, tObj->Image[level+1], texcoord, t1);
rgba[RCOMP] = (GLchan) INTCAST ((1.0F-f) * t0[RCOMP] + f * t1[RCOMP]);
rgba[GCOMP] = (GLchan) INTCAST ((1.0F-f) * t0[GCOMP] + f * t1[GCOMP]);
rgba[BCOMP] = (GLchan) INTCAST ((1.0F-f) * t0[BCOMP] + f * t1[BCOMP]);
struct gl_texture_image *image = tObj->Image[tObj->BaseLevel];
(void) lambda;
for (i=0;i<n;i++) {
- sample_2d_nearest(ctx, tObj, image, texcoords[i][0],
- texcoords[i][1], rgba[i]);
+ sample_2d_nearest(ctx, tObj, image, texcoords[i], rgba[i]);
}
}
struct gl_texture_image *image = tObj->Image[tObj->BaseLevel];
(void) lambda;
for (i=0;i<n;i++) {
- sample_2d_linear(ctx, tObj, image, texcoords[i][0],
- texcoords[i][1], rgba[i]);
+ sample_2d_linear(ctx, tObj, image, texcoords[i], rgba[i]);
}
}
opt_sample_rgb_2d( GLcontext *ctx, GLuint texUnit,
const struct gl_texture_object *tObj,
GLuint n, GLfloat texcoords[][4],
- const GLfloat lambda[],
- GLchan rgba[][4] )
+ const GLfloat lambda[], GLchan rgba[][4] )
{
const struct gl_texture_image *img = tObj->Image[tObj->BaseLevel];
const GLfloat width = (GLfloat) img->Width;
opt_sample_rgba_2d( GLcontext *ctx, GLuint texUnit,
const struct gl_texture_object *tObj,
GLuint n, GLfloat texcoords[][4],
- const GLfloat lambda[],
- GLchan rgba[][4] )
+ const GLfloat lambda[], GLchan rgba[][4] )
{
const struct gl_texture_image *img = tObj->Image[tObj->BaseLevel];
const GLfloat width = (GLfloat) img->Width;
sample_lambda_2d( GLcontext *ctx, GLuint texUnit,
const struct gl_texture_object *tObj,
GLuint n, GLfloat texcoords[][4],
- const GLfloat lambda[],
- GLchan rgba[][4] )
+ const GLfloat lambda[], GLchan rgba[][4] )
{
const GLfloat minMagThresh = SWRAST_CONTEXT(ctx)->_MinMagThresh[texUnit];
GLuint i;
}
}
else {
+ const struct gl_texture_image *tImg = tObj->Image[tObj->BaseLevel];
for (i = 0; i < n; i++) {
if (lambda[i] > minMagThresh) {
/* minification */
switch (tObj->MinFilter) {
case GL_NEAREST:
- sample_2d_nearest(ctx, tObj, tObj->Image[tObj->BaseLevel],
- texcoords[i][0], texcoords[i][1], rgba[i]);
+ sample_2d_nearest(ctx, tObj, tImg, texcoords[i], rgba[i]);
break;
case GL_LINEAR:
- sample_2d_linear(ctx, tObj, tObj->Image[tObj->BaseLevel],
- texcoords[i][0], texcoords[i][1], rgba[i]);
+ sample_2d_linear(ctx, tObj, tImg, texcoords[i], rgba[i]);
break;
case GL_NEAREST_MIPMAP_NEAREST:
- sample_2d_nearest_mipmap_nearest(ctx, tObj,
- texcoords[i][0],
- texcoords[i][1],
+ sample_2d_nearest_mipmap_nearest(ctx, tObj, texcoords[i],
lambda[i], rgba[i]);
break;
case GL_LINEAR_MIPMAP_NEAREST:
- sample_2d_linear_mipmap_nearest(ctx, tObj,
- texcoords[i][0],
- texcoords[i][1],
+ sample_2d_linear_mipmap_nearest(ctx, tObj, texcoords[i],
lambda[i], rgba[i]);
break;
case GL_NEAREST_MIPMAP_LINEAR:
- sample_2d_nearest_mipmap_linear(ctx, tObj,
- texcoords[i][0],
- texcoords[i][1],
+ sample_2d_nearest_mipmap_linear(ctx, tObj, texcoords[i],
lambda[i], rgba[i]);
break;
case GL_LINEAR_MIPMAP_LINEAR:
- sample_2d_linear_mipmap_linear(ctx, tObj,
- texcoords[i][0],
- texcoords[i][1],
+ sample_2d_linear_mipmap_linear(ctx, tObj, texcoords[i],
lambda[i], rgba[i] );
break;
default:
/* magnification */
switch (tObj->MagFilter) {
case GL_NEAREST:
- sample_2d_nearest(ctx, tObj, tObj->Image[tObj->BaseLevel],
- texcoords[i][0], texcoords[i][1], rgba[i]);
+ sample_2d_nearest(ctx, tObj, tImg, texcoords[i], rgba[i]);
break;
case GL_LINEAR:
- sample_2d_linear(ctx, tObj, tObj->Image[tObj->BaseLevel],
- texcoords[i][0], texcoords[i][1], rgba[i] );
+ sample_2d_linear(ctx, tObj, tImg, texcoords[i], rgba[i] );
break;
default:
_mesa_problem(NULL, "Bad mag filter in sample_2d_texture");
sample_3d_nearest(GLcontext *ctx,
const struct gl_texture_object *tObj,
const struct gl_texture_image *img,
- GLfloat s, GLfloat t, GLfloat r,
+ const GLfloat texcoord[4],
GLchan rgba[4])
{
const GLint width = img->Width2; /* without border, power of two */
const GLint depth = img->Depth2; /* without border, power of two */
GLint i, j, k;
- COMPUTE_NEAREST_TEXEL_LOCATION(tObj->WrapS, s, width, i);
- COMPUTE_NEAREST_TEXEL_LOCATION(tObj->WrapT, t, height, j);
- COMPUTE_NEAREST_TEXEL_LOCATION(tObj->WrapR, r, depth, k);
+ COMPUTE_NEAREST_TEXEL_LOCATION(tObj->WrapS, texcoord[0], width, i);
+ COMPUTE_NEAREST_TEXEL_LOCATION(tObj->WrapT, texcoord[1], height, j);
+ COMPUTE_NEAREST_TEXEL_LOCATION(tObj->WrapR, texcoord[2], depth, k);
if (i < 0 || i >= (GLint) img->Width ||
j < 0 || j >= (GLint) img->Height ||
sample_3d_linear(GLcontext *ctx,
const struct gl_texture_object *tObj,
const struct gl_texture_image *img,
- GLfloat s, GLfloat t, GLfloat r,
+ const GLfloat texcoord[4],
GLchan rgba[4])
{
const GLint width = img->Width2;
GLuint useBorderColor;
GLfloat u, v, w;
- COMPUTE_LINEAR_TEXEL_LOCATIONS(tObj->WrapS, s, u, width, i0, i1);
- COMPUTE_LINEAR_TEXEL_LOCATIONS(tObj->WrapT, t, v, height, j0, j1);
- COMPUTE_LINEAR_TEXEL_LOCATIONS(tObj->WrapR, r, w, depth, k0, k1);
+ COMPUTE_LINEAR_TEXEL_LOCATIONS(tObj->WrapS, texcoord[0], u, width, i0, i1);
+ COMPUTE_LINEAR_TEXEL_LOCATIONS(tObj->WrapT, texcoord[1], v, height, j0, j1);
+ COMPUTE_LINEAR_TEXEL_LOCATIONS(tObj->WrapR, texcoord[2], w, depth, k0, k1);
useBorderColor = 0;
if (img->Border) {
static void
sample_3d_nearest_mipmap_nearest(GLcontext *ctx,
const struct gl_texture_object *tObj,
- GLfloat s, GLfloat t, GLfloat r,
+ const GLfloat texcoord[4],
GLfloat lambda, GLchan rgba[4] )
{
GLint level;
COMPUTE_NEAREST_MIPMAP_LEVEL(tObj, lambda, level);
- sample_3d_nearest(ctx, tObj, tObj->Image[level], s, t, r, rgba);
+ sample_3d_nearest(ctx, tObj, tObj->Image[level], texcoord, rgba);
}
static void
sample_3d_linear_mipmap_nearest(GLcontext *ctx,
const struct gl_texture_object *tObj,
- GLfloat s, GLfloat t, GLfloat r,
+ const GLfloat texcoord[4],
GLfloat lambda, GLchan rgba[4])
{
GLint level;
COMPUTE_NEAREST_MIPMAP_LEVEL(tObj, lambda, level);
- sample_3d_linear(ctx, tObj, tObj->Image[level], s, t, r, rgba);
+ sample_3d_linear(ctx, tObj, tObj->Image[level], texcoord, rgba);
}
static void
sample_3d_nearest_mipmap_linear(GLcontext *ctx,
const struct gl_texture_object *tObj,
- GLfloat s, GLfloat t, GLfloat r,
+ const GLfloat texcoord[4],
GLfloat lambda, GLchan rgba[4])
{
GLint level;
if (level >= tObj->_MaxLevel) {
sample_3d_nearest(ctx, tObj, tObj->Image[tObj->_MaxLevel],
- s, t, r, rgba);
+ texcoord, rgba);
}
else {
GLchan t0[4], t1[4]; /* texels */
const GLfloat f = FRAC(lambda);
- sample_3d_nearest(ctx, tObj, tObj->Image[level ], s, t, r, t0);
- sample_3d_nearest(ctx, tObj, tObj->Image[level+1], s, t, r, t1);
+ sample_3d_nearest(ctx, tObj, tObj->Image[level ], texcoord, t0);
+ sample_3d_nearest(ctx, tObj, tObj->Image[level+1], texcoord, t1);
rgba[RCOMP] = (GLchan) INTCAST ((1.0F-f) * t0[RCOMP] + f * t1[RCOMP]);
rgba[GCOMP] = (GLchan) INTCAST ((1.0F-f) * t0[GCOMP] + f * t1[GCOMP]);
rgba[BCOMP] = (GLchan) INTCAST ((1.0F-f) * t0[BCOMP] + f * t1[BCOMP]);
static void
sample_3d_linear_mipmap_linear(GLcontext *ctx,
const struct gl_texture_object *tObj,
- GLfloat s, GLfloat t, GLfloat r,
+ const GLfloat texcoord[4],
GLfloat lambda, GLchan rgba[4] )
{
GLint level;
COMPUTE_LINEAR_MIPMAP_LEVEL(tObj, lambda, level);
if (level >= tObj->_MaxLevel) {
- sample_3d_linear(ctx, tObj, tObj->Image[tObj->_MaxLevel], s, t, r, rgba);
+ sample_3d_linear(ctx, tObj, tObj->Image[tObj->_MaxLevel], texcoord, rgba);
}
else {
GLchan t0[4], t1[4]; /* texels */
const GLfloat f = FRAC(lambda);
- sample_3d_linear(ctx, tObj, tObj->Image[level ], s, t, r, t0);
- sample_3d_linear(ctx, tObj, tObj->Image[level+1], s, t, r, t1);
+ sample_3d_linear(ctx, tObj, tObj->Image[level ], texcoord, t0);
+ sample_3d_linear(ctx, tObj, tObj->Image[level+1], texcoord, t1);
rgba[RCOMP] = (GLchan) INTCAST ((1.0F-f) * t0[RCOMP] + f * t1[RCOMP]);
rgba[GCOMP] = (GLchan) INTCAST ((1.0F-f) * t0[GCOMP] + f * t1[GCOMP]);
rgba[BCOMP] = (GLchan) INTCAST ((1.0F-f) * t0[BCOMP] + f * t1[BCOMP]);
struct gl_texture_image *image = tObj->Image[tObj->BaseLevel];
(void) lambda;
for (i=0;i<n;i++) {
- sample_3d_nearest(ctx, tObj, image,
- texcoords[i][0], texcoords[i][1], texcoords[i][2],
- rgba[i]);
+ sample_3d_nearest(ctx, tObj, image, texcoords[i], rgba[i]);
}
}
struct gl_texture_image *image = tObj->Image[tObj->BaseLevel];
(void) lambda;
for (i=0;i<n;i++) {
- sample_3d_linear(ctx, tObj, image,
- texcoords[i][0], texcoords[i][1], texcoords[i][2],
- rgba[i]);
+ sample_3d_linear(ctx, tObj, image, texcoords[i], rgba[i]);
}
}
switch (tObj->MinFilter) {
case GL_NEAREST:
sample_3d_nearest(ctx, tObj, tObj->Image[tObj->BaseLevel],
- texcoords[i][0], texcoords[i][1],
- texcoords[i][2], rgba[i]);
+ texcoords[i], rgba[i]);
break;
case GL_LINEAR:
sample_3d_linear(ctx, tObj, tObj->Image[tObj->BaseLevel],
- texcoords[i][0], texcoords[i][1],
- texcoords[i][2], rgba[i]);
+ texcoords[i], rgba[i]);
break;
case GL_NEAREST_MIPMAP_NEAREST:
- sample_3d_nearest_mipmap_nearest(ctx, tObj,
- texcoords[i][0],
- texcoords[i][1],
- texcoords[i][2],
+ sample_3d_nearest_mipmap_nearest(ctx, tObj, texcoords[i],
lambda[i], rgba[i]);
break;
case GL_LINEAR_MIPMAP_NEAREST:
- sample_3d_linear_mipmap_nearest(ctx, tObj,
- texcoords[i][0],
- texcoords[i][1],
- texcoords[i][2],
+ sample_3d_linear_mipmap_nearest(ctx, tObj, texcoords[i],
lambda[i], rgba[i]);
break;
case GL_NEAREST_MIPMAP_LINEAR:
- sample_3d_nearest_mipmap_linear(ctx, tObj,
- texcoords[i][0],
- texcoords[i][1],
- texcoords[i][2],
+ sample_3d_nearest_mipmap_linear(ctx, tObj, texcoords[i],
lambda[i], rgba[i]);
break;
case GL_LINEAR_MIPMAP_LINEAR:
- sample_3d_linear_mipmap_linear(ctx, tObj,
- texcoords[i][0],
- texcoords[i][1],
- texcoords[i][2],
+ sample_3d_linear_mipmap_linear(ctx, tObj, texcoords[i],
lambda[i], rgba[i]);
break;
default:
switch (tObj->MagFilter) {
case GL_NEAREST:
sample_3d_nearest(ctx, tObj, tObj->Image[tObj->BaseLevel],
- texcoords[i][0], texcoords[i][1],
- texcoords[i][2], rgba[i]);
+ texcoords[i], rgba[i]);
break;
case GL_LINEAR:
sample_3d_linear(ctx, tObj, tObj->Image[tObj->BaseLevel],
- texcoords[i][0], texcoords[i][1],
- texcoords[i][2], rgba[i]);
+ texcoords[i], rgba[i]);
break;
default:
_mesa_problem(NULL, "Bad mag filter in sample_3d_texture");
*/
static const struct gl_texture_image **
choose_cube_face(const struct gl_texture_object *texObj,
- GLfloat rx, GLfloat ry, GLfloat rz,
- GLfloat *newS, GLfloat *newT)
+ const GLfloat texcoord[4], GLfloat newCoord[4])
{
/*
major axis
+rz TEXTURE_CUBE_MAP_POSITIVE_Z_EXT +rx -ry rz
-rz TEXTURE_CUBE_MAP_NEGATIVE_Z_EXT -rx -ry rz
*/
+ const GLfloat rx = texcoord[0];
+ const GLfloat ry = texcoord[1];
+ const GLfloat rz = texcoord[2];
const struct gl_texture_image **imgArray;
const GLfloat arx = ABSF(rx), ary = ABSF(ry), arz = ABSF(rz);
GLfloat sc, tc, ma;
}
}
- *newS = ( sc / ma + 1.0F ) * 0.5F;
- *newT = ( tc / ma + 1.0F ) * 0.5F;
+ newCoord[0] = ( sc / ma + 1.0F ) * 0.5F;
+ newCoord[1] = ( tc / ma + 1.0F ) * 0.5F;
return imgArray;
}
(void) lambda;
for (i = 0; i < n; i++) {
const struct gl_texture_image **images;
- GLfloat newS, newT;
- images = choose_cube_face(tObj, texcoords[i][0], texcoords[i][1], texcoords[i][2], &newS, &newT);
+ GLfloat newCoord[4];
+ images = choose_cube_face(tObj, texcoords[i], newCoord);
sample_2d_nearest(ctx, tObj, images[tObj->BaseLevel],
- newS, newT, rgba[i]);
+ newCoord, rgba[i]);
}
}
(void) lambda;
for (i = 0; i < n; i++) {
const struct gl_texture_image **images;
- GLfloat newS, newT;
- images = choose_cube_face(tObj, texcoords[i][0], texcoords[i][1], texcoords[i][2], &newS, &newT);
+ GLfloat newCoord[4];
+ images = choose_cube_face(tObj, texcoords[i], newCoord);
sample_2d_linear(ctx, tObj, images[tObj->BaseLevel],
- newS, newT, rgba[i]);
+ newCoord, rgba[i]);
}
}
static void
sample_cube_nearest_mipmap_nearest(GLcontext *ctx,
const struct gl_texture_object *tObj,
- GLfloat s, GLfloat t, GLfloat u,
+ const GLfloat texcoord[4],
GLfloat lambda, GLchan rgba[4])
{
const struct gl_texture_image **images;
- GLfloat newS, newT;
+ GLfloat newCoord[4];
GLint level;
COMPUTE_NEAREST_MIPMAP_LEVEL(tObj, lambda, level);
- images = choose_cube_face(tObj, s, t, u, &newS, &newT);
- sample_2d_nearest(ctx, tObj, images[level], newS, newT, rgba);
+ images = choose_cube_face(tObj, texcoord, newCoord);
+ sample_2d_nearest(ctx, tObj, images[level], newCoord, rgba);
}
static void
sample_cube_linear_mipmap_nearest(GLcontext *ctx,
const struct gl_texture_object *tObj,
- GLfloat s, GLfloat t, GLfloat u,
+ const GLfloat texcoord[4],
GLfloat lambda, GLchan rgba[4])
{
const struct gl_texture_image **images;
- GLfloat newS, newT;
+ GLfloat newCoord[4];
GLint level;
COMPUTE_NEAREST_MIPMAP_LEVEL(tObj, lambda, level);
- images = choose_cube_face(tObj, s, t, u, &newS, &newT);
- sample_2d_linear(ctx, tObj, images[level], newS, newT, rgba);
+ images = choose_cube_face(tObj, texcoord, newCoord);
+ sample_2d_linear(ctx, tObj, images[level], newCoord, rgba);
}
static void
sample_cube_nearest_mipmap_linear(GLcontext *ctx,
const struct gl_texture_object *tObj,
- GLfloat s, GLfloat t, GLfloat u,
+ const GLfloat texcoord[4],
GLfloat lambda, GLchan rgba[4])
{
const struct gl_texture_image **images;
- GLfloat newS, newT;
+ GLfloat newCoord[4];
GLint level;
COMPUTE_LINEAR_MIPMAP_LEVEL(tObj, lambda, level);
- images = choose_cube_face(tObj, s, t, u, &newS, &newT);
+ images = choose_cube_face(tObj, texcoord, newCoord);
if (level >= tObj->_MaxLevel) {
- sample_2d_nearest(ctx, tObj, images[tObj->_MaxLevel], newS, newT, rgba);
+ sample_2d_nearest(ctx, tObj, images[tObj->_MaxLevel], newCoord, rgba);
}
else {
GLchan t0[4], t1[4]; /* texels */
const GLfloat f = FRAC(lambda);
- sample_2d_nearest(ctx, tObj, images[level ], newS, newT, t0);
- sample_2d_nearest(ctx, tObj, images[level+1], newS, newT, t1);
+ sample_2d_nearest(ctx, tObj, images[level ], newCoord, t0);
+ sample_2d_nearest(ctx, tObj, images[level+1], newCoord, t1);
rgba[RCOMP] = (GLchan) INTCAST ((1.0F-f) * t0[RCOMP] + f * t1[RCOMP]);
rgba[GCOMP] = (GLchan) INTCAST ((1.0F-f) * t0[GCOMP] + f * t1[GCOMP]);
rgba[BCOMP] = (GLchan) INTCAST ((1.0F-f) * t0[BCOMP] + f * t1[BCOMP]);
static void
sample_cube_linear_mipmap_linear(GLcontext *ctx,
const struct gl_texture_object *tObj,
- GLfloat s, GLfloat t, GLfloat u,
+ const GLfloat texcoord[4],
GLfloat lambda, GLchan rgba[4])
{
const struct gl_texture_image **images;
- GLfloat newS, newT;
+ GLfloat newCoord[4];
GLint level;
COMPUTE_LINEAR_MIPMAP_LEVEL(tObj, lambda, level);
- images = choose_cube_face(tObj, s, t, u, &newS, &newT);
+ images = choose_cube_face(tObj, texcoord, newCoord);
if (level >= tObj->_MaxLevel) {
- sample_2d_linear(ctx, tObj, images[tObj->_MaxLevel], newS, newT, rgba);
+ sample_2d_linear(ctx, tObj, images[tObj->_MaxLevel], newCoord, rgba);
}
else {
GLchan t0[4], t1[4];
const GLfloat f = FRAC(lambda);
- sample_2d_linear(ctx, tObj, images[level ], newS, newT, t0);
- sample_2d_linear(ctx, tObj, images[level+1], newS, newT, t1);
+ sample_2d_linear(ctx, tObj, images[level ], newCoord, t0);
+ sample_2d_linear(ctx, tObj, images[level+1], newCoord, t1);
rgba[RCOMP] = (GLchan) INTCAST ((1.0F-f) * t0[RCOMP] + f * t1[RCOMP]);
rgba[GCOMP] = (GLchan) INTCAST ((1.0F-f) * t0[GCOMP] + f * t1[GCOMP]);
rgba[BCOMP] = (GLchan) INTCAST ((1.0F-f) * t0[BCOMP] + f * t1[BCOMP]);
case GL_NEAREST:
{
const struct gl_texture_image **images;
- GLfloat newS, newT;
- images = choose_cube_face(tObj, texcoords[i][0],
- texcoords[i][1], texcoords[i][2],
- &newS, &newT);
+ GLfloat newCoord[4];
+ images = choose_cube_face(tObj, texcoords[i], newCoord);
sample_2d_nearest(ctx, tObj, images[tObj->BaseLevel],
- newS, newT, rgba[i]);
+ newCoord, rgba[i]);
}
break;
case GL_LINEAR:
{
const struct gl_texture_image **images;
- GLfloat newS, newT;
- images = choose_cube_face(tObj, texcoords[i][0], texcoords[i][1], texcoords[i][2],
- &newS, &newT);
+ GLfloat newCoord[4];
+ images = choose_cube_face(tObj, texcoords[i], newCoord);
sample_2d_linear(ctx, tObj, images[tObj->BaseLevel],
- newS, newT, rgba[i]);
+ newCoord, rgba[i]);
}
break;
case GL_NEAREST_MIPMAP_NEAREST:
- sample_cube_nearest_mipmap_nearest(ctx, tObj, texcoords[i][0], texcoords[i][1], texcoords[i][2],
+ sample_cube_nearest_mipmap_nearest(ctx, tObj, texcoords[i],
lambda[i], rgba[i]);
break;
case GL_LINEAR_MIPMAP_NEAREST:
- sample_cube_linear_mipmap_nearest(ctx, tObj, texcoords[i][0], texcoords[i][1], texcoords[i][2],
+ sample_cube_linear_mipmap_nearest(ctx, tObj, texcoords[i],
lambda[i], rgba[i]);
break;
case GL_NEAREST_MIPMAP_LINEAR:
- sample_cube_nearest_mipmap_linear(ctx, tObj, texcoords[i][0], texcoords[i][1], texcoords[i][2],
+ sample_cube_nearest_mipmap_linear(ctx, tObj, texcoords[i],
lambda[i], rgba[i]);
break;
case GL_LINEAR_MIPMAP_LINEAR:
- sample_cube_linear_mipmap_linear(ctx, tObj, texcoords[i][0], texcoords[i][1], texcoords[i][2],
+ sample_cube_linear_mipmap_linear(ctx, tObj, texcoords[i],
lambda[i], rgba[i]);
break;
default:
else {
/* magnification */
const struct gl_texture_image **images;
- GLfloat newS, newT;
- images = choose_cube_face(tObj, texcoords[i][0], texcoords[i][1], texcoords[i][2],
- &newS, &newT);
+ GLfloat newCoord[4];
+ images = choose_cube_face(tObj, texcoords[i], newCoord);
switch (tObj->MagFilter) {
case GL_NEAREST:
sample_2d_nearest(ctx, tObj, images[tObj->BaseLevel],
- newS, newT, rgba[i]);
+ newCoord, rgba[i]);
break;
case GL_LINEAR:
sample_2d_linear(ctx, tObj, images[tObj->BaseLevel],
- newS, newT, rgba[i]);
+ newCoord, rgba[i]);
break;
default:
_mesa_problem(NULL, "Bad mag filter in sample_lambda_cube");