From a441a30921aa75fed18105a9eee889572432740d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Sun, 15 Jun 2025 15:12:42 -0400 Subject: [PATCH] radeonsi: compute blake3 hashes of internal shaders if they are not set Reviewed-by: Pierre-Eric Pelloux-Prayer Part-of: --- src/gallium/drivers/radeonsi/si_shaderlib_nir.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/gallium/drivers/radeonsi/si_shaderlib_nir.c b/src/gallium/drivers/radeonsi/si_shaderlib_nir.c index 86242057504..fdaeab6463c 100644 --- a/src/gallium/drivers/radeonsi/si_shaderlib_nir.c +++ b/src/gallium/drivers/radeonsi/si_shaderlib_nir.c @@ -12,9 +12,21 @@ #include "aco_interface.h" #include "nir_format_convert.h" #include "ac_nir_helpers.h" +#include "nir/nir_serialize.h" void *si_create_shader_state(struct si_context *sctx, nir_shader *nir) { + static blake3_hash zeros; + + if (!memcmp(nir->info.source_blake3, zeros, sizeof(blake3_hash))) { + struct blob blob = {}; + + blob_init(&blob); + nir_serialize(&blob, nir, false); + _mesa_blake3_compute(blob.data, blob.size, nir->info.source_blake3); + blob_finish(&blob); + } + sctx->b.screen->finalize_nir(sctx->b.screen, nir); return pipe_shader_from_nir(&sctx->b, nir); }