radv/rt: Hash the pipeline key

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20243>
This commit is contained in:
Konstantin Seurer
2022-12-10 13:13:09 +01:00
committed by Marge Bot
parent 48ae92ceea
commit cdd68cbafd
3 changed files with 7 additions and 3 deletions

View File

@@ -153,7 +153,7 @@ radv_hash_shaders(unsigned char *hash, const struct radv_pipeline_stage *stages,
void
radv_hash_rt_shaders(unsigned char *hash, const VkRayTracingPipelineCreateInfoKHR *pCreateInfo,
uint32_t flags)
const struct radv_pipeline_key *key, uint32_t flags)
{
RADV_FROM_HANDLE(radv_pipeline_layout, layout, pCreateInfo->layout);
struct mesa_sha1 ctx;
@@ -162,6 +162,8 @@ radv_hash_rt_shaders(unsigned char *hash, const VkRayTracingPipelineCreateInfoKH
if (layout)
_mesa_sha1_update(&ctx, layout->sha1, sizeof(layout->sha1));
_mesa_sha1_update(&ctx, key, sizeof(*key));
for (uint32_t i = 0; i < pCreateInfo->stageCount; ++i) {
RADV_FROM_HANDLE(vk_shader_module, module, pCreateInfo->pStages[i].module);
const VkSpecializationInfo *spec_info = pCreateInfo->pStages[i].pSpecializationInfo;

View File

@@ -272,7 +272,6 @@ radv_rt_pipeline_create(VkDevice _device, VkPipelineCache _cache,
goto fail;
}
radv_hash_rt_shaders(hash, &local_create_info, radv_get_hash_flags(device, keep_statistic_info));
struct vk_shader_module module = {.base.type = VK_OBJECT_TYPE_SHADER_MODULE};
VkPipelineShaderStageCreateInfo stage = {
@@ -301,6 +300,9 @@ radv_rt_pipeline_create(VkDevice _device, VkPipelineCache _cache,
struct radv_pipeline_key key = radv_generate_rt_pipeline_key(rt_pipeline, pCreateInfo->flags);
UNUSED gl_shader_stage last_vgt_api_stage = MESA_SHADER_NONE;
radv_hash_rt_shaders(hash, &local_create_info, &key,
radv_get_hash_flags(device, keep_statistic_info));
/* First check if we can get things from the cache before we take the expensive step of
* generating the nir. */
result = radv_create_shaders(

View File

@@ -1965,7 +1965,7 @@ void radv_hash_shaders(unsigned char *hash, const struct radv_pipeline_stage *st
const struct radv_pipeline_key *key, uint32_t flags);
void radv_hash_rt_shaders(unsigned char *hash, const VkRayTracingPipelineCreateInfoKHR *pCreateInfo,
uint32_t flags);
const struct radv_pipeline_key *key, uint32_t flags);
uint32_t radv_get_hash_flags(const struct radv_device *device, bool stats);