Skip to content

[SPIR-V] -fspv-preserve-interface fails to work if -fspv-flatten-resource-arrays is also specified #7982

@krajzeg

Description

@krajzeg

Description
dxc running on a simple shader that has one unused field in the input struct drops this field, when it should preserve it since -fspv-preserve-interface was passed.

Steps to Reproduce

 dxc -E main -T ps_6_0 -spirv -fspv-flatten-resource-arrays -fspv-preserve-interface minimal.hlsl

minimal.hlsl

struct Input
{
    float2 f_uv : TEXCOORD0;
    float3 f_normal_world : TEXCOORD1;
};

float4 main(Input i) : SV_Target0 
{
    return float4(i.f_normal_world, 1.0f);
}

Actual Behavior

After looking at the generated SPIR-V file with spirv-dis, you can see that f_uv is not present:

// this will be the only input variable, no TEXCOORD0
OpName %in_var_TEXCOORD1 "in.var.TEXCOORD1"

Environment

  • dxcompiler.dll: 1.9 - 1.8.2505.32 (b106a96); dxil.dll: 1.9(1.8.2505.32)
  • Windows 11 25H2

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