Mesa (master): vc4: Fix the mapping of the minification filter to HW values.

Eric Anholt anholt at kemper.freedesktop.org
Thu Oct 2 00:05:32 UTC 2014


Module: Mesa
Branch: master
Commit: 4111b1d54b6c0ad0031506f81fb08d94b2db5a72
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=4111b1d54b6c0ad0031506f81fb08d94b2db5a72

Author: Eric Anholt <eric at anholt.net>
Date:   Wed Oct  1 11:58:22 2014 -0700

vc4: Fix the mapping of the minification filter to HW values.

They're actually as documented in the HW specs and the GL mipmapping enums
order.  Fixes fbo-generatemipmap-filtering , and some other tests where we
were off by a few bits due to unexpected linear filtering.

---

 src/gallium/drivers/vc4/vc4_program.c |   16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/src/gallium/drivers/vc4/vc4_program.c b/src/gallium/drivers/vc4/vc4_program.c
index c3da5fe..544ae66 100644
--- a/src/gallium/drivers/vc4/vc4_program.c
+++ b/src/gallium/drivers/vc4/vc4_program.c
@@ -1982,12 +1982,12 @@ write_texture_p1(struct vc4_context *vc4,
         struct pipe_sampler_view *texture = texstate->textures[unit];
         struct vc4_resource *rsc = vc4_resource(texture->texture);
         struct pipe_sampler_state *sampler = texstate->samplers[unit];
-        static const uint32_t mipfilter_map[] = {
-                [PIPE_TEX_MIPFILTER_NEAREST] = 2,
-                [PIPE_TEX_MIPFILTER_LINEAR] = 4,
-                [PIPE_TEX_MIPFILTER_NONE] = 0
+        static const uint8_t minfilter_map[6] = {
+                2, 4, /* mipfilter nearest */
+                3, 5, /* mipfilter linear */
+                1, 0, /* mipfilter none */
         };
-        static const uint32_t imgfilter_map[] = {
+        static const uint32_t magfilter_map[] = {
                 [PIPE_TEX_FILTER_NEAREST] = 1,
                 [PIPE_TEX_FILTER_LINEAR] = 0,
         };
@@ -2000,9 +2000,9 @@ write_texture_p1(struct vc4_context *vc4,
                ((rsc->vc4_format >> 4) << 31) |
                (texture->texture->height0 << 20) |
                (texture->texture->width0 << 8) |
-               (imgfilter_map[sampler->mag_img_filter] << 7) |
-               ((imgfilter_map[sampler->min_img_filter] +
-                 mipfilter_map[sampler->min_mip_filter]) << 4) |
+               (magfilter_map[sampler->mag_img_filter] << 7) |
+               (minfilter_map[sampler->min_mip_filter * 2 +
+                              sampler->min_img_filter] << 4) |
                (translate_wrap(sampler->wrap_t, either_nearest) << 2) |
                (translate_wrap(sampler->wrap_s, either_nearest) << 0));
 }




More information about the mesa-commit mailing list