aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Borca <[email protected]>2004-02-02 07:46:27 +0000
committerDaniel Borca <[email protected]>2004-02-02 07:46:27 +0000
commit4c7883e402dd0733a56870f4517e455e46523cf4 (patch)
tree81c3a1e53141f07f31af6e3a3f8a8f2bef662d10
parentc9e1c8098b40e28a1273b2846972f2434076156b (diff)
fixed a bug in GL_NEAREST sampler
-rw-r--r--src/mesa/drivers/glide/fxddtex.c15
-rw-r--r--src/mesa/swrast/s_texture.c24
2 files changed, 18 insertions, 21 deletions
diff --git a/src/mesa/drivers/glide/fxddtex.c b/src/mesa/drivers/glide/fxddtex.c
index 80728fe5778..17ff0826961 100644
--- a/src/mesa/drivers/glide/fxddtex.c
+++ b/src/mesa/drivers/glide/fxddtex.c
@@ -978,21 +978,6 @@ fxDDChooseTextureFormat( GLcontext *ctx, GLint internalFormat,
fxMesaContext fxMesa = FX_CONTEXT(ctx);
GLboolean allow32bpt = fxMesa->HaveTexFmt;
- /* [dBorca] Hack alert:
- * There is something wrong with this!!! Take an example:
- * 1) start HW rendering
- * 2) create a texture like this:
- * glTexImage2D(GL_TEXTURE_2D, 0, 3, 16, 16, 0,
- * GL_RGB, GL_UNSIGNED_BYTE, floorTexture);
- * glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
- * 3) we get here with internalFormat==3 and return either
- * _mesa_texformat_rgb565 or _mesa_texformat_argb8888
- * 4) at some point, we encounter total rasterization fallback
- * 5) displaying a polygon with the above textures yield garbage on areas
- * where pixel is larger than a texel, because our already set texel
- * function doesn't match the real _mesa_texformat_argb888
- */
-
if (TDFX_DEBUG & VERBOSE_TEXTURE) {
fprintf(stderr, "fxDDChooseTextureFormat(...)\n");
}
diff --git a/src/mesa/swrast/s_texture.c b/src/mesa/swrast/s_texture.c
index b5a4509c07e..37e8ea86f34 100644
--- a/src/mesa/swrast/s_texture.c
+++ b/src/mesa/swrast/s_texture.c
@@ -1592,12 +1592,18 @@ sample_lambda_2d( GLcontext *ctx, GLuint texUnit,
switch (tObj->MinFilter) {
case GL_NEAREST:
if (repeatNoBorderPOT) {
- switch (tImg->Format) {
- case GL_RGB:
+ switch (tImg->TexFormat->MesaFormat) {
+ case MESA_FORMAT_RGB:
+ case MESA_FORMAT_RGB888:
+ /*case MESA_FORMAT_BGR888:*/
opt_sample_rgb_2d(ctx, texUnit, tObj, m, texcoords + minStart,
NULL, rgba + minStart);
break;
- case GL_RGBA:
+ case MESA_FORMAT_RGBA:
+ case MESA_FORMAT_RGBA8888:
+ case MESA_FORMAT_ARGB8888:
+ /*case MESA_FORMAT_ABGR8888:*/
+ /*case MESA_FORMAT_BGRA8888:*/
opt_sample_rgba_2d(ctx, texUnit, tObj, m, texcoords + minStart,
NULL, rgba + minStart);
break;
@@ -1649,12 +1655,18 @@ sample_lambda_2d( GLcontext *ctx, GLuint texUnit,
switch (tObj->MagFilter) {
case GL_NEAREST:
if (repeatNoBorderPOT) {
- switch (tImg->Format) {
- case GL_RGB:
+ switch (tImg->TexFormat->MesaFormat) {
+ case MESA_FORMAT_RGB:
+ case MESA_FORMAT_RGB888:
+ /*case MESA_FORMAT_BGR888:*/
opt_sample_rgb_2d(ctx, texUnit, tObj, m, texcoords + magStart,
NULL, rgba + magStart);
break;
- case GL_RGBA:
+ case MESA_FORMAT_RGBA:
+ case MESA_FORMAT_RGBA8888:
+ case MESA_FORMAT_ARGB8888:
+ /*case MESA_FORMAT_ABGR8888:*/
+ /*case MESA_FORMAT_BGRA8888:*/
opt_sample_rgba_2d(ctx, texUnit, tObj, m, texcoords + magStart,
NULL, rgba + magStart);
break;