Skip to content

Fix validation errors in Vulkan sample#175

Open
sasamiyatu wants to merge 3 commits into
odin-lang:masterfrom
sasamiyatu:fix-vulkan-triangle-swapchain-sync
Open

Fix validation errors in Vulkan sample#175
sasamiyatu wants to merge 3 commits into
odin-lang:masterfrom
sasamiyatu:fix-vulkan-triangle-swapchain-sync

Conversation

@sasamiyatu

Copy link
Copy Markdown

This pull request implements the following changes to fix validation errors:

Allocated g_render_finished_semaphores dynamically based on swapchain image count and index it using swapchain image index instead of frame in flight index. See https://docs.vulkan.org/guide/latest/swapchain_semaphore_reuse.html:

vkQueueSubmit(): pSubmits[0].pSignalSemaphores[0] (VkSemaphore 0x170000000017) is being signaled by VkQueue 0x181c21214d0, but it may still be in use by VkSwapchainKHR 0x30000000003.
Most recently acquired image indices: 0, [1], 2, 0.
(Brackets mark the last use of VkSemaphore 0x170000000017 in a presentation operation.)
Swapchain image 1 was presented but was not re-acquired, so VkSemaphore 0x170000000017 may still be in use and cannot be safely reused with image index 0.
Hint: See https://docs.vulkan.org/guide/latest/swapchain_semaphore_reuse.html for details on swapchain semaphore reuse. Examples of possible approaches:
   a) Use a separate semaphore per swapchain image. Index these semaphores using the index of the acquired image.
   b) Consider the VK_KHR_swapchain_maintenance1 extension. It allows using a VkFence with the presentation operation.
The Vulkan spec states: Each binary semaphore element of the pSignalSemaphores member of any element of pSubmits must be unsignaled when the semaphore signal operation it defines is executed on the device (https://docs.vulkan.org/spec/latest/chapters/cmdbuffers.html#VUID-vkQueueSubmit-pSignalSemaphores-00067)

Removed VK_DEBUG_UTILS_MESSAGE_TYPE_DEVICE_ADDRESS_BINDING_BIT_EXT from DebugUtilsMessengerCreateInfoEXTas it requires VK_EXT_device_address_binding_report:

vkCreateInstance(): pCreateInfo->pNext<VkDebugUtilsMessengerCreateInfoEXT>.messageType has VkDebugUtilsMessageTypeFlagBitsEXT values (VK_DEBUG_UTILS_MESSAGE_TYPE_GENERAL_BIT_EXT|VK_DEBUG_UTILS_MESSAGE_TYPE_VALIDATION_BIT_EXT|VK_DEBUG_UTILS_MESSAGE_TYPE_PERFORMANCE_BIT_EXT|VK_DEBUG_UTILS_MESSAGE_TYPE_DEVICE_ADDRESS_BINDING_BIT_EXT) that requires the extensions VK_EXT_device_address_binding_report.
The Vulkan spec states: messageType must be a valid combination of VkDebugUtilsMessageTypeFlagBitsEXT values (https://docs.vulkan.org/spec/latest/chapters/debugging.html#VUID-VkDebugUtilsMessengerCreateInfoEXT-messageType-parameter)

Removed layers from device creation:

vkCreateDevice(): pCreateInfo->enabledLayerCount is 1 (not zero).
Device Layers have never worked since Vulkan 1.0 and only Instance Layers should be used instead: https://docs.vulkan.org/spec/latest/appendices/legacy.html#legacy-devicelayers.
The Vulkan spec states: enabledLayerCount must be 0 (https://docs.vulkan.org/spec/latest/chapters/devsandqueues.html#VUID-VkDeviceCreateInfo-enabledLayerCount-12384)

Checklist before submitting:

  • This example has been added to .github/workflows/check.yml (for automatic testing)
  • This example compiles cleanly with flags -vet -strict-style -vet-tabs -disallow-do -warnings-as-errors
  • This example the naming and style convention: https://github.com/odin-lang/examples/wiki/Naming-and-style-convention (exceptions can be made for ports of examples that need to match 1:1 to the original source).
  • By submitting, I understand that this example is made available under these licenses: Public Domain and Odin's zlib license. Only for third-party dependencies are other licenses allowed.

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

Successfully merging this pull request may close these issues.

1 participant