mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-03-04 12:17:16 +00:00
Merge pull request #5083 from unknownbrackets/softgpu
Rotate UVs and fix crash in softgpu
This commit is contained in:
commit
76915d0fac
@ -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 <algorithm>
|
||||
|
||||
#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);
|
||||
|
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user