#black screen but shows on renderdoc capture

12 messages · Page 1 of 1 (latest)

mortal granite
#

i have validation layers on and there were no messages

#

im using xlib is there a function i need to call to swap buffers?

floral sparrow
#

No, vkQueuePresentKHR takes care of all that stuff.

rotund raptor
#

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

rotund raptor
#

Renderdoc typically shows your execution down, which means that it could be a timing issue. Did you also enable sync validation?

mortal granite
rotund raptor
#

I would recommend enabling this via vkconfig. I would never trust env for this. Also, try to provoke a sync error, to be safe

floral sparrow
#

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 renderFinishedSemaphores should be indexed using imageIndex (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_KHR is not an error. If you get that back from vkAcquireNextImageKHR then 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.
  • vkQueuePresentKHR can also return VK_ERROR_OUT_OF_DATE_KHR or VK_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.
rotund raptor
#

Wait... what can go wrong if you index renderFinishedSemaphore with frameIndex? I always thought this was the way.

floral sparrow
#

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.