Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Re-design GetAttributeAtVertex #181

Open
llvm-beanz opened this issue Mar 25, 2024 · 3 comments
Open

Re-design GetAttributeAtVertex #181

llvm-beanz opened this issue Mar 25, 2024 · 3 comments
Labels
Breaking A proposal that will break at least some existing shaders
Milestone

Comments

@llvm-beanz
Copy link
Collaborator

Is your feature request related to a problem? Please describe.
The current implementation of GetAttributeAtVertex has bugs which are products of the design rather than just the implementation:

Describe the solution you'd like
We need to design a different approach to this feature that doesn't rely on compiler optimization to guarantee correctness.

Describe alternatives you've considered

  • Use a proper type qualification for data that may have attributes
  • Use a boxed type for parameters that may have attributes
@llvm-beanz
Copy link
Collaborator Author

(cc @Keenuts, @sudonatalie, @tex3d)

I filed this to track our need to spend some time designing an alternate solution at the language level to handle GetAttributeAtVertex.

@Keenuts
Copy link
Collaborator

Keenuts commented Mar 25, 2024

Do you happen to know how the DXIL side is usually implemented? And why we haven't required the input of GetAttributeAtVertex() to be an array of 3?

On the SPIR-V Side, the shader ends up with a array as input. nointerpolate float a : A would give us roughly:

%array_type = OpTypeArray %float 3
%a = OpVariable %array_type Input

So if the HLSL type was an actual array, it would be quite easy to support this feature correctly.

@llvm-beanz
Copy link
Collaborator Author

The DXIL side of this is totally magic (and buggy). We don't actually represent the parameter as anything but the specified source type. The presence of the attributes is implied in DXIL not represented.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Breaking A proposal that will break at least some existing shaders
Projects
Status: Triaged
Development

No branches or pull requests

3 participants