summaryrefslogtreecommitdiff
path: root/Source/Core
diff options
context:
space:
mode:
authordonkopunchstania <donkopunchstania@gmail.com>2010-12-01 04:26:21 +0000
committerdonkopunchstania <donkopunchstania@gmail.com>2010-12-01 04:26:21 +0000
commit1f660de7e53eb3675bc258dc57dfff99d779fc55 (patch)
treef31378952893f088af43b544735514cde4defdef /Source/Core
parent0718e1bd772e641cfad180b42d800f5fb49b46d7 (diff)
Avoid repeatedly asserting in SWG plugin when matrix indices don't match. Small change to the transform unit to avoid some unnecessary work. Check if Q is zero before dividing UV coordinates by it. Fixes issue 3454.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6504 8ced0084-cf51-0410-be5f-012b33b47a6e
Diffstat (limited to 'Source/Core')
-rw-r--r--Source/Core/Common/Src/LinearDiskCache.h2
-rw-r--r--Source/Core/VideoCommon/Src/PixelShaderGen.cpp7
2 files changed, 7 insertions, 2 deletions
diff --git a/Source/Core/Common/Src/LinearDiskCache.h b/Source/Core/Common/Src/LinearDiskCache.h
index 252713d2c3..4fc86b6f0c 100644
--- a/Source/Core/Common/Src/LinearDiskCache.h
+++ b/Source/Core/Common/Src/LinearDiskCache.h
@@ -26,7 +26,7 @@
// shader cache for every revision, graphics-related or not, which is simply annoying.
enum
{
- LINEAR_DISKCACHE_VER = 6473
+ LINEAR_DISKCACHE_VER = 6504
};
// On disk format:
diff --git a/Source/Core/VideoCommon/Src/PixelShaderGen.cpp b/Source/Core/VideoCommon/Src/PixelShaderGen.cpp
index 44964acc61..9f0d20ba53 100644
--- a/Source/Core/VideoCommon/Src/PixelShaderGen.cpp
+++ b/Source/Core/VideoCommon/Src/PixelShaderGen.cpp
@@ -730,7 +730,12 @@ const char *GeneratePixelShaderCode(DSTALPHA_MODE dstAlphaMode, API_TYPE ApiType
{
// optional perspective divides
if (xfregs.texcoords[i].texmtxinfo.projection == XF_TEXPROJ_STQ)
- WRITE(p, "uv%d.xy = uv%d.xy/uv%d.z;\n", i, i, i);
+ {
+ WRITE(p, "if (uv%d.z)", i);
+ WRITE(p, " uv%d.xy = uv%d.xy / uv%d.z;\n", i, i, i);
+ WRITE(p, "else");
+ WRITE(p, " uv%d.xy = float2(0.0f, 0.0f);\n", i);
+ }
WRITE(p, "uv%d.xy = uv%d.xy * "I_TEXDIMS"[%d].zw;\n", i, i, i);
}