xMeM / vulkan-wsi-layer

Other
12 stars 3 forks source link

validation errors #6

Open Trass3r opened 4 months ago

Trass3r commented 4 months ago

The Vulkan validation layers have just been added. https://github.com/termux/termux-packages/issues/19381

pkg in vulkan-validation-layers
export VK_LOADER_LAYERS_ENABLE=*validation

And this layer probably causes the following entries:

$ vkcube
VUID-vkCreateDevice-ppEnabledExtensionNames-01387(ERROR / SPEC): msgNum: 307460652 - Validation Error: [ VUID-vkCreateDevice-ppEnabledExtensionNames-01387 ] Object 0: handle = 0xb400007913891800, type = VK_OBJECT_TYPE_INSTANCE; | MessageID = 0x12537a2c | vkCreateDevice(): pCreateInfo->ppEnabledExtensionNames[12] Missing extension required by the device extension VK_KHR_dedicated_allocation: VK_KHR_get_memory_requirements2. The Vulkan spec states: All required device extensions for each extension in the VkDeviceCreateInfo::ppEnabledExtensionNames list must also be present in that list (https://www.khronos.org/registry/vulkan/specs/1.3-extensions/html/vkspec.html#VUID-vkCreateDevice-ppEnabledExtensionNames-01387)                                        Objects: 1
        [0] 0xb400007913891800, type: 1, name: NULL   VUID-VkExternalMemoryImageCreateInfo-handleTypes-parameter(ERROR / SPEC): msgNum: 1827096663 - Validation Error: [ VUID-VkExternalMemoryImageCreateInfo-handleTypes-parameter ] | MessageID = 0x6ce74857 | vkCreateImage(): pCreateInfo->pNext<VkExternalMemoryImageCreateInfo>.handleTypes (0x400) has VkExternalMemoryHandleTypeFlagBits values that requires the extensions VK_ANDROID_external_memory_android_hardware_buffer. The Vulkan spec states: handleTypes must be a valid combination of VkExternalMemoryHandleTypeFlagBits values (https://www.khronos.org/registry/vulkan/specs/1.3-extensions/html/vkspec.html#VUID-VkExternalMemoryImageCreateInfo-handleTypes-parameter)
    Objects: 0                                        VUID-VkExportMemoryAllocateInfo-handleTypes-parameter(ERROR / SPEC): msgNum: 1861016839 - Validation Error: [ VUID-VkExportMemoryAllocateInfo-handleTypes-parameter ] | MessageID = 0x6eecdd07 | vkAllocateMemory(): pAllocateInfo->pNext<VkExportMemoryAllocateInfo>.handleTypes (0x400) has VkExternalMemoryHandleTypeFlagBits values that requires the extensions VK_ANDROID_external_memory_android_hardware_buffer. The Vulkan spec states: handleTypes must be a valid combination of VkExternalMemoryHandleTypeFlagBits values (https://www.khronos.org/registry/vulkan/specs/1.3-extensions/html/vkspec.html#VUID-VkExportMemoryAllocateInfo-handleTypes-parameter)
    Objects: 0
Segmentation fault
Thread 1 "vkcube" received signal SIGSEGV
 (gdb) bt
#0  0x0000000000000000 in ?? ()
#1  0x0000007f690f5b7c in wsi::x11::swapchain::create_and_bind_swapchain_image (this=0xb400007ff5ee9500,        image_create=..., image=...)                          at /home/builder/.termux-build/vulkan-wsi-layer/src/wsi/x11/swapchain.cpp:295
#2  0x0000007f690f0e78 in wsi::swapchain_base::init (     this=0xb400007ff5ee9500, device=<optimized out>,      swapchain_create_info=0x7fffffccc0)                   at /home/builder/.termux-build/vulkan-wsi-layer/src/wsi/swapchain_base.cpp:258
#3  0x0000007f690ebafc in wsi_layer_vkCreateSwapchainKHR (device=0xb400007ff5f4fdc0,
    pSwapchainCreateInfo=0x7fffffccc0,                    pAllocator=0x0, pSwapchain=0x7fffffdeb0)              at /home/builder/.termux-build/vulkan-wsi-layer/src/layer/swapchain_api.cpp:64
xMeM commented 4 months ago

I tested it and found that after enabling the validation layer, I couldn’t get the function address of vkGetMemoryAndroidHardwareBufferANDROID. This might be because the validation layer didn’t build the Android-related extensions. test.c.txt

Trass3r commented 4 months ago

Yeah might be the case: https://github.com/termux/termux-packages/pull/19713/files#diff-98d497683cc0629502aa3f334fc373b61b2a65d1b8b71c8999282f201b3be954

https://github.com/KhronosGroup/Vulkan-ValidationLayers/blob/main/layers/core_checks/cc_android.cpp#L26

Trass3r commented 4 months ago

I tried to enable them: https://github.com/Trass3r/termux-packages/actions/runs/8652307482

It does give different diagnostics at least, like:

Missing extensions required by the device extension VK_ANDROID_external_memory_android_hardware_buffer: VK_KHR_sampler_ycbcr_conversion, VK_EXT_queue_family_foreign

vkGetImageMemoryRequirements(): image was created with a VK_EXTERNAL_MEMORY_HANDLE_TYPE_ANDROID_HARDWARE_BUFFER_BIT_ANDROID handleType, which has not yet been bound to memory, so image memory requirements can't yet be queried.

vkCreateImageView(): pCreateInfo->format VK_FORMAT_B8G8R8A8_UNORM is different from VkImage 0x100000000010[] format (VK_FORMAT_R8G8B8A8_UNORM). Formats MUST be IDENTICAL unless VK_IMAGE_CREATE_MUTABLE_FORMAT BIT was set on image creation.

Trass3r commented 3 months ago

Nice now after 0e9e2f5e it's just

VUID-VkImageViewCreateInfo-image-01762(ERROR / SPEC): msgNum: 1695986743 - Validation Error: [ VUID-VkImageViewCreateInfo-image-01762 ] Object 0: handle = 0x80000000008, type = VK_OBJECT_TYPE_IMAGE; | MessageID = 0x6516b437 | vkCreateImageView(): pCreateInfo->format VK_FORMAT_B8G8R8A8_UNORM is different from VkImage 0x80000000008[] format (VK_FORMAT_R8G8B8A8_UNORM). Formats MUST be IDENTICAL unless VK_IMAGE_CREATE_MUTABLE_FORMAT BIT was set on image creation. The Vulkan spec states: If image was not created with the VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT flag, or if the format of the image is a multi-planar format and if subresourceRange.aspectMask is VK_IMAGE_ASPECT_COLOR_BIT, format must be identical to the format used to create image (https://www.khronos.org/registry/vulkan/specs/1.3-extensions/html/vkspec.html#VUID-VkImageViewCreateInfo-image-01762)

For vkmark it's similar but with vkCreateImageView(): pCreateInfo->format VK_FORMAT_B8G8R8A8_SRGB.

hansm629 commented 2 weeks ago

@Trass3r Could you please build the vulkan-wsi-layer deb package file with the latest commit?

I'm trying to test it on Xclipse 940 / Adreno(TM) 650 / Adreno(TM) 740 / Adreno(TM) 750.

Trass3r commented 2 weeks ago

https://github.com/Trass3r/termux-packages/actions/runs/10334250343

hansm629 commented 1 week ago

@Trass3r Thank you very much!