GS: Remove std::optional from gaps variable.

This commit is contained in:
refractionpcsx2 2024-06-29 13:10:02 +01:00
parent 2ce9dd4689
commit b5258a83c8
3 changed files with 20 additions and 25 deletions

View File

@ -3056,48 +3056,42 @@ bool GSState::SpriteDrawWithoutGaps()
GSState::NoGapsType GSState::PrimitiveCoversWithoutGaps()
{
if (m_primitive_covers_without_gaps.has_value())
return m_primitive_covers_without_gaps.value();
if (m_primitive_covers_without_gaps != Uninitialized)
return m_primitive_covers_without_gaps;
bool issue_found = false;
m_primitive_covers_without_gaps = FullCover;
// Draw shouldn't be offset.
if (((m_r.eq32(GSVector4i::zero())).mask() & 0xff) != 0xff)
{
issue_found = true;
m_primitive_covers_without_gaps = GapsFound;
}
if (m_vt.m_primclass == GS_POINT_CLASS)
{
m_primitive_covers_without_gaps = (m_vertex.next < 2) ? FullCover : GapsFound;
m_primitive_covers_without_gaps = (m_vertex.next < 2) ? m_primitive_covers_without_gaps : GapsFound;
return m_primitive_covers_without_gaps.value();
return m_primitive_covers_without_gaps;
}
else if (m_vt.m_primclass == GS_TRIANGLE_CLASS)
{
m_primitive_covers_without_gaps = (m_index.tail == 6 && TrianglesAreQuads()) ? FullCover : GapsFound;
m_primitive_covers_without_gaps = (m_index.tail == 6 && TrianglesAreQuads()) ? m_primitive_covers_without_gaps : GapsFound;
return m_primitive_covers_without_gaps.value();
return m_primitive_covers_without_gaps;
}
else if (m_vt.m_primclass != GS_SPRITE_CLASS)
{
m_primitive_covers_without_gaps = GapsFound;
return m_primitive_covers_without_gaps.value();
return m_primitive_covers_without_gaps;
}
// Simple case: one sprite.
if (issue_found == false && m_index.tail == 2)
if (m_primitive_covers_without_gaps != GapsFound && m_index.tail == 2)
{
m_primitive_covers_without_gaps = FullCover;
return m_primitive_covers_without_gaps.value();
return m_primitive_covers_without_gaps;
}
if (issue_found)
m_primitive_covers_without_gaps = GapsFound;
else
m_primitive_covers_without_gaps = FullCover;
const NoGapsType result = SpriteDrawWithoutGaps() ? (issue_found ? SpriteNoGaps : m_primitive_covers_without_gaps.value()) : GapsFound;
const NoGapsType result = SpriteDrawWithoutGaps() ? (m_primitive_covers_without_gaps == GapsFound ? SpriteNoGaps : m_primitive_covers_without_gaps) : GapsFound;
m_primitive_covers_without_gaps = result;
return result;

View File

@ -202,7 +202,8 @@ public:
enum NoGapsType
{
GapsFound = 0,
Uninitialized = 0,
GapsFound,
SpriteNoGaps,
FullCover,
};
@ -227,7 +228,7 @@ public:
u32 m_dirty_gs_regs = 0;
int m_backed_up_ctx = 0;
std::vector<GSUploadQueue> m_draw_transfers;
std::optional<NoGapsType> m_primitive_covers_without_gaps;
NoGapsType m_primitive_covers_without_gaps;
GSVector4i m_r = {};
GSVector4i m_r_no_scissor = {};

View File

@ -1251,7 +1251,7 @@ bool GSRendererHW::IsSplitClearActive() const
bool GSRendererHW::IsStartingSplitClear()
{
// Shouldn't have gaps.
if (m_vt.m_eq.rgba != 0xFFFF || (!m_cached_ctx.ZBUF.ZMSK && !m_vt.m_eq.z) || PrimitiveCoversWithoutGaps() == NoGapsType::GapsFound)
if (m_vt.m_eq.rgba != 0xFFFF || (!m_cached_ctx.ZBUF.ZMSK && !m_vt.m_eq.z) || PrimitiveCoversWithoutGaps() != NoGapsType::FullCover)
return false;
// Limit to only single page wide tall draws for now. Too many false positives otherwise (e.g. NFSU).
@ -1289,7 +1289,7 @@ bool GSRendererHW::ContinueSplitClear()
return false;
// Shouldn't have gaps.
if (m_vt.m_eq.rgba != 0xFFFF || (!m_cached_ctx.ZBUF.ZMSK && !m_vt.m_eq.z) || PrimitiveCoversWithoutGaps() == NoGapsType::GapsFound)
if (m_vt.m_eq.rgba != 0xFFFF || (!m_cached_ctx.ZBUF.ZMSK && !m_vt.m_eq.z) || PrimitiveCoversWithoutGaps() != NoGapsType::FullCover)
return false;
// Remove any targets which are directly at the start, since we checked this draw in the last.
@ -1998,7 +1998,7 @@ void GSRendererHW::Draw()
m_cached_ctx.TEST = context->TEST;
m_cached_ctx.FRAME = context->FRAME;
m_cached_ctx.ZBUF = context->ZBUF;
m_primitive_covers_without_gaps.reset();
m_primitive_covers_without_gaps = NoGapsType::Uninitialized;
if (IsBadFrame())
{
@ -3006,7 +3006,7 @@ void GSRendererHW::Draw()
if (!m_texture_shuffle && !m_channel_shuffle)
{
// Try to turn blits in to single sprites, saves upscaling problems when striped clears/blits.
if (m_vt.m_primclass == GS_SPRITE_CLASS && no_gaps != NoGapsType::GapsFound && m_index.tail > 2 && (!PRIM->TME || TextureCoversWithoutGapsNotEqual()) && m_vt.m_eq.rgba == 0xFFFF)
if (m_vt.m_primclass == GS_SPRITE_CLASS && no_gaps == NoGapsType::FullCover && m_index.tail > 2 && (!PRIM->TME || TextureCoversWithoutGapsNotEqual()) && m_vt.m_eq.rgba == 0xFFFF)
{
// Full final framebuffer only.
const GSVector2i fb_size = PCRTCDisplays.GetFramebufferSize(-1);