radv: fix ignoring graphics shader stages that don't need to be imported

If a shader stage is already imported from a library it should be
properly ignored.

Fixes recent CTS dEQP-VK.pipeline.fast_linked_library.misc.unused_shader_stages*.

Fixes: c8765c5244 ("radv: ignore shader stages that don't need to be imported with GPL")
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20899>
This commit is contained in:
Samuel Pitoiset
2023-01-25 09:30:48 +01:00
committed by Marge Bot
parent 6bec915919
commit b97fee432c
3 changed files with 15 additions and 5 deletions

View File

@@ -3382,6 +3382,7 @@ radv_create_shaders(struct radv_pipeline *pipeline, struct radv_pipeline_layout
const VkPipelineCreationFeedbackCreateInfo *creation_feedback,
struct radv_pipeline_shader_stack_size **stack_sizes,
uint32_t *num_stack_sizes,
VkGraphicsPipelineLibraryFlagBitsEXT lib_flags,
gl_shader_stage *last_vgt_api_stage)
{
const char *noop_fs_entrypoint = "noop_fs";
@@ -3409,6 +3410,12 @@ radv_create_shaders(struct radv_pipeline *pipeline, struct radv_pipeline_layout
const VkPipelineShaderStageCreateInfo *sinfo = &pStages[i];
gl_shader_stage stage = vk_to_mesa_shader_stage(sinfo->stage);
/* Ignore graphics shader stages that don't need to be imported. */
if ((pipeline->type == RADV_PIPELINE_GRAPHICS ||
pipeline->type == RADV_PIPELINE_GRAPHICS_LIB) &&
!(shader_stage_to_pipeline_library_flags(sinfo->stage) & lib_flags))
continue;
radv_pipeline_stage_init(sinfo, &stages[stage], stage);
}
@@ -4963,7 +4970,9 @@ radv_graphics_pipeline_init(struct radv_graphics_pipeline *pipeline, struct radv
result = radv_create_shaders(&pipeline->base, &pipeline_layout, device, cache, &key, pCreateInfo->pStages,
pCreateInfo->stageCount, pCreateInfo->flags, NULL,
creation_feedback, NULL, NULL, &pipeline->last_vgt_api_stage);
creation_feedback, NULL, NULL,
(~imported_flags) & ALL_GRAPHICS_LIB_FLAGS,
&pipeline->last_vgt_api_stage);
if (result != VK_SUCCESS) {
radv_pipeline_layout_finish(device, &pipeline_layout);
return result;
@@ -5182,7 +5191,7 @@ radv_graphics_lib_pipeline_init(struct radv_graphics_lib_pipeline *pipeline,
result = radv_create_shaders(&pipeline->base.base, pipeline_layout, device, cache, &key,
pCreateInfo->pStages, pCreateInfo->stageCount, pCreateInfo->flags,
NULL, creation_feedback, NULL, NULL,
NULL, creation_feedback, NULL, NULL, imported_flags,
&pipeline->base.last_vgt_api_stage);
if (result != VK_SUCCESS)
@@ -5387,7 +5396,7 @@ radv_compute_pipeline_create(VkDevice _device, VkPipelineCache _cache,
UNUSED gl_shader_stage last_vgt_api_stage = MESA_SHADER_NONE;
result = radv_create_shaders(&pipeline->base, pipeline_layout, device, cache, &key,
&pCreateInfo->stage, 1, pCreateInfo->flags, NULL, creation_feedback,
NULL, NULL, &last_vgt_api_stage);
NULL, NULL, 0, &last_vgt_api_stage);
if (result != VK_SUCCESS) {
radv_pipeline_destroy(device, &pipeline->base, pAllocator);
return result;

View File

@@ -307,7 +307,7 @@ radv_rt_pipeline_create(VkDevice _device, VkPipelineCache _cache,
* generating the nir. */
result = radv_create_shaders(
&rt_pipeline->base.base, pipeline_layout, device, cache, &key, &stage, 1, flags, hash,
creation_feedback, &rt_pipeline->stack_sizes, &rt_pipeline->group_count, &last_vgt_api_stage);
creation_feedback, &rt_pipeline->stack_sizes, &rt_pipeline->group_count, 0, &last_vgt_api_stage);
if (result != VK_SUCCESS && result != VK_PIPELINE_COMPILE_REQUIRED)
goto pipeline_fail;
@@ -327,7 +327,7 @@ radv_rt_pipeline_create(VkDevice _device, VkPipelineCache _cache,
module.nir = shader;
result = radv_create_shaders(&rt_pipeline->base.base, pipeline_layout, device, cache, &key,
&stage, 1, pCreateInfo->flags, hash, creation_feedback,
&rt_pipeline->stack_sizes, &rt_pipeline->group_count,
&rt_pipeline->stack_sizes, &rt_pipeline->group_count, 0,
&last_vgt_api_stage);
if (result != VK_SUCCESS)
goto shader_fail;

View File

@@ -566,6 +566,7 @@ VkResult radv_create_shaders(struct radv_pipeline *pipeline,
const VkPipelineCreationFeedbackCreateInfo *creation_feedback,
struct radv_pipeline_shader_stack_size **stack_sizes,
uint32_t *num_stack_sizes,
VkGraphicsPipelineLibraryFlagBitsEXT lib_flags,
gl_shader_stage *last_vgt_api_stage);
struct radv_shader_args;