microsoft / microsoft/DirectXShaderCompiler

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

Open
#7,982 2 comments 0 reactions 1 assignee View on GitHub

@Keenuts is already working on this.

Since Dec 10, 2025.

bug needs-triage spirv
Dominant language
C++
Stars
3.7k
Forks
900
Avg merge
2d 11h
Merged PRs (30d)
44

Description

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 (b106a961d); dxil.dll: 1.9(1.8.2505.32)
  • Windows 11 25H2

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.