#black screen but shows on renderdoc capture
12 messages · Page 1 of 1 (latest)
i have validation layers on and there were no messages
im using xlib is there a function i need to call to swap buffers?
No, vkQueuePresentKHR takes care of all that stuff.
have you tried vkcube in your machine? it's a good idea to make sure that your code is the issue rather than your setup/driver
it works
Renderdoc typically shows your execution down, which means that it could be a timing issue. Did you also enable sync validation?
i tried export VK_KHRONOS_VALIDATION_VALIDATE_SYNC=true there were no messages
I would recommend enabling this via vkconfig. I would never trust env for this. Also, try to provoke a sync error, to be safe
Reading more closely, I do see a few bugs in your code, though I doubt any of them are the cause of your blank screen (the first one might be, though if it is then validation should already have flagged it for you).
- Your
renderFinishedSemaphoresshould be indexed usingimageIndex(and there should be as many of them as you have swapchain images, not frames-in-flight). This is a common bug that people pick up from bad tutorial code and it's one of those things that tends to mostly work, until suddenly it doesn't. VK_SUBOPTIMAL_KHRis not an error. If you get that back fromvkAcquireNextImageKHRthen you need to return that image to the swap chain before you can recreate it. Either look at the swapchain maintenance extension or - much easier - just render the frame and recreate the swapchain before acquiring an image for the next frame.vkQueuePresentKHRcan also returnVK_ERROR_OUT_OF_DATE_KHRorVK_SUBOPTIMAL_KHR. If it does, recreate the swapchain before attempting to acquire an image for the next frame.
If none of that's the issue and validation isn't shouting about anything else, then I'd start looking at your window and surface setup code next.
Wait... what can go wrong if you index renderFinishedSemaphore with frameIndex? I always thought this was the way.
In a nutshell:
You have no control over when the WSI is actually done with the render finished semaphore. The only way to know that it's ready to be reused is when vkAcquireNextImageKHR returns the same image index that it was last used with. And there is no requirement whatsoever that those image indices are returned in any knowable or even consistent pattern. The pattern is usually stable and consistent, but that only holds until something disturbs the surface/swap chain. It could be window resizes or timing hiccups in the desktop compositor or really anything that does it.