v3d: Fix min vs mag determination when not doing mip filtering.
authorEric Anholt <eric@anholt.net>
Wed, 20 Jun 2018 17:22:44 +0000 (10:22 -0700)
committerEric Anholt <eric@anholt.net>
Wed, 20 Jun 2018 19:31:54 +0000 (12:31 -0700)
Fixes all 128 failing tests in
dEQP-GLES3.functional.texture.filtering.*.combinations

src/gallium/drivers/v3d/v3dx_state.c

index 70c596855f9b7ac419547471b4e38f41f55268a2..c0f43d800eabec46bedfa6da497f2a5df441d1c0 100644 (file)
@@ -556,9 +556,17 @@ v3d_create_sampler_state(struct pipe_context *pctx,
                                                    15);
                 sampler.max_level_of_detail = MIN2(cso->max_lod, 15);
 
+                /* If we're not doing inter-miplevel filtering, we need to
+                 * clamp the LOD so that we only sample from baselevel.
+                 * However, we need to still allow the calculated LOD to be
+                 * fractionally over the baselevel, so that the HW can decide
+                 * between the min and mag filters.
+                 */
                 if (cso->min_mip_filter == PIPE_TEX_MIPFILTER_NONE) {
-                        sampler.min_level_of_detail = 0;
-                        sampler.max_level_of_detail = 0;
+                        sampler.min_level_of_detail =
+                                MIN2(sampler.min_level_of_detail, 1.0 / 256.0);
+                        sampler.max_level_of_detail =
+                                MIN2(sampler.max_level_of_detail, 1.0 / 256.0);
                 }
 
                 if (cso->max_anisotropy) {