radeonsi: compute blake3 hashes of internal shaders if they are not set

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37566>
This commit is contained in:
Marek Olšák 2025-06-15 15:12:42 -04:00 committed by Marge Bot
parent e018b916d1
commit a441a30921

View file

@ -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);
}