GS: Reduce FindMinMax instantiation count

This commit is contained in:
TellowKrinkle 2022-07-16 02:44:23 -05:00 committed by lightningterror
parent 9d8b93a269
commit f53cb0fae7
2 changed files with 17 additions and 3 deletions

View File

@ -27,9 +27,7 @@ GSVertexTrace::GSVertexTrace(const GSState* state, bool provoking_vertex_first)
memset(&m_alpha, 0, sizeof(m_alpha));
#define InitUpdate3(P, IIP, TME, FST, COLOR) \
m_fmm[COLOR][FST][TME][IIP][P] = \
provoking_vertex_first ? &GSVertexTrace::FindMinMax<P, IIP, TME, FST, COLOR, true> : \
&GSVertexTrace::FindMinMax<P, IIP, TME, FST, COLOR, false>;
m_fmm[COLOR][FST][TME][IIP][P] = GetFMM<P, IIP, TME, FST, COLOR>(provoking_vertex_first);
#define InitUpdate2(P, IIP, TME) \
InitUpdate3(P, IIP, TME, 0, 0) \
@ -153,6 +151,19 @@ void GSVertexTrace::Update(const void* vertex, const u32* index, int v_count, in
}
}
template <GS_PRIM_CLASS primclass, u32 iip, u32 tme, u32 fst, u32 color>
GSVertexTrace::FindMinMaxPtr GSVertexTrace::GetFMM(bool provoking_vertex_first)
{
constexpr bool real_fst = tme ? fst : false;
constexpr bool provoking_vertex_first_class = primclass == GS_LINE_CLASS || primclass == GS_TRIANGLE_CLASS;
const bool swap = provoking_vertex_first_class && !iip && provoking_vertex_first;
if (swap)
return &GSVertexTrace::FindMinMax<primclass, iip, tme, real_fst, color, true>;
else
return &GSVertexTrace::FindMinMax<primclass, iip, tme, real_fst, color, false>;
}
template <GS_PRIM_CLASS primclass, u32 iip, u32 tme, u32 fst, u32 color, bool flat_swapped>
void GSVertexTrace::FindMinMax(const void* vertex, const u32* index, int count)
{

View File

@ -51,6 +51,9 @@ protected:
template <GS_PRIM_CLASS primclass, u32 iip, u32 tme, u32 fst, u32 color, bool provoking_vertex_first>
void FindMinMax(const void* vertex, const u32* index, int count);
template <GS_PRIM_CLASS primclass, u32 iip, u32 tme, u32 fst, u32 color>
FindMinMaxPtr GetFMM(bool provoking_vertex_first);
public:
GS_PRIM_CLASS m_primclass;