Compare commits

...

14 Commits

Author SHA1 Message Date
refractionpcsx2
695c39fba2 GS/HW: Remove channel shuffle override from Namco CRC hack 2025-06-08 16:05:24 +02:00
refractionpcsx2
e5616cff98 GS/HW: Improve shuffle detection robustness 2025-06-08 13:51:19 +02:00
refractionpcsx2
76d5994c1e GS/TC: Improve rect block offset calculation for translation and invalidation 2025-06-08 13:51:19 +02:00
refractionpcsx2
cbb40832a1 GS/HW: Correct block offset target usage 2025-06-08 13:51:19 +02:00
refractionpcsx2
e4bdcde1ca GS/HW: Remove CRC hacks for Kunoichi and Sakura Wars 2025-06-08 13:51:19 +02:00
refractionpcsx2
863e119ff4 GS/HW: Allow conversion of colour to Z formats during HW move 2025-06-08 13:51:19 +02:00
refractionpcsx2
2ccf6dc872 GS: Add IsPageAlignedMasked to return an alignment mask 2025-06-08 13:51:19 +02:00
refractionpcsx2
24ebf1b4f1 GS/HW: Fix bug in target preloading causing misaligned base addresses 2025-06-08 13:51:19 +02:00
refractionpcsx2
ed2832434c GS/HW: Don't look up block offset targets on Exact target lookup 2025-06-08 13:51:19 +02:00
TJnotJT
5e160fca8f Tools: Small fix to gsrunner args. 2025-06-06 18:05:37 -04:00
JordanTheToaster
a0ef82e221 AudioStream: Fix typo with default output latency 2025-06-06 18:03:29 -04:00
icup321
3e7ac3d66c GameDB: Add native scaling to Scooby-Doo! Unmasked 2025-06-06 23:09:37 +02:00
JordanTheToaster
730e6fa737 GameDB: Simple 2000 Vol 92 Fixes 2025-06-06 23:09:26 +02:00
PCSX2 Bot
cdfcd9fddd [ci skip] Qt: Update Base Translation. 2025-06-06 02:31:08 +02:00
10 changed files with 122 additions and 132 deletions

View File

@@ -2557,8 +2557,6 @@ SCAJ-25012:
SCAJ-25026:
name: "Kunoichi Shinobi"
region: "NTSC-Unk"
gsHWFixes:
getSkipCount: "GSC_Kunoichi"
SCAJ-25034:
name: "Sakura Taisen Monogatari"
region: "NTSC-Unk"
@@ -12878,8 +12876,6 @@ SLAJ-25023:
SLAJ-25026:
name: "Kunoichi Shinobi"
region: "NTSC-Unk"
gsHWFixes:
getSkipCount: "GSC_Kunoichi"
SLAJ-25027:
name: "Sonic Heroes"
region: "NTSC-Unk"
@@ -12894,8 +12890,6 @@ SLAJ-25030:
SLAJ-25031:
name: "Kunoichi - Shinobu"
region: "NTSC-C-J"
gsHWFixes:
getSkipCount: "GSC_Kunoichi"
SLAJ-25033:
name: "Puyo Puyo Fever"
region: "NTSC-Unk"
@@ -19388,8 +19382,6 @@ SLES-52238:
name: "Nightshade"
region: "PAL-M5"
compat: 5
gsHWFixes:
getSkipCount: "GSC_Kunoichi"
SLES-52240:
name: "International Pool Championship"
region: "PAL-M5"
@@ -22086,6 +22078,8 @@ SLES-53099:
SLES-53100:
name: "Scooby-Doo! Unmasked"
region: "PAL-M4"
gsHWFixes:
nativeScaling: 2 # Fixes post processing position.
SLES-53104:
name: "Tom Clancy's Rainbow Six - Lockdown"
region: "PAL-M5"
@@ -30956,8 +30950,6 @@ SLKA-25135:
name: "Kunoichi"
region: "NTSC-K"
compat: 5
gsHWFixes:
getSkipCount: "GSC_Kunoichi"
SLKA-25136:
name: "Need for Speed - Underground"
region: "NTSC-K"
@@ -32522,8 +32514,6 @@ SLKA-35004:
name: "Sakura Wars 5 So Long My Love"
region: "NTSC-K"
compat: 5
gsHWFixes:
getSkipCount: "GSC_SakuraWarsSoLongMyLove"
SLKA-35005:
name: "Jin Samguk Mussang 5 - Special"
region: "NTSC-K"
@@ -35217,8 +35207,6 @@ SLPM-61059:
name-sort: "くのいち -しのび- [たいけんばん]"
name-en: "Kunoichi -Shinobi- [Trial]"
region: "NTSC-J"
gsHWFixes:
getSkipCount: "GSC_Kunoichi"
SLPM-61060:
name: "BUSIN 0 Wizardry Alternative NEO [体験版]"
name-sort: "ぶしん ぜろ ~うぃざーどりぃ おるたなてぃぶ ねお~ [たいけんばん]"
@@ -42473,8 +42461,6 @@ SLPM-65447:
name-en: "Kunoichi -Shinobi-"
region: "NTSC-J"
compat: 5
gsHWFixes:
getSkipCount: "GSC_Kunoichi"
SLPM-65448:
name: "カンブリアンQTS ~化石になっても~"
name-sort: "かんぶりあんQTS ~かせきになっても~"
@@ -59136,6 +59122,8 @@ SLPS-25581:
name-sort: "しんぷる2000しりーず Vol. 92 THE のろいのげーむ"
name-en: "Simple 2000 Series Vol. 92 - The Game of a Curse"
region: "NTSC-J"
gsHWFixes:
cpuCLUTRender: 1 # Fixes corrupted and missing graphics.
SLPS-25582:
name: "アストロ球団 決戦!!ビクトリー球団編"
name-sort: "あすとろきゅうだん けっせん!!びくとりーきゅうだんへん"
@@ -66538,8 +66526,6 @@ SLUS-20810:
name: "Nightshade"
region: "NTSC-U"
compat: 5
gsHWFixes:
getSkipCount: "GSC_Kunoichi"
SLUS-20811:
name: "Need for Speed - Underground"
region: "NTSC-U"
@@ -68231,6 +68217,8 @@ SLUS-21091:
name: "Scooby-Doo! Unmasked"
region: "NTSC-U"
compat: 5
gsHWFixes:
nativeScaling: 2 # Fixes post processing position.
SLUS-21093:
name: "Worms Forts - Under Siege"
region: "NTSC-U"
@@ -73133,8 +73121,6 @@ SLUS-21927:
name: "Sakura Wars - So Long, My Love [English - Disc 1]"
region: "NTSC-U"
compat: 5
gsHWFixes:
getSkipCount: "GSC_SakuraWarsSoLongMyLove"
SLUS-21928:
name: "Scooby-Doo! and the Spooky Swamp"
region: "NTSC-U"
@@ -73151,8 +73137,6 @@ SLUS-21930:
name: "Sakura Wars - So Long, My Love [Japanese - Disc 2]"
region: "NTSC-U"
compat: 5
gsHWFixes:
getSkipCount: "GSC_SakuraWarsSoLongMyLove"
SLUS-21931:
name: "Disney/Pixar Toy Story 3"
region: "NTSC-U"

View File

@@ -534,7 +534,7 @@ bool GSRunner::ParseCommandLineArgs(int argc, char* argv[], VMBootParameters& pa
{
std::string str(argv[++i]);
s_settings_interface.SetBoolValue("EmuCore/GS", "dump", true);
s_settings_interface.SetBoolValue("EmuCore/GS", "DumpGSData", true);
if (str.find("rt") != std::string::npos)
s_settings_interface.SetBoolValue("EmuCore/GS", "SaveRT", true);
@@ -766,7 +766,7 @@ bool GSRunner::ParseCommandLineArgs(int argc, char* argv[], VMBootParameters& pa
return false;
}
if (s_settings_interface.GetBoolValue("EmuCore/GS", "dump") && !dumpdir.empty())
if (s_settings_interface.GetBoolValue("EmuCore/GS", "DumpGSData") && !dumpdir.empty())
{
if (s_settings_interface.GetStringValue("EmuCore/GS", "HWDumpDirectory").empty())
s_settings_interface.SetStringValue("EmuCore/GS", "HWDumpDirectory", dumpdir.c_str());

View File

@@ -10866,7 +10866,7 @@ Do you want to load this save and continue?</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../pcsx2/GS/Renderers/Vulkan/GSDeviceVK.cpp" line="5060"/>
<location filename="../../pcsx2/GS/Renderers/Vulkan/GSDeviceVK.cpp" line="5061"/>
<source>Spin GPU During Readbacks is enabled, but calibrated timestamps are unavailable. This might be really slow.</source>
<translation type="unfinished"></translation>
</message>
@@ -10959,7 +10959,7 @@ Please see our official documentation for more information.</source>
<context>
<name>GSDeviceOGL</name>
<message>
<location filename="../../pcsx2/GS/Renderers/OpenGL/GSDeviceOGL.cpp" line="641"/>
<location filename="../../pcsx2/GS/Renderers/OpenGL/GSDeviceOGL.cpp" line="642"/>
<source>OpenGL renderer is not supported. Only OpenGL {}.{}
was found</source>
<translation type="unfinished"></translation>

View File

@@ -446,6 +446,13 @@ std::vector<GSVector2i>* GSLocalMemory::GetPage2TileMap(const GIFRegTEX0& TEX0)
return p2t;
}
u32 GSLocalMemory::IsPageAlignedMasked(u32 psm, const GSVector4i& rc)
{
const psm_t& psm_s = m_psm[psm];
const GSVector4i pgmsk = GSVector4i(psm_s.pgs).xyxy() - GSVector4i(1);
return ((rc & pgmsk) == GSVector4i::zero()).mask();
}
bool GSLocalMemory::IsPageAligned(u32 psm, const GSVector4i& rc)
{
const psm_t& psm_s = m_psm[psm];

View File

@@ -524,6 +524,7 @@ public:
GSPixelOffset4* GetPixelOffset4(const GIFRegFRAME& FRAME, const GIFRegZBUF& ZBUF);
std::vector<GSVector2i>* GetPage2TileMap(const GIFRegTEX0& TEX0);
static bool HasOverlap(u32 src_bp, u32 src_bw, u32 src_psm, GSVector4i src_rect, u32 dst_bp, u32 dst_bw, u32 dst_psm, GSVector4i dst_rect);
static u32 IsPageAlignedMasked(u32 psm, const GSVector4i& rc);
static bool IsPageAligned(u32 psm, const GSVector4i& rc);
static u32 GetStartBlockAddress(u32 bp, u32 bw, u32 psm, GSVector4i rect);
static u32 GetEndBlockAddress(u32 bp, u32 bw, u32 psm, GSVector4i rect);

View File

@@ -184,40 +184,6 @@ bool GSHwHack::GSC_NamcoGames(GSRendererHW& r, int& skip)
{
if (skip == 0)
{
if (r.IsPossibleChannelShuffle() && !(RTBP0 & 31))
{
GSVertex* v = &r.m_vertex.buff[0];
// Make sure we're detecting the right effect.
if (((v[1].XYZ.X - v[0].XYZ.X) >> 4) != 8 || ((v[1].XYZ.Y - v[0].XYZ.Y) >> 4) != 14)
return false;
GSTextureCache::Target* rt = g_texture_cache->LookupTarget(GIFRegTEX0::Create(RTBP0, RFBW, RFPSM),
GSVector2i(1, 1), r.GetTextureScaleFactor(), GSTextureCache::RenderTarget);
if (!rt)
return false;
GL_INS("GSC_NamcoGames(): HLE channel shuffle");
// have to set up the palette ourselves too, since GSC executes before it does
r.m_mem.m_clut.Read32(RTEX0, r.m_draw_env->TEXA);
std::shared_ptr<GSTextureCache::Palette> palette =
g_texture_cache->LookupPaletteObject(r.m_mem.m_clut, GSLocalMemory::m_psm[RTEX0.PSM].pal, true);
if (!palette)
return false;
GSHWDrawConfig& conf = r.BeginHLEHardwareDraw(
rt->GetTexture(), nullptr, rt->GetScale(), rt->GetTexture(), rt->GetScale(), rt->GetUnscaledRect());
conf.pal = palette->GetPaletteGSTexture();
conf.ps.channel = ChannelFetch_RGB;
conf.colormask.wa = false;
r.EndHLEHardwareDraw(false);
// 12 pages: 2 calls by channel, 3 channels, 1 blit
skip = 12 * (3 + 3 + 1);
return true;
}
if (!s_nativeres && r.PRIM->PRIM == GS_SPRITE && RTME && RTEX0.TFX == 1 && RFPSM == RTPSM && RTPSM == PSMCT32 && RFBMSK == 0xFF000000 && r.m_index.tail > 2)
{
GSVertex* v = &r.m_vertex.buff[0];
@@ -431,31 +397,6 @@ bool GSHwHack::GSC_TalesOfLegendia(GSRendererHW& r, int& skip)
return true;
}
bool GSHwHack::GSC_Kunoichi(GSRendererHW& r, int& skip)
{
if (skip == 0)
{
if (!RTME && (RFBP == 0x0 || RFBP == 0x00700 || RFBP == 0x00800) && RFPSM == PSMCT32 && RFBMSK == 0x00FFFFFF)
{
// Removes depth effects(shadows) not rendered correctly on all renders.
skip = 3;
}
if (RTME && (RFBP == 0x0700 || RFBP == 0) && RTBP0 == 0x0e00 && RTPSM == 0 && RFBMSK == 0)
{
skip = 1; // Removes black screen (not needed anymore maybe)?
}
}
else
{
if (RTME && (RFBP == 0x0e00) && RFPSM == PSMCT32 && RFBMSK == 0xFF000000)
{
skip = 0;
}
}
return true;
}
bool GSHwHack::GSC_ZettaiZetsumeiToshi2(GSRendererHW& r, int& skip)
{
if (skip == 0)
@@ -505,27 +446,6 @@ bool GSHwHack::GSC_ZettaiZetsumeiToshi2(GSRendererHW& r, int& skip)
return true;
}
bool GSHwHack::GSC_SakuraWarsSoLongMyLove(GSRendererHW& r, int& skip)
{
if (skip == 0)
{
if (RTME == 0 && RFBP != RTBP0 && RTBP0 && RFBMSK == 0x00FFFFFF)
{
skip = 3; // Remove darkness
}
else if (RTME == 0 && RFBP == RTBP0 && (RTBP0 == 0x1200 || RTBP0 == 0x1180 || RTBP0 == 0) && RFBMSK == 0x00FFFFFF)
{
skip = 3; // Remove darkness
}
else if (RTME && (RFBP == 0 || RFBP == 0x1180) && RFPSM == PSMCT32 && RTBP0 == 0x3F3F && RTPSM == PSMT8)
{
skip = 1; // Floodlight
}
}
return true;
}
bool GSHwHack::GSC_UltramanFightingEvolution(GSRendererHW& r, int& skip)
{
if (skip == 0)
@@ -1393,12 +1313,10 @@ bool GSHwHack::MV_Ico(GSRendererHW& r)
#define CRC_F(name) { #name, &GSHwHack::name }
const GSHwHack::Entry<GSRendererHW::GSC_Ptr> GSHwHack::s_get_skip_count_functions[] = {
CRC_F(GSC_Kunoichi),
CRC_F(GSC_Manhunt2),
CRC_F(GSC_MidnightClub3),
CRC_F(GSC_SacredBlaze),
CRC_F(GSC_GuitarHero),
CRC_F(GSC_SakuraWarsSoLongMyLove),
CRC_F(GSC_SFEX3),
CRC_F(GSC_DTGames),
CRC_F(GSC_TalesOfLegendia),

View File

@@ -16,9 +16,7 @@ public:
static bool GSC_BlackAndBurnoutSky(GSRendererHW& r, int& skip);
static bool GSC_MidnightClub3(GSRendererHW& r, int& skip);
static bool GSC_TalesOfLegendia(GSRendererHW& r, int& skip);
static bool GSC_Kunoichi(GSRendererHW& r, int& skip);
static bool GSC_ZettaiZetsumeiToshi2(GSRendererHW& r, int& skip);
static bool GSC_SakuraWarsSoLongMyLove(GSRendererHW& r, int& skip);
static bool GSC_UltramanFightingEvolution(GSRendererHW& r, int& skip);
static bool GSC_TalesofSymphonia(GSRendererHW& r, int& skip);
static bool GSC_UrbanReign(GSRendererHW& r, int& skip);

View File

@@ -2862,7 +2862,9 @@ void GSRendererHW::Draw()
GIFRegTEX0 FRAME_TEX0;
bool shuffle_target = false;
if (!no_rt && GSLocalMemory::m_psm[m_cached_ctx.FRAME.PSM].bpp == 16 && GSLocalMemory::m_psm[m_cached_ctx.TEX0.PSM].bpp >= 16 &&
const u32 page_alignment = GSLocalMemory::IsPageAlignedMasked(m_cached_ctx.TEX0.PSM, m_r);
const bool page_aligned = (page_alignment & 0xF0F0) != 0; // Make sure Y is page aligned.
if (!no_rt && page_aligned && m_cached_ctx.ZBUF.ZMSK && GSLocalMemory::m_psm[m_cached_ctx.FRAME.PSM].bpp == 16 && GSLocalMemory::m_psm[m_cached_ctx.TEX0.PSM].bpp >= 16 &&
(m_vt.m_primclass == GS_SPRITE_CLASS || (m_vt.m_primclass == GS_TRIANGLE_CLASS && (m_index.tail % 6) == 0 && TrianglesAreQuads(true) && m_index.tail > 6)))
{
// Tail check is to make sure we have enough strips to go all the way across the page, or if it's using a region clamp could be used to draw strips.

View File

@@ -228,8 +228,8 @@ bool GSTextureCache::CanTranslate(u32 bp, u32 bw, u32 spsm, GSVector4i r, u32 db
{
const GSVector2i src_page_size = GSLocalMemory::m_psm[spsm].pgs;
const GSVector2i dst_page_size = GSLocalMemory::m_psm[dpsm].pgs;
const bool bp_page_aligned_bp = ((bp & ~((1 << 5) - 1)) == bp) || bp == dbp;
const bool block_layout_match = GSLocalMemory::m_psm[spsm].bpp == GSLocalMemory::m_psm[dpsm].bpp;
const bool bp_page_aligned_bp = ((bp & ~((1 << 5) - 1)) == bp) || bp == dbp || (block_layout_match && bw == dbw);
const GSVector4i page_mask(GSVector4i((src_page_size.x - 1), (src_page_size.y - 1)).xyxy());
const GSVector4i masked_rect(r & ~page_mask);
const int src_pixel_width = static_cast<int>(bw * 64);
@@ -276,7 +276,7 @@ GSVector4i GSTextureCache::TranslateAlignedRectByPage(u32 tbp, u32 tebp, u32 tbw
int page_offset = (static_cast<int>(sbp) - static_cast<int>(tbp)) >> 5;
int block_offset = (static_cast<int>(sbp) - static_cast<int>(tbp)) & 0x1F;
if (!(s_psm.bpp == t_psm.bpp))
if (!(s_psm.bpp == t_psm.bpp) || block_offset)
{
if (block_offset)
in_rect = in_rect.ralign<Align_Outside>(s_psm.bs);
@@ -299,6 +299,33 @@ GSVector4i GSTextureCache::TranslateAlignedRectByPage(u32 tbp, u32 tebp, u32 tbw
DevCon.Warning("Error translating rect");
return GSVector4i::zero();
}
const bool block_matched_format = s_psm.bpp == t_psm.bpp && (sbw == tbw || sbw == 1);
// If there is block offset left over, try to adjust to that.
if (block_matched_format)
{
GSVector4i b2a_offset = GSVector4i::zero();
const GSVector4i target_rect = GSVector4i(0, 0, src_bw, 2048);
bool offset_found = false;
for (b2a_offset.x = target_rect.x; b2a_offset.x < target_rect.z; b2a_offset.x += s_psm.bs.x)
{
for (b2a_offset.y = target_rect.y; b2a_offset.y < target_rect.w; b2a_offset.y += s_psm.bs.y)
{
const u32 a_candidate_bp = s_psm.info.bn(b2a_offset.x, b2a_offset.y, tbp, sbw);
if (sbp == a_candidate_bp)
{
offset_found = true;
break;
}
}
if (offset_found)
break;
}
if (offset_found)
in_rect = (in_rect + b2a_offset.xyxy()).max_i32(GSVector4i(0));
}
}
GSVector4i new_rect = GSVector4i::zero();
@@ -618,7 +645,7 @@ void GSTextureCache::DirtyRectByPage(u32 sbp, u32 spsm, u32 sbw, Target* t, GSVe
int block_offset = static_cast<int>(sbp) - static_cast<int>(target_bp);
// Different format needs to be page aligned, unless the block layout matches, then we can block align
// Might be able to translate the original rect.
if (!(src_info->bpp == dst_info->bpp))
if (!(src_info->bpp == dst_info->bpp) || block_offset)
{
const int src_bpp = src_info->bpp;
const bool column_align = !block_offset && src_r.z <= src_info->cs.x && src_r.w <= src_info->cs.y && src_info->depth == dst_info->depth;
@@ -741,7 +768,7 @@ void GSTextureCache::DirtyRectByPage(u32 sbp, u32 spsm, u32 sbw, Target* t, GSVe
const int yblocks = in_rect.height() / src_info->bs.y;
// if !(block_offset & 0x7) is false, this is technically incorrect, but FFX hates it and starts making a mess, so it's better this way without adding complexity.
// TODO maybe: Add per block invalidation? ugh, would have to keep that to small blocks. 2 blocks in the case of FFX.
if ((xblocks <= 4 && yblocks <= 2) || req_depth_offset)
if ((xblocks <= (src_info->pgs.x / src_info->bs.x) && yblocks <= (src_info->pgs.y / src_info->bs.y)) || req_depth_offset)
{
GSVector4i b2a_offset = GSVector4i::zero();
const GSVector4i target_rect = GSVector4i(0, 0, src_width, 2048);
@@ -1279,11 +1306,6 @@ GSTextureCache::Source* GSTextureCache::LookupSource(const bool is_color, const
// Make sure it is page aligned, otherwise things get messy with the pixel order (Tomb Raider Legend).
if (t->m_used)
{
// If the BP is block offset it's unlikely to be a target, but a target can be made by a HW move, so we need to check for a match.
// Good for Baldurs Gate Dark Alliance (HW Move), bad for Tomb Raider Legends (just offset).
if (((bp & (BLOCKS_PER_PAGE - 1)) != (t->m_TEX0.TBP0 & (BLOCKS_PER_PAGE - 1))) && (bp & (BLOCKS_PER_PAGE - 1)))
continue;
//const bool overlaps = t->Inside(bp, bw, psm, block_boundary_rect);
const bool overlaps = t->Overlaps(bp, bw, psm, block_boundary_rect);
// Try to make sure the target has available what we need, be careful of self referencing frames with font in the alpha.
@@ -1293,6 +1315,12 @@ GSTextureCache::Source* GSTextureCache::LookupSource(const bool is_color, const
if (!overlaps || (found_t && (GSState::s_n - dst->m_last_draw) < (GSState::s_n - t->m_last_draw)))
continue;
// If the BP is offset in to a page and the format does not match, trying to match up the correct position is very difficult since we don't swizzle.
// Tomb Raider Legends does a block level BP in PSMT8 over a C16 target, which is just a nightmare to get right.
// Baldurs Gate used to have this too, but now we can translate HW moves inside targets when the format matches.
if (((bp & (BLOCKS_PER_PAGE - 1)) != (t->m_TEX0.TBP0 & (BLOCKS_PER_PAGE - 1))) && (bp & (BLOCKS_PER_PAGE - 1)) && !CanTranslate(bp, bw, psm, block_boundary_rect, t->m_TEX0.TBP0, t->m_TEX0.PSM, t->m_TEX0.TBW))
continue;
const bool width_match = (std::max(64U, bw * 64U) >> GSLocalMemory::m_psm[psm].info.pageShiftX()) ==
(std::max(64U, t->m_TEX0.TBW * 64U) >> GSLocalMemory::m_psm[t->m_TEX0.PSM].info.pageShiftX());
@@ -3543,11 +3571,11 @@ bool GSTextureCache::PreloadTarget(GIFRegTEX0 TEX0, const GSVector2i& size, cons
continue;
}
const int height_adjust = (((dst_end_block - t->m_TEX0.TBP0) >> 5) / std::max(t->m_TEX0.TBW, 1U)) * GSLocalMemory::m_psm[t->m_TEX0.PSM].pgs.y;
const int height_adjust = ((((dst_end_block + 31) - t->m_TEX0.TBP0) >> 5) / std::max(t->m_TEX0.TBW, 1U)) * GSLocalMemory::m_psm[t->m_TEX0.PSM].pgs.y;
if (height_adjust < t->m_unscaled_size.y)
{
t->m_TEX0.TBP0 = dst_end_block;
t->m_TEX0.TBP0 = GSLocalMemory::GetStartBlockAddress(t->m_TEX0.TBP0, t->m_TEX0.TBW, t->m_TEX0.PSM, GSVector4i(0, height_adjust, t->m_valid.z, t->m_valid.w));
t->m_valid.w -= height_adjust;
t->ResizeValidity(t->m_valid);
@@ -4733,7 +4761,7 @@ bool GSTextureCache::Move(u32 SBP, u32 SBW, u32 SPSM, int sx, int sy, u32 DBP, u
// Not even going to go down the rabbit hole of palette formats on the GPU.. We shouldn't have any targets with P4/P8 anyway.
const GSLocalMemory::psm_t& spsm_s = GSLocalMemory::m_psm[SPSM];
const GSLocalMemory::psm_t& dpsm_s = GSLocalMemory::m_psm[DPSM];
if (SPSM != DPSM || ((spsm_s.pal + dpsm_s.pal) != 0 && !alpha_only))
if (GSLocalMemory::m_psm[SPSM].bpp != GSLocalMemory::m_psm[DPSM].bpp || ((spsm_s.pal + dpsm_s.pal) != 0 && !alpha_only))
{
GL_CACHE("TC: Skipping HW move from 0x%X to 0x%X with SPSM=%s DPSM=%s", SBP, DBP, psm_str(SPSM), psm_str(DPSM));
return false;
@@ -4749,6 +4777,7 @@ bool GSTextureCache::Move(u32 SBP, u32 SBW, u32 SPSM, int sx, int sy, u32 DBP, u
return false;
}
bool req_resize = false;
if (m_expected_src_bp == static_cast<int>(SBP) && m_expected_dst_bp == static_cast<int>(DBP))
{
// Get the new position so we can work out the offset.
@@ -4759,7 +4788,7 @@ bool GSTextureCache::Move(u32 SBP, u32 SBW, u32 SPSM, int sx, int sy, u32 DBP, u
sy += rect_offset.y;
dx += rect_offset.x;
dy += rect_offset.y;
req_resize = true;
GL_INS("TC: Detected striped move, realigning from SBP %x->%x DBP %x->%x", SBP, m_remembered_src_bp, DBP, m_remembered_dst_bp);
SBP = m_remembered_src_bp;
@@ -4804,15 +4833,18 @@ bool GSTextureCache::Move(u32 SBP, u32 SBW, u32 SPSM, int sx, int sy, u32 DBP, u
const GSVector2i target_size = GetTargetSize(DBP, DBW, DPSM, Common::AlignUpPow2(w, 64), h);
dst = LookupTarget(new_TEX0, target_size, src->m_scale, src->m_type);
if (!dst)
dst = CreateTarget(new_TEX0, target_size, target_size, src->m_scale, src->m_type);
{
dst = Target::Create(new_TEX0, target_size.x, target_size.y, src->m_scale, GSLocalMemory::m_psm[DPSM].depth, true);
if (!dst) [[unlikely]]
return false;
}
else // Expand if necessary (Silent hill 4 takes an old target which is smaller).
{
dst->ResizeTexture(std::max(dst->m_unscaled_size.x, target_size.x), std::max(dst->m_unscaled_size.y, target_size.y));
req_resize = true;
// If it was matched to an old target, make sure to clear the other type and update its information.
if (dst->m_was_dst_matched)
{
g_texture_cache->InvalidateVideoMemType(GSTextureCache::DepthStencil - dst->m_type, dst->m_TEX0.TBP0);
dst->m_TEX0 = new_TEX0;
}
}
@@ -4827,6 +4859,24 @@ bool GSTextureCache::Move(u32 SBP, u32 SBW, u32 SPSM, int sx, int sy, u32 DBP, u
if (!src || !dst || src->m_scale != dst->m_scale)
return false;
// If we have an offset, adjust the base positions
if (src->m_TEX0.TBP0 != SBP)
{
GSVector4i offset = TranslateAlignedRectByPage(dst, SBP, SPSM, SBW, GSVector4i(0, 1).xxyy(), false);
sx += offset.x;
sy += offset.y;
}
if (dst->m_TEX0.TBP0 != DBP)
{
GSVector4i offset = TranslateAlignedRectByPage(dst, DBP, DPSM, DBW, GSVector4i(0, 1).xxyy(), false);
dx += offset.x;
dy += offset.y;
req_resize = true;
}
// Scale coordinates.
const float scale = src->m_scale;
const int scaled_sx = static_cast<int>(sx * scale);
@@ -4840,6 +4890,11 @@ bool GSTextureCache::Move(u32 SBP, u32 SBW, u32 SPSM, int sx, int sy, u32 DBP, u
if ((scaled_sx + scaled_w) > src->m_texture->GetWidth() || (scaled_sy + scaled_h) > src->m_texture->GetHeight())
return false;
if (req_resize)
{
const GSVector2i target_size = GetTargetSize(DBP, DBW, DPSM, Common::AlignUpPow2(dx + w, 64), dx + h);
dst->ResizeTexture(std::max(dst->m_unscaled_size.x, target_size.x), std::max(dst->m_unscaled_size.y, target_size.y));
}
// We don't want to copy "old" data that the game has overwritten with writes,
// so flush any overlapping dirty area.
src->UpdateIfDirtyIntersects(GSVector4i(sx, sy, sx + w, sy + h));
@@ -4848,6 +4903,9 @@ bool GSTextureCache::Move(u32 SBP, u32 SBW, u32 SPSM, int sx, int sy, u32 DBP, u
// we're not going to be able to use it as a source.
dst->Update();
// Invalidate any opposite targets.
g_texture_cache->InvalidateVideoMemType(GSTextureCache::DepthStencil - dst->m_type, dst->m_TEX0.TBP0);
// Expand the target when we used a more conservative size.
const int required_dh = scaled_dy + scaled_h;
if ((scaled_dx + scaled_w) <= dst->m_texture->GetWidth() && required_dh > dst->m_texture->GetHeight())
@@ -4936,9 +4994,30 @@ bool GSTextureCache::Move(u32 SBP, u32 SBW, u32 SPSM, int sx, int sy, u32 DBP, u
{
if (SPSM == PSMT8H && SPSM == DPSM)
{
ShaderConvert shader = ShaderConvert::COPY;
const GSVector4 src_rect = GSVector4(scaled_sx, scaled_sy, scaled_sx + scaled_w, scaled_sy + scaled_h) / (GSVector4(src->m_texture->GetSize()).xyxy());
const GSVector4 dst_rect = GSVector4(scaled_dx, scaled_dy, (scaled_dx + scaled_w), (scaled_dy + scaled_h));
g_gs_device->StretchRect(src->m_texture, src_rect, dst->m_texture, dst_rect, false, false, false, true);
g_gs_device->StretchRect(src->m_texture, src_rect, dst->m_texture, dst_rect, false, false, false, true, shader);
}
else if (src->m_type != dst->m_type)
{
ShaderConvert shader = dst->m_type ? ShaderConvert::RGBA8_TO_FLOAT32 : ShaderConvert::FLOAT32_TO_RGBA8;
switch (dpsm_s.trbpp)
{
case 24:
shader = dst->m_type ? ShaderConvert::RGBA8_TO_FLOAT24 : ShaderConvert::FLOAT32_TO_RGB8;
break;
case 16:
shader = dst->m_type ? ShaderConvert::RGB5A1_TO_FLOAT16 : ShaderConvert::FLOAT16_TO_RGB5A1;
break;
default:
break;
}
const GSVector4 src_rect = GSVector4(scaled_sx, scaled_sy, scaled_sx + scaled_w, scaled_sy + scaled_h) / (GSVector4(src->m_texture->GetSize()).xyxy());
g_gs_device->StretchRect(src->m_texture, src_rect, dst->m_texture, GSVector4(scaled_sx, scaled_sy, scaled_sx + scaled_w, scaled_sy + scaled_h), shader, false);
}
else
{
@@ -4966,7 +5045,8 @@ bool GSTextureCache::Move(u32 SBP, u32 SBW, u32 SPSM, int sx, int sy, u32 DBP, u
dst->m_alpha_range |= src->m_alpha_range;
}
if (GSLocalMemory::IsPageAligned(src->m_TEX0.PSM, GSVector4i(sx, sy, sx + w, sy + h)) && (w == GSLocalMemory::m_psm[src->m_TEX0.PSM].pgs.x || h == GSLocalMemory::m_psm[src->m_TEX0.PSM].pgs.y))
u32 page_mask = GSLocalMemory::IsPageAlignedMasked(src->m_TEX0.PSM, GSVector4i(sx, sy, sx + w, sy + h));
if (((page_mask & 0x0f0f) == 0x0f0f || (page_mask & 0xf0f0) == 0xf0f0) && (w == GSLocalMemory::m_psm[src->m_TEX0.PSM].pgs.x || h == GSLocalMemory::m_psm[src->m_TEX0.PSM].pgs.y))
{
// Vertical Strips
if (w == GSLocalMemory::m_psm[src->m_TEX0.PSM].pgs.x)
@@ -5001,7 +5081,7 @@ bool GSTextureCache::Move(u32 SBP, u32 SBW, u32 SPSM, int sx, int sy, u32 DBP, u
// Invalidate any sources that overlap with the target (since they're now stale).
InvalidateVideoMem(g_gs_renderer->m_mem.GetOffset(DBP, DBW, DPSM), GSVector4i(dx, dy, dx + w, dy + h), false);
CombineAlignedInsideTargets(dst);
return true;
}
@@ -5188,7 +5268,7 @@ GSTextureCache::Target* GSTextureCache::GetExactTarget(u32 BP, u32 BW, int type,
{
Target* t = *it;
const u32 tgt_bw = std::max(t->m_TEX0.TBW, 1U);
if ((t->m_TEX0.TBP0 == BP || (GSConfig.UserHacks_TextureInsideRt >= GSTextureInRtMode::InsideTargets && t->m_TEX0.TBP0 < BP && (((BP - t->m_TEX0.TBP0) >> 5) % tgt_bw) == 0)) && tgt_bw == BW && t->UnwrappedEndBlock() >= end_bp)
if ((t->m_TEX0.TBP0 == BP || (GSConfig.UserHacks_TextureInsideRt >= GSTextureInRtMode::InsideTargets && t->m_TEX0.TBP0 < BP && !(BP & 0x1f) && (((BP - t->m_TEX0.TBP0) >> 5) % tgt_bw) == 0)) && tgt_bw == BW && t->UnwrappedEndBlock() >= end_bp)
{
rts.MoveFront(it.Index());
return t;

View File

@@ -857,7 +857,7 @@ void AudioStreamParameters::LoadSave(SettingsWrapper& wrap, const char* section)
wrap.EnumEntry(section, "ExpansionMode", expansion_mode, &AudioStream::ParseExpansionMode, &AudioStream::GetExpansionModeName, DEFAULT_EXPANSION_MODE);
minimal_output_latency = wrap.EntryBitBool(section, "OutputLatencyMinimal", DEFAULT_OUTPUT_LATENCY_MINIMAL);
buffer_ms = static_cast<u16>(std::clamp<int>(wrap.EntryBitfield(section, "BufferMS", buffer_ms, DEFAULT_BUFFER_MS), 0, std::numeric_limits<u16>::max()));
output_latency_ms = static_cast<u16>(std::clamp<int>(wrap.EntryBitfield(section, "OutputLatencyMS", buffer_ms, DEFAULT_OUTPUT_LATENCY_MS), 0, std::numeric_limits<u16>::max()));
output_latency_ms = static_cast<u16>(std::clamp<int>(wrap.EntryBitfield(section, "OutputLatencyMS", output_latency_ms, DEFAULT_OUTPUT_LATENCY_MS), 0, std::numeric_limits<u16>::max()));
stretch_sequence_length_ms = static_cast<u16>(std::clamp<int>(wrap.EntryBitfield(section, "StretchSequenceLengthMS", DEFAULT_STRETCH_SEQUENCE_LENGTH), 0, std::numeric_limits<u16>::max()));
stretch_seekwindow_ms = static_cast<u16>(std::clamp<int>(wrap.EntryBitfield(section, "StretchSeekWindowMS", DEFAULT_STRETCH_SEEKWINDOW), 0, std::numeric_limits<u16>::max()));