Merge pull request #7456 from Tilka/drop_floor
VideoCommon: remove unnecessary floor()
This commit is contained in:
commit
bb6aff1d78
|
@ -780,7 +780,7 @@ void Tev::Draw()
|
||||||
floatindex = MathUtil::Clamp(floatindex, 0.f, 9.f); // TODO: This shouldn't be necessary!
|
floatindex = MathUtil::Clamp(floatindex, 0.f, 9.f); // TODO: This shouldn't be necessary!
|
||||||
|
|
||||||
// Get the two closest integer indices, look up the corresponding samples
|
// Get the two closest integer indices, look up the corresponding samples
|
||||||
const int indexlower = (int)floor(floatindex);
|
const int indexlower = (int)floatindex;
|
||||||
const int indexupper = indexlower + 1;
|
const int indexupper = indexlower + 1;
|
||||||
// Look up coefficient... Seems like multiplying by 4 makes Fortune Street work properly (fog
|
// Look up coefficient... Seems like multiplying by 4 makes Fortune Street work properly (fog
|
||||||
// is too strong without the factor)
|
// is too strong without the factor)
|
||||||
|
|
|
@ -1354,7 +1354,7 @@ static void WriteFog(ShaderCode& out, const pixel_shader_uid_data* uid_data)
|
||||||
out.SetConstantsUsed(C_FOGF, C_FOGF);
|
out.SetConstantsUsed(C_FOGF, C_FOGF);
|
||||||
out.Write("\tfloat offset = (2.0 * (rawpos.x / " I_FOGF ".w)) - 1.0 - " I_FOGF ".z;\n");
|
out.Write("\tfloat offset = (2.0 * (rawpos.x / " I_FOGF ".w)) - 1.0 - " I_FOGF ".z;\n");
|
||||||
out.Write("\tfloat floatindex = clamp(9.0 - abs(offset) * 9.0, 0.0, 9.0);\n");
|
out.Write("\tfloat floatindex = clamp(9.0 - abs(offset) * 9.0, 0.0, 9.0);\n");
|
||||||
out.Write("\tuint indexlower = uint(floor(floatindex));\n");
|
out.Write("\tuint indexlower = uint(floatindex);\n");
|
||||||
out.Write("\tuint indexupper = indexlower + 1u;\n");
|
out.Write("\tuint indexupper = indexlower + 1u;\n");
|
||||||
out.Write("\tfloat klower = " I_FOGRANGE "[indexlower >> 2u][indexlower & 3u];\n");
|
out.Write("\tfloat klower = " I_FOGRANGE "[indexlower >> 2u][indexlower & 3u];\n");
|
||||||
out.Write("\tfloat kupper = " I_FOGRANGE "[indexupper >> 2u][indexupper & 3u];\n");
|
out.Write("\tfloat kupper = " I_FOGRANGE "[indexupper >> 2u][indexupper & 3u];\n");
|
||||||
|
|
|
@ -1171,7 +1171,7 @@ ShaderCode GenPixelShader(APIType ApiType, const ShaderHostConfig& host_config,
|
||||||
" // ze *= x_adjust\n"
|
" // ze *= x_adjust\n"
|
||||||
" float offset = (2.0 * (rawpos.x / " I_FOGF ".w)) - 1.0 - " I_FOGF ".z;\n"
|
" float offset = (2.0 * (rawpos.x / " I_FOGF ".w)) - 1.0 - " I_FOGF ".z;\n"
|
||||||
" float floatindex = clamp(9.0 - abs(offset) * 9.0, 0.0, 9.0);\n"
|
" float floatindex = clamp(9.0 - abs(offset) * 9.0, 0.0, 9.0);\n"
|
||||||
" uint indexlower = uint(floor(floatindex));\n"
|
" uint indexlower = uint(floatindex);\n"
|
||||||
" uint indexupper = indexlower + 1u;\n"
|
" uint indexupper = indexlower + 1u;\n"
|
||||||
" float klower = " I_FOGRANGE "[indexlower >> 2u][indexlower & 3u];\n"
|
" float klower = " I_FOGRANGE "[indexlower >> 2u][indexlower & 3u];\n"
|
||||||
" float kupper = " I_FOGRANGE "[indexupper >> 2u][indexupper & 3u];\n"
|
" float kupper = " I_FOGRANGE "[indexupper >> 2u][indexupper & 3u];\n"
|
||||||
|
|
Loading…
Reference in New Issue