-
Notifications
You must be signed in to change notification settings - Fork 15.2k
Description
- Implement
ddx_coarseclang builtin, - Link
ddx_coarseclang builtin withhlsl_intrinsics.h - Add sema checks for
ddx_coarsetoCheckHLSLBuiltinFunctionCallinSemaChecking.cpp - Add codegen for
ddx_coarsetoEmitHLSLBuiltinExprinCGBuiltin.cpp - Add codegen tests to
clang/test/CodeGenHLSL/builtins/ddx_coarse.hlsl - Add sema tests to
clang/test/SemaHLSL/BuiltIns/ddx_coarse-errors.hlsl - Create the
int_dx_ddx_coarseintrinsic inIntrinsicsDirectX.td - Create the
DXILOpMappingofint_dx_ddx_coarseto83inDXIL.td - Create the
ddx_coarse.llandddx_coarse_errors.lltests inllvm/test/CodeGen/DirectX/ - Create the
int_spv_ddx_coarseintrinsic inIntrinsicsSPIRV.td - In SPIRVInstructionSelector.cpp create the
ddx_coarselowering and map it toint_spv_ddx_coarseinSPIRVInstructionSelector::selectIntrinsic. - Create SPIR-V backend test case in
llvm/test/CodeGen/SPIRV/hlsl-intrinsics/ddx_coarse.ll
DirectX
| DXIL Opcode | DXIL OpName | Shader Model | Shader Stages |
|---|---|---|---|
| 83 | DerivCoarseX | 6.0 | ('library', 'pixel', 'compute', 'amplification', 'mesh', 'node') |
SPIR-V
OpDPdxCoarse:
Description:
Result is the partial derivative of P with respect to the window x
coordinate. Uses local differencing based on the value of P for the
current fragment’s neighbors, and possibly, but not necessarily,
includes the value of P for the current fragment. That is, over a
given area, the implementation can compute x derivatives in fewer
unique locations than would be allowed for
OpDPdxFine.
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:
DerivativeControl
| Word Count | Opcode | Results | Operands | |
|---|---|---|---|---|
4 |
213 |
<id> |
<id> |
Test Case(s)
Example 1
//dxc ddx_coarse_test.hlsl -T lib_6_8 -enable-16bit-types -O0
export float4 fn(float4 p1) {
return ddx_coarse(p1);
}HLSL:
Computes a low precision partial derivative with respect to the screen-space x-coordinate.
Syntax
float ddx_coarse(
in float value
);Parameters
-
value [in]
-
Type: float
The input value.
Return value
Type: float
The low precision partial derivative of value.
Remarks
The following overloaded versions are also available:
float2 ddx_coarse(float2 value);
float3 ddx_coarse(float3 value);
float4 ddx_coarse(float4 value);Minimum Shader Model
This function is supported in the following shader models.
| Shader Model | Supported |
|---|---|
| Shader Model 5 and higher shader models | yes |
This function is supported in the following types of shaders:
| Vertex | Hull | Domain | Geometry | Pixel | Compute |
|---|---|---|---|---|---|
| x |
See also
Metadata
Metadata
Assignees
Labels
Type
Projects
Status