From 516ece6b04d941ab08569ce23ea3ca480af9b18f Mon Sep 17 00:00:00 2001 From: Billy Laws Date: Sun, 11 Dec 2022 14:35:55 +0000 Subject: [PATCH] Calculate renderarea from attachment min size --- .../skyline/gpu/interconnect/maxwell_3d/maxwell_3d.cpp | 10 ++++++++++ .../interconnect/maxwell_3d/packed_pipeline_state.cpp | 6 +----- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/app/src/main/cpp/skyline/gpu/interconnect/maxwell_3d/maxwell_3d.cpp b/app/src/main/cpp/skyline/gpu/interconnect/maxwell_3d/maxwell_3d.cpp index e09b03b8..337871ae 100644 --- a/app/src/main/cpp/skyline/gpu/interconnect/maxwell_3d/maxwell_3d.cpp +++ b/app/src/main/cpp/skyline/gpu/interconnect/maxwell_3d/maxwell_3d.cpp @@ -294,6 +294,16 @@ namespace skyline::gpu::interconnect::maxwell3d { {surfaceClip.horizontal.width, surfaceClip.vertical.height} }; + auto colorAttachments{activeState.GetColorAttachments()}; + auto depthStencilAttachment{activeState.GetDepthAttachment()}; + auto depthStencilAttachmentSpan{depthStencilAttachment ? span(depthStencilAttachment) : span()}; + for (auto attachment : ranges::views::concat(colorAttachments, depthStencilAttachmentSpan)) { + if (attachment) { + scissor.extent.width = std::min(scissor.extent.width, static_cast(static_cast(attachment->texture->dimensions.width) - scissor.offset.x)); + scissor.extent.height = std::min(scissor.extent.height, static_cast(static_cast(attachment->texture->dimensions.height) - scissor.offset.y)); + } + } + ctx.executor.AddSubpass([drawParams](vk::raii::CommandBuffer &commandBuffer, const std::shared_ptr &, GPU &gpu, vk::RenderPass, u32) { drawParams->stateUpdater.RecordAll(gpu, commandBuffer); diff --git a/app/src/main/cpp/skyline/gpu/interconnect/maxwell_3d/packed_pipeline_state.cpp b/app/src/main/cpp/skyline/gpu/interconnect/maxwell_3d/packed_pipeline_state.cpp index 7f1e89bb..39c03d40 100644 --- a/app/src/main/cpp/skyline/gpu/interconnect/maxwell_3d/packed_pipeline_state.cpp +++ b/app/src/main/cpp/skyline/gpu/interconnect/maxwell_3d/packed_pipeline_state.cpp @@ -204,11 +204,7 @@ namespace skyline::gpu::interconnect::maxwell3d { } size_t PackedPipelineState::GetColorRenderTargetCount() const { - for (size_t i{engine::ColorTargetCount}; i > 0 ; i--) - if (IsColorRenderTargetEnabled(ctSelect[i - 1])) - return i; - - return 0; + return ctSelect.count; } texture::Format PackedPipelineState::GetDepthRenderTargetFormat() const {