Implement the faceforward
HLSL Function
#99114
Labels
backend:SPIR-V
bot:HLSL
HLSL
HLSL Language Support
metabug
Issue to collect references to a group of similar or related issues.
faceforward
in thehlsl_intrinsics.h
clang/include/clang/Basic/BuiltinsSPIRV.td
hlsl_detail.h
in the formAn alternative to doing a built-in here would be to do pattern matching. Say we have code like this
We would expect the code gen to look something like this
that means we could pattern match in
SPIRVCombine.td
andSPIRVPreLegalizerCombiner.cpp
tofaceforward
builtin toEmitSPIRVBuiltinExpr
inCGBuiltin.cpp
clang/test/CodeGenHLSL/builtins/faceforward.hlsl
clang/test/CodeGenSPIRV/Builtins/faceforward.c
clang/test/SemaHLSL/BuiltIns/faceforward-errors.hlsl
clang/test/CodeGenSPIRV/Builtins/faceforward-errors.c
int_spv_faceforward
intrinsic inIntrinsicsSPIRV.td
faceforward
lowering and map it toint_spv_faceforward
inSPIRVInstructionSelector::selectIntrinsic
.llvm/test/CodeGen/SPIRV/hlsl-intrinsics/faceforward.ll
llvm/test/CodeGen/SPIRV/opencl/faceforward.ll
DirectX
No DXIL Opcodes were found.
SPIR-V
FaceForward:
Description:
FaceForward
If the dot product of Nref and I is negative, the result is N,
otherwise it is -N.
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.
70
<id>
N
<id>
I
<id>
Nref
Test Case(s)
Example 1
HLSL:
Flips the surface-normal (if needed) to face in a direction opposite to i; returns the result in n.
This function uses the following formula: -n sign(dot(i, ng)).
Parameters
Return Value
A floating-point, surface normal vector that is facing the view direction.
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: