Skip to content

[SPIR-V] EvaluateAttribute* on a matrix input emits invalid InterpolateAt* #9181

Backlog

Description

@inbelic

With -spirv, calling EvaluateAttributeAtSample, EvaluateAttributeCentroid or EvaluateAttributeSnapped on a matrix pixel shader input fails to compile. DXC emits a single GLSL.std.450 InterpolateAt* instruction with a matrix result type, and its own SPIR-V validation rejects it. The same shaders compile to DXIL, and the vector versions compile to SPIR-V.

Reproduction

repro.hlsl:

struct PSInput {
  float4 Pos : SV_Position;
  float2x2 V : ATTR0;
};

RWStructuredBuffer<float2x2> Out : register(u0);

float4 main(PSInput I) : SV_Target {
  Out[0] = EvaluateAttributeAtSample(I.V, 1);
  return 0;
}
dxc -T ps_6_0 -spirv repro.hlsl

Output:

fatal error: generated SPIR-V is invalid: GLSL.std.450 InterpolateAtSample: expected Result Type to be a 32-bit float scalar or vector type
  %26 = OpExtInst %mat2v2float %1 InterpolateAtSample %in_var_ATTR0 %uint_1

note: please file a bug report on https://github.com/Microsoft/DirectXShaderCompiler/issues with source code if possible

Expected

The shader compiles to valid SPIR-V, as it does for DXIL. In GLSL.std.450, InterpolateAtCentroid, InterpolateAtSample and InterpolateAtOffset take only float scalars or vectors, never matrices. DXC could split the matrix into per-column vectors, interpolate each through an OpAccessChain into the input variable, and rebuild the matrix with OpCompositeConstruct.

Activity

  1. added
    bug
    spirv
    needs-triage
    on Dec 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugneeds-triagespirv

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions