Merge remote-tracking branch 'origin/tlotr/native-vu1-gs' into native/renderer

This commit is contained in:
Thomas Martin committed 2026-10-30 00:22:49 +01:00
commit 2d6ecba096
4 files changed
+17 -1

No files matched your search

@@ -32,6 +32,12 @@ namespace ps2x::native
void setDirectGate(DirectGate gate);
bool directSkipped(uint32_t qwords);
// An MSCNT continuing a skipped program counts as a group of its own in the GS stream (its draws land after what
// the stream sent since the MSCAL). Off by default: an adapter that turns it on numbers its groups the same way
// (Vu1StreamAdapter does); the others keep one group per skipped MSCAL / DIRECT.
void setMscntGroups(bool on);
bool mscntGroups();
// VIF1's own registers (the VIF1 thread's, read without a lock): STMASK / STROW / STCOL / STMOD a game set in a
// transfer the adapter did not see (at boot) are there. Null before the runtime registers them.
void setVif1Registers(const VIFRegisters *registers);
@@ -48,6 +48,15 @@ namespace ps2x::native
g_directGate.store(gate, std::memory_order_release);
}
namespace
{
std::atomic<bool> g_mscntGroups{false};
}
void setMscntGroups(bool on) { g_mscntGroups.store(on, std::memory_order_release); }
bool mscntGroups() { return g_mscntGroups.load(std::memory_order_acquire); }
bool directSkipped(uint32_t qwords)
{
const DirectGate gate = g_directGate.load(std::memory_order_acquire);
@@ -173,6 +173,7 @@ namespace ps2x::native
setVif1Observer(&onVif1);
setVu1Gate(&programGate);
setDirectGate(&directGate);
setMscntGroups(true); // an MSCNT is a group of its own here, so VIF1 must count it too
m_installed = true;
}
+1 -1
View File
@@ -758,7 +758,7 @@ uint32_t PS2Memory::processVIF1Data(const uint8_t *data, uint32_t sizeBytes)
vif1_regs.tops = (vif1_regs.base + vif1_regs.ofst) & 0x3FFu;
vif1_regs.stat ^= (1u << 7); // toggle DBF
if (m_vu1ProgramSkipped && m_vu1SkipCallback) // the native port's next group (see Vu1StreamAdapter)
if (m_vu1ProgramSkipped && m_vu1SkipCallback && ps2x::native::mscntGroups()) // the port's next group
m_vu1SkipCallback(~0u);
if (m_vu1MscntCallback && !m_vu1ProgramSkipped)
m_vu1MscntCallback(runTop, runItop);