gallivm: don't cache shaders that use fetch functions.
authorDave Airlie <airlied@redhat.com>
Thu, 14 May 2020 05:23:48 +0000 (15:23 +1000)
committerDave Airlie <airlied@redhat.com>
Wed, 10 Jun 2020 20:05:40 +0000 (06:05 +1000)
This needs to be reworked, but it's a bit messy as we have to store
all the fetch pointers to be added as globals later once gallivm
has been initialised further. For now just refuse to cache shaders
that hit these paths (mainly ETC1 and BPTC).

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5049>

src/gallium/auxiliary/gallivm/lp_bld_format_aos.c

index f8e1a963bb4264e5497b5897a55df6475b256092..d48dbfb69b096b43bf980f5970d053363e5af5b2 100644 (file)
@@ -54,7 +54,7 @@
 #include "lp_bld_intr.h"
 #include "lp_bld_logic.h"
 #include "lp_bld_bitarit.h"
-
+#include "lp_bld_misc.h"
 
 /**
  * Basic swizzling.  Rearrange the order of the unswizzled array elements
@@ -835,6 +835,8 @@ lp_build_fetch_rgba_aos(struct gallivm_state *gallivm,
          function_type = LLVMFunctionType(ret_type, arg_types,
                                           ARRAY_SIZE(arg_types), 0);
 
+         if (gallivm->cache)
+            gallivm->cache->dont_cache = true;
          /* make const pointer for the C fetch_rgba_8unorm function */
          function = lp_build_const_int_pointer(gallivm,
             func_to_pointer((func_pointer) format_desc->fetch_rgba_8unorm));
@@ -937,6 +939,8 @@ lp_build_fetch_rgba_aos(struct gallivm_state *gallivm,
          arg_types[2] = i32t;
          arg_types[3] = i32t;
 
+         if (gallivm->cache)
+            gallivm->cache->dont_cache = true;
          function = lp_build_const_func_pointer(gallivm,
                                                 func_to_pointer((func_pointer) format_desc->fetch_rgba_float),
                                                 ret_type,