Skip to content

[SPIR-V] Invalid SPIR-V when using globallycoherent in conjunction with the Vulkan memory model #8380

@vntec

Description

@vntec

Description
When using a globallycoherent RWTexture and the Vulkan memory model via -fspv-use-vulkan-memory-model, the generated SPIR-V is invalid. When the default GLSL450 memory model is used, the code compiles correctly.
Coherent structured buffers don't seem to be affected.

Steps to Reproduce
https://godbolt.org/z/sGYzc8KW4

// -T ps_6_6 -E main -spirv -HV 2021 -fspv-target-env=vulkan1.3 -fspv-use-vulkan-memory-model
// Does not compile if vulkan memory model is requested

[[vk::binding(0, 0)]] globallycoherent RWTexture2D<float4> img;

struct PSInput {
    float4 position : SV_Position;
};

float4 main(PSInput input) : SV_Target0 {
    return img[uint2(input.position.xy)];
}

Actual Behavior
fatal error: generated SPIR-V is invalid: NonPrivatePointerKHR requires a pointer in Uniform, Workgroup, CrossWorkgroup, Generic, Image or StorageBuffer storage classes.
%22 = OpLoad %type_2d_image %img MakePointerVisible|NonPrivatePointer %uint_5

Environment

  • DXC trunk

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugBug, regression, crashneeds-triageAwaiting triagespirvWork related to SPIR-V

    Type

    No type

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions