glsl: use rounding in convert 4 shader

It will avoid texture rouding error with negative number
This commit is contained in:
Gregory Hainaut 2015-07-24 21:56:15 +02:00
parent 7b9fa8fbe5
commit d191ae4aba
2 changed files with 4 additions and 12 deletions

View File

@ -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

View File

@ -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"