From 4b8d8c875d35aa101e1a425445474ca82005bd56 Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Mon, 19 Feb 2018 09:09:35 -0800 Subject: [PATCH] Qt: Remove old texture debug API. No one's testing it and it's not the best way. We have a better implemented API and should use it instead. --- GPU/D3D11/GPU_D3D11.h | 3 -- GPU/D3D11/TextureCacheD3D11.cpp | 5 -- GPU/D3D11/TextureCacheD3D11.h | 3 -- GPU/Directx9/GPU_DX9.h | 3 -- GPU/Directx9/TextureCacheDX9.cpp | 6 --- GPU/Directx9/TextureCacheDX9.h | 3 -- GPU/GLES/GPU_GLES.h | 3 -- GPU/GLES/TextureCacheGLES.cpp | 79 ------------------------------ GPU/GLES/TextureCacheGLES.h | 3 -- GPU/GPUCommon.h | 3 -- GPU/GPUInterface.h | 1 - GPU/Vulkan/GPU_Vulkan.h | 3 -- Qt/Debugger/debugger_memorytex.cpp | 12 +---- 13 files changed, 1 insertion(+), 126 deletions(-) diff --git a/GPU/D3D11/GPU_D3D11.h b/GPU/D3D11/GPU_D3D11.h index 9d7ff6bc59..f2dea31c61 100644 --- a/GPU/D3D11/GPU_D3D11.h +++ b/GPU/D3D11/GPU_D3D11.h @@ -50,9 +50,6 @@ public: void DoState(PointerWrap &p) override; void ClearShaderCache() override; - bool DecodeTexture(u8 *dest, const GPUgstate &state) override { - return false; - } bool FramebufferDirty() override; bool FramebufferReallyDirty() override; diff --git a/GPU/D3D11/TextureCacheD3D11.cpp b/GPU/D3D11/TextureCacheD3D11.cpp index fc12d417db..dfcd8e9334 100644 --- a/GPU/D3D11/TextureCacheD3D11.cpp +++ b/GPU/D3D11/TextureCacheD3D11.cpp @@ -769,11 +769,6 @@ void TextureCacheD3D11::LoadTextureLevel(TexCacheEntry &entry, ReplacedTexture & FreeAlignedMemory(mapData); } -bool TextureCacheD3D11::DecodeTexture(u8 *output, const GPUgstate &state) { - OutputDebugStringA("TextureCache::DecodeTexture : FixMe\r\n"); - return true; -} - bool TextureCacheD3D11::GetCurrentTextureDebug(GPUDebugBuffer &buffer, int level) { SetTexture(false); if (!nextTexture_) diff --git a/GPU/D3D11/TextureCacheD3D11.h b/GPU/D3D11/TextureCacheD3D11.h index c7fdc9899d..c20ed762a9 100644 --- a/GPU/D3D11/TextureCacheD3D11.h +++ b/GPU/D3D11/TextureCacheD3D11.h @@ -57,9 +57,6 @@ public: shaderManager_ = sm; } - // Only used by Qt UI? - bool DecodeTexture(u8 *output, const GPUgstate &state); - void ForgetLastTexture() override; void InvalidateLastTexture(TexCacheEntry *entry = nullptr) override; diff --git a/GPU/Directx9/GPU_DX9.h b/GPU/Directx9/GPU_DX9.h index 9c0da49c11..1a0a7ee037 100644 --- a/GPU/Directx9/GPU_DX9.h +++ b/GPU/Directx9/GPU_DX9.h @@ -51,9 +51,6 @@ public: void DoState(PointerWrap &p) override; void ClearShaderCache() override; - bool DecodeTexture(u8 *dest, const GPUgstate &state) override { - return textureCacheDX9_->DecodeTexture(dest, state); - } bool FramebufferDirty() override; bool FramebufferReallyDirty() override; diff --git a/GPU/Directx9/TextureCacheDX9.cpp b/GPU/Directx9/TextureCacheDX9.cpp index 53e69baa56..a354f27994 100644 --- a/GPU/Directx9/TextureCacheDX9.cpp +++ b/GPU/Directx9/TextureCacheDX9.cpp @@ -780,12 +780,6 @@ void TextureCacheDX9::LoadTextureLevel(TexCacheEntry &entry, ReplacedTexture &re texture->UnlockRect(level); } -bool TextureCacheDX9::DecodeTexture(u8 *output, const GPUgstate &state) -{ - OutputDebugStringA("TextureCache::DecodeTexture : FixMe\r\n"); - return true; -} - bool TextureCacheDX9::GetCurrentTextureDebug(GPUDebugBuffer &buffer, int level) { SetTexture(true); ApplyTexture(); diff --git a/GPU/Directx9/TextureCacheDX9.h b/GPU/Directx9/TextureCacheDX9.h index 451cb922c5..a4c19572f4 100644 --- a/GPU/Directx9/TextureCacheDX9.h +++ b/GPU/Directx9/TextureCacheDX9.h @@ -49,9 +49,6 @@ public: shaderManager_ = sm; } - // Only used by Qt UI? - bool DecodeTexture(u8 *output, const GPUgstate &state); - void ForgetLastTexture() override; void InvalidateLastTexture(TexCacheEntry *entry = nullptr) override; diff --git a/GPU/GLES/GPU_GLES.h b/GPU/GLES/GPU_GLES.h index 4378f166a7..f23c5ddf9d 100644 --- a/GPU/GLES/GPU_GLES.h +++ b/GPU/GLES/GPU_GLES.h @@ -55,9 +55,6 @@ public: void ClearShaderCache() override; void CleanupBeforeUI() override; - bool DecodeTexture(u8 *dest, const GPUgstate &state) override { - return textureCacheGL_->DecodeTexture(dest, state); - } bool FramebufferDirty() override; bool FramebufferReallyDirty() override; diff --git a/GPU/GLES/TextureCacheGLES.cpp b/GPU/GLES/TextureCacheGLES.cpp index 0430decbf1..7468c4a390 100644 --- a/GPU/GLES/TextureCacheGLES.cpp +++ b/GPU/GLES/TextureCacheGLES.cpp @@ -804,85 +804,6 @@ void TextureCacheGLES::LoadTextureLevel(TexCacheEntry &entry, ReplacedTexture &r } } -// Only used by Qt UI? -bool TextureCacheGLES::DecodeTexture(u8* output, const GPUgstate &state) { - GPUgstate oldState = gstate; - gstate = state; - - u32 texaddr = gstate.getTextureAddress(0); - - if (!Memory::IsValidAddress(texaddr)) { - return false; - } - - GLenum dstFmt = 0; - - GETextureFormat format = gstate.getTextureFormat(); - GEPaletteFormat clutformat = gstate.getClutPaletteFormat(); - u8 level = 0; - - int bufw = GetTextureBufw(level, texaddr, format); - int w = gstate.getTextureWidth(level); - int h = gstate.getTextureHeight(level); - - int pixelSize = dstFmt == GL_UNSIGNED_BYTE ? 4 : 2; - int decPitch = w * pixelSize; - - void *finalBuf = AllocateAlignedMemory(decPitch * h * pixelSize, 16); - DecodeTextureLevel((uint8_t *)finalBuf, decPitch, format, clutformat, texaddr, level, bufw, true, false, false); - - switch (dstFmt) { - case GL_UNSIGNED_SHORT_4_4_4_4: - for (int y = 0; y < h; y++) - for (int x = 0; x < w; x++) { - u32 val = ((u16*)finalBuf)[y*w + x]; - u32 r = ((val>>12) & 0xF) * 17; - u32 g = ((val>> 8) & 0xF) * 17; - u32 b = ((val>> 4) & 0xF) * 17; - u32 a = ((val>> 0) & 0xF) * 17; - ((u32*)output)[y*w + x] = (a << 24) | (r << 16) | (g << 8) | b; - } - break; - - case GL_UNSIGNED_SHORT_5_5_5_1: - for (int y = 0; y < h; y++) - for (int x = 0; x < w; x++) { - u32 val = ((u16*)finalBuf)[y*w + x]; - u32 r = Convert5To8((val>>11) & 0x1F); - u32 g = Convert5To8((val>> 6) & 0x1F); - u32 b = Convert5To8((val>> 1) & 0x1F); - u32 a = (val & 0x1) * 255; - ((u32*)output)[y*w + x] = (a << 24) | (r << 16) | (g << 8) | b; - } - break; - - case GL_UNSIGNED_SHORT_5_6_5: - for (int y = 0; y < h; y++) - for (int x = 0; x < w; x++) { - u32 val = ((u16*)finalBuf)[y*w + x]; - u32 a = 0xFF; - u32 r = Convert5To8((val>>11) & 0x1F); - u32 g = Convert6To8((val>> 5) & 0x3F); - u32 b = Convert5To8((val ) & 0x1F); - ((u32*)output)[y*w + x] = (a << 24) | (r << 16) | (g << 8) | b; - } - break; - - default: - for (int y = 0; y < h; y++) - for (int x = 0; x < w; x++) { - u32 val = ((u32*)finalBuf)[y*w + x]; - ((u32*)output)[y*w + x] = ((val & 0xFF000000)) | ((val & 0x00FF0000)>>16) | ((val & 0x0000FF00)) | ((val & 0x000000FF)<<16); - } - break; - } - - FreeAlignedMemory(finalBuf); - - gstate = oldState; - return true; -} - bool TextureCacheGLES::GetCurrentTextureDebug(GPUDebugBuffer &buffer, int level) { #ifndef USING_GLES2 GPUgstate saved; diff --git a/GPU/GLES/TextureCacheGLES.h b/GPU/GLES/TextureCacheGLES.h index eb81e44663..82756af4f6 100644 --- a/GPU/GLES/TextureCacheGLES.h +++ b/GPU/GLES/TextureCacheGLES.h @@ -63,9 +63,6 @@ public: } } - // Only used by Qt UI? - bool DecodeTexture(u8 *output, const GPUgstate &state); - void SetFramebufferSamplingParams(u16 bufferWidth, u16 bufferHeight); bool GetCurrentTextureDebug(GPUDebugBuffer &buffer, int level) override; diff --git a/GPU/GPUCommon.h b/GPU/GPUCommon.h index 83653c3673..1890166ce8 100644 --- a/GPU/GPUCommon.h +++ b/GPU/GPUCommon.h @@ -227,9 +227,6 @@ public: const std::list& GetDisplayLists() override { return dlQueue; } - bool DecodeTexture(u8* dest, const GPUgstate &state) override { - return false; - } std::vector GetFramebufferList() override; void ClearShaderCache() override {} void CleanupBeforeUI() override {} diff --git a/GPU/GPUInterface.h b/GPU/GPUInterface.h index eeaa7c87a6..101f73e14b 100644 --- a/GPU/GPUInterface.h +++ b/GPU/GPUInterface.h @@ -241,7 +241,6 @@ public: virtual void DumpNextFrame() = 0; virtual void GetReportingInfo(std::string &primaryInfo, std::string &fullInfo) = 0; virtual const std::list& GetDisplayLists() = 0; - virtual bool DecodeTexture(u8* dest, const GPUgstate &state) = 0; virtual std::vector GetFramebufferList() = 0; virtual s64 GetListTicks(int listid) = 0; diff --git a/GPU/Vulkan/GPU_Vulkan.h b/GPU/Vulkan/GPU_Vulkan.h index fcbbf4145d..63813331fb 100644 --- a/GPU/Vulkan/GPU_Vulkan.h +++ b/GPU/Vulkan/GPU_Vulkan.h @@ -54,9 +54,6 @@ public: void DoState(PointerWrap &p) override; void ClearShaderCache() override; - bool DecodeTexture(u8 *dest, const GPUgstate &state) override { - return false; - } bool FramebufferDirty() override; bool FramebufferReallyDirty() override; diff --git a/Qt/Debugger/debugger_memorytex.cpp b/Qt/Debugger/debugger_memorytex.cpp index f077daaaf7..238c1371af 100644 --- a/Qt/Debugger/debugger_memorytex.cpp +++ b/Qt/Debugger/debugger_memorytex.cpp @@ -54,17 +54,7 @@ void Debugger_MemoryTex::on_readBtn_clicked() w = std::max(bufW,w); uchar* newData = new uchar[w*h*4]; - if(gpu->DecodeTexture(newData, state)) - { - QImage img = QImage(newData, w, h, w*4, QImage::Format_ARGB32); // EmuThread_GrabBackBuffer(); - - QPixmap pixmap = QPixmap::fromImage(img); - ui->textureImg->setPixmap(pixmap); - ui->textureImg->setMinimumWidth(pixmap.width()); - ui->textureImg->setMinimumHeight(pixmap.height()); - ui->textureImg->setMaximumWidth(pixmap.width()); - ui->textureImg->setMaximumHeight(pixmap.height()); - } + // TODO: Use GPU_GetCurrentTexture(). Warning: blocks. delete[] newData; }