VideoCommon/VertexLoader_Normal: Initialize function table at compile-time

Makes VertexLoader_Normal completely stateless, eliminating the need for
an Init() function, and by extension, also gets rid of the need for the
FifoAnalyzer to have an Init() function.
This commit is contained in:
Lioncash
2019-05-29 22:54:21 -04:00
parent 911755242d
commit 8268b6f454
7 changed files with 138 additions and 147 deletions

View File

@ -10,58 +10,7 @@
class VertexLoader_Normal
{
public:
static void Init();
static u32 GetSize(u64 type, u32 format, u32 elements, u32 index3);
static TPipelineFunction GetFunction(u64 type, u32 format, u32 elements, u32 index3);
private:
enum NormalType
{
NRM_NOT_PRESENT = 0,
NRM_DIRECT = 1,
NRM_INDEX8 = 2,
NRM_INDEX16 = 3,
NUM_NRM_TYPE
};
enum NormalFormat
{
FORMAT_UBYTE = 0,
FORMAT_BYTE = 1,
FORMAT_USHORT = 2,
FORMAT_SHORT = 3,
FORMAT_FLOAT = 4,
NUM_NRM_FORMAT
};
enum NormalElements
{
NRM_NBT = 0,
NRM_NBT3 = 1,
NUM_NRM_ELEMENTS
};
enum NormalIndices
{
NRM_INDICES1 = 0,
NRM_INDICES3 = 1,
NUM_NRM_INDICES
};
struct Set
{
template <typename T>
void operator=(const T&)
{
gc_size = T::size;
function = T::function;
}
int gc_size;
TPipelineFunction function;
};
static Set m_Table[NUM_NRM_TYPE][NUM_NRM_INDICES][NUM_NRM_ELEMENTS][NUM_NRM_FORMAT];
};