From a123e6518521f3d59c628678c11031a4d2d8358c Mon Sep 17 00:00:00 2001 From: Gregory Hainaut Date: Sat, 3 Sep 2016 00:11:56 +0200 Subject: [PATCH] gsdx sw: handle the invalidation of the palette when written by the GS Manual gives all setup to upload a palette from the host. But nothing forbid to render directly in the palette buffer. (GS rule nb 1, there is no rule ^^) Fix Virtua Fighter 2 dark colors However I'm not sure we can fix HW renderer. Rendering is done on the GPU but palette handling is done on the CPU... So we need to read back data (ouch, and slow). A quick test didn't get the expected results. Potentially there are others bugs (aka not gonna happen on the HW renderer) --- plugins/GSdx/GSClut.cpp | 7 +++++++ plugins/GSdx/GSClut.h | 1 + plugins/GSdx/GSRendererSW.cpp | 2 ++ 3 files changed, 10 insertions(+) diff --git a/plugins/GSdx/GSClut.cpp b/plugins/GSdx/GSClut.cpp index 30808bcd47..f9e1f516b7 100644 --- a/plugins/GSdx/GSClut.cpp +++ b/plugins/GSdx/GSClut.cpp @@ -98,6 +98,13 @@ void GSClut::Invalidate() m_write.dirty = true; } +void GSClut::Invalidate(uint32 block) +{ + if (block == m_write.TEX0.CBP) { + m_write.dirty = true; + } +} + bool GSClut::WriteTest(const GIFRegTEX0& TEX0, const GIFRegTEXCLUT& TEXCLUT) { switch(TEX0.CLD) diff --git a/plugins/GSdx/GSClut.h b/plugins/GSdx/GSClut.h index a4c6ce750a..df3c713518 100644 --- a/plugins/GSdx/GSClut.h +++ b/plugins/GSdx/GSClut.h @@ -103,6 +103,7 @@ public: virtual ~GSClut(); void Invalidate(); + void Invalidate(uint32 block); bool WriteTest(const GIFRegTEX0& TEX0, const GIFRegTEXCLUT& TEXCLUT); void Write(const GIFRegTEX0& TEX0, const GIFRegTEXCLUT& TEXCLUT); //void Read(const GIFRegTEX0& TEX0); diff --git a/plugins/GSdx/GSRendererSW.cpp b/plugins/GSdx/GSRendererSW.cpp index 6b8d20f121..1c462a1ff7 100644 --- a/plugins/GSdx/GSRendererSW.cpp +++ b/plugins/GSdx/GSRendererSW.cpp @@ -665,6 +665,8 @@ void GSRendererSW::Queue(shared_ptr& item) if(sd->global.sel.fwrite) { m_tc->InvalidatePages(sd->m_fb_pages, sd->m_fpsm); + + m_mem.m_clut.Invalidate(m_context->FRAME.Block()); } if(sd->global.sel.zwrite)