mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-11-18 11:54:30 +01:00
Merge pull request #15833 from unknownbrackets/debugger
Debugger: Correct GE frame dump VRAM dirty flag
This commit is contained in:
4 files changed
+18
-8
No files matched your search
@@ -154,7 +154,7 @@ void RequestHeader::ParseHeaders(net::InputSink *sink) {
|
||||
}
|
||||
|
||||
VERBOSE_LOG(IO, "finished parsing request.");
|
||||
ok = line_count > 1;
|
||||
ok = line_count > 1 && resource != nullptr;
|
||||
}
|
||||
|
||||
} // namespace http
|
||||
@@ -282,8 +282,8 @@ int BufMapping::slabGeneration_ = 0;
|
||||
|
||||
class DumpExecute {
|
||||
public:
|
||||
DumpExecute(const std::vector<u8> &pushbuf, const std::vector<Command> &commands)
|
||||
: pushbuf_(pushbuf), commands_(commands), mapping_(pushbuf) {
|
||||
DumpExecute(const std::vector<u8> &pushbuf, const std::vector<Command> &commands, uint32_t version)
|
||||
: pushbuf_(pushbuf), commands_(commands), mapping_(pushbuf), version_(version) {
|
||||
}
|
||||
~DumpExecute();
|
||||
|
||||
@@ -320,6 +320,7 @@ private:
|
||||
const std::vector<u8> &pushbuf_;
|
||||
const std::vector<Command> &commands_;
|
||||
BufMapping mapping_;
|
||||
uint32_t version_ = 0;
|
||||
};
|
||||
|
||||
void DumpExecute::SyncStall() {
|
||||
@@ -564,7 +565,7 @@ void DumpExecute::Framebuf(int level, u32 ptr, u32 sz) {
|
||||
u32 headerSize = (u32)sizeof(FramebufData);
|
||||
u32 pspSize = sz - headerSize;
|
||||
const bool isTarget = (framebuf->flags & 1) != 0;
|
||||
const bool unchangedVRAM = (framebuf->flags & 2) != 0;
|
||||
const bool unchangedVRAM = version_ >= 6 && (framebuf->flags & 2) != 0;
|
||||
// TODO: Could use drawnVRAM flag, but it can be wrong.
|
||||
// Could potentially always skip if !isTarget, but playing it safe for offset texture behavior.
|
||||
if (Memory::IsValidRange(framebuf->addr, pspSize) && !unchangedVRAM && (!isTarget || !g_Config.bSoftwareRendering)) {
|
||||
@@ -708,11 +709,14 @@ bool RunMountedReplay(const std::string &filename) {
|
||||
|
||||
std::lock_guard<std::mutex> guard(executeLock);
|
||||
Core_ListenStopRequest(&ReplayStop);
|
||||
|
||||
uint32_t version = 0;
|
||||
if (lastExecFilename != filename) {
|
||||
PROFILE_THIS_SCOPE("ReplayLoad");
|
||||
u32 fp = pspFileSystem.OpenFile(filename, FILEACCESS_READ);
|
||||
Header header;
|
||||
pspFileSystem.ReadFile(fp, (u8 *)&header, sizeof(header));
|
||||
version = header.version;
|
||||
|
||||
if (memcmp(header.magic, HEADER_MAGIC, sizeof(header.magic)) != 0 || header.version > VERSION || header.version < MIN_VERSION) {
|
||||
ERROR_LOG(SYSTEM, "Invalid GE dump or unsupported version");
|
||||
@@ -751,7 +755,7 @@ bool RunMountedReplay(const std::string &filename) {
|
||||
lastExecFilename = filename;
|
||||
}
|
||||
|
||||
DumpExecute executor(lastExecPushbuf, lastExecCommands);
|
||||
DumpExecute executor(lastExecPushbuf, lastExecCommands, version);
|
||||
return executor.Run();
|
||||
}
|
||||
|
||||
|
||||
@@ -108,7 +108,7 @@ static void DirtyAllVRAM(DirtyVRAMFlag flag) {
|
||||
|
||||
static void DirtyVRAM(u32 start, u32 sz, DirtyVRAMFlag flag) {
|
||||
u32 count = (sz + DIRTY_VRAM_ROUND) >> DIRTY_VRAM_SHIFT;
|
||||
u32 first = (start >> 10) & DIRTY_VRAM_MASK;
|
||||
u32 first = (start >> DIRTY_VRAM_SHIFT) & DIRTY_VRAM_MASK;
|
||||
if (first + count > DIRTY_VRAM_SIZE) {
|
||||
DirtyAllVRAM(flag);
|
||||
return;
|
||||
@@ -329,10 +329,15 @@ static void EmitTextureData(int level, u32 texaddr) {
|
||||
|
||||
bool isDirtyVRAM = false;
|
||||
bool isDrawnVRAM = false;
|
||||
uint32_t start = (texaddr >> DIRTY_VRAM_SHIFT) & DIRTY_VRAM_MASK;
|
||||
for (uint32_t i = 0; i < (sizeInRAM + DIRTY_VRAM_ROUND) >> DIRTY_VRAM_SHIFT; ++i) {
|
||||
DirtyVRAMFlag flag = dirtyVRAM[(texaddr >> DIRTY_VRAM_SHIFT) + i];
|
||||
DirtyVRAMFlag flag = dirtyVRAM[start + i];
|
||||
isDirtyVRAM = isDirtyVRAM || flag != DirtyVRAMFlag::CLEAN;
|
||||
isDrawnVRAM = isDrawnVRAM || flag == DirtyVRAMFlag::DRAWN;
|
||||
|
||||
// Mark the VRAM clean now that it's been copied to VRAM.
|
||||
if (flag == DirtyVRAMFlag::DIRTY)
|
||||
dirtyVRAM[start + i] = DirtyVRAMFlag::CLEAN;
|
||||
}
|
||||
|
||||
// The isTarget flag is mostly used for replay of dumps on a PSP.
|
||||
|
||||
@@ -34,7 +34,8 @@ static const char *HEADER_MAGIC = "PPSSPPGE";
|
||||
// Version 3: Adds FRAMEBUF0-FRAMEBUF9
|
||||
// Version 4: Expanded header with game ID
|
||||
// Version 5: Uses zstd
|
||||
static const int VERSION = 5;
|
||||
// Version 6: Corrects dirty VRAM flag
|
||||
static const int VERSION = 6;
|
||||
static const int MIN_VERSION = 2;
|
||||
|
||||
enum class CommandType : u8 {
|
||||
|
||||
Reference in new issue
Block a user