Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix swapchain semaphore handling #424

Merged
merged 1 commit into from
Jun 26, 2024
Merged

Fix swapchain semaphore handling #424

merged 1 commit into from
Jun 26, 2024

Conversation

IAmNotHanni
Copy link
Contributor

@IAmNotHanni IAmNotHanni commented Jun 21, 2024

Closes #421

Please verify if this solution is technically correct.
Tested on NVIDIA RTX 3090, NVIDIA GeForce 940M, Intel Arc A770, and AMD Ryzen 9 7950X.

Have a nice weekend
Johannes

@@ -2306,7 +2319,7 @@ static void DrawFrame()

// Acquire swapchain image
uint32_t imageIndex = 0;
VkResult res = vkAcquireNextImageKHR(g_hDevice, g_hSwapchain, UINT64_MAX, g_hImageAvailableSemaphore, VK_NULL_HANDLE, &imageIndex);
VkResult res = vkAcquireNextImageKHR(g_hDevice, g_hSwapchain, UINT64_MAX, g_hImageAvailableSemaphores.at(g_SwapchainImageIndex), VK_NULL_HANDLE, &imageIndex);
Copy link
Contributor Author

@IAmNotHanni IAmNotHanni Jun 21, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe a comment on this here: We can't do

uint32_t imageIndex = 0;
VkResult res = vkAcquireNextImageKHR(g_hDevice, g_hSwapchain, UINT64_MAX, g_hImageAvailableSemaphores.at(imageIndex), VK_NULL_HANDLE, &imageIndex);

because imageIndex is written to by vkAcquireNextImageKHR (pass by reference), so we can't use is in the call directly. At the time of the function call, it would always be g_hImageAvailableSemaphores.at(0). I had to track the swapchain image index manually, as can be seen at the end of DrawFrame.

@adam-sawicki-a adam-sawicki-a merged commit feb11e1 into GPUOpen-LibrariesAndSDKs:master Jun 26, 2024
@adam-sawicki-a
Copy link
Contributor

Thank you for this fix.

@adam-sawicki-a adam-sawicki-a added bug Something isn't working next release To be done as soon as possible labels Jun 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working next release To be done as soon as possible
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Validation layer error in sample application
2 participants