-
Notifications
You must be signed in to change notification settings - Fork 13k
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
Implement the step
HLSL Function
#99157
Comments
@damyanp Adding refinment priority. This is used in DirectML shader Lighting.fxh |
@llvm/issue-subscribers-clang-codegen Author: Farzon Lotfi (farzonl)
- [ ] Implement `step` clang builtin,
- [ ] Link `step` clang builtin with `hlsl_intrinsics.h`
- [ ] Add sema checks for `step` to `CheckHLSLBuiltinFunctionCall` in `SemaChecking.cpp`
- [ ] Add codegen for `step` to `EmitHLSLBuiltinExpr` in `CGBuiltin.cpp`
- [ ] Add codegen tests to `clang/test/CodeGenHLSL/builtins/step.hlsl`
- [ ] Add sema tests to `clang/test/SemaHLSL/BuiltIns/step-errors.hlsl`
- [ ] Create the `int_spv_step` intrinsic in `IntrinsicsSPIRV.td`
- [ ] In SPIRVInstructionSelector.cpp create the `step` lowering and map it to `int_spv_step` in `SPIRVInstructionSelector::selectIntrinsic`.
- [ ] Create SPIR-V backend test case in `llvm/test/CodeGen/SPIRV/hlsl-intrinsics/step.ll`
DirectXThere were no DXIL opcodes found for SPIR-VStep:Description:Step Result is 0.0 if x < edge; otherwise result is 1.0. The operands must all be a scalar or vector whose component type is Result Type and the type of all operands must be the same type. <table> Test Case(s)Example 1//dxc step_test.hlsl -T lib_6_8 -enable-16bit-types -O0
export float4 fn(float4 p1, float4 p2) {
return step(p1, p2);
} HLSL:Compares two values, returning 0 or 1 based on which value is greater.
Parameters
Return Value1 if the x parameter is greater than or equal to the y parameter; otherwise, 0. RemarksThis function uses the following formula: (x >= y) ? 1 : 0. The function returns either 0 or 1 depending on whether the x parameter is greater than the y parameter. To compute a smooth interpolation between 0 and 1, use the smoothstep HLSL intrinsic function. Type Description
Minimum Shader ModelThis function is supported in the following shader models.
See also<dl> <dt> Intrinsic Functions (DirectX HLSL) |
@llvm/issue-subscribers-clang-frontend Author: Farzon Lotfi (farzonl)
- [ ] Implement `step` clang builtin,
- [ ] Link `step` clang builtin with `hlsl_intrinsics.h`
- [ ] Add sema checks for `step` to `CheckHLSLBuiltinFunctionCall` in `SemaChecking.cpp`
- [ ] Add codegen for `step` to `EmitHLSLBuiltinExpr` in `CGBuiltin.cpp`
- [ ] Add codegen tests to `clang/test/CodeGenHLSL/builtins/step.hlsl`
- [ ] Add sema tests to `clang/test/SemaHLSL/BuiltIns/step-errors.hlsl`
- [ ] Create the `int_spv_step` intrinsic in `IntrinsicsSPIRV.td`
- [ ] In SPIRVInstructionSelector.cpp create the `step` lowering and map it to `int_spv_step` in `SPIRVInstructionSelector::selectIntrinsic`.
- [ ] Create SPIR-V backend test case in `llvm/test/CodeGen/SPIRV/hlsl-intrinsics/step.ll`
DirectXThere were no DXIL opcodes found for SPIR-VStep:Description:Step Result is 0.0 if x < edge; otherwise result is 1.0. The operands must all be a scalar or vector whose component type is Result Type and the type of all operands must be the same type. <table> Test Case(s)Example 1//dxc step_test.hlsl -T lib_6_8 -enable-16bit-types -O0
export float4 fn(float4 p1, float4 p2) {
return step(p1, p2);
} HLSL:Compares two values, returning 0 or 1 based on which value is greater.
Parameters
Return Value1 if the x parameter is greater than or equal to the y parameter; otherwise, 0. RemarksThis function uses the following formula: (x >= y) ? 1 : 0. The function returns either 0 or 1 depending on whether the x parameter is greater than the y parameter. To compute a smooth interpolation between 0 and 1, use the smoothstep HLSL intrinsic function. Type Description
Minimum Shader ModelThis function is supported in the following shader models.
See also<dl> <dt> Intrinsic Functions (DirectX HLSL) |
step
clang builtin,step
clang builtin withhlsl_intrinsics.h
step
toCheckHLSLBuiltinFunctionCall
inSemaChecking.cpp
step
toEmitHLSLBuiltinExpr
inCGBuiltin.cpp
clang/test/CodeGenHLSL/builtins/step.hlsl
clang/test/SemaHLSL/BuiltIns/step-errors.hlsl
int_spv_step
intrinsic inIntrinsicsSPIRV.td
step
lowering and map it toint_spv_step
inSPIRVInstructionSelector::selectIntrinsic
.llvm/test/CodeGen/SPIRV/hlsl-intrinsics/step.ll
DirectX
There were no DXIL opcodes found for
step
.SPIR-V
Step:
Description:
Step
Result is 0.0 if x < edge; otherwise result is 1.0.
The operands must all be a scalar or vector whose component type is
floating-point.
Result Type and the type of all operands must be the same type.
Results are computed per component.
48
<id>
edge
<id>
x
Test Case(s)
Example 1
HLSL:
Compares two values, returning 0 or 1 based on which value is greater.
Parameters
Return Value
1 if the x parameter is greater than or equal to the y parameter; otherwise, 0.
Remarks
This function uses the following formula: (x >= y) ? 1 : 0. The function returns either 0 or 1 depending on whether the x parameter is greater than the y parameter. To compute a smooth interpolation between 0 and 1, use the smoothstep HLSL intrinsic function.
Type Description
Minimum Shader Model
This function is supported in the following shader models.
See also
Intrinsic Functions (DirectX HLSL)
The text was updated successfully, but these errors were encountered: