dx11: work around some float literal precision issue with the compiler

For some reason the directx compiler doesn't convert float literal in a
deterministic way (!). A difference of one ulp can be seen between
different compilation of the same code.
This causes an issue with the rounding of the alpha value for PT polys.
Issue #1207
This commit is contained in:
Flyinghead 2023-09-26 17:05:21 +02:00
parent 496429d6f4
commit 5eddc26850
2 changed files with 2 additions and 2 deletions

View File

@ -295,7 +295,7 @@ PSO main(in Pixel inpix)
#endif
#if cp_AlphaTest == 1
color.a = round(color.a * 255.0f) / 255.0f;
color.a = round(color.a * 255.0f) * 0.0039215688593685626983642578125; // 1 / 255
if (alphaTestValue > color.a)
discard;
color.a = 1.0f;

View File

@ -521,7 +521,7 @@ PSO main(in VertexIn inpix)
color *= trilinearAlpha;
#if cp_AlphaTest == 1
color.a = round(color.a * 255.0f) / 255.0f;
color.a = round(color.a * 255.0f) * 0.0039215688593685626983642578125; // 1 / 255
if (alphaTestValue > color.a)
discard;
color.a = 1.0f;