From b30d0e8cec8731a147d1ba31185e7a53c1c8d948 Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Sun, 17 Jul 2016 09:03:08 -0700 Subject: [PATCH] d3d9: Correct replaced texture format. This was causing the row width to be wrong for many textures too, which was generating errors. --- GPU/Directx9/TextureCacheDX9.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/GPU/Directx9/TextureCacheDX9.cpp b/GPU/Directx9/TextureCacheDX9.cpp index 0d0683c02a..c2fce59411 100644 --- a/GPU/Directx9/TextureCacheDX9.cpp +++ b/GPU/Directx9/TextureCacheDX9.cpp @@ -1370,7 +1370,9 @@ void TextureCacheDX9::LoadTextureLevel(TexCacheEntry &entry, ReplacedTexture &re int levels = scaleFactor == 1 ? maxLevel + 1 : 1; int tw = w, th = h; D3DFORMAT tfmt = (D3DFORMAT)D3DFMT(dstFmt); - if (!replaced.GetSize(level, tw, th)) { + if (replaced.GetSize(level, tw, th)) { + tfmt = (D3DFORMAT)D3DFMT(ToD3D9Format(replaced.Format(level))); + } else { tw *= scaleFactor; th *= scaleFactor; if (scaleFactor > 1) {