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 <illia.a.polishchuk@globallogic.com>

Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21012>
This commit is contained in:
Illia Polishchuk 2023-01-31 22:30:13 +02:00 committed by Marge Bot
parent dc2119bf3f
commit 6962bf4e57

View file

@ -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,