summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>2019-06-21 16:58:48 -0700
committerAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>2019-06-25 13:39:17 -0700
commitf57dfe4cdd7a51aa814a0533b30fc22db0357bcc (patch)
treee2d96d6372e657695db8ec00e9d219a5a7e33695
parent748e5dac72255583339af327af6741626e2ce0b0 (diff)
panfrost: Disable mipmapping if necessary
If a mipfilter is not set, it's legal to have an incomplete mipmap; we should handle this accordingly. An "easy way out" is to rig the LOD clamps. Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
-rw-r--r--src/gallium/drivers/panfrost/pan_context.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/gallium/drivers/panfrost/pan_context.c b/src/gallium/drivers/panfrost/pan_context.c
index de6dd38c556..b36ecccf7bf 100644
--- a/src/gallium/drivers/panfrost/pan_context.c
+++ b/src/gallium/drivers/panfrost/pan_context.c
@@ -1906,6 +1906,22 @@ panfrost_create_sampler_state(
.unknown2 = 1,
};
+ /* If necessary, we disable mipmapping in the sampler descriptor by
+ * clamping the LOD as tight as possible (from 0 to epsilon,
+ * essentially -- remember these are fixed point numbers, so
+ * epsilon=1/256) */
+
+ if (cso->min_mip_filter == PIPE_TEX_MIPFILTER_NONE)
+ sampler_descriptor.max_lod = sampler_descriptor.min_lod;
+
+ /* Enforce that there is something in the middle by adding epsilon*/
+
+ if (sampler_descriptor.min_lod == sampler_descriptor.max_lod)
+ sampler_descriptor.max_lod++;
+
+ /* Sanity check */
+ assert(sampler_descriptor.max_lod > sampler_descriptor.min_lod);
+
so->hw = sampler_descriptor;
return so;