Skip to content

[SPIR-V] GetAttributeAtVertex(0,0) fails validation #6382

Closed

Description

Description
Follow-up from #6041 (comment)

This invalid usage of GetAttributeAtVertex fails at validation rather than providing a useful error message.

Steps to Reproduce

dxc -T ps_6_0 -spirv
float main() : SV_Target
{
  return GetAttributeAtVertex(0, 0);
}

Actual Behavior
SPIR-V compilation fails with a validation error message:

fatal error: generated SPIR-V is invalid: The Base <id> '7[%int_0]' in OpAccessChain instruction must be a pointer.
  %14 = OpAccessChain %_ptr_Function_int %int_0 %uint_0

DXIL fails with:

<source>:6:10: error: attribute evaluation can only be done on values taken directly from inputs.
  return GetAttributeAtVertex(0, 0);
         ^

The SPIR-V backend should produce a similarly helpful error message.

Activity

  1. added
    bug
    spirv
    needs-triage
    on Mar 4, 2024
  2. moved this from For Google to Done in HLSL Triageon Mar 5, 2024
  3. sudonatalie commented on Mar 26, 2024

    @sudonatalie
    CollaboratorAuthor
  4. Keenuts commented on Apr 3, 2024

    @Keenuts
    Collaborator

    This is now fixed:

    ./build/bin/dxc -T ps_6_0 -spirv ./test.hlsl
    ./test.hlsl:3:31: error: parameter 0 of GetAttributeAtVertex must have a 'nointerpolation' attribute
      return GetAttributeAtVertex(0, 0);
                                  ^
    
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