From eeb86a4f8a20df3a47c63d7341700428941a583f Mon Sep 17 00:00:00 2001 From: Billy Laws Date: Sun, 31 Jul 2022 14:29:44 +0100 Subject: [PATCH] Calculate renderArea from min(attachments.dimensions...) Vulkan doesn't support a renderArea larger than that of the smallest attachment --- .../cpp/skyline/gpu/interconnect/graphics_context.h | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 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 dfab923c..ddcd1b2c 100644 --- a/app/src/main/cpp/skyline/gpu/interconnect/graphics_context.h +++ b/app/src/main/cpp/skyline/gpu/interconnect/graphics_context.h @@ -2971,6 +2971,13 @@ namespace skyline::gpu::interconnect { executor.AttachDependency(drawStorage); } + vk::Rect2D renderArea{depthRenderTargetView ? vk::Rect2D{.extent = depthRenderTargetView->texture->dimensions} : vk::Rect2D{.extent = {std::numeric_limits::max(), std::numeric_limits::max()}}}; + + for (auto &colorRt : activeColorRenderTargets) { + renderArea.extent.width = std::min(renderArea.extent.width, colorRt->texture->dimensions.width); + renderArea.extent.height = std::min(renderArea.extent.height, colorRt->texture->dimensions.height); + } + // Submit Draw executor.AddSubpass([=, drawStorage = std::move(drawStorage), pipelineLayout = compiledPipeline.pipelineLayout, pipeline = compiledPipeline.pipeline](vk::raii::CommandBuffer &commandBuffer, const std::shared_ptr &cycle, GPU &, vk::RenderPass renderPass, u32 subpassIndex) mutable { auto &vertexBufferHandles{boundVertexBuffers->handles}; @@ -3003,9 +3010,7 @@ namespace skyline::gpu::interconnect { } else { commandBuffer.draw(count, instanceCount, first, 0); } - }, vk::Rect2D{ - .extent = activeColorRenderTargets.empty() ? depthRenderTarget.guest.dimensions : activeColorRenderTargets.front()->texture->dimensions, - }, {}, activeColorRenderTargets, depthRenderTargetView, !gpu.traits.quirks.relaxedRenderPassCompatibility); + }, renderArea, {}, activeColorRenderTargets, depthRenderTargetView, !gpu.traits.quirks.relaxedRenderPassCompatibility); } void Draw(u32 vertexCount, u32 firstVertex, u32 instanceCount) {