From 2eb10c3b3f326896c6dfd5b8cc5a124628429178 Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Sat, 5 Oct 2013 11:37:14 -0700 Subject: [PATCH] Add basic GetCurrentTexture() to softgpu. --- GPU/Common/GPUDebugInterface.h | 4 ++++ GPU/Software/SoftGpu.cpp | 20 ++++++++++++++++++++ GPU/Software/SoftGpu.h | 5 +---- 3 files changed, 25 insertions(+), 4 deletions(-) diff --git a/GPU/Common/GPUDebugInterface.h b/GPU/Common/GPUDebugInterface.h index 6f53fa75d0..20c0b87dba 100644 --- a/GPU/Common/GPUDebugInterface.h +++ b/GPU/Common/GPUDebugInterface.h @@ -51,6 +51,10 @@ struct GPUDebugBuffer { : alloc_(false), data_((u8 *)data), stride_(stride), height_(height), fmt_(GPUDebugBufferFormat(fmt)), flipped_(false) { } + GPUDebugBuffer(void *data, u32 stride, u32 height, GETextureFormat fmt) + : alloc_(false), data_((u8 *)data), stride_(stride), height_(height), fmt_(GPUDebugBufferFormat(fmt)), flipped_(false) { + } + GPUDebugBuffer(void *data, u32 stride, u32 height, GPUDebugBufferFormat fmt) : alloc_(false), data_((u8 *)data), stride_(stride), height_(height), fmt_(fmt), flipped_(false) { } diff --git a/GPU/Software/SoftGpu.cpp b/GPU/Software/SoftGpu.cpp index 7b1d306e50..e841bf04f1 100644 --- a/GPU/Software/SoftGpu.cpp +++ b/GPU/Software/SoftGpu.cpp @@ -18,6 +18,7 @@ #include "GPU/GPUState.h" #include "GPU/ge_constants.h" +#include "GPU/Common/TextureDecoder.h" #include "Core/MemMap.h" #include "Core/HLE/sceKernelInterrupt.h" #include "Core/HLE/sceGe.h" @@ -767,3 +768,22 @@ bool SoftGPU::GetCurrentStencilbuffer(GPUDebugBuffer &buffer) // TODO: Just need the alpha value from the framebuffer... return false; } + +bool SoftGPU::GetCurrentTexture(GPUDebugBuffer &buffer) +{ + static const int level = 0; + u32 bufw = GetTextureBufw(level, gstate.getTextureAddress(level), gstate.getTextureFormat()); + switch (gstate.getTextureFormat()) + { + case GE_TFMT_5650: + case GE_TFMT_5551: + case GE_TFMT_4444: + case GE_TFMT_8888: + buffer = GPUDebugBuffer(Memory::GetPointer(gstate.getTextureAddress(level)), bufw, gstate.getTextureHeight(level), gstate.getTextureFormat()); + return true; + + default: + // TODO: Support these... + return false; + } +} diff --git a/GPU/Software/SoftGpu.h b/GPU/Software/SoftGpu.h index baa88f5fb4..2359c7323e 100644 --- a/GPU/Software/SoftGpu.h +++ b/GPU/Software/SoftGpu.h @@ -76,10 +76,7 @@ public: virtual bool GetCurrentFramebuffer(GPUDebugBuffer &buffer); virtual bool GetCurrentDepthbuffer(GPUDebugBuffer &buffer); virtual bool GetCurrentStencilbuffer(GPUDebugBuffer &buffer); - virtual bool GetCurrentTexture(GPUDebugBuffer &buffer) { - // TODO - return false; - } + virtual bool GetCurrentTexture(GPUDebugBuffer &buffer); protected: virtual void FastRunLoop(DisplayList &list);