From 300961ce6e9a01fb0f03e12918b46b76ece45bdb Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Sun, 4 Jun 2017 00:47:29 -0700 Subject: [PATCH] GE Debugger: Align texture/vertex/etc. data. This may allow slab allocation after all, since it needs to be aligned. --- GPU/Debugger/Record.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/GPU/Debugger/Record.cpp b/GPU/Debugger/Record.cpp index e669a4f437..052e27a512 100644 --- a/GPU/Debugger/Record.cpp +++ b/GPU/Debugger/Record.cpp @@ -242,7 +242,15 @@ static Command EmitCommandWithRAM(CommandType t, const void *p, u32 sz) { cmd.ptr = (u32)(prev - pushbuf.data()); } else { cmd.ptr = (u32)pushbuf.size(); - pushbuf.resize(pushbuf.size() + sz); + int pad = 0; + if (cmd.ptr & 0xF) { + pad = 0x10 - (cmd.ptr & 0xF); + cmd.ptr += pad; + } + pushbuf.resize(pushbuf.size() + sz + pad); + if (pad) { + memset(pushbuf.data() + cmd.ptr - pad, 0, pad); + } memcpy(pushbuf.data() + cmd.ptr, p, sz); } } @@ -533,7 +541,6 @@ static void FreePSPPointer(u32 &p) { } static bool AllocatePSPBuf(u32 &pspPointer, u32 bufptr, u32 sz) { - // TODO: Smarter... but slabs don't work, because of alignment issues. Arg. FreePSPPointer(pspPointer); u32 allocSize = sz;