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.
This commit is contained in:
PixelyIon 2021-12-08 02:34:19 +05:30
parent 525850ae09
commit 7776ef2cd0

View File

@ -1272,19 +1272,25 @@ namespace skyline::gpu::interconnect {
public: public:
void Draw(u32 vertexCount, u32 firstVertex) { void Draw(u32 vertexCount, u32 firstVertex) {
// Render Target Setup // Color Render Target Setup
boost::container::static_vector<std::scoped_lock<TextureView>, maxwell3d::RenderTargetCount> renderTargetLocks; boost::container::static_vector<std::scoped_lock<TextureView>, maxwell3d::RenderTargetCount> colorRenderTargetLocks;
std::vector<TextureView *> activeRenderTargets; boost::container::static_vector<TextureView *, maxwell3d::RenderTargetCount> activeColorRenderTargets;
for (u32 index{}; index < maxwell3d::RenderTargetCount; index++) { for (u32 index{}; index < maxwell3d::RenderTargetCount; index++) {
auto renderTarget{GetColorRenderTarget(index)}; auto renderTarget{GetColorRenderTarget(index)};
if (renderTarget) { if (renderTarget) {
renderTargetLocks.emplace_back(*renderTarget); colorRenderTargetLocks.emplace_back(*renderTarget);
activeRenderTargets.push_back(renderTarget); activeColorRenderTargets.push_back(renderTarget);
} }
} }
blendState.attachmentCount = static_cast<u32>(activeRenderTargets.size()); blendState.attachmentCount = static_cast<u32>(activeColorRenderTargets.size());
// Depth/Stencil Render Target Setup
auto depthRenderTargetView{GetDepthRenderTarget()};
std::optional<std::scoped_lock<TextureView>> depthTargetLock;
if (depthRenderTargetView)
depthTargetLock.emplace(*depthRenderTargetView);
// Vertex Buffer Setup // Vertex Buffer Setup
boost::container::static_vector<std::scoped_lock<BufferView>, maxwell3d::VertexBufferCount> vertexBufferLocks; boost::container::static_vector<std::scoped_lock<BufferView>, maxwell3d::VertexBufferCount> vertexBufferLocks;
@ -1363,8 +1369,8 @@ namespace skyline::gpu::interconnect {
cycle->AttachObject(std::make_shared<Storage>(std::move(pipelineLayout), vk::raii::Pipeline(vkDevice, pipeline.value))); cycle->AttachObject(std::make_shared<Storage>(std::move(pipelineLayout), vk::raii::Pipeline(vkDevice, pipeline.value)));
}, vk::Rect2D{ }, vk::Rect2D{
.extent = activeRenderTargets[0]->texture->dimensions, .extent = activeColorRenderTargets[0]->texture->dimensions,
}, {}, activeRenderTargets); }, {}, activeColorRenderTargets, depthRenderTargetView);
} }
}; };
} }