Description
- Implement
ddy
clang builtin, - Link
ddy
clang builtin withhlsl_intrinsics.h
- Add sema checks for
ddy
toCheckHLSLBuiltinFunctionCall
inSemaChecking.cpp
- Add codegen for
ddy
toEmitHLSLBuiltinExpr
inCGBuiltin.cpp
- Add codegen tests to
clang/test/CodeGenHLSL/builtins/ddy.hlsl
- Add sema tests to
clang/test/SemaHLSL/BuiltIns/ddy-errors.hlsl
- Create the
int_dx_ddy
intrinsic inIntrinsicsDirectX.td
- Create the
DXILOpMapping
ofint_dx_ddy
to84
inDXIL.td
- Create the
ddy.ll
andddy_errors.ll
tests inllvm/test/CodeGen/DirectX/
- Create the
int_spv_ddy
intrinsic inIntrinsicsSPIRV.td
- In SPIRVInstructionSelector.cpp create the
ddy
lowering and map it toint_spv_ddy
inSPIRVInstructionSelector::selectIntrinsic
. - Create SPIR-V backend test case in
llvm/test/CodeGen/SPIRV/hlsl-intrinsics/ddy.ll
DirectX
DXIL Opcode | DXIL OpName | Shader Model | Shader Stages |
---|---|---|---|
84 | DerivCoarseY | 6.0 | ('library', 'pixel', 'compute', 'amplification', 'mesh', 'node') |
SPIR-V
OpDPdy:
Description:
Same result as either OpDPdyFine or
OpDPdyCoarse on P. Selection of which one is
based on external factors.
Result Type must be a scalar or vector of floating-point
type using the IEEE 754 encoding. The component width must
be 32 bits.
The type of P must be the same as Result Type. P is the value to
take the derivative of.
This instruction is only valid in the Fragment Execution
Model.
Capability:
Shader
Word Count | Opcode | Results | Operands | |
---|---|---|---|---|
4 |
208 |
<id> |
<id> |
Test Case(s)
Example 1
//dxc ddy_test.hlsl -T lib_6_8 -enable-16bit-types -O0
export float4 fn(float4 p1) {
return ddy(p1);
}
HLSL:
Returns the partial derivative of the specified value with respect to the screen-space y-coordinate.
ret ddy(x) |
---|
This function computes the partial derivative with respect to the screen-space y-coordinate. To compute the partial derivative with respect to the screen-space x-coordinate, use the ddx function.
This function is only supported in pixel shaders.
Parameters
Item | Description |
---|---|
x |
[in] The specified value. |
Return Value
The partial derivative of the x parameter.
Type Description
Name | Template Type | Component Type | Size |
---|---|---|---|
x | scalar, vector, or matrix | float | any |
ret | same as input x | float | same dimension(s) as input x |
Minimum Shader Model
This function is supported in the following shader models.
Shader Model | Supported |
---|---|
Shader Model 5 and higher shader models | yes |
Shader Model 4 | yes |
Shader Model 3 (DirectX HLSL) | yes |
Shader Model 2 (DirectX HLSL) | yes in ps_2_x; unsupported in ps_2_0. |
Shader Model 1 (DirectX HLSL) | no |
This function is supported in the following types of shaders:
Vertex | Hull | Domain | Geometry | Pixel | Compute |
---|---|---|---|---|---|
x |
See also
Metadata
Metadata
Assignees
Type
Projects
Status