From 7e72b9fb7b15d4f5bc97d917c4bd09a56cf13105 Mon Sep 17 00:00:00 2001 From: Stenzek Date: Tue, 1 Oct 2024 23:01:18 +1000 Subject: [PATCH] GPU/TextureCache: Fix palette reduction in C4 mode It was only looking at the first row... --- src/core/gpu_hw_texture_cache.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/core/gpu_hw_texture_cache.cpp b/src/core/gpu_hw_texture_cache.cpp index e8ba492bd..873a0b729 100644 --- a/src/core/gpu_hw_texture_cache.cpp +++ b/src/core/gpu_hw_texture_cache.cpp @@ -1498,9 +1498,12 @@ std::pair GPUTextureCache::ReducePaletteBounds(const GSVector4i rect, if (mode == GPUTextureMode::Palette4Bit) { + const u16* row_ptr = &g_vram[rect.y * VRAM_WIDTH + rect.x]; for (u32 y = 0; y < rect_height; y++) { - const u16* ptr = &g_vram[rect.y * VRAM_WIDTH + rect.x]; + const u16* ptr = row_ptr; + row_ptr += VRAM_WIDTH; + for (u32 x = 0; x < rect_width; x++) { const u16 val = *(ptr++); @@ -1519,7 +1522,7 @@ std::pair GPUTextureCache::ReducePaletteBounds(const GSVector4i rect, const u16* row_ptr = &g_vram[rect.y * VRAM_WIDTH + rect.x]; for (u32 y = 0; y < rect_height; y++) { - const u16* ptr = reinterpret_cast(row_ptr); + const u16* ptr = row_ptr; row_ptr += VRAM_WIDTH; if (aligned_width > 0) [[likely]]