Mesa (master): gallivm: fix texture function name (key) when using txf/ld

Roland Scheidegger sroland at kemper.freedesktop.org
Sat Mar 28 02:01:51 UTC 2015


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

Author: Roland Scheidegger <sroland at vmware.com>
Date:   Sat Mar 28 02:57:13 2015 +0100

gallivm: fix texture function name (key) when using txf/ld

When using the texel fetch functions rather than ordinary texturing,
the arguments are all int vecs instead of float vecs, not to mention
the actual function would look completely different. Hence this must
be included in the texture function name (which serves as the key)
otherwise things crash badly when a shader accesses the same texture
and sampler unit with both txf/ld and ordinary texturing instructions
with otherwise matching keys.

---

 src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c b/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c
index 9e74bd6..598d5fc 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c
@@ -2900,7 +2900,8 @@ lp_build_sample_soa_code(struct gallivm_state *gallivm,
 #define LP_SAMPLER_FUNC_EXPLICITDERIVS  (1 << 2)
 #define LP_SAMPLER_FUNC_SHADOW          (1 << 3)
 #define LP_SAMPLER_FUNC_OFFSETS         (1 << 4)
-#define LP_SAMPLER_FUNC_LOD_PROPERTY_SHIFT 5
+#define LP_SAMPLER_FUNC_FETCH           (1 << 5)
+#define LP_SAMPLER_FUNC_LOD_PROPERTY_SHIFT 6
 
 
 static inline void
@@ -3091,6 +3092,9 @@ lp_build_sample_soa_func(struct gallivm_state *gallivm,
    else if (derivs) {
       sampler_bits |= LP_SAMPLER_FUNC_EXPLICITDERIVS;
    }
+   if (is_fetch) {
+      sampler_bits |= LP_SAMPLER_FUNC_FETCH;
+   }
    sampler_bits |= lod_property << LP_SAMPLER_FUNC_LOD_PROPERTY_SHIFT;
 
    util_snprintf(func_name, sizeof(func_name), "texfunc_res_%d_sam_%d_%x",
@@ -3142,7 +3146,6 @@ lp_build_sample_soa_func(struct gallivm_state *gallivm,
          }
       }
 
-      ret_type = LLVMVoidTypeInContext(gallivm->context);
       val_type[0] = val_type[1] = val_type[2] = val_type[3] =
          lp_build_vec_type(gallivm, type);
       ret_type = LLVMStructTypeInContext(gallivm->context, val_type, 4, 0);




More information about the mesa-commit mailing list