summaryrefslogtreecommitdiff
path: root/Source/Core/VideoCommon
diff options
context:
space:
mode:
authormagumagu <magumagu9@gmail.com>2014-05-11 12:53:02 -0700
committermagumagu <magumagu9@gmail.com>2014-05-11 12:53:02 -0700
commit9e4eeb3b9b012265d0f9865aeaa3fecbf200d7fc (patch)
tree1f971acc4ee1c8df17d9e54b36d32ce9996582f6 /Source/Core/VideoCommon
parent36720e6822a8049c34ff1bfe4ea24e47f85847ca (diff)
Video backends: fix rounding in lighting computation.
For whatever reason, the hardware doesn't do a full divide by 255, but instead uses an approximation with shifting, similar to the way it is done in TEV.
Diffstat (limited to 'Source/Core/VideoCommon')
-rw-r--r--Source/Core/VideoCommon/LightingShaderGen.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/Source/Core/VideoCommon/LightingShaderGen.h b/Source/Core/VideoCommon/LightingShaderGen.h
index f07f67d941..3ee6501b20 100644
--- a/Source/Core/VideoCommon/LightingShaderGen.h
+++ b/Source/Core/VideoCommon/LightingShaderGen.h
@@ -255,7 +255,8 @@ static void GenerateLightingShader(T& object, LightingUidData& uid_data, int com
GenerateLightShader<T>(object, uid_data, i, lit_index, lightsColName, lightsName, coloralpha);
}
}
- object.Write("%s%d = float4(mat * clamp(lacc, 0, 255) / 255) / 255.0;\n", dest, j);
+ object.Write("lacc = clamp(lacc, 0, 255);");
+ object.Write("%s%d = float4((mat * (lacc + (lacc >> 7))) >> 8) / 255.0;\n", dest, j);
object.Write("}\n");
}
}