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

vkAcquireNextImageKHR crashes in validation layers if vkGetSwapchainImagesKHR hasn't been called #358

Closed
zeux opened this issue Sep 29, 2018 · 3 comments
Assignees
Milestone

Comments

@zeux
Copy link

zeux commented Sep 29, 2018

If you call vkAcquireNextImageKHR before calling vkGetSwapchainImagesKHR, validation layers crash with this callstack:

VkLayer_core_validation.dll!core_validation::PostCallRecordAcquireNextImageKHR(core_validation::layer_data * dev_data, VkDevice_T * device, VkSwapchainKHR_T * swapchain, unsigned __int64 timeout, VkSemaphore_T * semaphore, VkFence_T * fence, unsigned int * pImageIndex) Line 11754	C++
 	VkLayer_core_validation.dll!core_validation::AcquireNextImageKHR(VkDevice_T * device, VkSwapchainKHR_T * swapchain, unsigned __int64 timeout, VkSemaphore_T * semaphore, VkFence_T * fence, unsigned int * pImageIndex) Line 11775	C++
 	VkLayer_object_tracker.dll!object_tracker::AcquireNextImageKHR(VkDevice_T * device, VkSwapchainKHR_T * swapchain, unsigned __int64 timeout, VkSemaphore_T * semaphore, VkFence_T * fence, unsigned int * pImageIndex) Line 2974	C++
 	VkLayer_parameter_validation.dll!parameter_validation::vkAcquireNextImageKHR(VkDevice_T * device, VkSwapchainKHR_T * swapchain, unsigned __int64 timeout, VkSemaphore_T * semaphore, VkFence_T * fence, unsigned int * pImageIndex) Line 7731	C++
 	VkLayer_threading.dll!threading::AcquireNextImageKHR(VkDevice_T * device, VkSwapchainKHR_T * swapchain, unsigned __int64 timeout, VkSemaphore_T * semaphore, VkFence_T * fence, unsigned int * pImageIndex) Line 3652	C++

Here:

    // Mark the image as acquired.
    auto swapchain_data = GetSwapchainNode(dev_data, swapchain);
    auto image = swapchain_data->images[*pImageIndex];
    auto image_state = GetImageState(dev_data, image);

The issue is that *pImageIndex is 0 (as returned by the driver), but swapchain_data->images is empty.

@jzulauf-lunarg
Copy link
Contributor

jzulauf-lunarg commented Oct 5, 2018

Triage notes:

two parts to this

  1. deduplicate the vkAcquireNextImageKHR and vkAcquireNextImage2KHR validate and record logic
  2. add defensive checks for invalid swapchain handle (VU codegen'd in Object Tracker) causing null returns from GetSwapchainNode

@mark-lunarg
Copy link
Contributor

For #2, see @tobine's comment in #399.

@TonyBarbour
Copy link
Contributor

Resolved in PR #402

@shannon-lunarg shannon-lunarg added this to the sdk-1.1.temp.0 milestone Oct 19, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants