Skip to content

[SPIR-V] GetAttributeAtVertex on struct member without nointerpolation fails validation #6384

Closed

Description

Description
Follow-up from #6041

Steps to Reproduce

dxc -T ps_6_6 -spirv
struct S {
  float4 a : COLOR;
};

float compute(nointerpolation float4 a) {
  return GetAttributeAtVertex(a, 2)[0];
}

float4 main(S s) : SV_TARGET
{
  return float4(0, 0, 0, compute(s.a));
}

Actual Behavior
Once #6041 is merged, the above sample will fail at validation for both DXIL and SPIR-V, but the SPIR-V backend needs better error messaging.

DXIL:

error: validation errors
<source>:6:10: error: Attribute COLOR must have nointerpolation mode in order to use GetAttributeAtVertex function.
note: at '%1 = call float @dx.op.attributeAtVertex.f32(i32 137, i32 0, i32 0, i8 0, i8 2)' in block '#0' of function 'main'.
Validation failed.

SPIR-V:

fatal error: generated SPIR-V is invalid: Result type (OpTypeVector) does not match the type that results from indexing into the composite (OpTypeFloat).
  %13 = OpCompositeExtract %v4float %12 2

Activity

  1. added
    bug
    spirv
    needs-triage
    on Mar 4, 2024
  2. pow2clk commented on Mar 5, 2024

    @pow2clk
    Collaborator

    I think this is a duplicate of #6220. Natalie Chouinard (@sudonatalie) can you confirm and close if so?

  3. sudonatalie commented on Mar 5, 2024

    @sudonatalie
    CollaboratorAuthor

    Gregory Roth (@pow2clk) Thanks for the reference! I'll keep this one open since the issue we wanted to highlight here is that the SPIR-V error messaging specifically is poor, but how we fix that might be dependent on #6220 is decided.

  4. added 3 commits that reference this issue on Mar 25, 2024
    2bcde80
    063e274
    d6d26db
  5. sudonatalie commented on Mar 26, 2024

    @sudonatalie
    CollaboratorAuthor
  6. added a commit that references this issue on Apr 3, 2024
    27b87b7
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

    bugspirv

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions