shader-slang / slang

Making it easier to work with shaders
MIT License
1.98k stars 169 forks source link

Vulkan validation layer error: VUID-vkCmdDispatch-viewType-07752 #4797

Open jkwak-work opened 1 month ago

jkwak-work commented 1 month ago

Problem description A following slang-test case prints Vulkan validation layer error.

The following error messages are observed when reproduced:

If a VkImageView is accessed as a result of this command, then the image view's viewType must match the Dim operand of the OpTypeImage as described in Instruction/Sampler/Image View Validation (https://vulkan.lunarg.com/doc/view/1.3.280.0/windows/1.3-extensions/vkspec.html#VUID-vkCmdDispatch-viewType-07752)

Repro steps

  1. Set an environment variable to enable Vulkan Validation Layer.
    set VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation
  2. Run slang-test without -use-test-server
    slang-test.exe tests/glsl-intrinsic/intrinsic-texture.slang
  3. Observe the error messages printed from Vulkan Validation Layer.
jkwak-work commented 3 weeks ago

It appears to be that the problem was on the Vulkan Validation Layer. I was not able to reproduce the issue when I used a latest set of SPIR-V tools and headers. I suggest to wait until we rebase SPIR-V one more time and see if the issue still exist.

To be clear, the issue can be reproduced with the following SPIR-V

SPIR-V tools: commit ce46482db7ab3ea9c52fce832d27ca40b14f8e87 (HEAD) Author: Nathan Gauër brioche@google.com Date: Thu Jun 6 12:17:51 2024 +0200

SPIR-V headers commit 2acb319af38d43be3ea76bfabf3998e5281d8d12 (HEAD, origin/main, origin/HEAD, main) Author: Kévin Petit kevin.petit@arm.com Date: Wed Jun 12 16:41:14 2024 +0100

And it is not reproducible with the following SPIR-V

SPIR-V tools: commit 6ea4e4d5ea5373b71f07d5d95e3f5174b34344f2 (origin/main) Merge: e58e7596 b64a423b Author: David Neto (Google, Inc.) dneto@google.com Date: Wed Aug 7 21:29:13 2024

SPIR-V Header: commit 6da3d955814466f4a096a659b70c9ae3deb7b64b (origin/main, origin/HEAD) Author: alan-baker alanbaker@google.com Date: Mon Jul 29 10:56:50 2024 -0400

jkwak-work commented 2 weeks ago

If we update to the latest SPIR-V header and tools, I think this issue will go away. I wrote a document of how to update them. https://github.com/shader-slang/slang/blob/master/docs/update_spirv.md