From 7776ef2cd07073352280fa76af87bf9714083925 Mon Sep 17 00:00:00 2001 From: PixelyIon Date: Wed, 8 Dec 2021 02:34:19 +0530 Subject: [PATCH] Support Depth/Stencil RT in Draw Adds the depth/stencil RT as an attachment for the draw but with `VkPipelineDepthStencilStateCreateInfo` stubbed out, it'll not function correctly and the contents will not be what the guest expects them to be. --- .../gpu/interconnect/graphics_context.h | 22 ++++++++++++------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/app/src/main/cpp/skyline/gpu/interconnect/graphics_context.h b/app/src/main/cpp/skyline/gpu/interconnect/graphics_context.h index 854884bd..cfb2a3bb 100644 --- a/app/src/main/cpp/skyline/gpu/interconnect/graphics_context.h +++ b/app/src/main/cpp/skyline/gpu/interconnect/graphics_context.h @@ -1272,19 +1272,25 @@ namespace skyline::gpu::interconnect { public: void Draw(u32 vertexCount, u32 firstVertex) { - // Render Target Setup - boost::container::static_vector, maxwell3d::RenderTargetCount> renderTargetLocks; - std::vector activeRenderTargets; + // Color Render Target Setup + boost::container::static_vector, maxwell3d::RenderTargetCount> colorRenderTargetLocks; + boost::container::static_vector activeColorRenderTargets; for (u32 index{}; index < maxwell3d::RenderTargetCount; index++) { auto renderTarget{GetColorRenderTarget(index)}; if (renderTarget) { - renderTargetLocks.emplace_back(*renderTarget); - activeRenderTargets.push_back(renderTarget); + colorRenderTargetLocks.emplace_back(*renderTarget); + activeColorRenderTargets.push_back(renderTarget); } } - blendState.attachmentCount = static_cast(activeRenderTargets.size()); + blendState.attachmentCount = static_cast(activeColorRenderTargets.size()); + + // Depth/Stencil Render Target Setup + auto depthRenderTargetView{GetDepthRenderTarget()}; + std::optional> depthTargetLock; + if (depthRenderTargetView) + depthTargetLock.emplace(*depthRenderTargetView); // Vertex Buffer Setup boost::container::static_vector, maxwell3d::VertexBufferCount> vertexBufferLocks; @@ -1363,8 +1369,8 @@ namespace skyline::gpu::interconnect { cycle->AttachObject(std::make_shared(std::move(pipelineLayout), vk::raii::Pipeline(vkDevice, pipeline.value))); }, vk::Rect2D{ - .extent = activeRenderTargets[0]->texture->dimensions, - }, {}, activeRenderTargets); + .extent = activeColorRenderTargets[0]->texture->dimensions, + }, {}, activeColorRenderTargets, depthRenderTargetView); } }; }