-
Notifications
You must be signed in to change notification settings - Fork 14.5k
Description
- implement
D3DCOLORtoUBYTE4
in thehlsl_intrinsics.h
header - Add codegen tests to
clang/test/CodeGenHLSL/builtins/D3DCOLORtoUBYTE4.hlsl
- Add sema tests to
clang/test/SemaHLSL/BuiltIns/D3DCOLORtoUBYTE4-errors.hlsl
DirectX
There were no DXIL opcodes found for D3DCOLORtoUBYTE4
. That should make it easy to do entirely in the frontend.
In DXC it was done via emitting llvmir. We do not want to do that in upstream.
SPIRV
There is no SPIRV opcode, but SPIRV has a custom implementation. We should try to consolidate behavior between backends. If you need to pick between implementations treat the implementation targeting the DirectX backend as the working spec.
Test Case(s)
Example 1
//dxc D3DCOLORtoUBYTE4_test.hlsl -T lib_6_8 -enable-16bit-types -O0
export int4 fn(float4 p1) {
return D3DCOLORtoUBYTE4(p1);
}
HLSL:
Converts a floating-point, 4D vector set by a D3DCOLOR to a UBYTE4.
ret D3DCOLORtoUBYTE4(x) |
---|
This function swizzles and scales components of the x parameter. Use this function to compensate for the lack of UBYTE4 support in some hardware.
Parameters
Item | Description |
---|---|
x |
[in] The floating-point vector4 to convert. |
Return Value
The UBYTE4 representation of the x parameter.
Type Description
Name | Template Type | Component Type | Size |
---|---|---|---|
x | vector | float | 4 |
ret | vector | integer | 4 |
Minimum Shader Model
This function is supported in the following shader models.
Shader Model | Supported |
---|---|
Shader Model 2 (DirectX HLSL) and higher shader models | yes |
Shader Model 1 (DirectX HLSL) | vs_1_1 |
See also
Metadata
Metadata
Assignees
Labels
Type
Projects
Status