On 14 January 2011 16:49, Brian Paul <bri...@vmware.com> wrote: > I applied your patch and now mipmap_limits no longer matches NVIDIA. > The attached mipmap.mbox series should fix the issues I found for softpipe, r300g and r600g. I can't easily verify or fix the other drivers, though in principle not respecting the sampler view's first_level is a bug in the relevant drivers regardless of what value the Mesa state tracker happens to set for that field. The Gallium interface didn't change in that regard.
Also attached is mipmap_limits.diff, which modifies mipmap_limits to more easily reproduce the original bug.
mipmap.mbox
Description: application/mbox
diff --git a/tests/mesa/tests/mipmap_limits.c b/tests/mesa/tests/mipmap_limits.c index dc066ca..002f74e 100644 --- a/tests/mesa/tests/mipmap_limits.c +++ b/tests/mesa/tests/mipmap_limits.c @@ -57,7 +57,22 @@ static GLint BaseLevel = 0, MaxLevel = 8; static GLfloat MinLod = -1, MaxLod = 9; static GLfloat LodBias = 0.0; static GLboolean NearestFilter = GL_TRUE; +static unsigned int min_filter; +static const struct +{ + GLint value; + const char *name; +} +min_filters[] = +{ + {GL_LINEAR_MIPMAP_LINEAR, "LINEAR_MIPMAP_LINEAR"}, + {GL_NEAREST_MIPMAP_LINEAR, "NEAREST_MIPMAP_LINEAR"}, + {GL_LINEAR_MIPMAP_NEAREST, "LINEAR_MIPMAP_NEAREST"}, + {GL_NEAREST_MIPMAP_NEAREST, "NEAREST_MIPMAP_NEAREST"}, + {GL_LINEAR, "LINEAR"}, + {GL_NEAREST, "NEAREST"}, +}; static void MakeImage(int level, int width, int height, const GLubyte color[4]) { @@ -125,8 +140,8 @@ static void myinit(void) static void display(void) { GLfloat tcm = 4.0; - printf("BASE_LEVEL = %d MAX_LEVEL = %d MIN_LOD = %f MAX_LOD = %f Bias = %.2g filter = %s\n", - BaseLevel, MaxLevel, MinLod, MaxLod, LodBias, + printf("BASE_LEVEL = %d MAX_LEVEL = %d MIN_LOD = %f MAX_LOD = %f Bias = %.2g filter = %s / %s\n", + BaseLevel, MaxLevel, MinLod, MaxLod, LodBias, min_filters[min_filter].name, NearestFilter ? "NEAREST" : "LINEAR"); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_BASE_LEVEL, BaseLevel); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, MaxLevel); @@ -134,16 +149,8 @@ static void display(void) glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_LOD, MinLod); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LOD, MaxLod); - if (NearestFilter) { - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, - GL_NEAREST_MIPMAP_NEAREST); - } - else { - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, - GL_LINEAR_MIPMAP_LINEAR); - } + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, min_filters[min_filter].value); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, NearestFilter ? GL_NEAREST : GL_LINEAR); glTexEnvf(GL_TEXTURE_FILTER_CONTROL_EXT, GL_TEXTURE_LOD_BIAS_EXT, LodBias); @@ -212,6 +219,16 @@ key(unsigned char k, int x, int y) MaxLod += 0.02; break; case 'f': + if (!min_filter) + min_filter = sizeof(min_filters) / sizeof(*min_filters); + min_filter--; + break; + case 'F': + min_filter++; + if (min_filter == sizeof(min_filters) / sizeof(*min_filters)) + min_filter = 0; + break; + case 'g': NearestFilter = !NearestFilter; break; case 27: /* Escape */ @@ -232,7 +249,8 @@ static void usage(void) printf(" n/N decrease/increase GL_TEXTURE_MIN_LOD\n"); printf(" x/X decrease/increase GL_TEXTURE_MAX_LOD\n"); printf(" l/L decrease/increase GL_TEXTURE_LOD_BIAS\n"); - printf(" f toggle nearest/linear filtering\n"); + printf(" f/F cycle minification filter\n"); + printf(" g toggle nearest/linear magnification filter\n"); }
_______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev