You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[SPIR-V] SV_Position can no longer be declared to be min10float4, min16float4, float16_t4 or half4 after fix to issue 3736
Functional impact
Vertex shaders using these types for SV_Position written for FXC will not be compatible with DXC
Cannot declare SV_Position to be relaxed or true 16-bit precision in the SPIR-V backend (can with the DXIL backend)
Minimal repro steps
Compile any of the following vertex shaders with with dxc.exe -T vs_6_0 -E Vert -spirv repro_shader.txt:
min10float4 Vert () : SV_Position
{
return 1;
}
min16float4 Vert () : SV_Position
{
return 1;
}
half4 Vert () : SV_Position
{
return 1;
}
Compile the following vertex shader using explicit fp16 support dxc.exe -T vs_6_2 -E Vert -spirv -enable-16bit-types repro_shader.txt:
float16_t4 Vert () : SV_Position
{
return 1;
}
Expected result
Compilation succeeds
Actual result
The compiler produces the corresponding error messages:
repro_shader.txt:1:24: error: semantic Position must be float4 or a composite type recursively including only float4
min10float4 Vert () : SV_Position
^
repro_shader.txt:1:24: error: semantic Position must be float4 or a composite type recursively including only float4
min16float4 Vert () : SV_Position
^
repro_shader.txt:1:18: error: semantic Position must be float4 or a composite type recursively including only float4
half4 Vert () : SV_Position
^
The vertex shader with -enable-16-bit-types produces the following error:
repro_shader4.txt:1:22: error: semantic Position must be float4 or a composite type recursively including only float4
float16_t4 Vert () : SV_Position
^
Further technical details
Seems to have been caused by the fix to issue 3736. The fix to only allow float4 seems to have been overly conservative.
Used dxc.exe downloaded from release v1.6.2112 (Dec 09, 2021).
Note, the DXIL validator appears to have a small typo, where it prints error: SV_Position must be float4. when the component count is not 4 for SV_Position, which seems to not account for the other 4 component floating-point types that are supported.
The text was updated successfully, but these errors were encountered:
A valid vertex shader output variable with SV_Position semantics may be
constructed from any HLSL BuiltinType that translates to a 32-bit
floating point type in the SPIR-V backend, so relax the requirements to
allow the use of additonal types (such as half4) when
-enable-16bit-types is false.
Fixesmicrosoft#4262
A valid vertex shader output variable with SV_Position semantics may be
constructed from any HLSL BuiltinType that translates to a 32-bit
floating point type in the SPIR-V backend, so relax the requirements to
allow the use of additonal types (such as half4) when
-enable-16bit-types is false.
Fixes#4262
Title
[SPIR-V]
SV_Position
can no longer be declared to bemin10float4
,min16float4
,float16_t4
orhalf4
after fix to issue 3736Functional impact
SV_Position
written for FXC will not be compatible with DXCSV_Position
to be relaxed or true 16-bit precision in the SPIR-V backend (can with the DXIL backend)Minimal repro steps
dxc.exe -T vs_6_0 -E Vert -spirv repro_shader.txt
:dxc.exe -T vs_6_2 -E Vert -spirv -enable-16bit-types repro_shader.txt
:Expected result
Compilation succeeds
Actual result
The compiler produces the corresponding error messages:
The vertex shader with
-enable-16-bit-types
produces the following error:Further technical details
float4
seems to have been overly conservative.dxc.exe
downloaded from release v1.6.2112 (Dec 09, 2021).DXIL
validator appears to have a small typo, where it printserror: SV_Position must be float4.
when the component count is not 4 forSV_Position
, which seems to not account for the other 4 component floating-point types that are supported.The text was updated successfully, but these errors were encountered: