From 56fdcf5f00a8066617ae738652ab041614b0938a Mon Sep 17 00:00:00 2001 From: Tillmann Karras Date: Wed, 19 Sep 2018 04:30:31 +0100 Subject: VideoCommon: remove unnecessary floor() floatindex is clamped to the range [0, 9]. For non-negative numbers floor() is equivalent to trunc(). Truncation happens implicitly when converting to uint, so the floor() is unnecessary. --- Source/Core/VideoCommon/PixelShaderGen.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Source/Core/VideoCommon/PixelShaderGen.cpp') diff --git a/Source/Core/VideoCommon/PixelShaderGen.cpp b/Source/Core/VideoCommon/PixelShaderGen.cpp index 7ba5edba7f..5271d31671 100644 --- a/Source/Core/VideoCommon/PixelShaderGen.cpp +++ b/Source/Core/VideoCommon/PixelShaderGen.cpp @@ -1354,7 +1354,7 @@ static void WriteFog(ShaderCode& out, const pixel_shader_uid_data* uid_data) 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 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("\tfloat klower = " I_FOGRANGE "[indexlower >> 2u][indexlower & 3u];\n"); out.Write("\tfloat kupper = " I_FOGRANGE "[indexupper >> 2u][indexupper & 3u];\n"); -- cgit v1.2.3