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

@ -5670,7 +5670,7 @@ void Application::spawnOnlineGameObject(uint64_t guid, uint32_t entry, uint32_t
}
uint32_t instanceId = m2Renderer->createInstance(modelId, renderPos,
glm::vec3(0.0f, 0.0f, renderYawM2), 1.0f);
glm::vec3(0.0f, 0.0f, renderYawWmo), 1.0f);
if (instanceId == 0) {
LOG_WARNING("Failed to create gameobject instance for guid 0x", std::hex, guid, std::dec);
return;

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);