Skip to content

Latest validation layer in SDK 1.4.335.0 gives apparently incorrect error about format of swapchain image that is not even presented, no error given by older SDK 1.3.275.0 #11521

@elmar-k

Description

@elmar-k

Environment:

  • OS: Ubuntu 22.04
  • GPU and driver version: Geforce RTX 4080, 580.95.05
  • SDK or header version if building from repo: 1.4.335.0
  • Options enabled (synchronization, best practices, etc.): VK_LAYER_KHRONOS_validation

Describe the Issue
I have a swapchain with three images: 0x280000000028, 0x290000000029, 0x2a000000002a
The render loop works fine, but at one point my app runs out of Vulkan memory in the middle of the frame, which is swapchain image 0x2a000000002a in this example. It therefore submits the half-finished command buffer and calls vkDeviceWaitIdle, wanting to allocate new memory after the GPU finished. While it hangs waiting for the device to become idle, the validation layer in a separate thread suddenly raises the error that image 0x2a000000002a is in the wrong format for presentation, even though I triple checked that my app never tried to present this image (since it's half finished now, and it was presented fine three frames ago). This error did not happen in my previous SDK 1.3.275.0

Here is the traceback of my app waiting in vkDeviceWaitIdle:

Thread 1 (Thread 0x7138038deb80 (LWP 24104) "yasara"):

#0 syscall () at ../sysdeps/unix/sysv/linux/x86_64/syscall.S:38

#1 0x00007137844d9706 in std::__atomic_futex_unsigned_base::_M_futex_wait_until_steady(unsigned int*, unsigned int, bool, std::chrono::duration<long, std::ratio<1l, 1l> >, std::chrono::duration<long, std::ratio<1l, 1000000000l> >) () from /lib/x86_64-linux-gnu/libstdc++.so.6

#2 0x00007137716f4bad in std::__atomic_futex_unsigned<2147483648u>::_M_load_and_test_until_steady (__ns=..., __s=..., __has_timeout=true, __mo=std::memory_order_acquire, __equal=true, __operand=1, __assumed=, this=) at /usr/include/c++/11/bits/atomic_futex.h:140

#3 std::__atomic_futex_unsigned<2147483648u>::_M_load_and_test_until_impl<std::chrono::duration<long, std::ratio<1l, 1000000000l> > > (__atime=..., __atime=..., __mo=std:--Type for more, q to quit, c to continue without paging--

:memory_order_acquire, __equal=true, __operand=1, __assumed=, this=) at /usr/include/c++/11/bits/atomic_futex.h:190

#4 std::__atomic_futex_unsigned<2147483648u>::_M_load_when_equal_until<std::chrono::duration<long, std::ratio<1l, 1000000000l> > > (__atime=..., __mo=std::memory_order_acquire, __val=1, this=) at /usr/include/c++/11/bits/atomic_futex.h:270

#5 std::__future_base::_State_baseV2::wait_until<std::chrono::_V2::steady_clock, std::chrono::duration<long, std::ratio<1l, 1000000000l> > > (__abs=..., this=0x3a6a3680) at /usr/include/c++/11/future:389

#6 std::__basic_future::wait_until<std::chrono::_V2::steady_clock, std::chrono::duration<long, std::ratio<1l, 1000000000l> > > (__abs=..., this=) at /usr/include/c++/11/future:710

#7 vvl::Queue::Wait (this=0x3805a8c0, loc=..., until_seq=2215, until_seq@entry=18446744073709551615) at /vulkan-sdk/1.4.335.0/source/Vulkan-ValidationLayers/layers/state_tracker/queue_state.cpp:133

#8 0x000071377173bc62 in vvl::DeviceState::PostCallRecordDeviceWaitIdle (this=0x3737a600, device=, record_obj=...) at /usr/include/c++/11/bits/shared_ptr_base.h:1295

#9 0x00007137713ad39a in vulkan_layer_chassis::DeviceWaitIdle (device=0x3748c960) at /vulkan-sdk/1.4.335.0/source/Vulkan-ValidationLayers/layers/vulkan/generated/chassis.cpp:620

#10 0x000000000051ebcc in vk_finish (combuffered=1) at /home/twinset/yasara/inout.c:6523

#11 0x000000000051f137 in vk_allocarea (allocadd=allocadd@entry=0x7ffccd37cd98, offsetadd=offsetadd@entry=0x713785890528, type=type@entry=0, size=4194304, imagealignment=0) at /home/twinset/yasara/inout.c:4784

#12 0x000000000051f997 in vk_alloc (memobj=memobj@entry=0x713785890518, type=type@entry=0, required=required@entry=0x7ffccd37cdf0, imaged=imaged@entry=0) at /home/twinset/yasara/inout.c:4928

Here is the traceback of the separate validation layer thread that complains that image 0x2a000000002a has not been transitioned to VK_IMAGE_LAYOUT_PRESENT_SRC_KHR, even though I didn't try to present this image:

#59 0x0000000000511129 in vk_printdebug (flags=, objtype=, srcobject=, location=, code=0, layerprefix=0x7137720--Type for more, q to quit, c to continue without paging--

892ae "Validation", message=0x7137041892e0 "vkQueuePresentKHR(): pPresentInfo->pSwapchains[0] images passed to present must be in layout VK_IMAGE_LAYOUT_PRESENT_SRC_KHR or VK_IMAGE_LAYOUT_SHARED_PRESENT_KHR but VkImage 0x2a000000002a is in VK_I"..., userdata=0x0) at /home/twinset/yasara/inout.c:3511

#60 0x0000713771be2cd8 in DebugReport::LogMessage (this=, msg_flags=8, vuid_text=..., objects=..., loc=..., main_message="images passed to present must be in layout VK_IMAGE_LAYOUT_PRESENT_SRC_KHR or VK_IMAGE_LAYOUT_SHARED_PRESENT_KHR but VkImage 0x2a000000002a is in VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL.") at /vulkan-sdk/1.4.335.0/source/Vulkan-ValidationLayers/layers/error_message/logging.cpp:252

#61 0x0000713771be38db in DebugReport::LogMessageVaList (this=0x3523c790, msg_flags=msg_flags@entry=8, vuid_text="VUID-VkPresentInfoKHR-pImageIndices-01430", objects=..., loc=..., format=0x713771f22a30 "images passed to present must be in layout VK_IMAGE_LAYOUT_PRESENT_SRC_KHR or VK_IMAGE_LAYOUT_SHARED_PRESENT_KHR but %s is in %s.", argptr=0x713719dffa60) at /vulkan-sdk/1.4.335.0/source/Vulkan-ValidationLayers/layers/error_message/logging.cpp:711

#62 0x0000713770fc2a41 in Logger::LogError (this=this@entry=0x3736e988, vuid_text=..., objlist=..., loc=..., format=format@entry=0x713771f22a30 "images passed to present must be in layout VK_IMAGE_LAYOUT_PRESENT_SRC_KHR or VK_IMAGE_LAYOUT_SHARED_PRESENT_KHR but %s is in %s.") at /vulkan-sdk/1.4.335.0/source/Vulkan-ValidationLayers/layers/./error_message/logging.h:289

#63 0x00007137711eb77e in QueueSubmissionValidator::Validate (this=0x3805ac60, submission=...) at /usr/include/c++/11/bits/char_traits.h:399

#64 0x00007137711e0466 in core::QueueSubState::Retire (this=0x3805ac50, submission=...) at /vulkan-sdk/1.4.335.0/source/Vulkan-ValidationLayers/layers/core_checks/cc_state_tracker.cpp:1180

#65 0x00007137716f4905 in vvl::Queue::Retire (submission=..., this=0x3805a8c0) at /vulkan-sdk/1.4.335.0/source/Vulkan-ValidationLayers/layers/state_tracker/queue_state.cpp:307

#66 vvl::Queue::Retire (this=0x3805a8c0, submission=...) at /vulkan-sdk/1.4.335.0/source/Vulkan-ValidationLayers/layers/state_tracker/queue_state.cpp:297

#67 0x00007137716f5be4 in vvl::Queue::ThreadFunc (this=0x3805a8c0) at /vulkan-sdk/1.4.335.0/source/Vulkan-ValidationLayers/layers/state_tracker/queue_state.cpp:328

#68 0x00007137844dc253 in ?? () from /lib/x86_64-linux-gnu/libstdc++.so.6

#69 0x0000713803294ac3 in start_thread (arg=) at ./nptl/pthread_create.c:442

This is the complete validation error:

Vulkan driver error: [Validation] Code 0: vkQueuePresentKHR(): pPresentInfo->pSwapchains[0] images passed to present must be in layout VK_IMAGE_LAYOUT_PRESENT_SRC_KHR or VK_IMAGE_LAYOUT_SHARED_PRESENT_KHR but VkImage 0x2a000000002a is in VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL.

The Vulkan spec states: Each element of pImageIndices must be the index of a presentable image acquired from the swapchain specified by the corresponding element of the pSwapchains array, and the presented image subresource must be in the VK_IMAGE_LAYOUT_PRESENT_SRC_KHR or VK_IMAGE_LAYOUT_SHARED_PRESENT_KHR layout at the time the operation is executed on a VkDevice (https://vulkan.lunarg.com/doc/view/1.4.335.0/linux/antora/spec/latest/chapters/VK_KHR_surface/wsi.html#VUID-VkPresentInfoKHR-pImageIndices-01430)

This error did not happen in my previous SDK 1.3.275.0. I can provide a binary for reproducing the problem..

Metadata

Metadata

Assignees

Labels

ImageLayoutWSIWindow System Integration related issues

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions