About Social Code
aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLionel Landwerlin <lionel.g.landwerlin@intel.com>2025-07-30 16:04:19 +0300
committerMarge Bot <marge-bot@fdo.invalid>2025-11-06 15:27:23 +0000
commit9a5b0bbba4011b0b2a86a9270ec69b92073514ea (patch)
treebf161c5dad74b2cc64b3fab6ba863b39709c43c7
parent8e93938c3fdb00596bc0ab7f30b05f28e03064fb (diff)
vulkan/runtime: use stage flags to track valid stages
We'll want to have only hashes in vk_pipeline_stage so the vk_pipeline_stage_is_null() helper won't work. Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36647>
-rw-r--r--src/vulkan/runtime/vk_pipeline.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/vulkan/runtime/vk_pipeline.c b/src/vulkan/runtime/vk_pipeline.c
index c4602e0cbcb..8c774a96d88 100644
--- a/src/vulkan/runtime/vk_pipeline.c
+++ b/src/vulkan/runtime/vk_pipeline.c
@@ -1680,6 +1680,8 @@ vk_create_graphics_pipeline(struct vk_device *device,
all_state = &all_state_tmp;
}
+ VkShaderStageFlags imported_stages = 0;
+
uint32_t set_layout_count = 0;
struct vk_descriptor_set_layout *set_layouts[MESA_VK_MAX_DESCRIPTOR_SETS] = { 0 };
@@ -1717,6 +1719,7 @@ vk_create_graphics_pipeline(struct vk_device *device,
continue;
stages[lib_stage->stage] = vk_pipeline_stage_clone(lib_stage);
+ imported_stages |= mesa_to_vk_shader_stage(lib_stage->stage);
}
}
}
@@ -1748,6 +1751,7 @@ vk_create_graphics_pipeline(struct vk_device *device,
}
}
+ VkShaderStageFlags all_stages = imported_stages;
for (uint32_t i = 0; i < pCreateInfo->stageCount; i++) {
const VkPipelineShaderStageCreateInfo *stage_info =
&pCreateInfo->pStages[i];
@@ -1764,7 +1768,12 @@ vk_create_graphics_pipeline(struct vk_device *device,
stage_feedbacks[stage].flags |=
VK_PIPELINE_CREATION_FEEDBACK_VALID_BIT;
- if (!vk_pipeline_stage_is_null(&stages[stage]))
+ /* We don't need to load anything for imported stages, precomp should be
+ * included if
+ * VK_PIPELINE_CREATE_2_RETAIN_LINK_TIME_OPTIMIZATION_INFO_BIT_EXT was
+ * provided and shader should obviously be there.
+ */
+ if (imported_stages & stage_info->stage)
continue;
stages[stage] = (struct vk_pipeline_stage) {
@@ -1781,6 +1790,8 @@ vk_create_graphics_pipeline(struct vk_device *device,
if (result != VK_SUCCESS)
goto fail_stages;
+ all_stages |= stage_info->stage;
+
const int64_t stage_end = os_time_get_nano();
stage_feedbacks[stage].duration += stage_end - stage_start;
}
@@ -1789,7 +1800,7 @@ vk_create_graphics_pipeline(struct vk_device *device,
uint32_t stage_count = 0;
for (uint32_t s = 0; s < ARRAY_SIZE(stages); s++) {
assert(s >= stage_count);
- if (!vk_pipeline_stage_is_null(&stages[s]))
+ if (all_stages & mesa_to_vk_shader_stage(s))
stages[stage_count++] = stages[s];
}
for (uint32_t s = stage_count; s < ARRAY_SIZE(stages); s++)