protonscr

Missing VK_IMAGE_CREATE_2D_ARRAY_COMPATIBLE_BIT for 3D Image Used as 2DArray in Descriptor

vkd3dclosed
HansKristian-Work/vkd3d-proton#2657 · opened 2025-10-14 by sushma08 · updated 2025-10-14 · 4 comments · github
Ssushma08 2025-10-14 github

Background - https://gitlab.freedesktop.org/mesa/mesa/-/issues/12555#note_2985966

While analyzing the contents of forbidden_2182.zip, @kwg pointed out that draw call 24007 includes a VK_STRUCTURE_TYPE_IMAGE_VIEW_SLICED_CREATE_INFO_EXT to create a 2DArray image view with 64 slices. This image is bound via a VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET as a VK_DESCRIPTOR_TYPE_STORAGE_IMAGE.
According to the Vulkan spec, in this case, the backing image must have the VK_IMAGE_CREATE_2D_ARRAY_COMPATIBLE_BIT flag set. However, this flag is missing.

We have logged a bug - https://github.com/KhronosGroup/Vulkan-ValidationLayers/issues/10848 to ensure validation layers is capturing the issue.

Expected Behavior:
VKD3D should ensure that when a 3D image is used to create a 2DArray view (especially with VK_IMAGE_VIEW_SLICED_CREATE_INFO_EXT), the backing image includes the VK_IMAGE_CREATE_2D_ARRAY_COMPATIBLE_BIT flag. This is necessary for spec compliance and correct descriptor binding behavior.

Ddoitsujin maintainer 2025-10-14 github

Which draw are you referring to exactly? The only thing I can find with an ID 24007 is a vkBindImageMemory call.

I don't really see why we would ever create a 2D array view for a 3D storage image though, the proper 3D path still uses VK_IMAGE_VIEW_TYPE_3D, everything else smells like an app bug.

Ssushma08 2025-10-14 github

We are referring to 24007 image view creation -

{
  "index": 43153,
  "function": {
    "name": "vkCreateImageView",
    "thread": 1,
    "return": "VK_SUCCESS",
    "args": {
      "device": 215,
      "pCreateInfo": {
        "sType": "VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO",
        "flags": "0x00000000",
        "image": 24004,
        "viewType": "VK_IMAGE_VIEW_TYPE_3D",
        "format": "VK_FORMAT_R16G16B16A16_SFLOAT",
        "components": {
          "r": "VK_COMPONENT_SWIZZLE_R",
          "g": "VK_COMPONENT_SWIZZLE_G",
          "b": "VK_COMPONENT_SWIZZLE_B",
          "a": "VK_COMPONENT_SWIZZLE_A"
        },
        "subresourceRange": {
          "aspectMask": "0x00000001",
          "baseMipLevel": 0,
          "levelCount": 1,
          "baseArrayLayer": 0,
          "layerCount": 1
        },
        "pNext": {
          "sType": "VK_STRUCTURE_TYPE_IMAGE_VIEW_SLICED_CREATE_INFO_EXT",
          "sliceOffset": 0,
          "sliceCount": 64,
          "pNext": {
            "sType": "VK_STRUCTURE_TYPE_IMAGE_VIEW_USAGE_CREATE_INFO",
            "usage": "0x00000008",
            "pNext": null
          }
        }
      },
      "pAllocator": null,
      "pView": 24007
    }
  }
},
Ddoitsujin maintainer 2025-10-14 github

OK, but the view type is 3D, not 2D_ARRAY. Why do we need to specify 2D_ARRAY_COMPATIBLE on the image? I can't find any spec wording that requires this for VkImageViewSlicedCreateInfoEXT.

Ssushma08 2025-10-14 github

Unfortunately, we misread the spec, so closing this bug. Appreciate your time on this!