diff options
author | Samuel Pitoiset <samuel.pitoiset@gmail.com> | 2023-01-25 09:30:48 +0100 |
---|---|---|
committer | Eric Engestrom <eric@engestrom.ch> | 2023-01-26 15:40:35 +0000 |
commit | d1daf01b3af7183311f4bbed8e319df517803f7b (patch) | |
tree | 8e4622e273f4932189da2bf88f5e354b55073598 | |
parent | 5a2ca86429a8d1915538c777662dea01bc2d499d (diff) | |
download | mesa-d1daf01b3af7183311f4bbed8e319df517803f7b.tar.gz |
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: c8765c5244a ("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>
(cherry picked from commit b97fee432c23435bc6c6ef3f27af54c2538cc36b)
-rw-r--r-- | .pick_status.json | 2 | ||||
-rw-r--r-- | src/amd/vulkan/radv_pipeline.c | 15 | ||||
-rw-r--r-- | src/amd/vulkan/radv_pipeline_rt.c | 4 | ||||
-rw-r--r-- | src/amd/vulkan/radv_shader.h | 1 |
4 files changed, 16 insertions, 6 deletions
diff --git a/.pick_status.json b/.pick_status.json index 5736e3f5388..0f2977cd824 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -13,7 +13,7 @@ "description": "radv: fix ignoring graphics shader stages that don't need to be imported", "nominated": true, "nomination_type": 1, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": "c8765c5244ac194e1c85d2a88dde76c5d92a8111" }, diff --git a/src/amd/vulkan/radv_pipeline.c b/src/amd/vulkan/radv_pipeline.c index 6fa32b6e687..9758c79084e 100644 --- a/src/amd/vulkan/radv_pipeline.c +++ b/src/amd/vulkan/radv_pipeline.c @@ -4069,6 +4069,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"; @@ -4096,6 +4097,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); } @@ -6181,7 +6188,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; @@ -6414,7 +6423,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) @@ -6617,7 +6626,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; diff --git a/src/amd/vulkan/radv_pipeline_rt.c b/src/amd/vulkan/radv_pipeline_rt.c index 44fb143ba3b..fba8c3dd6d7 100644 --- a/src/amd/vulkan/radv_pipeline_rt.c +++ b/src/amd/vulkan/radv_pipeline_rt.c @@ -1762,7 +1762,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; @@ -1782,7 +1782,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; diff --git a/src/amd/vulkan/radv_shader.h b/src/amd/vulkan/radv_shader.h index 0e3eeea9d6b..62b72c154ac 100644 --- a/src/amd/vulkan/radv_shader.h +++ b/src/amd/vulkan/radv_shader.h @@ -570,6 +570,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; |