diff --git a/src/core/gpu_hw.cpp b/src/core/gpu_hw.cpp index b1e644063..f17807ef6 100644 --- a/src/core/gpu_hw.cpp +++ b/src/core/gpu_hw.cpp @@ -1464,9 +1464,22 @@ bool GPU_HW::CompilePipelines(Error* error) plconfig.SetTargetFormats(use_rov ? GPUTexture::Format::Unknown : VRAM_RT_FORMAT, needs_rov_depth ? GPUTexture::Format::Unknown : depth_buffer_format); plconfig.color_formats[1] = needs_rov_depth ? VRAM_DS_COLOR_FORMAT : GPUTexture::Format::Unknown; - plconfig.render_pass_flags = - use_rov ? GPUPipeline::BindRenderTargetsAsImages : - (needs_feedback_loop ? GPUPipeline::ColorFeedbackLoop : GPUPipeline::NoRenderPassFlags); + + // Don't enable feedback loop bit if it's not needed. + if (use_rov) + { + plconfig.render_pass_flags = GPUPipeline::BindRenderTargetsAsImages; + } + else if (needs_feedback_loop) + { + plconfig.render_pass_flags = static_cast( + use_shader_blending ? (GPUPipeline::ColorFeedbackLoop | GPUPipeline::ColorFeedbackLoopActive) : + GPUPipeline::ColorFeedbackLoop); + } + else + { + plconfig.render_pass_flags = GPUPipeline::NoRenderPassFlags; + } plconfig.blend = GPUPipeline::BlendState::GetNoBlendingState(); diff --git a/src/util/gpu_device.h b/src/util/gpu_device.h index c590bd611..84e1c2f98 100644 --- a/src/util/gpu_device.h +++ b/src/util/gpu_device.h @@ -229,8 +229,9 @@ public: { NoRenderPassFlags = 0, ColorFeedbackLoop = (1 << 0), - SampleDepthBuffer = (1 << 1), - BindRenderTargetsAsImages = (1 << 2), + ColorFeedbackLoopActive = (1 << 1), + SampleDepthBuffer = (1 << 2), + BindRenderTargetsAsImages = (1 << 3), }; enum class Primitive : u8 diff --git a/src/util/vulkan_device.cpp b/src/util/vulkan_device.cpp index ba0fa3b1b..9a31b12be 100644 --- a/src/util/vulkan_device.cpp +++ b/src/util/vulkan_device.cpp @@ -4146,6 +4146,8 @@ void VulkanDevice::DrawIndexedWithBarrierWithPushConstants(u32 index_count, u32 void VulkanDevice::SubmitDrawIndexedWithBarrier(u32 index_count, u32 base_index, u32 base_vertex, DrawBarrier type) { + DebugAssert(m_current_pipeline->GetRenderPassFlags() & GPUPipeline::ColorFeedbackLoopActive); + switch (type) { case GPUDevice::DrawBarrier::None: diff --git a/src/util/vulkan_pipeline.cpp b/src/util/vulkan_pipeline.cpp index 73f2f1bca..3e8863720 100644 --- a/src/util/vulkan_pipeline.cpp +++ b/src/util/vulkan_pipeline.cpp @@ -244,6 +244,13 @@ std::unique_ptr VulkanDevice::CreatePipeline(const GPUPipeline::Gra gpb.SetPipelineLayout(m_pipeline_layouts[static_cast(GetPipelineLayoutType(config.render_pass_flags))] [static_cast(config.layout)]); + if ((config.render_pass_flags & GPUPipeline::ColorFeedbackLoopActive) && + m_optional_extensions.vk_ext_rasterization_order_attachment_access) + { + DebugAssert(config.render_pass_flags & GPUPipeline::ColorFeedbackLoop); + gpb.AddBlendFlags(VK_PIPELINE_COLOR_BLEND_STATE_CREATE_RASTERIZATION_ORDER_ATTACHMENT_ACCESS_BIT_EXT); + } + if (m_optional_extensions.vk_khr_dynamic_rendering && (m_optional_extensions.vk_khr_dynamic_rendering_local_read || !(config.render_pass_flags & GPUPipeline::ColorFeedbackLoop))) { diff --git a/src/util/vulkan_pipeline.h b/src/util/vulkan_pipeline.h index 2dcc72d91..91be444d7 100644 --- a/src/util/vulkan_pipeline.h +++ b/src/util/vulkan_pipeline.h @@ -35,6 +35,7 @@ public: ALWAYS_INLINE VkPipeline GetPipeline() const { return m_pipeline; } ALWAYS_INLINE Layout GetLayout() const { return m_layout; } ALWAYS_INLINE u8 GetVerticesPerPrimitive() const { return m_vertices_per_primitive; } + ALWAYS_INLINE RenderPassFlag GetRenderPassFlags() const { return m_render_pass_flags; } #ifdef ENABLE_GPU_OBJECT_NAMES void SetDebugName(std::string_view name) override;