From 493d92eb2538ea290e1f25f96cd4d5240ce9fcad Mon Sep 17 00:00:00 2001 From: "sl1nk3.s" Date: Tue, 11 Jan 2011 21:46:58 +0000 Subject: [PATCH] Sneak in a quick fix for the sun effect in Wind Waker and Mario Sunshine before anyone notice it's broken ! git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6819 8ced0084-cf51-0410-be5f-012b33b47a6e --- Source/Plugins/Plugin_VideoDX9/Src/PixelShaderCache.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Source/Plugins/Plugin_VideoDX9/Src/PixelShaderCache.cpp b/Source/Plugins/Plugin_VideoDX9/Src/PixelShaderCache.cpp index bb89e1983d..904763f71e 100644 --- a/Source/Plugins/Plugin_VideoDX9/Src/PixelShaderCache.cpp +++ b/Source/Plugins/Plugin_VideoDX9/Src/PixelShaderCache.cpp @@ -211,8 +211,9 @@ static LPDIRECT3DPIXELSHADER9 CreateCopyShader(int copyMatrixType, int depthConv if(depthConversionType != DEPTH_CONVERSION_TYPE_NONE) { + // Here, we need to downscale texcol a bit since frac(1.0) will indeed return 0.0f, ceil() takes care of restoring the precision WRITE(p, "float4 EncodedDepth = frac((texcol.r * (16777215.0f/16777216.0f)) * float4(1.0f,256.0f,256.0f*256.0f,1.0f));\n" - "texcol = round(EncodedDepth * (16777216.0f/16777215.0f) * float4(255.0f,255.0f,255.0f,15.0f)) / float4(255.0f,255.0f,255.0f,15.0f);\n"); + "texcol = ceil(EncodedDepth * float4(255.0f,255.0f,255.0f,15.0f)) / float4(255.0f,255.0f,255.0f,15.0f);\n"); } else {