From 5ca02a505390b891f4357a415a41131fac22c320 Mon Sep 17 00:00:00 2001 From: vlj Date: Mon, 1 Jun 2015 18:55:04 +0200 Subject: [PATCH] d3d12: Fix R5G6B5 being byte swapped --- rpcs3/Emu/RSX/D3D12/D3D12Texture.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/rpcs3/Emu/RSX/D3D12/D3D12Texture.cpp b/rpcs3/Emu/RSX/D3D12/D3D12Texture.cpp index d91984425a..dccfd04f70 100644 --- a/rpcs3/Emu/RSX/D3D12/D3D12Texture.cpp +++ b/rpcs3/Emu/RSX/D3D12/D3D12Texture.cpp @@ -231,6 +231,17 @@ size_t D3D12GSRender::UploadTextures() dst[(row * rowPitch / 4) + j] = src[LinearToSwizzleAddress(j, i, 0, log2width, log2height, 0)]; } } + else if (format == CELL_GCM_TEXTURE_R5G6B5) + { + unsigned short *dst = (unsigned short *)textureData, + *src = (unsigned short *)pixels; + + for (int j = 0; j < m_textures[i].GetWidth(); j++) + { + u16 tmp = src[row * m_texture_pitch + j]; + dst[row * rowPitch / 2 + j] = (tmp >> 8) | (tmp << 8); + } + } else streamToBuffer((char*)textureData + row * rowPitch, (char*)pixels + row * m_texture_pitch, m_texture_pitch); }