get `VK_KHR_timeline_semaphore` validation error when construct vulkan instance with api verions 1.1
wlgys8 opened this issue · 1 comments
wlgys8 commented
Description
I try to construct wgpu instance and deivce from external prodvided raw vulkan instance. My vulkan driver version is 1.3, and the external provided vulkan instance api version is 1.1.
In this case, vulkan validation error raised when executing queue_submit
pNext includes a pointer to a VkStructureType (VK_STRUCTURE_TYPE_SEMAPHORE_TYPE_CREATE_INFO), but its parent extension VK_KHR_timeline_semaphore has not been enabled
Repro steps
- on a device that supports vulkan1.3, use ash to create a vulkan instance with api version = 1.1
- use
wgpu::hal::vulkan::Instance::from_raw
to createhal::Instance
- use
wgpu::Instance::from_hal::<vulkan::Api>()
to create vulkan instance
Expected vs observed behavior
I think change following code
wgpu/wgpu-hal/src/vulkan/adapter.rs
Lines 1234 to 1239 in 3b6112d
to
if self.instance_api_version >= vk::API_VERSION_1_2
&& capabilities.supports_extension(vk::KhrTimelineSemaphoreFn::name())
{
//...
}
could fix the issue.
Correct me if i misunderstood
Extra materials
VUID-VkSemaphoreCreateInfo-pNext-pNext(ERROR / SPEC): msgNum: -1880859272 - Validation Error: [ VUID-VkSemaphoreCreateInfo-pNext-pNext ] Object 0: handle = 0x29ff2e498a0, type = VK_OBJECT_TYPE_INSTANCE; | MessageID = 0x8fe45d78 | vkCreateSemaphore(): pCreateInfo->pNext includes a pointer to a VkStructureType (VK_STRUCTURE_TYPE_SEMAPHORE_TYPE_CREATE_INFO), but its parent extension VK_KHR_timeline_semaphore has not been enabled. The Vulkan spec states: Each pNext member of any structure (including this one) in the pNext chain must be either NULL or a pointer to a valid instance of VkExportMetalObjectCreateInfoEXT, VkExportSemaphoreCreateInfo, VkExportSemaphoreWin32HandleInfoKHR, VkImportMetalSharedEventInfoEXT, VkQueryLowLatencySupportNV, or VkSemaphoreTypeCreateInfo (https://vulkan.lunarg.com/doc/view/1.3.280.0/windows/1.3-extensions/vkspec.html#VUID-VkSemaphoreCreateInfo-pNext-pNext)
Objects: 1
[0] 0x29ff2e498a0, type: 1, name: NULL
VUID-VkSemaphoreCreateInfo-pNext-pNext(ERROR / SPEC): msgNum: -1880859272 - Validation Error: [ VUID-VkSemaphoreCreateInfo-pNext-pNext ] Object 0: handle = 0x29ff2e498a0, type = VK_OBJECT_TYPE_INSTANCE; | MessageID = 0x8fe45d78 | vkCreateSemaphore(): pCreateInfo->pNext<VkSemaphoreTypeCreateInfo> extended struct requires the extensions VK_KHR_timeline_semaphore. The Vulkan spec states: Each pNext member of any structure (including this one) in the pNext chain must be either NULL or a pointer to a valid instance of VkExportMetalObjectCreateInfoEXT, VkExportSemaphoreCreateInfo, VkExportSemaphoreWin32HandleInfoKHR, VkImportMetalSharedEventInfoEXT, VkQueryLowLatencySupportNV, or VkSemaphoreTypeCreateInfo (https://vulkan.lunarg.com/doc/view/1.3.280.0/windows/1.3-extensions/vkspec.html#VUID-VkSemaphoreCreateInfo-pNext-pNext)
Objects: 1
[0] 0x29ff2e498a0, type: 1, name: NULL
VUID-VkSemaphoreTypeCreateInfo-timelineSemaphore-03252(ERROR / SPEC): msgNum: 963335225 - Validation Error: [ VUID-VkSemaphoreTypeCreateInfo-timelineSemaphore-03252 ] | MessageID = 0x396b5439 | vkCreateSemaphore(): pCreateInfo->semaphoreType is VK_SEMAPHORE_TYPE_TIMELINE, but timelineSemaphore feature was not enabled. The Vulkan spec states: If the timelineSemaphore feature is not enabled, semaphoreType must not equal VK_SEMAPHORE_TYPE_TIMELINE (https://vulkan.lunarg.com/doc/view/1.3.280.0/windows/1.3-extensions/vkspec.html#VUID-VkSemaphoreTypeCreateInfo-timelineSemaphore-03252)
Objects: 0
VUID-VkSubmitInfo-pNext-pNext(ERROR / SPEC): msgNum: -61378218 - Validation Error: [ VUID-VkSubmitInfo-pNext-pNext ] Object 0: handle = 0x29ff2e498a0, type = VK_OBJECT_TYPE_INSTANCE; | MessageID = 0xfc577156 | vkQueueSubmit(): pSubmits[0].pNext includes a pointer to a VkStructureType (VK_STRUCTURE_TYPE_TIMELINE_SEMAPHORE_SUBMIT_INFO), but its parent extension VK_KHR_timeline_semaphore has not been enabled. The Vulkan spec states: Each pNext member of any structure (including this one) in the pNext chain must be either NULL or a pointer to a valid instance of VkAmigoProfilingSubmitInfoSEC, VkD3D12FenceSubmitInfoKHR, VkDeviceGroupSubmitInfo, VkFrameBoundaryEXT, VkLatencySubmissionPresentIdNV, VkPerformanceQuerySubmitInfoKHR, VkProtectedSubmitInfo, VkTimelineSemaphoreSubmitInfo, VkWin32KeyedMutexAcquireReleaseInfoKHR, or VkWin32KeyedMutexAcquireReleaseInfoNV (https://vulkan.lunarg.com/doc/view/1.3.280.0/windows/1.3-extensions/vkspec.html#VUID-VkSubmitInfo-pNext-pNext)
Objects: 1
[0] 0x29ff2e498a0, type: 1, name: NULL
VUID-VkSubmitInfo-pSignalSemaphores-03244(ERROR / SPEC): msgNum: 2144375519 - Validation Error: [ VUID-VkSubmitInfo-pSignalSemaphores-03244 ] Object 0: handle = 0xfa21a40000000003, type = VK_OBJECT_TYPE_SEMAPHORE; | MessageID = 0x7fd092df | vkQueueSubmit(): pSubmits[0].pSignalSemaphores[1] value (1) exceeds limit regarding current semaphore VkSemaphore 0xfa21a40000000003[] value (0). The Vulkan spec states: For each element of pSignalSemaphores created with a VkSemaphoreType of VK_SEMAPHORE_TYPE_TIMELINE the corresponding element of VkTimelineSemaphoreSubmitInfo::pSignalSemaphoreValues must have a value which does not differ from the current value of the semaphore or the value of any outstanding semaphore wait or signal operation on that semaphore by more than maxTimelineSemaphoreValueDifference (https://vulkan.lunarg.com/doc/view/1.3.280.0/windows/1.3-extensions/vkspec.html#VUID-VkSubmitInfo-pSignalSemaphores-03244)
Objects: 1
[0] 0xfa21a40000000003, type: 5, name: NULL
**Platform**
OS: windows 11
Graphics Card: NVIDIA GeForce RTX 4060
Backend: Vulkan
Vulkan version: 1.3.280.0
wlgys8 commented
solved by hooking host engine's vk method
- change api version to 1.3 by hooking
vkCreateInstance
- enable
VK_KHR_timeline_semaphore
extension andtimelineSemaphore
feature by hookingvkCreateDevice