From a0629587be61946011a50942b4c5df12b700b1c4 Mon Sep 17 00:00:00 2001 From: Pseudonym Date: Wed, 5 Oct 2016 21:56:29 +0200 Subject: [PATCH] gsdx memory: implement read texture of PS GPU24 convert the swizzled block as tightly packed 24 bits RGB Then convert scanline to standard 32 bits RGBA The HW renderer requires the preload data hack --- plugins/GSdx/GSLocalMemory.cpp | 15 +++++++++++++++ plugins/GSdx/GSRendererSW.cpp | 7 ------- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/plugins/GSdx/GSLocalMemory.cpp b/plugins/GSdx/GSLocalMemory.cpp index acae0cfea9..d43a8e1f8a 100644 --- a/plugins/GSdx/GSLocalMemory.cpp +++ b/plugins/GSdx/GSLocalMemory.cpp @@ -1657,6 +1657,21 @@ void GSLocalMemory::ReadTexture24(const GSOffset* RESTRICT off, const GSVector4i void GSLocalMemory::ReadTextureGPU24(const GSOffset* RESTRICT off, const GSVector4i& r, uint8* dst, int dstpitch, const GIFRegTEXA& TEXA) { + FOREACH_BLOCK_START(r, 16, 8, 16) + { + GSBlock::ReadBlock16(src, read_dst, dstpitch); + } + FOREACH_BLOCK_END + + // Convert packed RGB scanline to 32 bits RGBA + ASSERT(dstpitch >= r.width() * 4); + for(int y = r.top; y < r.bottom; y ++) { + uint8* line = dst + y * dstpitch; + + for(int x = r.right; x >= r.left; x--) { + *(uint32*)&line[x * 4] = *(uint32*)&line[x * 3] & 0xFFFFFF; + } + } } void GSLocalMemory::ReadTexture16(const GSOffset* RESTRICT off, const GSVector4i& r, uint8* dst, int dstpitch, const GIFRegTEXA& TEXA) diff --git a/plugins/GSdx/GSRendererSW.cpp b/plugins/GSdx/GSRendererSW.cpp index 15f8694a49..5f8cbd864c 100644 --- a/plugins/GSdx/GSRendererSW.cpp +++ b/plugins/GSdx/GSRendererSW.cpp @@ -252,13 +252,6 @@ GSTexture* GSRendererSW::GetOutput(int i, int& y_offset) GSRegDISPFB DISPFB = m_regs->DISP[i].DISPFB; -#if 1 - // Hack for PSX until we find the correct way to decode it - if (DISPFB.PSM == 18) { - DISPFB.PSM = PSM_PSMCT16; - } -#endif - int w = DISPFB.FBW * 64; int h = GetFrameRect(i).bottom;