From: Illia Polishchuk Date: Tue, 31 Jan 2023 20:30:13 +0000 (+0200) Subject: nir: Add sha1 hash for nir shaders converted from spir-v X-Git-Tag: upstream/23.3.3~13876 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=6962bf4e572c6366aec956b91751e8e587055177;p=platform%2Fupstream%2Fmesa.git nir: Add sha1 hash for nir shaders converted from spir-v The sha1 hash inside nir structure makes it easier to find bad shader in games. For example INTEL_DEBUG=fs will show not zero source_sha1 field for shaders with vulkan applications Signed-off-by: Illia Polishchuk Reviewed-by: Faith Ekstrand Part-of: --- diff --git a/src/compiler/spirv/spirv_to_nir.c b/src/compiler/spirv/spirv_to_nir.c index 5a21f4d..d06c1a1 100644 --- a/src/compiler/spirv/spirv_to_nir.c +++ b/src/compiler/spirv/spirv_to_nir.c @@ -6585,12 +6585,13 @@ spirv_to_nir(const uint32_t *words, size_t word_count, return NULL; } - /* Skip the SPIR-V header, handled at vtn_create_builder */ - words+= 5; - b->shader = nir_shader_create(b, stage, nir_options, NULL); b->shader->info.subgroup_size = options->subgroup_size; b->shader->info.float_controls_execution_mode = options->float_controls_execution_mode; + _mesa_sha1_compute(words, word_count * sizeof(uint32_t), b->shader->info.source_sha1); + + /* Skip the SPIR-V header, handled at vtn_create_builder */ + words+= 5; /* Handle all the preamble instructions */ words = vtn_foreach_instruction(b, words, word_end,