GS/SW: Stop C rasterizer crashing with AA1

This commit is contained in:
Stenzek 2023-04-13 23:49:25 +10:00 committed by refractionpcsx2
parent 839b482cb5
commit bde81380c3
3 changed files with 12 additions and 13 deletions

View File

@ -451,10 +451,14 @@ __ri static void WritePixel(const T& src, int addr, int i, u32 psm, const GSScan
} }
void GSDrawScanline::CDrawScanline(int pixels, int left, int top, const GSVertexSW& scan, GSScanlineLocalData& local) void GSDrawScanline::CDrawScanline(int pixels, int left, int top, const GSVertexSW& scan, GSScanlineLocalData& local)
{
CDrawScanline(pixels, left, top, scan, local, GlobalFromLocal(local).sel);
}
__ri void GSDrawScanline::CDrawScanline(int pixels, int left, int top, const GSVertexSW& scan, GSScanlineLocalData& local, GSScanlineSelector sel)
{ {
const GSScanlineGlobalData& global = GlobalFromLocal(local); const GSScanlineGlobalData& global = GlobalFromLocal(local);
GSScanlineSelector sel = global.sel;
constexpr int vlen = sizeof(VectorF) / sizeof(float); constexpr int vlen = sizeof(VectorF) / sizeof(float);
#if _M_SSE < 0x501 #if _M_SSE < 0x501
@ -1729,17 +1733,10 @@ void GSDrawScanline::CDrawScanline(int pixels, int left, int top, const GSVertex
void GSDrawScanline::CDrawEdge(int pixels, int left, int top, const GSVertexSW& scan, GSScanlineLocalData& local) void GSDrawScanline::CDrawEdge(int pixels, int left, int top, const GSVertexSW& scan, GSScanlineLocalData& local)
{ {
// This sucks. But so does not jitting! GSScanlineSelector sel = local.gd->sel;
const GSScanlineGlobalData* old_gd = local.gd; sel.zwrite = 0;
GSScanlineGlobalData gd; sel.edge = 1;
std::memcpy(&gd, &local.gd, sizeof(gd)); CDrawScanline(pixels, left, top, scan, local, sel);
gd.sel.zwrite = 0;
gd.sel.edge = 1;
local.gd = &gd;
CDrawScanline(pixels, left, top, scan, local);
local.gd = old_gd;
} }
template <class T, bool masked> template <class T, bool masked>

View File

@ -63,6 +63,7 @@ private:
static void CSetupPrim(const GSVertexSW* vertex, const u16* index, const GSVertexSW& dscan, GSScanlineLocalData& local); static void CSetupPrim(const GSVertexSW* vertex, const u16* index, const GSVertexSW& dscan, GSScanlineLocalData& local);
static void CDrawScanline(int pixels, int left, int top, const GSVertexSW& scan, GSScanlineLocalData& local); static void CDrawScanline(int pixels, int left, int top, const GSVertexSW& scan, GSScanlineLocalData& local);
static void CDrawEdge(int pixels, int left, int top, const GSVertexSW& scan, GSScanlineLocalData& local); static void CDrawEdge(int pixels, int left, int top, const GSVertexSW& scan, GSScanlineLocalData& local);
__ri static void CDrawScanline(int pixels, int left, int top, const GSVertexSW& scan, GSScanlineLocalData& local, GSScanlineSelector sel);
}; };
MULTI_ISA_UNSHARED_END MULTI_ISA_UNSHARED_END

View File

@ -91,7 +91,8 @@ GSDrawScanlineCodeGenerator::GSDrawScanlineCodeGenerator(u64 key, void* code, si
if (shouldUseCDrawScanline(key)) if (shouldUseCDrawScanline(key))
{ {
jmp(reinterpret_cast<const void*>(&GSDrawScanline::CDrawScanline)); jmp(reinterpret_cast<const void*>(static_cast<void (*)(int, int, int, const GSVertexSW&, GSScanlineLocalData&)>(
&GSDrawScanline::CDrawScanline)));
return; return;
} }