mirror of https://github.com/PCSX2/pcsx2.git
glsl: use rounding in convert 4 shader
It will avoid texture rouding error with negative number
This commit is contained in:
parent
7b9fa8fbe5
commit
d191ae4aba
|
@ -77,7 +77,7 @@ layout(std140, binding = 15) uniform cb15
|
|||
|
||||
vec4 sample_c()
|
||||
{
|
||||
return texture(TextureSampler, PSin_t );
|
||||
return texture(TextureSampler, PSin_t);
|
||||
}
|
||||
|
||||
vec4 ps_crt(uint i)
|
||||
|
@ -372,11 +372,7 @@ void ps_main3()
|
|||
#ifdef ps_main4
|
||||
void ps_main4()
|
||||
{
|
||||
// FIXME mod and fmod are different when value are negative
|
||||
// output.c = fmod(sample_c(input.t) * 255 + 0.5f, 256) / 255;
|
||||
vec4 c = mod(sample_c() * 255.0f + 0.5f, 256.0f) / 255.0f;
|
||||
|
||||
SV_Target0 = c;
|
||||
SV_Target0 = mod(round(sample_c() * 255.0f), 256.0f) / 255.0f;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -102,7 +102,7 @@ static const char* convert_glsl =
|
|||
"\n"
|
||||
"vec4 sample_c()\n"
|
||||
"{\n"
|
||||
" return texture(TextureSampler, PSin_t );\n"
|
||||
" return texture(TextureSampler, PSin_t);\n"
|
||||
"}\n"
|
||||
"\n"
|
||||
"vec4 ps_crt(uint i)\n"
|
||||
|
@ -397,11 +397,7 @@ static const char* convert_glsl =
|
|||
"#ifdef ps_main4\n"
|
||||
"void ps_main4()\n"
|
||||
"{\n"
|
||||
" // FIXME mod and fmod are different when value are negative\n"
|
||||
" // output.c = fmod(sample_c(input.t) * 255 + 0.5f, 256) / 255;\n"
|
||||
" vec4 c = mod(sample_c() * 255.0f + 0.5f, 256.0f) / 255.0f;\n"
|
||||
"\n"
|
||||
" SV_Target0 = c;\n"
|
||||
" SV_Target0 = mod(round(sample_c() * 255.0f), 256.0f) / 255.0f;\n"
|
||||
"}\n"
|
||||
"#endif\n"
|
||||
"\n"
|
||||
|
|
Loading…
Reference in New Issue