Fix MSAA 8x crash: clearValueCount must match attachment count

Render pass begin used 2 clear values but MSAA render pass has 3
attachments (MSAA color, depth, resolve). Vulkan requires clear
value count >= attachment count, causing a driver crash at 8x.

Also fix renderYawM2 reference removed in previous commit.
This commit is contained in:
Kelsi 2026-02-22 03:11:21 -08:00
parent 786b35ae0d
commit b1a9d231c7
2 changed files with 6 additions and 3 deletions

View file

@ -835,10 +835,13 @@ void Renderer::beginFrame() {
rpInfo.renderArea.offset = {0, 0};
rpInfo.renderArea.extent = vkCtx->getSwapchainExtent();
VkClearValue clearValues[2]{};
// MSAA render pass has 3 attachments (color, depth, resolve), non-MSAA has 2
VkClearValue clearValues[3]{};
clearValues[0].color = {{0.0f, 0.0f, 0.0f, 1.0f}};
clearValues[1].depthStencil = {1.0f, 0};
rpInfo.clearValueCount = 2;
clearValues[2].color = {{0.0f, 0.0f, 0.0f, 1.0f}}; // resolve (DONT_CARE, but count must match)
bool msaaOn = (vkCtx->getMsaaSamples() > VK_SAMPLE_COUNT_1_BIT);
rpInfo.clearValueCount = msaaOn ? 3 : 2;
rpInfo.pClearValues = clearValues;
vkCmdBeginRenderPass(currentCmd, &rpInfo, VK_SUBPASS_CONTENTS_INLINE);