From d5e5730fef5b3e0dbc650fbda31008625c53dd7a Mon Sep 17 00:00:00 2001 From: donkopunchstania Date: Sat, 29 Jan 2011 08:34:57 +0000 Subject: [PATCH] If perspective divide is enabled and texture coordinate Z is 0 then leave texture coordinates alone. Fixes issue 3676. git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6964 8ced0084-cf51-0410-be5f-012b33b47a6e --- Source/Core/Common/Src/LinearDiskCache.h | 2 +- Source/Core/VideoCommon/Src/PixelShaderGen.cpp | 2 -- Source/Plugins/Plugin_VideoSoftware/Src/Clipper.cpp | 4 ---- Source/Plugins/Plugin_VideoSoftware/Src/OpcodeDecoder.cpp | 7 ++++++- Source/Plugins/Plugin_VideoSoftware/Src/Rasterizer.cpp | 7 +++---- 5 files changed, 10 insertions(+), 12 deletions(-) diff --git a/Source/Core/Common/Src/LinearDiskCache.h b/Source/Core/Common/Src/LinearDiskCache.h index f467646ccc..7a124aaa7b 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 = 6957 + LINEAR_DISKCACHE_VER = 6964 }; // On disk format: diff --git a/Source/Core/VideoCommon/Src/PixelShaderGen.cpp b/Source/Core/VideoCommon/Src/PixelShaderGen.cpp index f5f9c84f46..425666e4ce 100644 --- a/Source/Core/VideoCommon/Src/PixelShaderGen.cpp +++ b/Source/Core/VideoCommon/Src/PixelShaderGen.cpp @@ -734,8 +734,6 @@ const char *GeneratePixelShaderCode(DSTALPHA_MODE dstAlphaMode, API_TYPE ApiType { 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); diff --git a/Source/Plugins/Plugin_VideoSoftware/Src/Clipper.cpp b/Source/Plugins/Plugin_VideoSoftware/Src/Clipper.cpp index 5a55dc25e2..dc792ea694 100644 --- a/Source/Plugins/Plugin_VideoSoftware/Src/Clipper.cpp +++ b/Source/Plugins/Plugin_VideoSoftware/Src/Clipper.cpp @@ -54,7 +54,6 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "XFMemLoader.h" #include "BPMemLoader.h" #include "Statistics.h" -#include "SWVideoConfig.h" namespace Clipper @@ -274,9 +273,6 @@ namespace Clipper void ProcessTriangle(OutputVertexData *v0, OutputVertexData *v1, OutputVertexData *v2) { - if (stats.thisFrame.numDrawnObjects < g_SWVideoConfig.drawStart || stats.thisFrame.numDrawnObjects >= g_SWVideoConfig.drawEnd ) - return; - INCSTAT(stats.thisFrame.numTrianglesIn) bool backface; diff --git a/Source/Plugins/Plugin_VideoSoftware/Src/OpcodeDecoder.cpp b/Source/Plugins/Plugin_VideoSoftware/Src/OpcodeDecoder.cpp index 67022ed928..05e5467ca6 100644 --- a/Source/Plugins/Plugin_VideoSoftware/Src/OpcodeDecoder.cpp +++ b/Source/Plugins/Plugin_VideoSoftware/Src/OpcodeDecoder.cpp @@ -28,6 +28,7 @@ #include "Statistics.h" #include "DebugUtil.h" #include "CommandProcessor.h" +#include "SWVideoConfig.h" typedef void (*DecodingFunction)(u32); DecodingFunction currentFunction = NULL; @@ -48,7 +49,11 @@ void DecodePrimitiveStream(u32 iBufferSize) { u32 vertexSize = vertexLoader.GetVertexSize(); - if(g_bSkipCurrentFrame) + bool skipPrimitives = g_bSkipCurrentFrame || + stats.thisFrame.numDrawnObjects < g_SWVideoConfig.drawStart || + stats.thisFrame.numDrawnObjects >= g_SWVideoConfig.drawEnd; + + if (skipPrimitives) { while (streamSize > 0 && iBufferSize >= vertexSize) { diff --git a/Source/Plugins/Plugin_VideoSoftware/Src/Rasterizer.cpp b/Source/Plugins/Plugin_VideoSoftware/Src/Rasterizer.cpp index e73c28d2c2..1bb5cf97bc 100644 --- a/Source/Plugins/Plugin_VideoSoftware/Src/Rasterizer.cpp +++ b/Source/Plugins/Plugin_VideoSoftware/Src/Rasterizer.cpp @@ -257,14 +257,13 @@ void BuildBlock(s32 blockX, s32 blockY) // tex coords for (unsigned int i = 0; i < bpmem.genMode.numtexgens; i++) { - float projection; + float projection = invW; if (xfregs.texMtxInfo[i].projection) { float q = TexSlopes[i][2].GetValue(dx, dy) * invW; - projection = invW / q; + if (q != 0.0f) + projection = invW / q; } - else - projection = invW; pixel.Uv[i][0] = TexSlopes[i][0].GetValue(dx, dy) * projection; pixel.Uv[i][1] = TexSlopes[i][1].GetValue(dx, dy) * projection;