diff --git a/src/video_core/renderer_vulkan/vk_graphics_pipeline.cpp b/src/video_core/renderer_vulkan/vk_graphics_pipeline.cpp index 2c432e9bf..901096259 100644 --- a/src/video_core/renderer_vulkan/vk_graphics_pipeline.cpp +++ b/src/video_core/renderer_vulkan/vk_graphics_pipeline.cpp @@ -19,6 +19,15 @@ namespace Vulkan { using Shader::Backend::SPIRV::AuxShaderType; +static constexpr std::array LogicalStageToStageBit = { + vk::ShaderStageFlagBits::eFragment, + vk::ShaderStageFlagBits::eTessellationControl, + vk::ShaderStageFlagBits::eTessellationEvaluation, + vk::ShaderStageFlagBits::eVertex, + vk::ShaderStageFlagBits::eGeometry, + vk::ShaderStageFlagBits::eCompute, +}; + GraphicsPipeline::GraphicsPipeline( const Instance& instance, Scheduler& scheduler, DescriptorHeap& desc_heap, const Shader::Profile& profile, const GraphicsPipelineKey& key_, @@ -34,7 +43,7 @@ GraphicsPipeline::GraphicsPipeline( const auto debug_str = GetDebugString(); const vk::PushConstantRange push_constants = { - .stageFlags = gp_stage_flags, + .stageFlags = AllGraphicsStageBits, .offset = 0, .size = sizeof(Shader::PushData), }; @@ -352,6 +361,7 @@ void GraphicsPipeline::BuildDescSetLayout() { if (!stage) { continue; } + const auto stage_bit = LogicalStageToStageBit[u32(stage->l_stage)]; for (const auto& buffer : stage->buffers) { const auto sharp = buffer.GetSharp(*stage); bindings.push_back({ @@ -360,7 +370,7 @@ void GraphicsPipeline::BuildDescSetLayout() { ? vk::DescriptorType::eStorageBuffer : vk::DescriptorType::eUniformBuffer, .descriptorCount = 1, - .stageFlags = gp_stage_flags, + .stageFlags = stage_bit, }); } for (const auto& image : stage->images) { @@ -369,7 +379,7 @@ void GraphicsPipeline::BuildDescSetLayout() { .descriptorType = image.is_written ? vk::DescriptorType::eStorageImage : vk::DescriptorType::eSampledImage, .descriptorCount = 1, - .stageFlags = gp_stage_flags, + .stageFlags = stage_bit, }); } for (const auto& sampler : stage->samplers) { @@ -377,7 +387,7 @@ void GraphicsPipeline::BuildDescSetLayout() { .binding = binding++, .descriptorType = vk::DescriptorType::eSampler, .descriptorCount = 1, - .stageFlags = gp_stage_flags, + .stageFlags = stage_bit, }); } } diff --git a/src/video_core/renderer_vulkan/vk_pipeline_common.cpp b/src/video_core/renderer_vulkan/vk_pipeline_common.cpp index bf43257f8..96e19d6a1 100644 --- a/src/video_core/renderer_vulkan/vk_pipeline_common.cpp +++ b/src/video_core/renderer_vulkan/vk_pipeline_common.cpp @@ -37,7 +37,7 @@ void Pipeline::BindResources(DescriptorWrites& set_writes, const BufferBarriers& cmdbuf.pipelineBarrier2(dependencies); } - const auto stage_flags = IsCompute() ? vk::ShaderStageFlagBits::eCompute : gp_stage_flags; + const auto stage_flags = IsCompute() ? vk::ShaderStageFlagBits::eCompute : AllGraphicsStageBits; cmdbuf.pushConstants(*pipeline_layout, stage_flags, 0u, sizeof(push_data), &push_data); // Bind descriptor set. diff --git a/src/video_core/renderer_vulkan/vk_pipeline_common.h b/src/video_core/renderer_vulkan/vk_pipeline_common.h index e9e6fed01..9633fc4ea 100644 --- a/src/video_core/renderer_vulkan/vk_pipeline_common.h +++ b/src/video_core/renderer_vulkan/vk_pipeline_common.h @@ -15,7 +15,7 @@ class BufferCache; namespace Vulkan { -static constexpr auto gp_stage_flags = +static constexpr auto AllGraphicsStageBits = vk::ShaderStageFlagBits::eVertex | vk::ShaderStageFlagBits::eTessellationControl | vk::ShaderStageFlagBits::eTessellationEvaluation | vk::ShaderStageFlagBits::eGeometry | vk::ShaderStageFlagBits::eFragment;