lwjglgamedev / vulkanbook

Online book which introduces the main concepts required to write graphics games or any other applications using Vulkan in Java by using the LWJGL library.
MIT License
263 stars 13 forks source link

[Potential Bug] Render Complete Semaphore is specified using `currentFrame` rather than `imageIndex` which can cause sync validation errors. #90

Open Mjrlun opened 3 months ago

Mjrlun commented 3 months ago

As title suggests. I noticed this after comparing my work with yours (having previously followed the tutorial before), and having conferred with someone in the Vulkan discord.

The solution would be to create an array of Semaphores and access them using the imageIndex passed back from acquireNextImage, in place of the current renderCompleteSemaphore within the SyncSemaphores record. You could also do the same by specially accessing the SyncSemaphores array for the render complete semaphore: syncSemaphores[imageIndex].renderCompleteSemaphore().vkSemaphore

Mjrlun commented 3 months ago

Additionally, the index for the LightingFrameBuffer VkFrameBuffers should also be using this same imageIndex, rather than how it currently uses the current frame.

lwjglgamedev commented 3 months ago

Ok,

I saw this issue some weeks ago, becuase it caused validation warnings. Perviously, everything as reported as correct. I was not using the proper image index returned while acquiring the image. But I already uploaded a fix for that, and the valiaton error messages are goone. Therfore, it seems to be working now.

In any case, just for you to know. I'm currently working on a new version of the book with the following deisgn goals:

I'm also planning in including a sample for PhysX.

It is taking some time, but I'm working on it.

Mjrlun commented 3 months ago

Sounds awesome! I will take a look at it when it's done, although not looking forward to more sync error nightmares. Hopefully it will run faster though :)

lwjglgamedev commented 3 months ago

I can give access to the working source code if you want to have a look. I'm regulary testing with sync validation layers on.

Mjrlun commented 3 months ago

Sure if you want. Just DM me on discord I guess.