mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-07 02:10:12 +01:00
radv: remove the pipeline key for ray tracing pipelines
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27036>
This commit is contained in:
parent
e799907071
commit
ee96de53e4
1 changed files with 25 additions and 20 deletions
|
|
@ -83,12 +83,17 @@ handle_from_stages(struct radv_device *device, const struct radv_ray_tracing_sta
|
|||
return ret;
|
||||
}
|
||||
|
||||
static struct radv_pipeline_key
|
||||
radv_generate_rt_pipeline_key(const struct radv_device *device, const struct radv_ray_tracing_pipeline *pipeline,
|
||||
const VkRayTracingPipelineCreateInfoKHR *pCreateInfo)
|
||||
static void
|
||||
radv_generate_rt_shaders_key(const struct radv_device *device, const struct radv_ray_tracing_pipeline *pipeline,
|
||||
const VkRayTracingPipelineCreateInfoKHR *pCreateInfo,
|
||||
struct radv_shader_stage_key *stage_keys)
|
||||
{
|
||||
struct radv_pipeline_key key = radv_generate_pipeline_key(device, pCreateInfo->pStages, pCreateInfo->stageCount,
|
||||
pipeline->base.base.create_flags, pCreateInfo->pNext);
|
||||
for (uint32_t i = 0; i < pCreateInfo->stageCount; i++) {
|
||||
const VkPipelineShaderStageCreateInfo *stage = &pCreateInfo->pStages[i];
|
||||
gl_shader_stage s = vk_to_mesa_shader_stage(stage->stage);
|
||||
|
||||
stage_keys[s] = radv_pipeline_get_shader_key(device, stage, pipeline->base.base.create_flags, pCreateInfo->pNext);
|
||||
}
|
||||
|
||||
if (pCreateInfo->pLibraryInfo) {
|
||||
for (unsigned i = 0; i < pCreateInfo->pLibraryInfo->libraryCount; ++i) {
|
||||
|
|
@ -96,14 +101,12 @@ radv_generate_rt_pipeline_key(const struct radv_device *device, const struct rad
|
|||
struct radv_ray_tracing_pipeline *library_pipeline = radv_pipeline_to_ray_tracing(pipeline_lib);
|
||||
/* apply shader robustness from merged shaders */
|
||||
if (library_pipeline->traversal_storage_robustness2)
|
||||
key.stage_info[MESA_SHADER_INTERSECTION].storage_robustness2 = true;
|
||||
stage_keys[MESA_SHADER_INTERSECTION].storage_robustness2 = true;
|
||||
|
||||
if (library_pipeline->traversal_uniform_robustness2)
|
||||
key.stage_info[MESA_SHADER_INTERSECTION].uniform_robustness2 = true;
|
||||
stage_keys[MESA_SHADER_INTERSECTION].uniform_robustness2 = true;
|
||||
}
|
||||
}
|
||||
|
||||
return key;
|
||||
}
|
||||
|
||||
static VkResult
|
||||
|
|
@ -278,7 +281,7 @@ radv_rt_fill_stage_info(const VkRayTracingPipelineCreateInfoKHR *pCreateInfo, st
|
|||
|
||||
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)
|
||||
struct radv_ray_tracing_stage *stages, const struct radv_shader_stage_key *stage_keys)
|
||||
{
|
||||
RADV_FROM_HANDLE(radv_pipeline_layout, pipeline_layout, pCreateInfo->layout);
|
||||
|
||||
|
|
@ -286,7 +289,7 @@ radv_init_rt_stage_hashes(struct radv_device *device, const VkRayTracingPipeline
|
|||
gl_shader_stage s = vk_to_mesa_shader_stage(pCreateInfo->pStages[idx].stage);
|
||||
struct radv_shader_stage stage;
|
||||
|
||||
radv_pipeline_stage_init(&pCreateInfo->pStages[idx], pipeline_layout, &key->stage_info[s], &stage);
|
||||
radv_pipeline_stage_init(&pCreateInfo->pStages[idx], pipeline_layout, &stage_keys[s], &stage);
|
||||
|
||||
radv_hash_shaders(device, stages[idx].sha1, &stage, 1, NULL, NULL);
|
||||
}
|
||||
|
|
@ -489,7 +492,7 @@ static VkResult
|
|||
radv_rt_compile_shaders(struct radv_device *device, struct vk_pipeline_cache *cache,
|
||||
const VkRayTracingPipelineCreateInfoKHR *pCreateInfo,
|
||||
const VkPipelineCreationFeedbackCreateInfo *creation_feedback,
|
||||
const struct radv_pipeline_key *key, struct radv_ray_tracing_pipeline *pipeline,
|
||||
const struct radv_shader_stage_key *stage_keys, struct radv_ray_tracing_pipeline *pipeline,
|
||||
struct radv_serialized_shader_arena_block *capture_replay_handles)
|
||||
{
|
||||
RADV_FROM_HANDLE(radv_pipeline_layout, pipeline_layout, pCreateInfo->layout);
|
||||
|
|
@ -515,7 +518,7 @@ radv_rt_compile_shaders(struct radv_device *device, struct vk_pipeline_cache *ca
|
|||
|
||||
struct radv_shader_stage *stage = &stages[i];
|
||||
gl_shader_stage s = vk_to_mesa_shader_stage(pCreateInfo->pStages[i].stage);
|
||||
radv_pipeline_stage_init(&pCreateInfo->pStages[i], pipeline_layout, &key->stage_info[s], stage);
|
||||
radv_pipeline_stage_init(&pCreateInfo->pStages[i], pipeline_layout, &stage_keys[s], stage);
|
||||
|
||||
/* precompile the shader */
|
||||
stage->nir = radv_parse_rt_stage(device, stage);
|
||||
|
|
@ -621,7 +624,7 @@ radv_rt_compile_shaders(struct radv_device *device, struct vk_pipeline_cache *ca
|
|||
struct radv_shader_stage traversal_stage = {
|
||||
.stage = MESA_SHADER_INTERSECTION,
|
||||
.nir = traversal_module.nir,
|
||||
.key = key->stage_info[MESA_SHADER_INTERSECTION],
|
||||
.key = stage_keys[MESA_SHADER_INTERSECTION],
|
||||
};
|
||||
vk_pipeline_hash_shader_stage(&pStage, NULL, traversal_stage.shader_sha1);
|
||||
radv_shader_layout_init(pipeline_layout, MESA_SHADER_INTERSECTION, &traversal_stage.layout);
|
||||
|
|
@ -773,16 +776,18 @@ radv_rt_pipeline_create(VkDevice _device, VkPipelineCache _cache, const VkRayTra
|
|||
|
||||
radv_rt_fill_stage_info(pCreateInfo, stages);
|
||||
|
||||
struct radv_pipeline_key key = radv_generate_rt_pipeline_key(device, pipeline, pCreateInfo);
|
||||
struct radv_shader_stage_key stage_keys[MESA_VULKAN_SHADER_STAGES] = {0};
|
||||
|
||||
radv_generate_rt_shaders_key(device, pipeline, pCreateInfo, stage_keys);
|
||||
|
||||
/* cache robustness state for making merged shaders */
|
||||
if (key.stage_info[MESA_SHADER_INTERSECTION].storage_robustness2)
|
||||
if (stage_keys[MESA_SHADER_INTERSECTION].storage_robustness2)
|
||||
pipeline->traversal_storage_robustness2 = true;
|
||||
|
||||
if (key.stage_info[MESA_SHADER_INTERSECTION].uniform_robustness2)
|
||||
if (stage_keys[MESA_SHADER_INTERSECTION].uniform_robustness2)
|
||||
pipeline->traversal_uniform_robustness2 = true;
|
||||
|
||||
radv_init_rt_stage_hashes(device, pCreateInfo, stages, &key);
|
||||
radv_init_rt_stage_hashes(device, pCreateInfo, stages, stage_keys);
|
||||
result = radv_rt_fill_group_info(device, pipeline, pCreateInfo, stages, capture_replay_blocks, pipeline->groups);
|
||||
if (result != VK_SUCCESS)
|
||||
goto fail;
|
||||
|
|
@ -797,8 +802,8 @@ radv_rt_pipeline_create(VkDevice _device, VkPipelineCache _cache, const VkRayTra
|
|||
cache_hit = radv_ray_tracing_pipeline_cache_search(device, cache, pipeline, pCreateInfo);
|
||||
|
||||
if (!cache_hit) {
|
||||
result =
|
||||
radv_rt_compile_shaders(device, cache, pCreateInfo, creation_feedback, &key, pipeline, capture_replay_blocks);
|
||||
result = radv_rt_compile_shaders(device, cache, pCreateInfo, creation_feedback, stage_keys, pipeline,
|
||||
capture_replay_blocks);
|
||||
|
||||
if (result != VK_SUCCESS)
|
||||
goto fail;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue