Debian Codegraph @

Source/Core/VideoCommon/VertexLoader_TextCoord.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_TextCoord
14 {
15 public:
16 static DOLPHIN_FORCE_INLINE u32 GetSize(VertexComponentFormat type, ComponentFormat format,
17 TexComponentCount elements)
18 {
19 return s_table_size[type][format][elements];
20 }
21
22 static TPipelineFunction GetFunction(VertexComponentFormat type, ComponentFormat format,
23 TexComponentCount elements);
24
25 // It is important to synchronize tcIndex, or else the wrong texture coordinate array will be used
26 static TPipelineFunction GetDummyFunction();
27
28 private:
29 template <typename T, auto last_member>
30 using EnumMap = typename Common::EnumMap<T, last_member>;
31
32 using SizeTable =
33 EnumMap<EnumMap<EnumMap<u32, TexComponentCount::ST>, ComponentFormat::InvalidFloat7>,
34 VertexComponentFormat::Index16>;
35
36 static constexpr SizeTable s_table_size = []() consteval {
37 SizeTable table{};
38
39 using VCF = VertexComponentFormat;
40 using FMT = ComponentFormat;
41
42 table[VCF::Direct][FMT::UByte] = {1, 2};
43 table[VCF::Direct][FMT::Byte] = {1, 2};
44 table[VCF::Direct][FMT::UShort] = {2, 4};
45 table[VCF::Direct][FMT::Short] = {2, 4};
46 table[VCF::Direct][FMT::Float] = {4, 8};
47 table[VCF::Direct][FMT::InvalidFloat5] = {4, 8};
48 table[VCF::Direct][FMT::InvalidFloat6] = {4, 8};
49 table[VCF::Direct][FMT::InvalidFloat7] = {4, 8};
50
51 table[VCF::Index8][FMT::UByte] = {1, 1};
52 table[VCF::Index8][FMT::Byte] = {1, 1};
53 table[VCF::Index8][FMT::UShort] = {1, 1};
54 table[VCF::Index8][FMT::Short] = {1, 1};
55 table[VCF::Index8][FMT::Float] = {1, 1};
56 table[VCF::Index8][FMT::InvalidFloat5] = {1, 1};
57 table[VCF::Index8][FMT::InvalidFloat6] = {1, 1};
58 table[VCF::Index8][FMT::InvalidFloat7] = {1, 1};
59
60 table[VCF::Index16][FMT::UByte] = {2, 2};
61 table[VCF::Index16][FMT::Byte] = {2, 2};
62 table[VCF::Index16][FMT::UShort] = {2, 2};
63 table[VCF::Index16][FMT::Short] = {2, 2};
64 table[VCF::Index16][FMT::Float] = {2, 2};
65 table[VCF::Index16][FMT::InvalidFloat5] = {2, 2};
66 table[VCF::Index16][FMT::InvalidFloat6] = {2, 2};
67 table[VCF::Index16][FMT::InvalidFloat7] = {2, 2};
68
69 return table;
70 }();
71 };