[SPIR-V] HLSL round intrinsic is translated to "Round" instead of to "RoundEven" which is incorrect based on the HLSL docs (works with the DXIL backend and FXC) #4368
Labels
spirv
Work related to SPIR-V
Title
[SPIR-V] HLSL round intrinsic is translated to "Round" instead of to "RoundEven" which is incorrect based on the HLSL docs (works with the DXIL backend and FXC)
Functional impact
Functional parity when using the HLSL
round
intrinsic is lost between the DXIL and SPIR-V backends for floating-point arguments exactly in between integers.Based on the HLSL docs for round:
Halfway cases are rounded to the nearest even.
and indeed FXC and the DXIL backend generate round_ne (which means "round to nearest even")
Minimal repro steps
dxc.exe -T ps_6_0 -E PSMain -spirv repro_shader.txt
:Expected result
The generated SPIR-V should use the
RoundEven
instruction from theGLSL.std.450
extended instruction setActual result
The generated SPIR-V generates the following instructions:
Further technical details
Used DXC binary from the latest official release v1.6.2112
The text was updated successfully, but these errors were encountered: