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

[HLSL] Implement derivative intrinsics #88820

Closed
hekota opened this issue Apr 16, 2024 · 3 comments
Closed

[HLSL] Implement derivative intrinsics #88820

hekota opened this issue Apr 16, 2024 · 3 comments
Labels
backend:DirectX duplicate Resolved as duplicate HLSL HLSL Language Support

Comments

@hekota
Copy link
Member

hekota commented Apr 16, 2024

Implement HLSL derivative intrinsics ddx, ddx_fine, ddx_coarse, ddy , ddy_fine and ddy_coarse.

https://godbolt.org/z/1Ej8514MY

The ddx and ddy intrinsic were initially introduced in Shader Model 2.1 for pixel shaders:
https://learn.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-ddx
https://learn.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-ddy

Shader Model 5.0 added ddx_fine, ddx_coarse, ddy_fine and ddy_coarse, also just for pixel shaders:
https://learn.microsoft.com/en-us/windows/win32/direct3dhlsl/ddx-fine
https://learn.microsoft.com/en-us/windows/win32/direct3dhlsl/ddx-coarse
https://learn.microsoft.com/en-us/windows/win32/direct3dhlsl/ddy-fine
https://learn.microsoft.com/en-us/windows/win32/direct3dhlsl/ddy-coarse

In DirectX the ddx and ddy functions default to coarse behavior - ddx is the same as ddx_coarse and ddy is the same as ddy_coarse.

In Shader model 6.6 the derivative intrinsics support was extended to compute, mesh and amplification shaders:
https://microsoft.github.io/DirectX-Specs/d3d/HLSL_SM_6_6_Derivatives.html

@hekota hekota added backend:DirectX HLSL HLSL Language Support labels Apr 16, 2024
@davidcook-msft
Copy link

Need an additional discussion on if we are using the rich availability diagnostics to also validate the numthreads on shaders using derivative intrinsics.

Conversation around if the availability diagnostics should be used for larger analysis should happen on the diagnostics spec.

@hekota
Copy link
Member Author

hekota commented Sep 18, 2024

Yes, it looks like it is a dupe and can be closed!

@EugeneZelenko EugeneZelenko added the duplicate Resolved as duplicate label Sep 18, 2024
@EugeneZelenko EugeneZelenko closed this as not planned Won't fix, can't repro, duplicate, stale Sep 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend:DirectX duplicate Resolved as duplicate HLSL HLSL Language Support
Projects
Status: No status
Development

No branches or pull requests

4 participants