Debian Codegraph @

Source/Core/VideoCommon/VertexLoader_Position.h

raw symbols SCIP
1 // Copyright 2008 Dolphin Emulator Project
2 // SPDX-License-Identifier: GPL-2.0-or-later
3
4 #pragma once
5
6 #include "Common/CommonTypes.h"
7 #include "Common/EnumMap.h"
8 #include "Common/Inline.h"
9
10 #include "VideoCommon/CPMemory.h"
11 #include "VideoCommon/VertexLoader.h"
12
13 class VertexLoader_Position
14 {
15 public:
16 static DOLPHIN_FORCE_INLINE u32 GetSize(VertexComponentFormat type, ComponentFormat format,
17 CoordComponentCount elements)
18 {
19 return s_table_size[type][format][elements];
20 }
21
22 static TPipelineFunction GetFunction(VertexComponentFormat type, ComponentFormat format,
23 CoordComponentCount elements);
24
25 private:
26 template <typename T, auto last_member>
27 using EnumMap = typename Common::EnumMap<T, last_member>;
28
29 using SizeTable =
30 EnumMap<EnumMap<EnumMap<u32, CoordComponentCount::XYZ>, ComponentFormat::InvalidFloat7>,
31 VertexComponentFormat::Index16>;
32
33 static constexpr SizeTable s_table_size = []() consteval {
34 SizeTable table{};
35
36 using VCF = VertexComponentFormat;
37 using FMT = ComponentFormat;
38
39 table[VCF::Direct][FMT::UByte] = {2, 3};
40 table[VCF::Direct][FMT::Byte] = {2, 3};
41 table[VCF::Direct][FMT::UShort] = {4, 6};
42 table[VCF::Direct][FMT::Short] = {4, 6};
43 table[VCF::Direct][FMT::Float] = {8, 12};
44 table[VCF::Direct][FMT::InvalidFloat5] = {8, 12};
45 table[VCF::Direct][FMT::InvalidFloat6] = {8, 12};
46 table[VCF::Direct][FMT::InvalidFloat7] = {8, 12};
47
48 table[VCF::Index8][FMT::UByte] = {1, 1};
49 table[VCF::Index8][FMT::Byte] = {1, 1};
50 table[VCF::Index8][FMT::UShort] = {1, 1};
51 table[VCF::Index8][FMT::Short] = {1, 1};
52 table[VCF::Index8][FMT::Float] = {1, 1};
53 table[VCF::Index8][FMT::InvalidFloat5] = {1, 1};
54 table[VCF::Index8][FMT::InvalidFloat6] = {1, 1};
55 table[VCF::Index8][FMT::InvalidFloat7] = {1, 1};
56
57 table[VCF::Index16][FMT::UByte] = {2, 2};
58 table[VCF::Index16][FMT::Byte] = {2, 2};
59 table[VCF::Index16][FMT::UShort] = {2, 2};
60 table[VCF::Index16][FMT::Short] = {2, 2};
61 table[VCF::Index16][FMT::Float] = {2, 2};
62 table[VCF::Index16][FMT::InvalidFloat5] = {2, 2};
63 table[VCF::Index16][FMT::InvalidFloat6] = {2, 2};
64 table[VCF::Index16][FMT::InvalidFloat7] = {2, 2};
65
66 return table;
67 }();
68 };