vk_rasterizer: Fix framebuffer creation validation errors

Framebuffer creation was ignoring the number of color attachments.
merge-requests/60/head
ReinUsesLisp 2020-04-22 21:21:10 +07:00
parent 8c37cd1af6
commit 3e35101895
1 changed files with 4 additions and 2 deletions

@ -692,7 +692,7 @@ std::tuple<VkFramebuffer, VkExtent2D> RasterizerVulkan::ConfigureFramebuffers(
FramebufferCacheKey key{renderpass, std::numeric_limits<u32>::max(), FramebufferCacheKey key{renderpass, std::numeric_limits<u32>::max(),
std::numeric_limits<u32>::max(), std::numeric_limits<u32>::max()}; std::numeric_limits<u32>::max(), std::numeric_limits<u32>::max()};
const auto try_push = [&](const View& view) { const auto try_push = [&key](const View& view) {
if (!view) { if (!view) {
return false; return false;
} }
@ -703,7 +703,9 @@ std::tuple<VkFramebuffer, VkExtent2D> RasterizerVulkan::ConfigureFramebuffers(
return true; return true;
}; };
for (std::size_t index = 0; index < std::size(color_attachments); ++index) { const auto& regs = system.GPU().Maxwell3D().regs;
const std::size_t num_attachments = static_cast<std::size_t>(regs.rt_control.count);
for (std::size_t index = 0; index < num_attachments; ++index) {
if (try_push(color_attachments[index])) { if (try_push(color_attachments[index])) {
texture_cache.MarkColorBufferInUse(index); texture_cache.MarkColorBufferInUse(index);
} }