diff --git a/GPU/GLES/DisplayListInterpreter.cpp b/GPU/GLES/DisplayListInterpreter.cpp index 28c07f6732..931eb9004b 100644 --- a/GPU/GLES/DisplayListInterpreter.cpp +++ b/GPU/GLES/DisplayListInterpreter.cpp @@ -235,7 +235,7 @@ void GLES_GPU::BuildReportingInfo() { void GLES_GPU::DeviceLost() { // Simply drop all caches and textures. - // FBO:s appear to survive? Or no? + // FBOs appear to survive? Or no? shaderManager_->ClearCache(false); textureCache_.Clear(false); framebufferManager_.DeviceLost(); diff --git a/GPU/GPUCommon.cpp b/GPU/GPUCommon.cpp index 0d587227d5..4bda47f109 100644 --- a/GPU/GPUCommon.cpp +++ b/GPU/GPUCommon.cpp @@ -470,6 +470,46 @@ inline void GPUCommon::UpdatePC(u32 currentPC, u32 newPC) downcount = 0; } +void GPUCommon::ReapplyGfxState() +{ + // ShaderManager_DirtyShader(); + // The commands are embedded in the command memory so we can just reexecute the words. Convenient. + // To be safe we pass 0xFFFFFFF as the diff. + /* + ExecuteOp(gstate.cmdmem[GE_CMD_ALPHABLENDENABLE], 0xFFFFFFFF); + ExecuteOp(gstate.cmdmem[GE_CMD_ALPHATESTENABLE], 0xFFFFFFFF); + ExecuteOp(gstate.cmdmem[GE_CMD_BLENDMODE], 0xFFFFFFFF); + ExecuteOp(gstate.cmdmem[GE_CMD_ZTEST], 0xFFFFFFFF); + ExecuteOp(gstate.cmdmem[GE_CMD_ZTESTENABLE], 0xFFFFFFFF); + ExecuteOp(gstate.cmdmem[GE_CMD_CULL], 0xFFFFFFFF); + ExecuteOp(gstate.cmdmem[GE_CMD_CULLFACEENABLE], 0xFFFFFFFF); + ExecuteOp(gstate.cmdmem[GE_CMD_SCISSOR1], 0xFFFFFFFF); + ExecuteOp(gstate.cmdmem[GE_CMD_SCISSOR2], 0xFFFFFFFF); + */ + + for (int i = GE_CMD_VERTEXTYPE; i < GE_CMD_BONEMATRIXNUMBER; i++) + { + if (i != GE_CMD_ORIGIN) + ExecuteOp(gstate.cmdmem[i], 0xFFFFFFFF); + } + + // Can't write to bonematrixnumber here + + for (int i = GE_CMD_MORPHWEIGHT0; i < GE_CMD_PATCHFACING; i++) + { + ExecuteOp(gstate.cmdmem[i], 0xFFFFFFFF); + } + + // There are a few here in the middle that we shouldn't execute... + + for (int i = GE_CMD_VIEWPORTX1; i < GE_CMD_TRANSFERSTART; i++) + { + ExecuteOp(gstate.cmdmem[i], 0xFFFFFFFF); + } + + // TODO: there's more... +} + inline void GPUCommon::UpdateState(GPUState state) { gpuState = state; diff --git a/GPU/GPUCommon.h b/GPU/GPUCommon.h index 5d0801fd38..5fe4622229 100644 --- a/GPU/GPUCommon.h +++ b/GPU/GPUCommon.h @@ -28,6 +28,7 @@ public: virtual bool FramebufferDirty() { return true; } virtual u32 Continue(); virtual u32 Break(int mode); + virtual void ReapplyGfxState(); protected: // To avoid virtual calls to PreExecuteOp(). diff --git a/GPU/GPUInterface.h b/GPU/GPUInterface.h index 15d7d91809..7dadd1a36b 100644 --- a/GPU/GPUInterface.h +++ b/GPU/GPUInterface.h @@ -192,6 +192,7 @@ public: virtual void DeviceLost() = 0; virtual void Flush() = 0; + virtual void ReapplyGfxState() = 0; virtual void DoState(PointerWrap &p) = 0; // Called by the window system if the window size changed. This will be reflected in PSPCoreParam.pixel*. diff --git a/GPU/GPUState.cpp b/GPU/GPUState.cpp index 35a5be2b7d..159423d563 100644 --- a/GPU/GPUState.cpp +++ b/GPU/GPUState.cpp @@ -82,40 +82,5 @@ void ReapplyGfxState() { if (!gpu) return; - // ShaderManager_DirtyShader(); - // The commands are embedded in the command memory so we can just reexecute the words. Convenient. - // To be safe we pass 0xFFFFFFF as the diff. - /* - gpu->ExecuteOp(gstate.cmdmem[GE_CMD_ALPHABLENDENABLE], 0xFFFFFFFF); - gpu->ExecuteOp(gstate.cmdmem[GE_CMD_ALPHATESTENABLE], 0xFFFFFFFF); - gpu->ExecuteOp(gstate.cmdmem[GE_CMD_BLENDMODE], 0xFFFFFFFF); - gpu->ExecuteOp(gstate.cmdmem[GE_CMD_ZTEST], 0xFFFFFFFF); - gpu->ExecuteOp(gstate.cmdmem[GE_CMD_ZTESTENABLE], 0xFFFFFFFF); - gpu->ExecuteOp(gstate.cmdmem[GE_CMD_CULL], 0xFFFFFFFF); - gpu->ExecuteOp(gstate.cmdmem[GE_CMD_CULLFACEENABLE], 0xFFFFFFFF); - gpu->ExecuteOp(gstate.cmdmem[GE_CMD_SCISSOR1], 0xFFFFFFFF); - gpu->ExecuteOp(gstate.cmdmem[GE_CMD_SCISSOR2], 0xFFFFFFFF); - */ - - for (int i = GE_CMD_VERTEXTYPE; i < GE_CMD_BONEMATRIXNUMBER; i++) - { - if(i != GE_CMD_ORIGIN) - gpu->ExecuteOp(gstate.cmdmem[i], 0xFFFFFFFF); - } - - // Can't write to bonematrixnumber here - - for (int i = GE_CMD_MORPHWEIGHT0; i < GE_CMD_PATCHFACING; i++) - { - gpu->ExecuteOp(gstate.cmdmem[i], 0xFFFFFFFF); - } - - // There are a few here in the middle that we shouldn't execute... - - for (int i = GE_CMD_VIEWPORTX1; i < GE_CMD_TRANSFERSTART; i++) - { - gpu->ExecuteOp(gstate.cmdmem[i], 0xFFFFFFFF); - } - - // TODO: there's more... + gpu->ReapplyGfxState(); }