DirectX
| DXIL Opcode |
DXIL OpName |
Shader Model |
Shader Stages |
| 56 |
Dot4 |
6.0 |
() |
SPIR-V
Normalize:
Description:
Normalize
Result is the vector in the same direction as x but with a length of
1.
The operand x must be a scalar or vector whose component type is
floating-point.
Result Type and the type of x must be the same type.
| Number |
Operand 1 |
Operand 2 |
Operand 3 |
Operand 4 |
69 |
<id>
x |
|
|
|
Test Case(s)
Example 1
//dxc normalize_test.hlsl -T lib_6_8 -enable-16bit-types -O0
export float4 fn(float4 p1) {
return normalize(p1);
}
HLSL:
Normalizes the specified floating-point vector according to x / length(x).
Parameters
| Item |
Description |
x
|
[in] The specified floating-point vector.
|
Return Value
The normalized x parameter. If the length of the x parameter is 0, the result is indefinite.
Remarks
The normalize HLSL intrinsic function uses the following formula: x / length(x).
Type Description
Minimum Shader Model
This function is supported in the following shader models.
See also
-
Intrinsic Functions (DirectX HLSL)
normalizeclang builtin,normalizeclang builtin withhlsl_intrinsics.hnormalizetoCheckHLSLBuiltinFunctionCallinSemaChecking.cppnormalizetoEmitHLSLBuiltinExprinCGBuiltin.cppclang/test/CodeGenHLSL/builtins/normalize.hlslclang/test/SemaHLSL/BuiltIns/normalize-errors.hlslint_dx_normalizeintrinsic inIntrinsicsDirectX.tdint_dx_normalizeinllvm/lib/Target/DirectX/DXILIntrinsicExpansion.cppnormalize.llandnormalize_errors.lltests inllvm/test/CodeGen/DirectX/int_spv_normalizeintrinsic inIntrinsicsSPIRV.tdnormalizelowering and map it toint_spv_normalizeinSPIRVInstructionSelector::selectIntrinsic.llvm/test/CodeGen/SPIRV/hlsl-intrinsics/normalize.llDirectX
SPIR-V
Normalize:
Description:
Normalize
Result is the vector in the same direction as x but with a length of
1.
The operand x must be a scalar or vector whose component type is
floating-point.
Result Type and the type of x must be the same type.
69
<id>
x
Test Case(s)
Example 1
HLSL:
Normalizes the specified floating-point vector according to x / length(x).
Parameters
Return Value
The normalized x parameter. If the length of the x parameter is 0, the result is indefinite.
Remarks
The normalize HLSL intrinsic function uses the following formula: x / length(x).
Type Description
Minimum Shader Model
This function is supported in the following shader models.
See also
Intrinsic Functions (DirectX HLSL)