radv/rt: Split stage initialization and hashing
The dependency chain is: init stages -> compute pipeline key -> hash stages. Reviewed-by: Daniel Schürmann <daniel@schuermann.dev> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24809>
This commit is contained in:

committed by
Marge Bot

parent
f3e2900c59
commit
ec708c26ef
@@ -252,20 +252,12 @@ radv_rt_fill_group_info(struct radv_device *device, const struct radv_ray_tracin
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
radv_rt_fill_stage_info(struct radv_device *device, const VkRayTracingPipelineCreateInfoKHR *pCreateInfo,
|
radv_rt_fill_stage_info(const VkRayTracingPipelineCreateInfoKHR *pCreateInfo, struct radv_ray_tracing_stage *stages)
|
||||||
struct radv_ray_tracing_stage *stages, struct radv_pipeline_key *key)
|
|
||||||
{
|
{
|
||||||
RADV_FROM_HANDLE(radv_pipeline_layout, pipeline_layout, pCreateInfo->layout);
|
|
||||||
uint32_t idx;
|
uint32_t idx;
|
||||||
for (idx = 0; idx < pCreateInfo->stageCount; idx++) {
|
for (idx = 0; idx < pCreateInfo->stageCount; idx++)
|
||||||
stages[idx].stage = vk_to_mesa_shader_stage(pCreateInfo->pStages[idx].stage);
|
stages[idx].stage = vk_to_mesa_shader_stage(pCreateInfo->pStages[idx].stage);
|
||||||
|
|
||||||
struct radv_shader_stage stage;
|
|
||||||
radv_pipeline_stage_init(&pCreateInfo->pStages[idx], pipeline_layout, &stage);
|
|
||||||
|
|
||||||
radv_hash_shaders(stages[idx].sha1, &stage, 1, NULL, key, radv_get_hash_flags(device, false));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (pCreateInfo->pLibraryInfo) {
|
if (pCreateInfo->pLibraryInfo) {
|
||||||
for (unsigned i = 0; i < pCreateInfo->pLibraryInfo->libraryCount; ++i) {
|
for (unsigned i = 0; i < pCreateInfo->pLibraryInfo->libraryCount; ++i) {
|
||||||
RADV_FROM_HANDLE(radv_pipeline, pipeline, pCreateInfo->pLibraryInfo->pLibraries[i]);
|
RADV_FROM_HANDLE(radv_pipeline, pipeline, pCreateInfo->pLibraryInfo->pLibraries[i]);
|
||||||
@@ -281,6 +273,20 @@ radv_rt_fill_stage_info(struct radv_device *device, const VkRayTracingPipelineCr
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
radv_init_rt_stage_hashes(struct radv_device *device, const VkRayTracingPipelineCreateInfoKHR *pCreateInfo,
|
||||||
|
struct radv_ray_tracing_stage *stages, const struct radv_pipeline_key *key)
|
||||||
|
{
|
||||||
|
RADV_FROM_HANDLE(radv_pipeline_layout, pipeline_layout, pCreateInfo->layout);
|
||||||
|
|
||||||
|
for (uint32_t idx = 0; idx < pCreateInfo->stageCount; idx++) {
|
||||||
|
struct radv_shader_stage stage;
|
||||||
|
radv_pipeline_stage_init(&pCreateInfo->pStages[idx], pipeline_layout, &stage);
|
||||||
|
|
||||||
|
radv_hash_shaders(stages[idx].sha1, &stage, 1, NULL, key, radv_get_hash_flags(device, false));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static VkRayTracingPipelineCreateInfoKHR
|
static VkRayTracingPipelineCreateInfoKHR
|
||||||
radv_create_merged_rt_create_info(const VkRayTracingPipelineCreateInfoKHR *pCreateInfo)
|
radv_create_merged_rt_create_info(const VkRayTracingPipelineCreateInfoKHR *pCreateInfo)
|
||||||
{
|
{
|
||||||
@@ -656,6 +662,8 @@ radv_rt_pipeline_create(VkDevice _device, VkPipelineCache _cache, const VkRayTra
|
|||||||
pipeline->stages = stages;
|
pipeline->stages = stages;
|
||||||
pipeline->groups = groups;
|
pipeline->groups = groups;
|
||||||
|
|
||||||
|
radv_rt_fill_stage_info(pCreateInfo, stages);
|
||||||
|
|
||||||
struct radv_pipeline_key key = radv_generate_rt_pipeline_key(device, pipeline, pCreateInfo);
|
struct radv_pipeline_key key = radv_generate_rt_pipeline_key(device, pipeline, pCreateInfo);
|
||||||
|
|
||||||
/* cache robustness state for making merged shaders */
|
/* cache robustness state for making merged shaders */
|
||||||
@@ -665,7 +673,7 @@ radv_rt_pipeline_create(VkDevice _device, VkPipelineCache _cache, const VkRayTra
|
|||||||
if (key.stage_info[MESA_SHADER_INTERSECTION].uniform_robustness2)
|
if (key.stage_info[MESA_SHADER_INTERSECTION].uniform_robustness2)
|
||||||
pipeline->traversal_uniform_robustness2 = true;
|
pipeline->traversal_uniform_robustness2 = true;
|
||||||
|
|
||||||
radv_rt_fill_stage_info(device, pCreateInfo, stages, &key);
|
radv_init_rt_stage_hashes(device, pCreateInfo, stages, &key);
|
||||||
result = radv_rt_fill_group_info(device, pipeline, pCreateInfo, stages, capture_replay_blocks, pipeline->groups);
|
result = radv_rt_fill_group_info(device, pipeline, pCreateInfo, stages, capture_replay_blocks, pipeline->groups);
|
||||||
if (result != VK_SUCCESS)
|
if (result != VK_SUCCESS)
|
||||||
goto fail;
|
goto fail;
|
||||||
|
Reference in New Issue
Block a user