From affe91cb3bb805fcb8647e8bfd431fa7c74a9461 Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Sun, 31 Mar 2013 23:23:03 -0700 Subject: [PATCH] Refactor some GPU methods to return errors. --- Core/HLE/sceGe.cpp | 25 +++++++--------------- GPU/GLES/DisplayListInterpreter.cpp | 11 ++-------- GPU/GLES/DisplayListInterpreter.h | 4 +--- GPU/GPUCommon.cpp | 33 +++++++++++++++++++++++++++-- GPU/GPUCommon.h | 8 +++++-- GPU/GPUInterface.h | 10 +++++---- GPU/Null/NullGpu.cpp | 7 ++---- GPU/Null/NullGpu.h | 9 +------- 8 files changed, 57 insertions(+), 50 deletions(-) diff --git a/Core/HLE/sceGe.cpp b/Core/HLE/sceGe.cpp index 43bdbccf5a..c4f46fd3cd 100644 --- a/Core/HLE/sceGe.cpp +++ b/Core/HLE/sceGe.cpp @@ -188,48 +188,39 @@ u32 sceGeListEnQueueHead(u32 listAddress, u32 stallAddress, int callbackId, int sceGeListDeQueue(u32 listID) { ERROR_LOG(HLE, "UNIMPL sceGeListDeQueue(%08x)", listID); - return 0; + return gpu->DequeueList(listID); } int sceGeListUpdateStallAddr(u32 displayListID, u32 stallAddress) { - DEBUG_LOG(HLE, "sceGeListUpdateStallAddr(dlid=%i,stalladdr=%08x)", - displayListID, stallAddress); - - gpu->UpdateStall(displayListID, stallAddress); - return 0; + DEBUG_LOG(HLE, "sceGeListUpdateStallAddr(dlid=%i,stalladdr=%08x)", displayListID, stallAddress); + return gpu->UpdateStall(displayListID, stallAddress); } int sceGeListSync(u32 displayListID, u32 mode) //0 : wait for completion 1:check and return { DEBUG_LOG(HLE, "sceGeListSync(dlid=%08x, mode=%08x)", displayListID, mode); - if(mode == 1) { - return gpu->listStatus(displayListID); - } - return 0; + return gpu->ListSync(displayListID, mode); } u32 sceGeDrawSync(u32 mode) { //wait/check entire drawing state - DEBUG_LOG(HLE, "FAKE sceGeDrawSync(mode=%d) (0=wait for completion)", - mode); - gpu->DrawSync(mode); - return 0; + DEBUG_LOG(HLE, "FAKE sceGeDrawSync(mode=%d) (0=wait for completion)", mode); + return gpu->DrawSync(mode); } int sceGeContinue() { DEBUG_LOG(HLE, "UNIMPL sceGeContinue"); - // no arguments - return 0; + return gpu->Continue(); } int sceGeBreak(u32 mode) { //mode => 0 : current dlist 1: all drawing DEBUG_LOG(HLE, "UNIMPL sceGeBreak(mode=%d)", mode); - return 0; + return gpu->Break(mode); } u32 sceGeSetCallback(u32 structAddr) diff --git a/GPU/GLES/DisplayListInterpreter.cpp b/GPU/GLES/DisplayListInterpreter.cpp index d37447551e..5cf982c71d 100644 --- a/GPU/GLES/DisplayListInterpreter.cpp +++ b/GPU/GLES/DisplayListInterpreter.cpp @@ -279,17 +279,10 @@ void GLES_GPU::CopyDisplayToOutput() { // Render queue -void GLES_GPU::DrawSync(int mode) +u32 GLES_GPU::DrawSync(int mode) { transformDraw_.Flush(); -} - -void GLES_GPU::Continue() { - -} - -void GLES_GPU::Break() { - + return GPUCommon::DrawSync(mode); } void GLES_GPU::PreExecuteOp(u32 op, u32 diff) { diff --git a/GPU/GLES/DisplayListInterpreter.h b/GPU/GLES/DisplayListInterpreter.h index 2c1cf6959a..9fb250e617 100644 --- a/GPU/GLES/DisplayListInterpreter.h +++ b/GPU/GLES/DisplayListInterpreter.h @@ -38,9 +38,7 @@ public: virtual void InitClear(); virtual void PreExecuteOp(u32 op, u32 diff); virtual void ExecuteOp(u32 op, u32 diff); - virtual void DrawSync(int mode); - virtual void Continue(); - virtual void Break(); + virtual u32 DrawSync(int mode); virtual void SetDisplayFramebuffer(u32 framebuf, u32 stride, int format); virtual void CopyDisplayToOutput(); diff --git a/GPU/GPUCommon.cpp b/GPU/GPUCommon.cpp index fe782d1103..7d80adeb03 100644 --- a/GPU/GPUCommon.cpp +++ b/GPU/GPUCommon.cpp @@ -15,8 +15,17 @@ void init() { dlIdGenerator = 1; } -int GPUCommon::listStatus(int listid) +u32 GPUCommon::DrawSync(int mode) { + return 0; +} + +int GPUCommon::ListSync(int listid, int mode) { + // TODO + if (mode != 1) + return 0; + + return 0; for(DisplayListQueue::iterator it(dlQueue.begin()); it != dlQueue.end(); ++it) { if(it->id == listid) @@ -44,7 +53,13 @@ u32 GPUCommon::EnqueueList(u32 listpc, u32 stall, int subIntrBase, bool head) return dl.id; } -void GPUCommon::UpdateStall(int listid, u32 newstall) +u32 GPUCommon::DequeueList(int listid) +{ + // TODO + return 0; +} + +u32 GPUCommon::UpdateStall(int listid, u32 newstall) { for (auto iter = dlQueue.begin(); iter != dlQueue.end(); ++iter) { @@ -56,6 +71,20 @@ void GPUCommon::UpdateStall(int listid, u32 newstall) } ProcessDLQueue(); + + return 0; +} + +u32 GPUCommon::Continue() +{ + // TODO + return 0; +} + +u32 GPUCommon::Break(int mode) +{ + // TODO + return 0; } bool GPUCommon::InterpretList(DisplayList &list) diff --git a/GPU/GPUCommon.h b/GPU/GPUCommon.h index 0a9b0ff43b..7f2e192624 100644 --- a/GPU/GPUCommon.h +++ b/GPU/GPUCommon.h @@ -24,11 +24,15 @@ public: virtual void PreExecuteOp(u32 op, u32 diff); virtual bool InterpretList(DisplayList &list); virtual bool ProcessDLQueue(); - virtual void UpdateStall(int listid, u32 newstall); + virtual u32 UpdateStall(int listid, u32 newstall); virtual u32 EnqueueList(u32 listpc, u32 stall, int subIntrBase, bool head); - virtual int listStatus(int listid); + virtual u32 DequeueList(int listid); + virtual int ListSync(int listid, int mode); + virtual u32 DrawSync(int mode); virtual void DoState(PointerWrap &p); virtual bool FramebufferDirty() { return true; } + virtual u32 Continue(); + virtual u32 Break(int mode); protected: typedef std::deque DisplayListQueue; diff --git a/GPU/GPUInterface.h b/GPU/GPUInterface.h index f558e3ceb8..d43a1da1bc 100644 --- a/GPU/GPUInterface.h +++ b/GPU/GPUInterface.h @@ -68,9 +68,11 @@ public: virtual DisplayList* getList(int listid) = 0; // TODO: Much of this should probably be shared between the different GPU implementations. virtual u32 EnqueueList(u32 listpc, u32 stall, int subIntrBase, bool head) = 0; - virtual void UpdateStall(int listid, u32 newstall) = 0; - virtual void DrawSync(int mode) = 0; - virtual void Continue() = 0; + virtual u32 UpdateStall(int listid, u32 newstall) = 0; + virtual u32 DequeueList(int listid) = 0; + virtual u32 DrawSync(int mode) = 0; + virtual u32 Continue() = 0; + virtual u32 Break(int mode) = 0; virtual void InterruptStart() = 0; virtual void InterruptEnd() = 0; @@ -78,7 +80,7 @@ public: virtual void PreExecuteOp(u32 op, u32 diff) = 0; virtual void ExecuteOp(u32 op, u32 diff) = 0; virtual bool InterpretList(DisplayList& list) = 0; - virtual int listStatus(int listid) = 0; + virtual int ListSync(int listid, int mode) = 0; // Framebuffer management virtual void SetDisplayFramebuffer(u32 framebuf, u32 stride, int format) = 0; diff --git a/GPU/Null/NullGpu.cpp b/GPU/Null/NullGpu.cpp index b4b8aaf420..a801ef7986 100644 --- a/GPU/Null/NullGpu.cpp +++ b/GPU/Null/NullGpu.cpp @@ -32,17 +32,14 @@ NullGPU::~NullGPU() { } -void NullGPU::DrawSync(int mode) +u32 NullGPU::DrawSync(int mode) { if (mode == 0) // Wait for completion { __RunOnePendingInterrupt(); } -} - -void NullGPU::Continue() -{ + return GPUCommon::DrawSync(mode); } void NullGPU::ExecuteOp(u32 op, u32 diff) diff --git a/GPU/Null/NullGpu.h b/GPU/Null/NullGpu.h index 0b50aa83a2..41093c0fdc 100644 --- a/GPU/Null/NullGpu.h +++ b/GPU/Null/NullGpu.h @@ -28,11 +28,7 @@ public: ~NullGPU(); virtual void InitClear() {} virtual void ExecuteOp(u32 op, u32 diff); - virtual void Continue(); - virtual void DrawSync(int mode); - virtual void EnableInterrupts(bool enable) { - interruptsEnabled_ = enable; - } + virtual u32 DrawSync(int mode); virtual void BeginFrame() {} virtual void SetDisplayFramebuffer(u32 framebuf, u32 stride, int format) {} @@ -46,7 +42,4 @@ public: virtual void DumpNextFrame() {} virtual void Resized() {} - -private: - bool interruptsEnabled_; };