mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-03-23 07:40:14 +00:00
Fix MSAA crash by deferring change to between frames, fix M2 GO orientation
MSAA change was called mid-frame from settings UI, destroying the render pass and framebuffers while the command buffer was still recording. Now deferred via pendingMsaaSamples_ flag, applied in beginFrame() before any GPU state. Also add +180° to M2 game object orientation to fix facing direction.
This commit is contained in:
parent
325254dfcb
commit
ebd0084c22
3 changed files with 21 additions and 1 deletions
|
|
@ -730,6 +730,17 @@ void Renderer::setMsaaSamples(VkSampleCountFlagBits samples) {
|
|||
VkSampleCountFlagBits maxSamples = vkCtx->getMaxUsableSampleCount();
|
||||
if (samples > maxSamples) samples = maxSamples;
|
||||
|
||||
if (samples == vkCtx->getMsaaSamples()) return;
|
||||
|
||||
// Defer to between frames — cannot destroy render pass/framebuffers mid-frame
|
||||
pendingMsaaSamples_ = samples;
|
||||
msaaChangePending_ = true;
|
||||
}
|
||||
|
||||
void Renderer::applyMsaaChange() {
|
||||
VkSampleCountFlagBits samples = pendingMsaaSamples_;
|
||||
msaaChangePending_ = false;
|
||||
|
||||
VkSampleCountFlagBits current = vkCtx->getMsaaSamples();
|
||||
if (samples == current) return;
|
||||
|
||||
|
|
@ -794,6 +805,11 @@ void Renderer::setMsaaSamples(VkSampleCountFlagBits samples) {
|
|||
void Renderer::beginFrame() {
|
||||
if (!vkCtx) return;
|
||||
|
||||
// Apply deferred MSAA change between frames (before any rendering state is used)
|
||||
if (msaaChangePending_) {
|
||||
applyMsaaChange();
|
||||
}
|
||||
|
||||
// Handle swapchain recreation if needed
|
||||
if (vkCtx->isSwapchainDirty()) {
|
||||
vkCtx->recreateSwapchain(window->getWidth(), window->getHeight());
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue