From 55fe5a950ee065cd75ff04225c33d7197791287d Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Sat, 11 Jan 2014 09:51:09 -0800 Subject: [PATCH 1/2] softgpu: rotate uvs in throughmode. --- GPU/Software/Clipper.cpp | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/GPU/Software/Clipper.cpp b/GPU/Software/Clipper.cpp index 11cd6ccae4..d43ef1c685 100644 --- a/GPU/Software/Clipper.cpp +++ b/GPU/Software/Clipper.cpp @@ -15,10 +15,12 @@ // Official git repository and contact information can be found at // https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. -#include "../GPUState.h" +#include -#include "Clipper.h" -#include "Rasterizer.h" +#include "GPU/GPUState.h" + +#include "GPU/Software/Clipper.h" +#include "GPU/Software/Rasterizer.h" namespace Clipper { @@ -123,6 +125,17 @@ static inline int CalcClipMask(const ClipCoords& v) } \ } +static void RotateUVThrough(VertexData &tl, VertexData &tr, VertexData &bl, VertexData &br) { + const fixed16 x1 = tl.screenpos.x; + const fixed16 x2 = br.screenpos.x; + const fixed16 y1 = tl.screenpos.y; + const fixed16 y2 = br.screenpos.y; + + if ((x1 < x2 && y1 > y2) || (x1 > x2 && y1 < y2)) { + std::swap(bl.texturecoords, tr.texturecoords); + } +} + void ProcessQuad(const VertexData& v0, const VertexData& v1) { if (!gstate.isModeThrough()) { @@ -198,6 +211,8 @@ void ProcessQuad(const VertexData& v0, const VertexData& v1) bottomright = &buf[i]; } + RotateUVThrough(*topleft, *topright, *bottomleft, *bottomright); + // Four triangles to do backfaces as well. Two of them will get backface culled. Rasterizer::DrawTriangle(*topleft, *topright, *bottomright); Rasterizer::DrawTriangle(*bottomright, *topright, *topleft); From 4ea4554ddf7a0795816c4e09fd573191cf35367d Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Sat, 11 Jan 2014 09:51:32 -0800 Subject: [PATCH 2/2] softgpu: detect a vram-relative display addr. --- GPU/Software/SoftGpu.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/GPU/Software/SoftGpu.cpp b/GPU/Software/SoftGpu.cpp index 45eeec75af..43522a6339 100644 --- a/GPU/Software/SoftGpu.cpp +++ b/GPU/Software/SoftGpu.cpp @@ -172,7 +172,8 @@ SoftGPU::~SoftGPU() } void SoftGPU::SetDisplayFramebuffer(u32 framebuf, u32 stride, GEBufferFormat format) { - displayFramebuf_ = framebuf; + // Seems like this can point into RAM, but should be VRAM if not in RAM. + displayFramebuf_ = (framebuf & 0xFF000000) == 0 ? 0x44000000 | framebuf : framebuf; displayStride_ = stride; displayFormat_ = format; host->GPUNotifyDisplay(framebuf, stride, format);