mesa: create program resource hash in a single place
authorTapani Pälli <tapani.palli@intel.com>
Tue, 7 Jan 2020 15:56:26 +0000 (17:56 +0200)
committerTapani Pälli <tapani.palli@intel.com>
Thu, 9 Jan 2020 05:28:13 +0000 (07:28 +0200)
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 <tapani.palli@intel.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
src/mesa/drivers/dri/i965/brw_link.cpp
src/mesa/program/ir_to_mesa.cpp
src/mesa/state_tracker/st_glsl_to_nir.cpp
src/mesa/state_tracker/st_glsl_to_tgsi.cpp

index 8a62ffd760b88104e23b782a3e0dc08a3c9dd072..2a844575c3d2907e97bbc9a25600d9c7f1fbc6d5 100644 (file)
@@ -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)
index 293c412d23d0d0b77c441e1f36a98c0ff94b6a11..bcf50c505e13510326e1422c0e2999cf406a92be 100644 (file)
@@ -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;
index b01cc3fd8d9a0617cfd64629346e6f1a522250d4..c92b1c365a7707aba1e78c9d07dc3d35e7046cd6 100644 (file)
@@ -843,8 +843,6 @@ st_link_nir(struct gl_context *ctx,
       prev_info = info;
    }
 
-   _mesa_create_program_resource_hash(shader_program);
-
    return true;
 }
 
index cd77effebc4016fcfd1e734b5162233b7ddaa845..b6c2c2deb776ab43d83d9a9a3230c128e075846b 100644 (file)
@@ -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;
 }