summaryrefslogtreecommitdiff
path: root/Source/Core/VideoCommon/Src/PixelShaderGen.cpp
diff options
context:
space:
mode:
authordonkopunchstania <donkopunchstania@gmail.com>2009-02-21 06:59:44 +0000
committerdonkopunchstania <donkopunchstania@gmail.com>2009-02-21 06:59:44 +0000
commit5a66927610879fc18ef4c45ecd40b452ab6f14c0 (patch)
treefc4e005e111345aff5459e29c5445587be0f5762 /Source/Core/VideoCommon/Src/PixelShaderGen.cpp
parent228652b0709bcf7cd39ac447dee2f08ae4d05c48 (diff)
Fog uses depth from z texture if it is available.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@2330 8ced0084-cf51-0410-be5f-012b33b47a6e
Diffstat (limited to 'Source/Core/VideoCommon/Src/PixelShaderGen.cpp')
-rw-r--r--Source/Core/VideoCommon/Src/PixelShaderGen.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/Source/Core/VideoCommon/Src/PixelShaderGen.cpp b/Source/Core/VideoCommon/Src/PixelShaderGen.cpp
index efe979af24..2ea282a3af 100644
--- a/Source/Core/VideoCommon/Src/PixelShaderGen.cpp
+++ b/Source/Core/VideoCommon/Src/PixelShaderGen.cpp
@@ -134,7 +134,7 @@ static void WriteStage(char *&p, int n, u32 texture_mask);
static void WrapNonPow2Tex(char* &p, const char* var, int texmap, u32 texture_mask);
static void WriteAlphaCompare(char *&p, int num, int comp);
static bool WriteAlphaTest(char *&p);
-static void WriteFog(char *&p);
+static void WriteFog(char *&p, bool bOutputZ);
const float epsilon8bit = 1.0f / 255.0f;
@@ -533,7 +533,7 @@ const char *GeneratePixelShader(u32 texture_mask, bool has_zbuffer_target, bool
WRITE(p, " ocol0 = float4(prev.rgb,"I_ALPHA"[0].w);\n");
else
*/
- WriteFog(p);
+ WriteFog(p, bOutputZ);
WRITE(p, " ocol0 = prev;\n");
}
}
@@ -943,7 +943,7 @@ static bool WriteAlphaTest(char *&p)
return true;
}
-static void WriteFog(char *&p)
+static void WriteFog(char *&p, bool bOutputZ)
{
bool enabled = bpmem.fog.c_proj_fsel.fsel == 0 ? false : true;
@@ -951,11 +951,11 @@ static void WriteFog(char *&p)
if (bpmem.fog.c_proj_fsel.proj == 0) {
// perspective
// ze = A/(B - Zs)
- WRITE (p, " float ze = "I_FOG"[1].x / ("I_FOG"[1].y - zCoord);\n");
+ WRITE (p, " float ze = "I_FOG"[1].x / ("I_FOG"[1].y - %s);\n", bOutputZ ? "depth" : "zCoord");
} else {
// orthographic
// ze = a*Zs
- WRITE (p, " float ze = "I_FOG"[1].x * zCoord;\n");
+ WRITE (p, " float ze = "I_FOG"[1].x * %s;\n", bOutputZ ? "depth" : "zCoord");
}
WRITE (p, " float fog = clamp(ze - "I_FOG"[1].z, 0.0f, 1.0f);\n");