From 31d17efb48efcabf4dd688602624f6a99e13c9e1 Mon Sep 17 00:00:00 2001 From: Joshua Ashton Date: Fri, 5 Aug 2022 23:09:40 +0000 Subject: [PATCH] [dxvk] Add feedback loop aspect flags to bindRenderTargets --- src/d3d11/d3d11_context.cpp | 4 ++-- src/d3d11/d3d11_video.cpp | 4 ++-- src/d3d9/d3d9_device.cpp | 2 +- src/dxvk/dxvk_context.h | 8 +++++++- src/dxvk/dxvk_swapchain_blitter.cpp | 2 +- 5 files changed, 13 insertions(+), 7 deletions(-) diff --git a/src/d3d11/d3d11_context.cpp b/src/d3d11/d3d11_context.cpp index 88a0a4c4..656b1cef 100644 --- a/src/d3d11/d3d11_context.cpp +++ b/src/d3d11/d3d11_context.cpp @@ -3161,7 +3161,7 @@ namespace dxvk { EmitCs([ cAttachments = std::move(attachments) ] (DxvkContext* ctx) mutable { - ctx->bindRenderTargets(Forwarder::move(cAttachments)); + ctx->bindRenderTargets(Forwarder::move(cAttachments), 0u); }); // If necessary, update push constant for the sample count @@ -3813,7 +3813,7 @@ namespace dxvk { cUsedBindings = GetMaxUsedBindings() ] (DxvkContext* ctx) { // Reset render targets - ctx->bindRenderTargets(DxvkRenderTargets()); + ctx->bindRenderTargets(DxvkRenderTargets(), 0u); // Reset vertex input state ctx->setInputLayout(0, nullptr, 0, nullptr); diff --git a/src/d3d11/d3d11_video.cpp b/src/d3d11/d3d11_video.cpp index b8fd949f..96e1486b 100644 --- a/src/d3d11/d3d11_video.cpp +++ b/src/d3d11/d3d11_video.cpp @@ -1198,7 +1198,7 @@ namespace dxvk { rt.color[0].view = cView; rt.color[0].layout = VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL; - ctx->bindRenderTargets(std::move(rt)); + ctx->bindRenderTargets(std::move(rt), 0u); ctx->bindShader(VK_SHADER_STAGE_VERTEX_BIT, Rc(m_vs)); ctx->bindShader(VK_SHADER_STAGE_FRAGMENT_BIT, Rc(m_fs)); ctx->bindResourceBuffer(VK_SHADER_STAGE_FRAGMENT_BIT, 0, DxvkBufferSlice(m_ubo)); @@ -1312,7 +1312,7 @@ namespace dxvk { void D3D11VideoContext::UnbindResources() { m_ctx->EmitCs([this] (DxvkContext* ctx) { - ctx->bindRenderTargets(DxvkRenderTargets()); + ctx->bindRenderTargets(DxvkRenderTargets(), 0u); ctx->bindShader(VK_SHADER_STAGE_VERTEX_BIT, nullptr); ctx->bindShader(VK_SHADER_STAGE_FRAGMENT_BIT, nullptr); diff --git a/src/d3d9/d3d9_device.cpp b/src/d3d9/d3d9_device.cpp index 8f9f964f..f972daa4 100644 --- a/src/d3d9/d3d9_device.cpp +++ b/src/d3d9/d3d9_device.cpp @@ -5465,7 +5465,7 @@ namespace dxvk { EmitCs([ cAttachments = std::move(attachments) ] (DxvkContext* ctx) mutable { - ctx->bindRenderTargets(std::move(cAttachments)); + ctx->bindRenderTargets(std::move(cAttachments), 0u); }); } diff --git a/src/dxvk/dxvk_context.h b/src/dxvk/dxvk_context.h index a716d31b..bebbcd52 100644 --- a/src/dxvk/dxvk_context.h +++ b/src/dxvk/dxvk_context.h @@ -87,10 +87,16 @@ namespace dxvk { * \param [in] targets Render targets to bind */ void bindRenderTargets( - DxvkRenderTargets&& targets) { + DxvkRenderTargets&& targets, + VkImageAspectFlags feedbackLoop) { // Set up default render pass ops m_state.om.renderTargets = std::move(targets); + if (unlikely(m_state.gp.state.om.feedbackLoop() != feedbackLoop)) { + m_state.gp.state.om.setFeedbackLoop(feedbackLoop); + m_flags.set(DxvkContextFlag::GpDirtyPipelineState); + } + this->resetRenderPassOps( m_state.om.renderTargets, m_state.om.renderPassOps); diff --git a/src/dxvk/dxvk_swapchain_blitter.cpp b/src/dxvk/dxvk_swapchain_blitter.cpp index c69a8942..603e1497 100644 --- a/src/dxvk/dxvk_swapchain_blitter.cpp +++ b/src/dxvk/dxvk_swapchain_blitter.cpp @@ -180,7 +180,7 @@ namespace dxvk { renderTargets.color[0].view = dstView; renderTargets.color[0].layout = VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL; - ctx->bindRenderTargets(std::move(renderTargets)); + ctx->bindRenderTargets(std::move(renderTargets), 0u); VkExtent2D dstExtent = { dstView->imageInfo().extent.width,