Calculate renderarea from attachment min size

This commit is contained in:
Billy Laws 2022-12-11 14:35:55 +00:00
parent 4a3cd69257
commit 516ece6b04
2 changed files with 11 additions and 5 deletions

View File

@ -294,6 +294,16 @@ namespace skyline::gpu::interconnect::maxwell3d {
{surfaceClip.horizontal.width, surfaceClip.vertical.height} {surfaceClip.horizontal.width, surfaceClip.vertical.height}
}; };
auto colorAttachments{activeState.GetColorAttachments()};
auto depthStencilAttachment{activeState.GetDepthAttachment()};
auto depthStencilAttachmentSpan{depthStencilAttachment ? span<TextureView *>(depthStencilAttachment) : span<TextureView *>()};
for (auto attachment : ranges::views::concat(colorAttachments, depthStencilAttachmentSpan)) {
if (attachment) {
scissor.extent.width = std::min(scissor.extent.width, static_cast<u32>(static_cast<i32>(attachment->texture->dimensions.width) - scissor.offset.x));
scissor.extent.height = std::min(scissor.extent.height, static_cast<u32>(static_cast<i32>(attachment->texture->dimensions.height) - scissor.offset.y));
}
}
ctx.executor.AddSubpass([drawParams](vk::raii::CommandBuffer &commandBuffer, const std::shared_ptr<FenceCycle> &, GPU &gpu, vk::RenderPass, u32) { ctx.executor.AddSubpass([drawParams](vk::raii::CommandBuffer &commandBuffer, const std::shared_ptr<FenceCycle> &, GPU &gpu, vk::RenderPass, u32) {
drawParams->stateUpdater.RecordAll(gpu, commandBuffer); drawParams->stateUpdater.RecordAll(gpu, commandBuffer);

View File

@ -204,11 +204,7 @@ namespace skyline::gpu::interconnect::maxwell3d {
} }
size_t PackedPipelineState::GetColorRenderTargetCount() const { size_t PackedPipelineState::GetColorRenderTargetCount() const {
for (size_t i{engine::ColorTargetCount}; i > 0 ; i--) return ctSelect.count;
if (IsColorRenderTargetEnabled(ctSelect[i - 1]))
return i;
return 0;
} }
texture::Format PackedPipelineState::GetDepthRenderTargetFormat() const { texture::Format PackedPipelineState::GetDepthRenderTargetFormat() const {