GameDatabase: Add GPUTargetCLUT

This commit is contained in:
Stenzek 2023-01-03 22:31:03 +10:00 committed by refractionpcsx2
parent d30e076dbd
commit 38957625ad
7 changed files with 21 additions and 4 deletions

View File

@ -312,7 +312,7 @@ PS_OUTPUT ps_convert_clut_8(PS_INPUT input)
{ {
float2 scale = BGColor.xy; float2 scale = BGColor.xy;
uint2 offset = uint2(uint(EMODA), uint(EMODC)); uint2 offset = uint2(uint(EMODA), uint(EMODC));
uint index = min(uint(input.p.x) + uint(DOFFSET), 240u); uint index = min(uint(input.p.x) + uint(DOFFSET), 255u);
// CLUT is arranged into 8 groups of 16x2, with the top-right and bottom-left quadrants swapped. // CLUT is arranged into 8 groups of 16x2, with the top-right and bottom-left quadrants swapped.
// This can probably be done better.. // This can probably be done better..

View File

@ -335,7 +335,7 @@ uniform vec2 scale;
void ps_convert_clut_8() void ps_convert_clut_8()
{ {
uint index = min(uint(gl_FragCoord.x) + offset.z, 240u); uint index = min(uint(gl_FragCoord.x) + offset.z, 255u);
// CLUT is arranged into 8 groups of 16x2, with the top-right and bottom-left quadrants swapped. // CLUT is arranged into 8 groups of 16x2, with the top-right and bottom-left quadrants swapped.
// This can probably be done better.. // This can probably be done better..

View File

@ -303,7 +303,7 @@ layout(push_constant) uniform cb10
void ps_convert_clut_8() void ps_convert_clut_8()
{ {
uint index = min(uint(gl_FragCoord.x) + doffset, 240u); uint index = min(uint(gl_FragCoord.x) + doffset, 255u);
// CLUT is arranged into 8 groups of 16x2, with the top-right and bottom-left quadrants swapped. // CLUT is arranged into 8 groups of 16x2, with the top-right and bottom-left quadrants swapped.
// This can probably be done better.. // This can probably be done better..

View File

@ -221,6 +221,11 @@
"minimum": 1, "minimum": 1,
"maximum": 2 "maximum": 2
}, },
"gpuTargetCLUT": {
"type": "integer",
"minimum": 0,
"maximum": 2
},
"gpuPaletteConversion": { "gpuPaletteConversion": {
"type": "integer", "type": "integer",
"minimum": 0, "minimum": 0,

View File

@ -2269,7 +2269,7 @@ GSTexture* GSTextureCache::LookupPaletteSource(u32 CBP, u32 CPSM, u32 CBW, GSVec
if (t->m_TEX0.PSM != CPSM || (CBW != 0 && t->m_TEX0.TBW != CBW)) if (t->m_TEX0.PSM != CPSM || (CBW != 0 && t->m_TEX0.TBW != CBW))
continue; continue;
GL_INS("Exact match on BP 0x%04x BW %u", t->m_TEX0.CBP, t->m_TEX0.TBW); GL_INS("Exact match on BP 0x%04x BW %u", t->m_TEX0.TBP0, t->m_TEX0.TBW);
this_offset.x = 0; this_offset.x = 0;
this_offset.y = 0; this_offset.y = 0;
} }

View File

@ -361,6 +361,7 @@ static const char* s_gs_hw_fix_names[] = {
"deinterlace", "deinterlace",
"cpuSpriteRenderBW", "cpuSpriteRenderBW",
"cpuCLUTRender", "cpuCLUTRender",
"gpuTargetCLUT",
"gpuPaletteConversion", "gpuPaletteConversion",
"getSkipCount", "getSkipCount",
"beforeDraw", "beforeDraw",
@ -604,6 +605,9 @@ bool GameDatabaseSchema::GameEntry::configMatchesHWFix(const Pcsx2Config::GSOpti
case GSHWFixId::CPUCLUTRender: case GSHWFixId::CPUCLUTRender:
return (config.UserHacks_CPUCLUTRender == value); return (config.UserHacks_CPUCLUTRender == value);
case GSHWFixId::GPUTargetCLUT:
return (static_cast<int>(config.UserHacks_GPUTargetCLUTMode) == value);
case GSHWFixId::GPUPaletteConversion: case GSHWFixId::GPUPaletteConversion:
return (config.GPUPaletteConversion == ((value > 1) ? (config.TexturePreloading == TexturePreloadingLevel::Full) : (value != 0))); return (config.GPUPaletteConversion == ((value > 1) ? (config.TexturePreloading == TexturePreloadingLevel::Full) : (value != 0)));
@ -753,6 +757,13 @@ u32 GameDatabaseSchema::GameEntry::applyGSHardwareFixes(Pcsx2Config::GSOptions&
config.UserHacks_CPUCLUTRender = value; config.UserHacks_CPUCLUTRender = value;
break; break;
case GSHWFixId::GPUTargetCLUT:
{
if (value >= 0 && value <= static_cast<int>(GSGPUTargetCLUTMode::InsideTarget))
config.UserHacks_GPUTargetCLUTMode = static_cast<GSGPUTargetCLUTMode>(value);
}
break;
case GSHWFixId::GPUPaletteConversion: case GSHWFixId::GPUPaletteConversion:
{ {
// if 2, enable paltex when preloading is full, otherwise leave as-is // if 2, enable paltex when preloading is full, otherwise leave as-is

View File

@ -83,6 +83,7 @@ namespace GameDatabaseSchema
Deinterlace, Deinterlace,
CPUSpriteRenderBW, CPUSpriteRenderBW,
CPUCLUTRender, CPUCLUTRender,
GPUTargetCLUT,
GPUPaletteConversion, GPUPaletteConversion,
GetSkipCount, GetSkipCount,
BeforeDraw, BeforeDraw,