Open hekota opened 4 months ago
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.
Implement HLSL derivative intrinsics
ddx
,ddx_fine
,ddx_coarse
,ddy
,ddy_fine
andddy_coarse
.https://godbolt.org/z/1Ej8514MY
The
ddx
andddy
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-ddyShader Model 5.0 added
ddx_fine
,ddx_coarse
,ddy_fine
andddy_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-coarseIn DirectX the
ddx
andddy
functions default to coarse behavior -ddx
is the same asddx_coarse
andddy
is the same asddy_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