summaryrefslogtreecommitdiff
path: root/src/mesa/swrast
diff options
context:
space:
mode:
authorBrian Paul <brian.paul@tungstengraphics.com>2004-05-12 01:50:30 +0000
committerBrian Paul <brian.paul@tungstengraphics.com>2004-05-12 01:50:30 +0000
commita156b49800c1419785d0709b78ef0d35e6dab5df (patch)
tree3831a74900723783b3117e2f1604ff3ebd9797c5 /src/mesa/swrast
parent939f6a724e991a9f994c6e2fffe96c5971a1f749 (diff)
Added big-endian texture formats.
Moved CI->RGBA palette lookup into texel fetch function.
Diffstat (limited to 'src/mesa/swrast')
-rw-r--r--src/mesa/swrast/s_texture.c105
1 files changed, 0 insertions, 105 deletions
diff --git a/src/mesa/swrast/s_texture.c b/src/mesa/swrast/s_texture.c
index 6a4b7f7303..b2ccb81e85 100644
--- a/src/mesa/swrast/s_texture.c
+++ b/src/mesa/swrast/s_texture.c
@@ -347,57 +347,6 @@ repeat_remainder(GLint a, GLint b)
/*
- * Get texture palette entry.
- */
-static void
-palette_sample(const GLcontext *ctx,
- const struct gl_texture_object *tObj,
- GLint index, GLchan rgba[4] )
-{
- const GLchan *palette;
- GLenum format;
-
- if (ctx->Texture.SharedPalette) {
- ASSERT(ctx->Texture.Palette.Type != GL_FLOAT);
- palette = (const GLchan *) ctx->Texture.Palette.Table;
- format = ctx->Texture.Palette.Format;
- }
- else {
- ASSERT(tObj->Palette.Type != GL_FLOAT);
- palette = (const GLchan *) tObj->Palette.Table;
- format = tObj->Palette.Format;
- }
-
- switch (format) {
- case GL_ALPHA:
- rgba[ACOMP] = palette[index];
- return;
- case GL_LUMINANCE:
- case GL_INTENSITY:
- rgba[RCOMP] = palette[index];
- return;
- case GL_LUMINANCE_ALPHA:
- rgba[RCOMP] = palette[(index << 1) + 0];
- rgba[ACOMP] = palette[(index << 1) + 1];
- return;
- case GL_RGB:
- rgba[RCOMP] = palette[index * 3 + 0];
- rgba[GCOMP] = palette[index * 3 + 1];
- rgba[BCOMP] = palette[index * 3 + 2];
- return;
- case GL_RGBA:
- rgba[RCOMP] = palette[(index << 2) + 0];
- rgba[GCOMP] = palette[(index << 2) + 1];
- rgba[BCOMP] = palette[(index << 2) + 2];
- rgba[ACOMP] = palette[(index << 2) + 3];
- return;
- default:
- _mesa_problem(ctx, "Bad palette format in palette_sample");
- }
-}
-
-
-/*
* The lambda[] array values are always monotonic. Either the whole span
* will be minified, magnified, or split between the two. This function
* determines the subranges in [0, n-1] that are to be minified or magnified.
@@ -519,9 +468,6 @@ sample_1d_nearest(GLcontext *ctx,
}
else {
img->FetchTexelc(img, i, 0, 0, rgba);
- if (img->Format == GL_COLOR_INDEX) {
- palette_sample(ctx, tObj, rgba[0], rgba);
- }
}
}
@@ -571,18 +517,12 @@ sample_1d_linear(GLcontext *ctx,
}
else {
img->FetchTexelc(img, i0, 0, 0, t0);
- if (img->Format == GL_COLOR_INDEX) {
- palette_sample(ctx, tObj, t0[0], t0);
- }
}
if (useBorderColor & I1BIT) {
COPY_CHAN4(t1, tObj->_BorderChan);
}
else {
img->FetchTexelc(img, i1, 0, 0, t1);
- if (img->Format == GL_COLOR_INDEX) {
- palette_sample(ctx, tObj, t1[0], t1);
- }
}
#if CHAN_TYPE == GL_FLOAT
@@ -848,9 +788,6 @@ sample_2d_nearest(GLcontext *ctx,
}
else {
img->FetchTexelc(img, i, j, 0, rgba);
- if (img->Format == GL_COLOR_INDEX) {
- palette_sample(ctx, tObj, rgba[0], rgba);
- }
}
}
@@ -916,36 +853,24 @@ sample_2d_linear(GLcontext *ctx,
}
else {
img->FetchTexelc(img, i0, j0, 0, t00);
- if (img->Format == GL_COLOR_INDEX) {
- palette_sample(ctx, tObj, t00[0], t00);
- }
}
if (useBorderColor & (I1BIT | J0BIT)) {
COPY_CHAN4(t10, tObj->_BorderChan);
}
else {
img->FetchTexelc(img, i1, j0, 0, t10);
- if (img->Format == GL_COLOR_INDEX) {
- palette_sample(ctx, tObj, t10[0], t10);
- }
}
if (useBorderColor & (I0BIT | J1BIT)) {
COPY_CHAN4(t01, tObj->_BorderChan);
}
else {
img->FetchTexelc(img, i0, j1, 0, t01);
- if (img->Format == GL_COLOR_INDEX) {
- palette_sample(ctx, tObj, t01[0], t01);
- }
}
if (useBorderColor & (I1BIT | J1BIT)) {
COPY_CHAN4(t11, tObj->_BorderChan);
}
else {
img->FetchTexelc(img, i1, j1, 0, t11);
- if (img->Format == GL_COLOR_INDEX) {
- palette_sample(ctx, tObj, t11[0], t11);
- }
}
#if CHAN_TYPE == GL_FLOAT
rgba[0] = w00 * t00[0] + w10 * t10[0] + w01 * t01[0] + w11 * t11[0];
@@ -1454,9 +1379,6 @@ sample_3d_nearest(GLcontext *ctx,
}
else {
img->FetchTexelc(img, i, j, k, rgba);
- if (img->Format == GL_COLOR_INDEX) {
- palette_sample(ctx, tObj, rgba[0], rgba);
- }
}
}
@@ -1537,36 +1459,24 @@ sample_3d_linear(GLcontext *ctx,
}
else {
img->FetchTexelc(img, i0, j0, k0, t000);
- if (img->Format == GL_COLOR_INDEX) {
- palette_sample(ctx, tObj, t000[0], t000);
- }
}
if (useBorderColor & (I1BIT | J0BIT | K0BIT)) {
COPY_CHAN4(t100, tObj->_BorderChan);
}
else {
img->FetchTexelc(img, i1, j0, k0, t100);
- if (img->Format == GL_COLOR_INDEX) {
- palette_sample(ctx, tObj, t100[0], t100);
- }
}
if (useBorderColor & (I0BIT | J1BIT | K0BIT)) {
COPY_CHAN4(t010, tObj->_BorderChan);
}
else {
img->FetchTexelc(img, i0, j1, k0, t010);
- if (img->Format == GL_COLOR_INDEX) {
- palette_sample(ctx, tObj, t010[0], t010);
- }
}
if (useBorderColor & (I1BIT | J1BIT | K0BIT)) {
COPY_CHAN4(t110, tObj->_BorderChan);
}
else {
img->FetchTexelc(img, i1, j1, k0, t110);
- if (img->Format == GL_COLOR_INDEX) {
- palette_sample(ctx, tObj, t110[0], t110);
- }
}
if (useBorderColor & (I0BIT | J0BIT | K1BIT)) {
@@ -1574,36 +1484,24 @@ sample_3d_linear(GLcontext *ctx,
}
else {
img->FetchTexelc(img, i0, j0, k1, t001);
- if (img->Format == GL_COLOR_INDEX) {
- palette_sample(ctx, tObj, t001[0], t001);
- }
}
if (useBorderColor & (I1BIT | J0BIT | K1BIT)) {
COPY_CHAN4(t101, tObj->_BorderChan);
}
else {
img->FetchTexelc(img, i1, j0, k1, t101);
- if (img->Format == GL_COLOR_INDEX) {
- palette_sample(ctx, tObj, t101[0], t101);
- }
}
if (useBorderColor & (I0BIT | J1BIT | K1BIT)) {
COPY_CHAN4(t011, tObj->_BorderChan);
}
else {
img->FetchTexelc(img, i0, j1, k1, t011);
- if (img->Format == GL_COLOR_INDEX) {
- palette_sample(ctx, tObj, t011[0], t011);
- }
}
if (useBorderColor & (I1BIT | J1BIT | K1BIT)) {
COPY_CHAN4(t111, tObj->_BorderChan);
}
else {
img->FetchTexelc(img, i1, j1, k1, t111);
- if (img->Format == GL_COLOR_INDEX) {
- palette_sample(ctx, tObj, t111[0], t111);
- }
}
#if CHAN_TYPE == GL_FLOAT
@@ -2171,9 +2069,6 @@ sample_nearest_rect(GLcontext *ctx, GLuint texUnit,
GLint row, col;
/* NOTE: we DO NOT use [0, 1] texture coordinates! */
if (tObj->WrapS == GL_CLAMP) {
- /* Note: we use width-1, not what the spec says, but it actually
- * does work correctly.
- */
col = IFLOOR( CLAMP(texcoords[i][0], 0.0F, width - 1) );
}
else if (tObj->WrapS == GL_CLAMP_TO_EDGE) {