mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-04 11:20:20 +01:00
radv/rt: re-use radv_ray_tracing_stage::sha1 for hashing RT pipelines
radv_ray_tracing_stage::sha1 is radv_pipeline_key+shader_sha1 which should be similar to what the code was doing. Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27030>
This commit is contained in:
parent
bb86fc0359
commit
4fe5f06d40
3 changed files with 9 additions and 20 deletions
|
|
@ -68,19 +68,8 @@ radv_hash_shaders(const struct radv_device *device, unsigned char *hash, const s
|
|||
}
|
||||
|
||||
void
|
||||
radv_hash_rt_stages(struct mesa_sha1 *ctx, const VkPipelineShaderStageCreateInfo *stages, unsigned stage_count)
|
||||
{
|
||||
for (unsigned i = 0; i < stage_count; ++i) {
|
||||
unsigned char hash[20];
|
||||
vk_pipeline_hash_shader_stage(&stages[i], NULL, hash);
|
||||
_mesa_sha1_update(ctx, hash, sizeof(hash));
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
radv_hash_rt_shaders(const struct radv_device *device, unsigned char *hash,
|
||||
const VkRayTracingPipelineCreateInfoKHR *pCreateInfo, const struct radv_pipeline_key *key,
|
||||
const struct radv_ray_tracing_group *groups)
|
||||
radv_hash_rt_shaders(const struct radv_device *device, unsigned char *hash, const struct radv_ray_tracing_stage *stages,
|
||||
const VkRayTracingPipelineCreateInfoKHR *pCreateInfo, const struct radv_ray_tracing_group *groups)
|
||||
{
|
||||
RADV_FROM_HANDLE(radv_pipeline_layout, layout, pCreateInfo->layout);
|
||||
struct mesa_sha1 ctx;
|
||||
|
|
@ -90,9 +79,9 @@ radv_hash_rt_shaders(const struct radv_device *device, unsigned char *hash,
|
|||
if (layout)
|
||||
_mesa_sha1_update(&ctx, layout->sha1, sizeof(layout->sha1));
|
||||
|
||||
_mesa_sha1_update(&ctx, key, sizeof(*key));
|
||||
|
||||
radv_hash_rt_stages(&ctx, pCreateInfo->pStages, pCreateInfo->stageCount);
|
||||
for (uint32_t i = 0; i < pCreateInfo->stageCount; i++) {
|
||||
_mesa_sha1_update(&ctx, stages[i].sha1, sizeof(stages[i].sha1));
|
||||
}
|
||||
|
||||
for (uint32_t i = 0; i < pCreateInfo->groupCount; i++) {
|
||||
_mesa_sha1_update(&ctx, &pCreateInfo->pGroups[i].type, sizeof(pCreateInfo->pGroups[i].type));
|
||||
|
|
|
|||
|
|
@ -788,7 +788,7 @@ radv_rt_pipeline_create(VkDevice _device, VkPipelineCache _cache, const VkRayTra
|
|||
|
||||
bool keep_executable_info = radv_pipeline_capture_shaders(device, pipeline->base.base.create_flags);
|
||||
|
||||
radv_hash_rt_shaders(device, pipeline->sha1, pCreateInfo, &key, pipeline->groups);
|
||||
radv_hash_rt_shaders(device, pipeline->sha1, stages, pCreateInfo, pipeline->groups);
|
||||
pipeline->base.base.pipeline_hash = *(uint64_t *)pipeline->sha1;
|
||||
|
||||
bool cache_hit = false;
|
||||
|
|
|
|||
|
|
@ -2015,10 +2015,10 @@ void radv_hash_shaders(const struct radv_device *device, unsigned char *hash, co
|
|||
uint32_t stage_count, const struct radv_pipeline_layout *layout,
|
||||
const struct radv_pipeline_key *key);
|
||||
|
||||
void radv_hash_rt_stages(struct mesa_sha1 *ctx, const VkPipelineShaderStageCreateInfo *stages, unsigned stage_count);
|
||||
|
||||
struct radv_ray_tracing_stage;
|
||||
void radv_hash_rt_shaders(const struct radv_device *device, unsigned char *hash,
|
||||
const VkRayTracingPipelineCreateInfoKHR *pCreateInfo, const struct radv_pipeline_key *key,
|
||||
const struct radv_ray_tracing_stage *stages,
|
||||
const VkRayTracingPipelineCreateInfoKHR *pCreateInfo,
|
||||
const struct radv_ray_tracing_group *groups);
|
||||
|
||||
bool radv_enable_rt(const struct radv_physical_device *pdevice, bool rt_pipelines);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue