Mesa (master): gallivm: adjust wrap mode to CLAMP_TO_EDGE always for cube maps.

Roland Scheidegger sroland at kemper.freedesktop.org
Thu Sep 19 15:14:50 UTC 2013


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

Author: Roland Scheidegger <sroland at vmware.com>
Date:   Thu Sep 19 17:13:18 2013 +0200

gallivm: adjust wrap mode to CLAMP_TO_EDGE always for cube maps.

Technically without seamless filtering enabled GL allows any wrap mode, which
made sense when supporting true borders (can get seamless effect with border
and CLAMP_TO_BORDER), but gallium doesn't support borders and d3d9 requires
wrap modes to be ignored and it's a pain to fix up the sampler state (as it
makes it texture dependent). It is difficult to imagine a situation where an
app really wants another behavior so just cheat here. (It looks like some
graphics hw (intel) actually requires this too hence it should be safe.)

Reviewed-by: Jose Fonseca <jfonseca at vmware.com>

---

 src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c b/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c
index 355e97d..33378bc 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c
@@ -2123,14 +2123,18 @@ lp_build_sample_soa(struct gallivm_state *gallivm,
       debug_printf("  .min_mip_filter = %u\n", derived_sampler_state.min_mip_filter);
    }
 
-   if ((static_texture_state->target == PIPE_TEXTURE_CUBE ||
-        static_texture_state->target == PIPE_TEXTURE_CUBE_ARRAY) &&
-       static_sampler_state->seamless_cube_map)
+   if (static_texture_state->target == PIPE_TEXTURE_CUBE ||
+       static_texture_state->target == PIPE_TEXTURE_CUBE_ARRAY)
    {
       /*
        * Seamless filtering ignores wrap modes.
        * Setting to CLAMP_TO_EDGE is correct for nearest filtering, for
        * bilinear it's not correct but way better than using for instance repeat.
+       * Note we even set this for non-seamless. Technically GL allows any wrap
+       * mode, which made sense when supporting true borders (can get seamless
+       * effect with border and CLAMP_TO_BORDER), but gallium doesn't support
+       * borders and d3d9 requires wrap modes to be ignored and it's a pain to fix
+       * up the sampler state (as it makes it texture dependent).
        */
       derived_sampler_state.wrap_s = PIPE_TEX_WRAP_CLAMP_TO_EDGE;
       derived_sampler_state.wrap_t = PIPE_TEX_WRAP_CLAMP_TO_EDGE;




More information about the mesa-commit mailing list