Mesa (master): gallivm: use sampler index 0 for texel fetches

Roland Scheidegger sroland at kemper.freedesktop.org
Fri Nov 20 16:01:15 UTC 2015


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

Author: Roland Scheidegger <sroland at vmware.com>
Date:   Fri Nov 20 04:49:23 2015 +0100

gallivm: use sampler index 0 for texel fetches

texel fetches don't use any samplers. Previously we just set the same
number for both texture and sampler unit (as per "ordinary" gl style
sampling where the numbers are always the same) however this would trigger
some assertions checking that the sampler index isn't over PIPE_MAX_SAMPLERS
limit elsewhere with d3d10, so just set to 0.
(Fixing the assertion instead isn't really an option, the sampler isn't
really used but might still pass an out-of-bound pointer around and even
copy some things from it.)

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

---

 src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c
index 7d2cd9a..28c7a86 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c
@@ -2608,7 +2608,12 @@ emit_fetch_texels( struct lp_build_tgsi_soa_context *bld,
    params.type = bld->bld_base.base.type;
    params.sample_key = sample_key;
    params.texture_index = unit;
-   params.sampler_index = unit;
+   /*
+    * sampler not actually used, set to 0 so it won't exceed PIPE_MAX_SAMPLERS
+    * and trigger some assertions with d3d10 where the sampler view number
+    * can exceed this.
+    */
+   params.sampler_index = 0;
    params.context_ptr = bld->context_ptr;
    params.thread_data_ptr = bld->thread_data_ptr;
    params.coords = coords;




More information about the mesa-commit mailing list