GS/HW: Don't drop fractional colour before modulating

Fixes banding in Xenosaga, Tales of the Abyss, Beyond Good and Evil.
This commit is contained in:
Stenzek 2023-07-28 23:23:53 +10:00 committed by refractionpcsx2
parent df32a32d99
commit 784118e9c1
5 changed files with 5 additions and 5 deletions

View File

@ -661,7 +661,7 @@ float4 sample_color(float2 st, float uv_w)
float4 tfx(float4 T, float4 C) float4 tfx(float4 T, float4 C)
{ {
float4 C_out; float4 C_out;
float4 FxT = trunc(trunc(C) * T / 128.0f); float4 FxT = trunc((C * T) / 128.0f);
#if (PS_TFX == 0) #if (PS_TFX == 0)
C_out = FxT; C_out = FxT;

View File

@ -614,7 +614,7 @@ vec4 sample_color(vec2 st)
vec4 tfx(vec4 T, vec4 C) vec4 tfx(vec4 T, vec4 C)
{ {
vec4 C_out; vec4 C_out;
vec4 FxT = trunc(trunc(C) * T / 128.0f); vec4 FxT = trunc((C * T) / 128.0f);
#if (PS_TFX == 0) #if (PS_TFX == 0)
C_out = FxT; C_out = FxT;

View File

@ -849,7 +849,7 @@ vec4 sample_color(vec2 st)
vec4 tfx(vec4 T, vec4 C) vec4 tfx(vec4 T, vec4 C)
{ {
vec4 C_out; vec4 C_out;
vec4 FxT = trunc(trunc(C) * T / 128.0f); vec4 FxT = trunc((C * T) / 128.0f);
#if (PS_TFX == 0) #if (PS_TFX == 0)
C_out = FxT; C_out = FxT;

View File

@ -730,7 +730,7 @@ struct PSMain
float4 tfx(float4 T, float4 C) float4 tfx(float4 T, float4 C)
{ {
float4 C_out; float4 C_out;
float4 FxT = trunc(trunc(C) * T / 128.f); float4 FxT = trunc((C * T) / 128.f);
if (PS_TFX == 0) if (PS_TFX == 0)
C_out = FxT; C_out = FxT;
else if (PS_TFX == 1) else if (PS_TFX == 1)

View File

@ -15,4 +15,4 @@
/// Version number for GS and other shaders. Increment whenever any of the contents of the /// Version number for GS and other shaders. Increment whenever any of the contents of the
/// shaders change, to invalidate the cache. /// shaders change, to invalidate the cache.
static constexpr u32 SHADER_CACHE_VERSION = 28; static constexpr u32 SHADER_CACHE_VERSION = 29;