Skip to content

[SPIR-V] Support EvaluateAttribute* intrinsics #3649

Closed

Description

@jaebaek

Currently, SPIR-V backend does not support EvaluateAttribute* intrinsics.

According to the discussion in KhronosGroup/glslang#2584, OpInterpolate* needs a pointer operand rather than OpLoad. Based on the offline discussion with Greg Fischer (@greg-lunarg) we need a spirv-opt pass to replace OpLoad operand of OpInterpolate* to the pointer loaded by the OpLoad.

When a spirv-opt pass is prepared, we can simply let DXC emit OpInterpolate* for EvaluateAttribute*. Since it will just follow typical code generation routine, it will use OpLoad for its operand. We can rely on the spirv-opt pass to make it correct (as a part of the legalization pass).

Activity

  1. added
    spirv
    on Mar 31, 2021
  2. jaebaek commented on Mar 31, 2021

    @jaebaek
    CollaboratorAuthor

    KhronosGroup/SPIRV-Tools#4220 is the spirv-opt PR.

  3. jaebaek commented on Jul 13, 2021

    @jaebaek
    CollaboratorAuthor

    We have two use three instructions InterpolateAtCentroid, InterpolateAtSample, and InterpolateAtOffset of GLSL.std.450 extended instruction set for corresponding EvaluateAttribute*.

  4. gjaegy commented on Jan 6, 2022

    @gjaegy

    We are also relying on EvaluateAttributeAtSample() HLSL instruction in our code. This is now the only thing we haven't been able to port to Vulkan. Not dramatic, but our tree shadows looked better in D3D11, what is a bit frustrating.

    Is there any update on that issue ?

    Thanks a lot !

  5. pdoane commented on Apr 6, 2022

    @pdoane

    I'm also interested in this. I tried using the SPIR-V intrinsics but not sure how to get the interpolant into the Input storage class. Here is what I tried:

    [[vk::ext_capability(/* InterpolationFunction */ 52)]]
    [[vk::ext_instruction(/* InterpolateAtSample */ 77, "GLSL.std.450")]]
    float2 InterpolateAtSample([[vk::ext_reference]] float2 x, uint);
    

    which outputs:

    fatal error: generated SPIR-V is invalid: GLSL.std.450 InterpolateAtSample: expected Interpolant storage class to be Input
      %76 = OpExtInst %v2float %1 InterpolateAtSample %75 %70
    
  6. moved this from For Google to Triaged in HLSL Triageon Aug 22, 2024
  7. moved this from New to In progress in HLSL Roadmapon Sep 5, 2024
  8. added 2 commits that reference this issue on Oct 4, 2024
    c15e59b
    75a9d72
  9. moved this from In progress to Done in HLSL Roadmapon Oct 8, 2024
  10. added a commit that references this issue on Oct 9, 2024
    b26fd80
  11. added a commit that references this issue on Jul 24, 2025
    27207c4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

spirv

Type

No type

Projects

Relationships

None yet

Development

No branches or pull requests

Issue actions