Open TheMostDiligent opened 5 months ago
The Tutorial01_HelloTriangle.app
runtime you submitted seems to contain a few hard-coded file paths to your environment.
Do you have a buildable version of that app so we can build it here to see what's happening?
Do you have a buildable version of that app so we can build it here to see what's happening?
Yes: https://github.com/DiligentGraphics/DiligentEngine
Build should as simple as
git clone --recursive https://github.com/DiligentGraphics/DiligentEngine.git
cd DiligentEngine
cmake -S . -B ./build/MacOS -G "Xcode"
open build/MacOS/DiligentEngine.xcodeproj/
After investigating the issue I found the following: the problem happens right after we recreate the swap chain (for example, when the sync mode changes). The first time we acquire the image, the vkAcquireNextImageKHR
returns VK_SUBOPTIMAL_KHR
. If, however, we recreate the swap chain the second time and acquire the image again, it works OK.
@billhollings does this behavior say something? Apparently it is related to some changes in 1.3.275.0
@TheMostDiligent
Thanks for this latest update, and for posting the workaround patch to your engine. I've had a look at the patch.
I can replicate something similar with the MoltenVK Cube demo, and I believe I understand what's happening, at least with the demo.
Anywhere that VK_SUBOPTIMAL_KHR
can be returned (acquire image & present), MoltenVK includes a dynamic comparison of the size of the CAMetalLayer
of the underlying view, in order to determine if the platform has resized the layer, typically as a result of the user dragging the edge of a window.
I believe what is happening is that as the user continues to drag the window edge, by the time the swap chain has been re-created, the platform may have expanded or shrunk the CAMetalLayer
further, resulting in another VK_SUBOPTIMAL_KHR
being triggered. This currently won't stop happening until the user stops changing the size of the window.
So...we need a mechanism to detect when the platform has changed the size of the CAMetalLayer
, but perhaps checking on both image acquisition time AND presentation request time is too aggressive. Perhaps we should check only once per frame after the presentation. Or perhaps even only once every , 5 or 10 frames, etc.
Does my description match what you're experiencing? Is this repetition occurring during continuous window resizing by the user?
I did see similar problem when resizing the window. However, it also happens when the swap chain is recreated (to change the swap effect) without resizing.
Hello!
After updating Vulkan SDK to the latest version, we started seeing issues with the swap chain that did not happen before (versions 1.3.268.1 and earlier).
First, when running application from XCode with Metal API Validation enabled, the app triggers Metal assertion:
When disabling Metal API Validation, Vulkan validation displays errors:
The errors do not make a lot of sense: the semaphore is signaled few lines before it is passed to
vkQueuePresentKHR
Lastly, when resizing the window, the app hangs.
None of these issues happened before the 1.3.275.0 SDK. They also don't happen on any other platform (Windows, Linux, Android) with the same SDK version.
The behavior is the same whether we use the MoltenVK surface or VK_EXT_Metal_Surface
Tutorial01_HelloTriangle.zip