From f65e49341bd27ed243692327bae6c45cf352acc2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Fri, 3 Jan 2025 18:08:38 -0500 Subject: [PATCH] glsl: fix corruption due to blake3 hash not being set for nir_opt_undef NIR is generated sooner, so we need to set it sooner. This fixes Viewperf13/CATIA_car_04. Fixes: cbfc225e2bd - glsl: switch to a full nir based linker Reviewed-by: Timothy Arceri (cherry picked from commit d09ba36f98c9b9737abcde84c7a14b8037d6179f) Part-of: --- .pick_status.json | 2 +- src/compiler/glsl/gl_nir_linker.c | 5 +++-- src/mesa/main/shader_types.h | 3 --- src/mesa/state_tracker/st_glsl_to_nir.cpp | 3 --- 4 files changed, 4 insertions(+), 9 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index 43f0a0a4008..10ee75395e9 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -1194,7 +1194,7 @@ "description": "glsl: fix corruption due to blake3 hash not being set for nir_opt_undef", "nominated": true, "nomination_type": 2, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": "cbfc225e2bda2c8627a4580fa3a9b63bfb7133e0", "notes": null diff --git a/src/compiler/glsl/gl_nir_linker.c b/src/compiler/glsl/gl_nir_linker.c index 7ee24061d6b..a994bf6ef26 100644 --- a/src/compiler/glsl/gl_nir_linker.c +++ b/src/compiler/glsl/gl_nir_linker.c @@ -2885,7 +2885,8 @@ link_intrastage_shaders(void *mem_ctx, /* Set the linked source BLAKE3. */ if (num_shaders == 1) { - memcpy(linked->linked_source_blake3, shader_list[0]->compiled_source_blake3, + memcpy(linked->Program->nir->info.source_blake3, + shader_list[0]->compiled_source_blake3, BLAKE3_OUT_LEN); } else { struct mesa_blake3 blake3_ctx; @@ -2898,7 +2899,7 @@ link_intrastage_shaders(void *mem_ctx, _mesa_blake3_update(&blake3_ctx, shader_list[i]->compiled_source_blake3, BLAKE3_OUT_LEN); } - _mesa_blake3_final(&blake3_ctx, linked->linked_source_blake3); + _mesa_blake3_final(&blake3_ctx, linked->Program->nir->info.source_blake3); } return linked; diff --git a/src/mesa/main/shader_types.h b/src/mesa/main/shader_types.h index e16c2cfc6d1..00f5be4466c 100644 --- a/src/mesa/main/shader_types.h +++ b/src/mesa/main/shader_types.h @@ -247,9 +247,6 @@ struct gl_linked_shader { gl_shader_stage Stage; - /** All gl_shader::compiled_source_blake3 combined. */ - blake3_hash linked_source_blake3; - struct gl_program *Program; /**< Post-compile assembly code */ /** diff --git a/src/mesa/state_tracker/st_glsl_to_nir.cpp b/src/mesa/state_tracker/st_glsl_to_nir.cpp index 5ba25a6bd7c..3ba9e8df16a 100644 --- a/src/mesa/state_tracker/st_glsl_to_nir.cpp +++ b/src/mesa/state_tracker/st_glsl_to_nir.cpp @@ -545,9 +545,6 @@ st_link_glsl_to_nir(struct gl_context *ctx, prog->nir->info.label = ralloc_strdup(shader, shader_program->Label); } - memcpy(prog->nir->info.source_blake3, shader->linked_source_blake3, - BLAKE3_OUT_LEN); - nir_shader_gather_info(prog->nir, nir_shader_get_entrypoint(prog->nir)); if (!st->ctx->SoftFP64 && ((prog->nir->info.bit_sizes_int | prog->nir->info.bit_sizes_float) & 64) && (options->lower_doubles_options & nir_lower_fp64_full_software) != 0) {