From 1e29ff7b3dab02aa8cf87144e38b10d2c9e19813 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Tapani=20P=C3=A4lli?= Date: Tue, 7 Jan 2020 17:56:26 +0200 Subject: [PATCH] mesa: create program resource hash in a single place MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit This is a cleanup but also a fix for commit dd09f1d806b. In case of i965 we did not actually create hash for cached shader programs. Fixes: dd09f1d806b "mesa/st/i965: add a ProgramResourceHash for quicker resource lookup" Signed-off-by: Tapani Pälli Reviewed-by: Marek Olšák --- src/mesa/drivers/dri/i965/brw_link.cpp | 2 -- src/mesa/program/ir_to_mesa.cpp | 3 +++ src/mesa/state_tracker/st_glsl_to_nir.cpp | 2 -- src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 2 -- 4 files changed, 3 insertions(+), 6 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_link.cpp b/src/mesa/drivers/dri/i965/brw_link.cpp index 8a62ffd760b..2a844575c3d 100644 --- a/src/mesa/drivers/dri/i965/brw_link.cpp +++ b/src/mesa/drivers/dri/i965/brw_link.cpp @@ -388,8 +388,6 @@ brw_link_shader(struct gl_context *ctx, struct gl_shader_program *shProg) else nir_build_program_resource_list(ctx, shProg, true); - _mesa_create_program_resource_hash(shProg); - for (stage = 0; stage < ARRAY_SIZE(shProg->_LinkedShaders); stage++) { struct gl_linked_shader *shader = shProg->_LinkedShaders[stage]; if (!shader) diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp index 293c412d23d..bcf50c505e1 100644 --- a/src/mesa/program/ir_to_mesa.cpp +++ b/src/mesa/program/ir_to_mesa.cpp @@ -3187,6 +3187,9 @@ _mesa_glsl_link_shader(struct gl_context *ctx, struct gl_shader_program *prog) prog->data->LinkStatus = LINKING_FAILURE; } + if (prog->data->LinkStatus != LINKING_FAILURE) + _mesa_create_program_resource_hash(prog); + /* Return early if we are loading the shader from on-disk cache */ if (prog->data->LinkStatus == LINKING_SKIPPED) return; diff --git a/src/mesa/state_tracker/st_glsl_to_nir.cpp b/src/mesa/state_tracker/st_glsl_to_nir.cpp index b01cc3fd8d9..c92b1c365a7 100644 --- a/src/mesa/state_tracker/st_glsl_to_nir.cpp +++ b/src/mesa/state_tracker/st_glsl_to_nir.cpp @@ -843,8 +843,6 @@ st_link_nir(struct gl_context *ctx, prev_info = info; } - _mesa_create_program_resource_hash(shader_program); - return true; } diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp index cd77effebc4..b6c2c2deb77 100644 --- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp +++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp @@ -7428,7 +7428,5 @@ st_link_tgsi(struct gl_context *ctx, struct gl_shader_program *prog) } } - _mesa_create_program_resource_hash(prog); - return GL_TRUE; } -- 2.30.2