mirror of
https://github.com/RetroDECK/Duckstation.git
synced 2024-11-26 23:55:40 +00:00
GPU/ShaderGen: Round normalized colours before converting to integer
Fixes broken rendering/precision issues on Intel Ivy Bridge GPUs. Many thanks to linkmauve from Dolphin for the idea - seems Dolphin also had a similar problem a few years ago.
This commit is contained in:
parent
16ca214d09
commit
b94de1924d
|
@ -203,9 +203,9 @@ uint fixYCoord(uint y)
|
||||||
|
|
||||||
uint RGBA8ToRGBA5551(float4 v)
|
uint RGBA8ToRGBA5551(float4 v)
|
||||||
{
|
{
|
||||||
uint r = uint(v.r * 255.0) >> 3;
|
uint r = uint(roundEven(v.r * 255.0)) >> 3;
|
||||||
uint g = uint(v.g * 255.0) >> 3;
|
uint g = uint(roundEven(v.g * 255.0)) >> 3;
|
||||||
uint b = uint(v.b * 255.0) >> 3;
|
uint b = uint(roundEven(v.b * 255.0)) >> 3;
|
||||||
uint a = (v.a != 0.0) ? 1u : 0u;
|
uint a = (v.a != 0.0) ? 1u : 0u;
|
||||||
return (r) | (g << 5) | (b << 10) | (a << 15);
|
return (r) | (g << 5) | (b << 10) | (a << 15);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue