Module: Mesa
Branch: main
Commit: 590eb9d6403248cec04f1dd2d3f62f96370d3269
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=590eb9d6403248cec04f1dd2d3f62f96370d3269

Author: Samuel Pitoiset <[email protected]>
Date:   Wed Mar 16 10:32:33 2022 +0100

radv: do not compute the cache UUID for LLVM if it's not used

If the LLVM version (even minor) isn't the same on the OS that
precompiles shaders vs the OS that runs them, the cache UUID would
be different, even if only ACO is used.

Signed-off-by: Samuel Pitoiset <[email protected]>
Reviewed-by: Bas Nieuwenhuizen <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15406>

---

 src/amd/vulkan/radv_device.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/amd/vulkan/radv_device.c b/src/amd/vulkan/radv_device.c
index ddcef7f44f9..ee9be00072f 100644
--- a/src/amd/vulkan/radv_device.c
+++ b/src/amd/vulkan/radv_device.c
@@ -98,8 +98,9 @@ radv_get_current_time(void)
 }
 
 static int
-radv_device_get_cache_uuid(enum radeon_family family, void *uuid)
+radv_device_get_cache_uuid(struct radv_physical_device *pdevice, void *uuid)
 {
+   enum radeon_family family = pdevice->rad_info.family;
    struct mesa_sha1 ctx;
    unsigned char sha1[20];
    unsigned ptr_size = sizeof(void *);
@@ -109,7 +110,8 @@ radv_device_get_cache_uuid(enum radeon_family family, void 
*uuid)
 
    if (!disk_cache_get_function_identifier(radv_device_get_cache_uuid, &ctx)
 #ifdef LLVM_AVAILABLE
-       || !disk_cache_get_function_identifier(LLVMInitializeAMDGPUTargetInfo, 
&ctx)
+       || (pdevice->use_llvm &&
+           !disk_cache_get_function_identifier(LLVMInitializeAMDGPUTargetInfo, 
&ctx))
 #endif
    )
       return -1;
@@ -716,7 +718,7 @@ radv_physical_device_try_create(struct radv_instance 
*instance, drmDevicePtr drm
             radv_get_compiler_string(device));
 
 #ifdef ENABLE_SHADER_CACHE
-   if (radv_device_get_cache_uuid(device->rad_info.family, 
device->cache_uuid)) {
+   if (radv_device_get_cache_uuid(device, device->cache_uuid)) {
       result = vk_errorf(instance, VK_ERROR_INITIALIZATION_FAILED, "cannot 
generate UUID");
       goto fail_wsi;
    }

Reply via email to