Skip to content

Impossible to create VK_DESCRIPTOR_TYPE_STORAGE_IMAGE properly #7805

@Shinkeys

Description

@Shinkeys

Issue Description
As I understood to use aforementioned texture of type storage image you need to use public RWTexture2D<uint2> lightsGrid; in slang, however that's not necessary in some cases, for example in the fragment shader.

If would change that to be Texture2D(readonly) it produces this error:

vkCreateGraphicsPipelines(): pCreateInfos[0].pStages[1] SPIR-V (VK_SHADER_STAGE_FRAGMENT_BIT) uses descriptor [Set 0, Binding 1, variable "lightsGrid"] of type VK_DESCRIPTOR_TYPE_STORAGE_IMAGE but expected VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE or VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER.

To use storage images in the fragment shader in Vulkan without validation errors you need to enable deviceFeatures2.features.fragmentStoresAndAtomics = VK_TRUE; device feature, which might be undesired in some cases.

Expected Behavior
Read only storage image for the fragment stage

Actual Behavior
Must use read write image inside of fragment stage, which forces to enable vulkan device feature.

Environment:

  • Slang Version 2025.12.1
  • Windows 11

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions