shader-slang / slang

Making it easier to work with shaders
MIT License
2.06k stars 177 forks source link

Tests: Vk Validation Layer errors: `tests\metal\texture.slang` #4409

Open ArielG-NV opened 3 months ago

ArielG-NV commented 3 months ago

tests/metal/texture.slang does not assign valid texture formats to any of the test input textures. This is a cause for validation error.

Repro steps:

  1. enable vulkan validation layer by setting an environment variable
    set VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation
  2. run slang-test with a following command,
    slang-test.exe tests/metal/texture.slang
  3. Observe following validation error messages
    VUID-vkCmdDispatch-format-07753(ERROR / SPEC): msgNum: 1729412364 - Validation Error: [ VUID-vkCmdDispatch-format-07753 ] Object 0: handle = 0x13105e0000000155, type = VK_OBJECT_TYPE_DESCRIPTOR_SET; Object 1: handle = 0x67eecd00000000ea, type = VK_OBJECT_TYPE_IMAGE_VIEW; | MessageID = 0x6714bd0c | vkCmdDispatch():  the descriptor (VkDescriptorSet 0x13105e0000000155[], binding 33, index 0) requires UINT component type, but bound descriptor format is VK_FORMAT_R8G8B8A8_UNORM. The Vulkan spec states: If a VkImageView is accessed as a result of this command, then the numeric type of the image view's format and the Sampled Type operand of the OpTypeImage must match (https://vulkan.lunarg.com/doc/view/1.3.283.0/windows/1.3-extensions/vkspec.html#VUID-vkCmdDispatch-format-07753)
    Objects: 2
        [0] 0x13105e0000000155, type: 23, name: NULL
        [1] 0x67eecd00000000ea, type: 14, name: NULL
    VUID-vkCmdDispatch-None-06479(ERROR / SPEC): msgNum: -1221877677 - Validation Error: [ VUID-vkCmdDispatch-None-06479 ] Object 0: handle = 0x13105e0000000155, type = VK_OBJECT_TYPE_DESCRIPTOR_SET; Object 1: handle = 0xd406ad000000014e, type = VK_OBJECT_TYPE_IMAGE_VIEW; | MessageID = 0xb72ba053 | vkCmdDispatch():  the descriptor (VkDescriptorSet 0x13105e0000000155[], binding 53, index 0) has VkImageView 0xd406ad000000014e[] with format of VK_FORMAT_R8G8B8A8_UNORM which doesn't support VK_FORMAT_FEATURE_2_SAMPLED_IMAGE_DEPTH_COMPARISON_BIT in.
    i(supported features: VK_FORMAT_FEATURE_2_SAMPLED_IMAGE_BIT|VK_FORMAT_FEATURE_2_STORAGE_IMAGE_BIT|VK_FORMAT_FEATURE_2_COLOR_ATTACHMENT_BIT|VK_FORMAT_FEATURE_2_COLOR_ATTACHMENT_BLEND_BIT|VK_FORMAT_FEATURE_2_BLIT_SRC_BIT|VK_FORMAT_FEATURE_2_BLIT_DST_BIT|VK_FORMAT_FEATURE_2_SAMPLED_IMAGE_FILTER_LINEAR_BIT|VK_FORMAT_FEATURE_2_TRANSFER_SRC_BIT|VK_FORMAT_FEATURE_2_TRANSFER_DST_BIT|VK_FORMAT_FEATURE_2_SAMPLED_IMAGE_FILTER_MINMAX_BIT|VK_FORMAT_FEATURE_2_STORAGE_READ_WITHOUT_FORMAT_BIT|VK_FORMAT_FEATURE_2_STORAGE_WRITE_WITHOUT_FORMAT_BIT|VK_FORMAT_FEATURE_2_HOST_IMAGE_TRANSFER_BIT_EXT). The Vulkan spec states: If a VkImageView is sampled with depth comparison, the image view's format features must contain VK_FORMAT_FEATURE_2_SAMPLED_IMAGE_DEPTH_COMPARISON_BIT (https://vulkan.lunarg.com/doc/view/1.3.283.0/windows/1.3-extensions/vkspec.html#VUID-vkCmdDispatch-None-06479)
    Objects: 2
        [0] 0x13105e0000000155, type: 23, name: NULL
        [1] 0xd406ad000000014e, type: 14, name: NULL
    ...
    ...
    ...
ArielG-NV commented 2 months ago

I added repro steps with example error to the issue description👍

jkwak-work commented 2 months ago

This turned out to be a problem on the gfx testing framework. And it is not an issue of slang compiler.

The same errors are observed from existing other tests as well such as tests/hlsl-intrinsic/texture/texture-instrinsic.slang and tests/glsl-intrinsic/intrinsic-texture.slang It will be nice to fix, but I think the priority of this issue should be very low.

I am unassigning myself from the issue, because the priority is much lower than expected.