summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Yuri Kunde Schlesner2017-01-28 13:27:24 -0800
committerGravatar Yuri Kunde Schlesner2017-02-04 13:59:12 -0800
commit5759d94b5c5b11af426668d046d206839bc5e802 (patch)
tree971681341d1134533fd485e20cfe4863aa34ce27 /src
parentVideoCore: Split shader regs from Regs struct (diff)
downloadyuzu-5759d94b5c5b11af426668d046d206839bc5e802.tar.gz
yuzu-5759d94b5c5b11af426668d046d206839bc5e802.tar.xz
yuzu-5759d94b5c5b11af426668d046d206839bc5e802.zip
VideoCore: Move Regs to its own file
Diffstat (limited to 'src')
-rw-r--r--src/citra_qt/debugger/graphics/graphics_cmdlists.cpp2
-rw-r--r--src/citra_qt/debugger/graphics/graphics_surface.cpp2
-rw-r--r--src/citra_qt/debugger/graphics/graphics_tracing.cpp1
-rw-r--r--src/citra_qt/debugger/graphics/graphics_vertex_shader.cpp1
-rw-r--r--src/video_core/CMakeLists.txt2
-rw-r--r--src/video_core/clipper.cpp2
-rw-r--r--src/video_core/command_processor.cpp2
-rw-r--r--src/video_core/debug_utils/debug_utils.cpp2
-rw-r--r--src/video_core/debug_utils/debug_utils.h2
-rw-r--r--src/video_core/pica.cpp485
-rw-r--r--src/video_core/pica.h159
-rw-r--r--src/video_core/pica_state.h2
-rw-r--r--src/video_core/rasterizer.cpp2
-rw-r--r--src/video_core/regs.cpp493
-rw-r--r--src/video_core/regs.h164
-rw-r--r--src/video_core/regs_framebuffer.h2
-rw-r--r--src/video_core/regs_lighting.h2
-rw-r--r--src/video_core/renderer_opengl/gl_rasterizer.cpp2
-rw-r--r--src/video_core/renderer_opengl/gl_rasterizer.h2
-rw-r--r--src/video_core/renderer_opengl/gl_rasterizer_cache.h2
-rw-r--r--src/video_core/renderer_opengl/gl_shader_gen.cpp2
-rw-r--r--src/video_core/renderer_opengl/pica_to_gl.h2
-rw-r--r--src/video_core/shader/shader.cpp2
-rw-r--r--src/video_core/shader/shader.h2
-rw-r--r--src/video_core/vertex_loader.cpp2
-rw-r--r--src/video_core/vertex_loader.h2
26 files changed, 681 insertions, 662 deletions
diff --git a/src/citra_qt/debugger/graphics/graphics_cmdlists.cpp b/src/citra_qt/debugger/graphics/graphics_cmdlists.cpp
index adaa18cfc..536548f36 100644
--- a/src/citra_qt/debugger/graphics/graphics_cmdlists.cpp
+++ b/src/citra_qt/debugger/graphics/graphics_cmdlists.cpp
@@ -18,8 +18,8 @@
18#include "citra_qt/util/util.h" 18#include "citra_qt/util/util.h"
19#include "common/vector_math.h" 19#include "common/vector_math.h"
20#include "video_core/debug_utils/debug_utils.h" 20#include "video_core/debug_utils/debug_utils.h"
21#include "video_core/pica.h"
22#include "video_core/pica_state.h" 21#include "video_core/pica_state.h"
22#include "video_core/regs.h"
23#include "video_core/texture/texture_decode.h" 23#include "video_core/texture/texture_decode.h"
24 24
25namespace { 25namespace {
diff --git a/src/citra_qt/debugger/graphics/graphics_surface.cpp b/src/citra_qt/debugger/graphics/graphics_surface.cpp
index 78156d5ec..f83c1f96c 100644
--- a/src/citra_qt/debugger/graphics/graphics_surface.cpp
+++ b/src/citra_qt/debugger/graphics/graphics_surface.cpp
@@ -16,8 +16,8 @@
16#include "common/color.h" 16#include "common/color.h"
17#include "core/hw/gpu.h" 17#include "core/hw/gpu.h"
18#include "core/memory.h" 18#include "core/memory.h"
19#include "video_core/pica.h"
20#include "video_core/pica_state.h" 19#include "video_core/pica_state.h"
20#include "video_core/regs.h"
21#include "video_core/texture/texture_decode.h" 21#include "video_core/texture/texture_decode.h"
22#include "video_core/utils.h" 22#include "video_core/utils.h"
23 23
diff --git a/src/citra_qt/debugger/graphics/graphics_tracing.cpp b/src/citra_qt/debugger/graphics/graphics_tracing.cpp
index 17f1c5ce2..40d5bed51 100644
--- a/src/citra_qt/debugger/graphics/graphics_tracing.cpp
+++ b/src/citra_qt/debugger/graphics/graphics_tracing.cpp
@@ -18,7 +18,6 @@
18#include "core/hw/lcd.h" 18#include "core/hw/lcd.h"
19#include "core/tracer/recorder.h" 19#include "core/tracer/recorder.h"
20#include "nihstro/float24.h" 20#include "nihstro/float24.h"
21#include "video_core/pica.h"
22#include "video_core/pica_state.h" 21#include "video_core/pica_state.h"
23 22
24GraphicsTracingWidget::GraphicsTracingWidget(std::shared_ptr<Pica::DebugContext> debug_context, 23GraphicsTracingWidget::GraphicsTracingWidget(std::shared_ptr<Pica::DebugContext> debug_context,
diff --git a/src/citra_qt/debugger/graphics/graphics_vertex_shader.cpp b/src/citra_qt/debugger/graphics/graphics_vertex_shader.cpp
index 6144a4607..e3f3194db 100644
--- a/src/citra_qt/debugger/graphics/graphics_vertex_shader.cpp
+++ b/src/citra_qt/debugger/graphics/graphics_vertex_shader.cpp
@@ -16,7 +16,6 @@
16#include <QTreeView> 16#include <QTreeView>
17#include "citra_qt/debugger/graphics/graphics_vertex_shader.h" 17#include "citra_qt/debugger/graphics/graphics_vertex_shader.h"
18#include "citra_qt/util/util.h" 18#include "citra_qt/util/util.h"
19#include "video_core/pica.h"
20#include "video_core/pica_state.h" 19#include "video_core/pica_state.h"
21#include "video_core/shader/debug_data.h" 20#include "video_core/shader/debug_data.h"
22#include "video_core/shader/shader.h" 21#include "video_core/shader/shader.h"
diff --git a/src/video_core/CMakeLists.txt b/src/video_core/CMakeLists.txt
index 2b0bf0960..11bc61e14 100644
--- a/src/video_core/CMakeLists.txt
+++ b/src/video_core/CMakeLists.txt
@@ -5,6 +5,7 @@ set(SRCS
5 pica.cpp 5 pica.cpp
6 primitive_assembly.cpp 6 primitive_assembly.cpp
7 rasterizer.cpp 7 rasterizer.cpp
8 regs.cpp
8 renderer_base.cpp 9 renderer_base.cpp
9 renderer_opengl/gl_rasterizer.cpp 10 renderer_opengl/gl_rasterizer.cpp
10 renderer_opengl/gl_rasterizer_cache.cpp 11 renderer_opengl/gl_rasterizer_cache.cpp
@@ -32,6 +33,7 @@ set(HEADERS
32 primitive_assembly.h 33 primitive_assembly.h
33 rasterizer.h 34 rasterizer.h
34 rasterizer_interface.h 35 rasterizer_interface.h
36 regs.h
35 regs_framebuffer.h 37 regs_framebuffer.h
36 regs_lighting.h 38 regs_lighting.h
37 regs_pipeline.h 39 regs_pipeline.h
diff --git a/src/video_core/clipper.cpp b/src/video_core/clipper.cpp
index 59fc5c86b..0f71bbd06 100644
--- a/src/video_core/clipper.cpp
+++ b/src/video_core/clipper.cpp
@@ -12,10 +12,10 @@
12#include "common/logging/log.h" 12#include "common/logging/log.h"
13#include "common/vector_math.h" 13#include "common/vector_math.h"
14#include "video_core/clipper.h" 14#include "video_core/clipper.h"
15#include "video_core/pica.h"
16#include "video_core/pica_state.h" 15#include "video_core/pica_state.h"
17#include "video_core/pica_types.h" 16#include "video_core/pica_types.h"
18#include "video_core/rasterizer.h" 17#include "video_core/rasterizer.h"
18#include "video_core/regs.h"
19#include "video_core/shader/shader.h" 19#include "video_core/shader/shader.h"
20 20
21using Pica::Rasterizer::Vertex; 21using Pica::Rasterizer::Vertex;
diff --git a/src/video_core/command_processor.cpp b/src/video_core/command_processor.cpp
index c8064bf6a..91c0ca4e6 100644
--- a/src/video_core/command_processor.cpp
+++ b/src/video_core/command_processor.cpp
@@ -16,11 +16,11 @@
16#include "core/tracer/recorder.h" 16#include "core/tracer/recorder.h"
17#include "video_core/command_processor.h" 17#include "video_core/command_processor.h"
18#include "video_core/debug_utils/debug_utils.h" 18#include "video_core/debug_utils/debug_utils.h"
19#include "video_core/pica.h"
20#include "video_core/pica_state.h" 19#include "video_core/pica_state.h"
21#include "video_core/pica_types.h" 20#include "video_core/pica_types.h"
22#include "video_core/primitive_assembly.h" 21#include "video_core/primitive_assembly.h"
23#include "video_core/rasterizer_interface.h" 22#include "video_core/rasterizer_interface.h"
23#include "video_core/regs.h"
24#include "video_core/renderer_base.h" 24#include "video_core/renderer_base.h"
25#include "video_core/shader/shader.h" 25#include "video_core/shader/shader.h"
26#include "video_core/vertex_loader.h" 26#include "video_core/vertex_loader.h"
diff --git a/src/video_core/debug_utils/debug_utils.cpp b/src/video_core/debug_utils/debug_utils.cpp
index ec8a9ee4a..e164e83a1 100644
--- a/src/video_core/debug_utils/debug_utils.cpp
+++ b/src/video_core/debug_utils/debug_utils.cpp
@@ -29,10 +29,10 @@
29#include "common/math_util.h" 29#include "common/math_util.h"
30#include "common/vector_math.h" 30#include "common/vector_math.h"
31#include "video_core/debug_utils/debug_utils.h" 31#include "video_core/debug_utils/debug_utils.h"
32#include "video_core/pica.h"
33#include "video_core/pica_state.h" 32#include "video_core/pica_state.h"
34#include "video_core/pica_types.h" 33#include "video_core/pica_types.h"
35#include "video_core/rasterizer_interface.h" 34#include "video_core/rasterizer_interface.h"
35#include "video_core/regs.h"
36#include "video_core/renderer_base.h" 36#include "video_core/renderer_base.h"
37#include "video_core/shader/shader.h" 37#include "video_core/shader/shader.h"
38#include "video_core/texture/texture_decode.h" 38#include "video_core/texture/texture_decode.h"
diff --git a/src/video_core/debug_utils/debug_utils.h b/src/video_core/debug_utils/debug_utils.h
index 44d5af462..fd94bdbb8 100644
--- a/src/video_core/debug_utils/debug_utils.h
+++ b/src/video_core/debug_utils/debug_utils.h
@@ -17,7 +17,7 @@
17#include <vector> 17#include <vector>
18#include "common/common_types.h" 18#include "common/common_types.h"
19#include "common/vector_math.h" 19#include "common/vector_math.h"
20#include "video_core/pica.h" 20#include "video_core/regs.h"
21 21
22namespace CiTrace { 22namespace CiTrace {
23class Recorder; 23class Recorder;
diff --git a/src/video_core/pica.cpp b/src/video_core/pica.cpp
index 6604ce83c..13f0a4ab9 100644
--- a/src/video_core/pica.cpp
+++ b/src/video_core/pica.cpp
@@ -3,497 +3,14 @@
3// Refer to the license.txt file included. 3// Refer to the license.txt file included.
4 4
5#include <cstring> 5#include <cstring>
6#include <iterator>
7#include <unordered_map>
8#include <utility>
9#include "video_core/pica.h" 6#include "video_core/pica.h"
10#include "video_core/pica_state.h" 7#include "video_core/pica_state.h"
11#include "video_core/primitive_assembly.h" 8#include "video_core/regs.h"
12#include "video_core/shader/shader.h"
13 9
14namespace Pica { 10namespace Pica {
15 11
16State g_state; 12State g_state;
17 13
18static const std::pair<u16, const char*> register_names[] = {
19 {0x010, "GPUREG_FINALIZE"},
20
21 {0x040, "GPUREG_FACECULLING_CONFIG"},
22 {0x041, "GPUREG_VIEWPORT_WIDTH"},
23 {0x042, "GPUREG_VIEWPORT_INVW"},
24 {0x043, "GPUREG_VIEWPORT_HEIGHT"},
25 {0x044, "GPUREG_VIEWPORT_INVH"},
26
27 {0x047, "GPUREG_FRAGOP_CLIP"},
28 {0x048, "GPUREG_FRAGOP_CLIP_DATA0"},
29 {0x049, "GPUREG_FRAGOP_CLIP_DATA1"},
30 {0x04A, "GPUREG_FRAGOP_CLIP_DATA2"},
31 {0x04B, "GPUREG_FRAGOP_CLIP_DATA3"},
32
33 {0x04D, "GPUREG_DEPTHMAP_SCALE"},
34 {0x04E, "GPUREG_DEPTHMAP_OFFSET"},
35 {0x04F, "GPUREG_SH_OUTMAP_TOTAL"},
36 {0x050, "GPUREG_SH_OUTMAP_O0"},
37 {0x051, "GPUREG_SH_OUTMAP_O1"},
38 {0x052, "GPUREG_SH_OUTMAP_O2"},
39 {0x053, "GPUREG_SH_OUTMAP_O3"},
40 {0x054, "GPUREG_SH_OUTMAP_O4"},
41 {0x055, "GPUREG_SH_OUTMAP_O5"},
42 {0x056, "GPUREG_SH_OUTMAP_O6"},
43
44 {0x061, "GPUREG_EARLYDEPTH_FUNC"},
45 {0x062, "GPUREG_EARLYDEPTH_TEST1"},
46 {0x063, "GPUREG_EARLYDEPTH_CLEAR"},
47 {0x064, "GPUREG_SH_OUTATTR_MODE"},
48 {0x065, "GPUREG_SCISSORTEST_MODE"},
49 {0x066, "GPUREG_SCISSORTEST_POS"},
50 {0x067, "GPUREG_SCISSORTEST_DIM"},
51 {0x068, "GPUREG_VIEWPORT_XY"},
52
53 {0x06A, "GPUREG_EARLYDEPTH_DATA"},
54
55 {0x06D, "GPUREG_DEPTHMAP_ENABLE"},
56 {0x06E, "GPUREG_RENDERBUF_DIM"},
57 {0x06F, "GPUREG_SH_OUTATTR_CLOCK"},
58
59 {0x080, "GPUREG_TEXUNIT_CONFIG"},
60 {0x081, "GPUREG_TEXUNIT0_BORDER_COLOR"},
61 {0x082, "GPUREG_TEXUNIT0_DIM"},
62 {0x083, "GPUREG_TEXUNIT0_PARAM"},
63 {0x084, "GPUREG_TEXUNIT0_LOD"},
64 {0x085, "GPUREG_TEXUNIT0_ADDR1"},
65 {0x086, "GPUREG_TEXUNIT0_ADDR2"},
66 {0x087, "GPUREG_TEXUNIT0_ADDR3"},
67 {0x088, "GPUREG_TEXUNIT0_ADDR4"},
68 {0x089, "GPUREG_TEXUNIT0_ADDR5"},
69 {0x08A, "GPUREG_TEXUNIT0_ADDR6"},
70 {0x08B, "GPUREG_TEXUNIT0_SHADOW"},
71
72 {0x08E, "GPUREG_TEXUNIT0_TYPE"},
73 {0x08F, "GPUREG_LIGHTING_ENABLE0"},
74
75 {0x091, "GPUREG_TEXUNIT1_BORDER_COLOR"},
76 {0x092, "GPUREG_TEXUNIT1_DIM"},
77 {0x093, "GPUREG_TEXUNIT1_PARAM"},
78 {0x094, "GPUREG_TEXUNIT1_LOD"},
79 {0x095, "GPUREG_TEXUNIT1_ADDR"},
80 {0x096, "GPUREG_TEXUNIT1_TYPE"},
81
82 {0x099, "GPUREG_TEXUNIT2_BORDER_COLOR"},
83 {0x09A, "GPUREG_TEXUNIT2_DIM"},
84 {0x09B, "GPUREG_TEXUNIT2_PARAM"},
85 {0x09C, "GPUREG_TEXUNIT2_LOD"},
86 {0x09D, "GPUREG_TEXUNIT2_ADDR"},
87 {0x09E, "GPUREG_TEXUNIT2_TYPE"},
88
89 {0x0A8, "GPUREG_TEXUNIT3_PROCTEX0"},
90 {0x0A9, "GPUREG_TEXUNIT3_PROCTEX1"},
91 {0x0AA, "GPUREG_TEXUNIT3_PROCTEX2"},
92 {0x0AB, "GPUREG_TEXUNIT3_PROCTEX3"},
93 {0x0AC, "GPUREG_TEXUNIT3_PROCTEX4"},
94 {0x0AD, "GPUREG_TEXUNIT3_PROCTEX5"},
95
96 {0x0AF, "GPUREG_PROCTEX_LUT"},
97 {0x0B0, "GPUREG_PROCTEX_LUT_DATA0"},
98 {0x0B1, "GPUREG_PROCTEX_LUT_DATA1"},
99 {0x0B2, "GPUREG_PROCTEX_LUT_DATA2"},
100 {0x0B3, "GPUREG_PROCTEX_LUT_DATA3"},
101 {0x0B4, "GPUREG_PROCTEX_LUT_DATA4"},
102 {0x0B5, "GPUREG_PROCTEX_LUT_DATA5"},
103 {0x0B6, "GPUREG_PROCTEX_LUT_DATA6"},
104 {0x0B7, "GPUREG_PROCTEX_LUT_DATA7"},
105
106 {0x0C0, "GPUREG_TEXENV0_SOURCE"},
107 {0x0C1, "GPUREG_TEXENV0_OPERAND"},
108 {0x0C2, "GPUREG_TEXENV0_COMBINER"},
109 {0x0C3, "GPUREG_TEXENV0_COLOR"},
110 {0x0C4, "GPUREG_TEXENV0_SCALE"},
111
112 {0x0C8, "GPUREG_TEXENV1_SOURCE"},
113 {0x0C9, "GPUREG_TEXENV1_OPERAND"},
114 {0x0CA, "GPUREG_TEXENV1_COMBINER"},
115 {0x0CB, "GPUREG_TEXENV1_COLOR"},
116 {0x0CC, "GPUREG_TEXENV1_SCALE"},
117
118 {0x0D0, "GPUREG_TEXENV2_SOURCE"},
119 {0x0D1, "GPUREG_TEXENV2_OPERAND"},
120 {0x0D2, "GPUREG_TEXENV2_COMBINER"},
121 {0x0D3, "GPUREG_TEXENV2_COLOR"},
122 {0x0D4, "GPUREG_TEXENV2_SCALE"},
123
124 {0x0D8, "GPUREG_TEXENV3_SOURCE"},
125 {0x0D9, "GPUREG_TEXENV3_OPERAND"},
126 {0x0DA, "GPUREG_TEXENV3_COMBINER"},
127 {0x0DB, "GPUREG_TEXENV3_COLOR"},
128 {0x0DC, "GPUREG_TEXENV3_SCALE"},
129
130 {0x0E0, "GPUREG_TEXENV_UPDATE_BUFFER"},
131 {0x0E1, "GPUREG_FOG_COLOR"},
132
133 {0x0E4, "GPUREG_GAS_ATTENUATION"},
134 {0x0E5, "GPUREG_GAS_ACCMAX"},
135 {0x0E6, "GPUREG_FOG_LUT_INDEX"},
136
137 {0x0E8, "GPUREG_FOG_LUT_DATA0"},
138 {0x0E9, "GPUREG_FOG_LUT_DATA1"},
139 {0x0EA, "GPUREG_FOG_LUT_DATA2"},
140 {0x0EB, "GPUREG_FOG_LUT_DATA3"},
141 {0x0EC, "GPUREG_FOG_LUT_DATA4"},
142 {0x0ED, "GPUREG_FOG_LUT_DATA5"},
143 {0x0EE, "GPUREG_FOG_LUT_DATA6"},
144 {0x0EF, "GPUREG_FOG_LUT_DATA7"},
145 {0x0F0, "GPUREG_TEXENV4_SOURCE"},
146 {0x0F1, "GPUREG_TEXENV4_OPERAND"},
147 {0x0F2, "GPUREG_TEXENV4_COMBINER"},
148 {0x0F3, "GPUREG_TEXENV4_COLOR"},
149 {0x0F4, "GPUREG_TEXENV4_SCALE"},
150
151 {0x0F8, "GPUREG_TEXENV5_SOURCE"},
152 {0x0F9, "GPUREG_TEXENV5_OPERAND"},
153 {0x0FA, "GPUREG_TEXENV5_COMBINER"},
154 {0x0FB, "GPUREG_TEXENV5_COLOR"},
155 {0x0FC, "GPUREG_TEXENV5_SCALE"},
156 {0x0FD, "GPUREG_TEXENV_BUFFER_COLOR"},
157
158 {0x100, "GPUREG_COLOR_OPERATION"},
159 {0x101, "GPUREG_BLEND_FUNC"},
160 {0x102, "GPUREG_LOGIC_OP"},
161 {0x103, "GPUREG_BLEND_COLOR"},
162 {0x104, "GPUREG_FRAGOP_ALPHA_TEST"},
163 {0x105, "GPUREG_STENCIL_TEST"},
164 {0x106, "GPUREG_STENCIL_OP"},
165 {0x107, "GPUREG_DEPTH_COLOR_MASK"},
166
167 {0x110, "GPUREG_FRAMEBUFFER_INVALIDATE"},
168 {0x111, "GPUREG_FRAMEBUFFER_FLUSH"},
169 {0x112, "GPUREG_COLORBUFFER_READ"},
170 {0x113, "GPUREG_COLORBUFFER_WRITE"},
171 {0x114, "GPUREG_DEPTHBUFFER_READ"},
172 {0x115, "GPUREG_DEPTHBUFFER_WRITE"},
173 {0x116, "GPUREG_DEPTHBUFFER_FORMAT"},
174 {0x117, "GPUREG_COLORBUFFER_FORMAT"},
175 {0x118, "GPUREG_EARLYDEPTH_TEST2"},
176
177 {0x11B, "GPUREG_FRAMEBUFFER_BLOCK32"},
178 {0x11C, "GPUREG_DEPTHBUFFER_LOC"},
179 {0x11D, "GPUREG_COLORBUFFER_LOC"},
180 {0x11E, "GPUREG_FRAMEBUFFER_DIM"},
181
182 {0x120, "GPUREG_GAS_LIGHT_XY"},
183 {0x121, "GPUREG_GAS_LIGHT_Z"},
184 {0x122, "GPUREG_GAS_LIGHT_Z_COLOR"},
185 {0x123, "GPUREG_GAS_LUT_INDEX"},
186 {0x124, "GPUREG_GAS_LUT_DATA"},
187
188 {0x126, "GPUREG_GAS_DELTAZ_DEPTH"},
189
190 {0x130, "GPUREG_FRAGOP_SHADOW"},
191
192 {0x140, "GPUREG_LIGHT0_SPECULAR0"},
193 {0x141, "GPUREG_LIGHT0_SPECULAR1"},
194 {0x142, "GPUREG_LIGHT0_DIFFUSE"},
195 {0x143, "GPUREG_LIGHT0_AMBIENT"},
196 {0x144, "GPUREG_LIGHT0_XY"},
197 {0x145, "GPUREG_LIGHT0_Z"},
198 {0x146, "GPUREG_LIGHT0_SPOTDIR_XY"},
199 {0x147, "GPUREG_LIGHT0_SPOTDIR_Z"},
200
201 {0x149, "GPUREG_LIGHT0_CONFIG"},
202 {0x14A, "GPUREG_LIGHT0_ATTENUATION_BIAS"},
203 {0x14B, "GPUREG_LIGHT0_ATTENUATION_SCALE"},
204
205 {0x150, "GPUREG_LIGHT1_SPECULAR0"},
206 {0x151, "GPUREG_LIGHT1_SPECULAR1"},
207 {0x152, "GPUREG_LIGHT1_DIFFUSE"},
208 {0x153, "GPUREG_LIGHT1_AMBIENT"},
209 {0x154, "GPUREG_LIGHT1_XY"},
210 {0x155, "GPUREG_LIGHT1_Z"},
211 {0x156, "GPUREG_LIGHT1_SPOTDIR_XY"},
212 {0x157, "GPUREG_LIGHT1_SPOTDIR_Z"},
213
214 {0x159, "GPUREG_LIGHT1_CONFIG"},
215 {0x15A, "GPUREG_LIGHT1_ATTENUATION_BIAS"},
216 {0x15B, "GPUREG_LIGHT1_ATTENUATION_SCALE"},
217
218 {0x160, "GPUREG_LIGHT2_SPECULAR0"},
219 {0x161, "GPUREG_LIGHT2_SPECULAR1"},
220 {0x162, "GPUREG_LIGHT2_DIFFUSE"},
221 {0x163, "GPUREG_LIGHT2_AMBIENT"},
222 {0x164, "GPUREG_LIGHT2_XY"},
223 {0x165, "GPUREG_LIGHT2_Z"},
224 {0x166, "GPUREG_LIGHT2_SPOTDIR_XY"},
225 {0x167, "GPUREG_LIGHT2_SPOTDIR_Z"},
226
227 {0x169, "GPUREG_LIGHT2_CONFIG"},
228 {0x16A, "GPUREG_LIGHT2_ATTENUATION_BIAS"},
229 {0x16B, "GPUREG_LIGHT2_ATTENUATION_SCALE"},
230
231 {0x170, "GPUREG_LIGHT3_SPECULAR0"},
232 {0x171, "GPUREG_LIGHT3_SPECULAR1"},
233 {0x172, "GPUREG_LIGHT3_DIFFUSE"},
234 {0x173, "GPUREG_LIGHT3_AMBIENT"},
235 {0x174, "GPUREG_LIGHT3_XY"},
236 {0x175, "GPUREG_LIGHT3_Z"},
237 {0x176, "GPUREG_LIGHT3_SPOTDIR_XY"},
238 {0x177, "GPUREG_LIGHT3_SPOTDIR_Z"},
239
240 {0x179, "GPUREG_LIGHT3_CONFIG"},
241 {0x17A, "GPUREG_LIGHT3_ATTENUATION_BIAS"},
242 {0x17B, "GPUREG_LIGHT3_ATTENUATION_SCALE"},
243
244 {0x180, "GPUREG_LIGHT4_SPECULAR0"},
245 {0x181, "GPUREG_LIGHT4_SPECULAR1"},
246 {0x182, "GPUREG_LIGHT4_DIFFUSE"},
247 {0x183, "GPUREG_LIGHT4_AMBIENT"},
248 {0x184, "GPUREG_LIGHT4_XY"},
249 {0x185, "GPUREG_LIGHT4_Z"},
250 {0x186, "GPUREG_LIGHT4_SPOTDIR_XY"},
251 {0x187, "GPUREG_LIGHT4_SPOTDIR_Z"},
252
253 {0x189, "GPUREG_LIGHT4_CONFIG"},
254 {0x18A, "GPUREG_LIGHT4_ATTENUATION_BIAS"},
255 {0x18B, "GPUREG_LIGHT4_ATTENUATION_SCALE"},
256
257 {0x190, "GPUREG_LIGHT5_SPECULAR0"},
258 {0x191, "GPUREG_LIGHT5_SPECULAR1"},
259 {0x192, "GPUREG_LIGHT5_DIFFUSE"},
260 {0x193, "GPUREG_LIGHT5_AMBIENT"},
261 {0x194, "GPUREG_LIGHT5_XY"},
262 {0x195, "GPUREG_LIGHT5_Z"},
263 {0x196, "GPUREG_LIGHT5_SPOTDIR_XY"},
264 {0x197, "GPUREG_LIGHT5_SPOTDIR_Z"},
265
266 {0x199, "GPUREG_LIGHT5_CONFIG"},
267 {0x19A, "GPUREG_LIGHT5_ATTENUATION_BIAS"},
268 {0x19B, "GPUREG_LIGHT5_ATTENUATION_SCALE"},
269
270 {0x1A0, "GPUREG_LIGHT6_SPECULAR0"},
271 {0x1A1, "GPUREG_LIGHT6_SPECULAR1"},
272 {0x1A2, "GPUREG_LIGHT6_DIFFUSE"},
273 {0x1A3, "GPUREG_LIGHT6_AMBIENT"},
274 {0x1A4, "GPUREG_LIGHT6_XY"},
275 {0x1A5, "GPUREG_LIGHT6_Z"},
276 {0x1A6, "GPUREG_LIGHT6_SPOTDIR_XY"},
277 {0x1A7, "GPUREG_LIGHT6_SPOTDIR_Z"},
278
279 {0x1A9, "GPUREG_LIGHT6_CONFIG"},
280 {0x1AA, "GPUREG_LIGHT6_ATTENUATION_BIAS"},
281 {0x1AB, "GPUREG_LIGHT6_ATTENUATION_SCALE"},
282
283 {0x1B0, "GPUREG_LIGHT7_SPECULAR0"},
284 {0x1B1, "GPUREG_LIGHT7_SPECULAR1"},
285 {0x1B2, "GPUREG_LIGHT7_DIFFUSE"},
286 {0x1B3, "GPUREG_LIGHT7_AMBIENT"},
287 {0x1B4, "GPUREG_LIGHT7_XY"},
288 {0x1B5, "GPUREG_LIGHT7_Z"},
289 {0x1B6, "GPUREG_LIGHT7_SPOTDIR_XY"},
290 {0x1B7, "GPUREG_LIGHT7_SPOTDIR_Z"},
291
292 {0x1B9, "GPUREG_LIGHT7_CONFIG"},
293 {0x1BA, "GPUREG_LIGHT7_ATTENUATION_BIAS"},
294 {0x1BB, "GPUREG_LIGHT7_ATTENUATION_SCALE"},
295
296 {0x1C0, "GPUREG_LIGHTING_AMBIENT"},
297
298 {0x1C2, "GPUREG_LIGHTING_NUM_LIGHTS"},
299 {0x1C3, "GPUREG_LIGHTING_CONFIG0"},
300 {0x1C4, "GPUREG_LIGHTING_CONFIG1"},
301 {0x1C5, "GPUREG_LIGHTING_LUT_INDEX"},
302 {0x1C6, "GPUREG_LIGHTING_ENABLE1"},
303
304 {0x1C8, "GPUREG_LIGHTING_LUT_DATA0"},
305 {0x1C9, "GPUREG_LIGHTING_LUT_DATA1"},
306 {0x1CA, "GPUREG_LIGHTING_LUT_DATA2"},
307 {0x1CB, "GPUREG_LIGHTING_LUT_DATA3"},
308 {0x1CC, "GPUREG_LIGHTING_LUT_DATA4"},
309 {0x1CD, "GPUREG_LIGHTING_LUT_DATA5"},
310 {0x1CE, "GPUREG_LIGHTING_LUT_DATA6"},
311 {0x1CF, "GPUREG_LIGHTING_LUT_DATA7"},
312 {0x1D0, "GPUREG_LIGHTING_LUTINPUT_ABS"},
313 {0x1D1, "GPUREG_LIGHTING_LUTINPUT_SELECT"},
314 {0x1D2, "GPUREG_LIGHTING_LUTINPUT_SCALE"},
315
316 {0x1D9, "GPUREG_LIGHTING_LIGHT_PERMUTATION"},
317
318 {0x200, "GPUREG_ATTRIBBUFFERS_LOC"},
319 {0x201, "GPUREG_ATTRIBBUFFERS_FORMAT_LOW"},
320 {0x202, "GPUREG_ATTRIBBUFFERS_FORMAT_HIGH"},
321 {0x203, "GPUREG_ATTRIBBUFFER0_OFFSET"},
322 {0x204, "GPUREG_ATTRIBBUFFER0_CONFIG1"},
323 {0x205, "GPUREG_ATTRIBBUFFER0_CONFIG2"},
324 {0x206, "GPUREG_ATTRIBBUFFER1_OFFSET"},
325 {0x207, "GPUREG_ATTRIBBUFFER1_CONFIG1"},
326 {0x208, "GPUREG_ATTRIBBUFFER1_CONFIG2"},
327 {0x209, "GPUREG_ATTRIBBUFFER2_OFFSET"},
328 {0x20A, "GPUREG_ATTRIBBUFFER2_CONFIG1"},
329 {0x20B, "GPUREG_ATTRIBBUFFER2_CONFIG2"},
330 {0x20C, "GPUREG_ATTRIBBUFFER3_OFFSET"},
331 {0x20D, "GPUREG_ATTRIBBUFFER3_CONFIG1"},
332 {0x20E, "GPUREG_ATTRIBBUFFER3_CONFIG2"},
333 {0x20F, "GPUREG_ATTRIBBUFFER4_OFFSET"},
334 {0x210, "GPUREG_ATTRIBBUFFER4_CONFIG1"},
335 {0x211, "GPUREG_ATTRIBBUFFER4_CONFIG2"},
336 {0x212, "GPUREG_ATTRIBBUFFER5_OFFSET"},
337 {0x213, "GPUREG_ATTRIBBUFFER5_CONFIG1"},
338 {0x214, "GPUREG_ATTRIBBUFFER5_CONFIG2"},
339 {0x215, "GPUREG_ATTRIBBUFFER6_OFFSET"},
340 {0x216, "GPUREG_ATTRIBBUFFER6_CONFIG1"},
341 {0x217, "GPUREG_ATTRIBBUFFER6_CONFIG2"},
342 {0x218, "GPUREG_ATTRIBBUFFER7_OFFSET"},
343 {0x219, "GPUREG_ATTRIBBUFFER7_CONFIG1"},
344 {0x21A, "GPUREG_ATTRIBBUFFER7_CONFIG2"},
345 {0x21B, "GPUREG_ATTRIBBUFFER8_OFFSET"},
346 {0x21C, "GPUREG_ATTRIBBUFFER8_CONFIG1"},
347 {0x21D, "GPUREG_ATTRIBBUFFER8_CONFIG2"},
348 {0x21E, "GPUREG_ATTRIBBUFFER9_OFFSET"},
349 {0x21F, "GPUREG_ATTRIBBUFFER9_CONFIG1"},
350 {0x220, "GPUREG_ATTRIBBUFFER9_CONFIG2"},
351 {0x221, "GPUREG_ATTRIBBUFFER10_OFFSET"},
352 {0x222, "GPUREG_ATTRIBBUFFER10_CONFIG1"},
353 {0x223, "GPUREG_ATTRIBBUFFER10_CONFIG2"},
354 {0x224, "GPUREG_ATTRIBBUFFER11_OFFSET"},
355 {0x225, "GPUREG_ATTRIBBUFFER11_CONFIG1"},
356 {0x226, "GPUREG_ATTRIBBUFFER11_CONFIG2"},
357 {0x227, "GPUREG_INDEXBUFFER_CONFIG"},
358 {0x228, "GPUREG_NUMVERTICES"},
359 {0x229, "GPUREG_GEOSTAGE_CONFIG"},
360 {0x22A, "GPUREG_VERTEX_OFFSET"},
361
362 {0x22D, "GPUREG_POST_VERTEX_CACHE_NUM"},
363 {0x22E, "GPUREG_DRAWARRAYS"},
364 {0x22F, "GPUREG_DRAWELEMENTS"},
365
366 {0x231, "GPUREG_VTX_FUNC"},
367 {0x232, "GPUREG_FIXEDATTRIB_INDEX"},
368 {0x233, "GPUREG_FIXEDATTRIB_DATA0"},
369 {0x234, "GPUREG_FIXEDATTRIB_DATA1"},
370 {0x235, "GPUREG_FIXEDATTRIB_DATA2"},
371
372 {0x238, "GPUREG_CMDBUF_SIZE0"},
373 {0x239, "GPUREG_CMDBUF_SIZE1"},
374 {0x23A, "GPUREG_CMDBUF_ADDR0"},
375 {0x23B, "GPUREG_CMDBUF_ADDR1"},
376 {0x23C, "GPUREG_CMDBUF_JUMP0"},
377 {0x23D, "GPUREG_CMDBUF_JUMP1"},
378
379 {0x242, "GPUREG_VSH_NUM_ATTR"},
380
381 {0x244, "GPUREG_VSH_COM_MODE"},
382 {0x245, "GPUREG_START_DRAW_FUNC0"},
383
384 {0x24A, "GPUREG_VSH_OUTMAP_TOTAL1"},
385
386 {0x251, "GPUREG_VSH_OUTMAP_TOTAL2"},
387 {0x252, "GPUREG_GSH_MISC0"},
388 {0x253, "GPUREG_GEOSTAGE_CONFIG2"},
389 {0x254, "GPUREG_GSH_MISC1"},
390
391 {0x25E, "GPUREG_PRIMITIVE_CONFIG"},
392 {0x25F, "GPUREG_RESTART_PRIMITIVE"},
393
394 {0x280, "GPUREG_GSH_BOOLUNIFORM"},
395 {0x281, "GPUREG_GSH_INTUNIFORM_I0"},
396 {0x282, "GPUREG_GSH_INTUNIFORM_I1"},
397 {0x283, "GPUREG_GSH_INTUNIFORM_I2"},
398 {0x284, "GPUREG_GSH_INTUNIFORM_I3"},
399
400 {0x289, "GPUREG_GSH_INPUTBUFFER_CONFIG"},
401 {0x28A, "GPUREG_GSH_ENTRYPOINT"},
402 {0x28B, "GPUREG_GSH_ATTRIBUTES_PERMUTATION_LOW"},
403 {0x28C, "GPUREG_GSH_ATTRIBUTES_PERMUTATION_HIGH"},
404 {0x28D, "GPUREG_GSH_OUTMAP_MASK"},
405
406 {0x28F, "GPUREG_GSH_CODETRANSFER_END"},
407 {0x290, "GPUREG_GSH_FLOATUNIFORM_INDEX"},
408 {0x291, "GPUREG_GSH_FLOATUNIFORM_DATA0"},
409 {0x292, "GPUREG_GSH_FLOATUNIFORM_DATA1"},
410 {0x293, "GPUREG_GSH_FLOATUNIFORM_DATA2"},
411 {0x294, "GPUREG_GSH_FLOATUNIFORM_DATA3"},
412 {0x295, "GPUREG_GSH_FLOATUNIFORM_DATA4"},
413 {0x296, "GPUREG_GSH_FLOATUNIFORM_DATA5"},
414 {0x297, "GPUREG_GSH_FLOATUNIFORM_DATA6"},
415 {0x298, "GPUREG_GSH_FLOATUNIFORM_DATA7"},
416
417 {0x29B, "GPUREG_GSH_CODETRANSFER_INDEX"},
418 {0x29C, "GPUREG_GSH_CODETRANSFER_DATA0"},
419 {0x29D, "GPUREG_GSH_CODETRANSFER_DATA1"},
420 {0x29E, "GPUREG_GSH_CODETRANSFER_DATA2"},
421 {0x29F, "GPUREG_GSH_CODETRANSFER_DATA3"},
422 {0x2A0, "GPUREG_GSH_CODETRANSFER_DATA4"},
423 {0x2A1, "GPUREG_GSH_CODETRANSFER_DATA5"},
424 {0x2A2, "GPUREG_GSH_CODETRANSFER_DATA6"},
425 {0x2A3, "GPUREG_GSH_CODETRANSFER_DATA7"},
426
427 {0x2A5, "GPUREG_GSH_OPDESCS_INDEX"},
428 {0x2A6, "GPUREG_GSH_OPDESCS_DATA0"},
429 {0x2A7, "GPUREG_GSH_OPDESCS_DATA1"},
430 {0x2A8, "GPUREG_GSH_OPDESCS_DATA2"},
431 {0x2A9, "GPUREG_GSH_OPDESCS_DATA3"},
432 {0x2AA, "GPUREG_GSH_OPDESCS_DATA4"},
433 {0x2AB, "GPUREG_GSH_OPDESCS_DATA5"},
434 {0x2AC, "GPUREG_GSH_OPDESCS_DATA6"},
435 {0x2AD, "GPUREG_GSH_OPDESCS_DATA7"},
436
437 {0x2B0, "GPUREG_VSH_BOOLUNIFORM"},
438 {0x2B1, "GPUREG_VSH_INTUNIFORM_I0"},
439 {0x2B2, "GPUREG_VSH_INTUNIFORM_I1"},
440 {0x2B3, "GPUREG_VSH_INTUNIFORM_I2"},
441 {0x2B4, "GPUREG_VSH_INTUNIFORM_I3"},
442
443 {0x2B9, "GPUREG_VSH_INPUTBUFFER_CONFIG"},
444 {0x2BA, "GPUREG_VSH_ENTRYPOINT"},
445 {0x2BB, "GPUREG_VSH_ATTRIBUTES_PERMUTATION_LOW"},
446 {0x2BC, "GPUREG_VSH_ATTRIBUTES_PERMUTATION_HIGH"},
447 {0x2BD, "GPUREG_VSH_OUTMAP_MASK"},
448
449 {0x2BF, "GPUREG_VSH_CODETRANSFER_END"},
450 {0x2C0, "GPUREG_VSH_FLOATUNIFORM_INDEX"},
451 {0x2C1, "GPUREG_VSH_FLOATUNIFORM_DATA0"},
452 {0x2C2, "GPUREG_VSH_FLOATUNIFORM_DATA1"},
453 {0x2C3, "GPUREG_VSH_FLOATUNIFORM_DATA2"},
454 {0x2C4, "GPUREG_VSH_FLOATUNIFORM_DATA3"},
455 {0x2C5, "GPUREG_VSH_FLOATUNIFORM_DATA4"},
456 {0x2C6, "GPUREG_VSH_FLOATUNIFORM_DATA5"},
457 {0x2C7, "GPUREG_VSH_FLOATUNIFORM_DATA6"},
458 {0x2C8, "GPUREG_VSH_FLOATUNIFORM_DATA7"},
459
460 {0x2CB, "GPUREG_VSH_CODETRANSFER_INDEX"},
461 {0x2CC, "GPUREG_VSH_CODETRANSFER_DATA0"},
462 {0x2CD, "GPUREG_VSH_CODETRANSFER_DATA1"},
463 {0x2CE, "GPUREG_VSH_CODETRANSFER_DATA2"},
464 {0x2CF, "GPUREG_VSH_CODETRANSFER_DATA3"},
465 {0x2D0, "GPUREG_VSH_CODETRANSFER_DATA4"},
466 {0x2D1, "GPUREG_VSH_CODETRANSFER_DATA5"},
467 {0x2D2, "GPUREG_VSH_CODETRANSFER_DATA6"},
468 {0x2D3, "GPUREG_VSH_CODETRANSFER_DATA7"},
469
470 {0x2D5, "GPUREG_VSH_OPDESCS_INDEX"},
471 {0x2D6, "GPUREG_VSH_OPDESCS_DATA0"},
472 {0x2D7, "GPUREG_VSH_OPDESCS_DATA1"},
473 {0x2D8, "GPUREG_VSH_OPDESCS_DATA2"},
474 {0x2D9, "GPUREG_VSH_OPDESCS_DATA3"},
475 {0x2DA, "GPUREG_VSH_OPDESCS_DATA4"},
476 {0x2DB, "GPUREG_VSH_OPDESCS_DATA5"},
477 {0x2DC, "GPUREG_VSH_OPDESCS_DATA6"},
478 {0x2DD, "GPUREG_VSH_OPDESCS_DATA7"},
479};
480
481std::string Regs::GetCommandName(int index) {
482 static std::unordered_map<u32, const char*> map;
483
484 if (map.empty()) {
485 map.insert(std::begin(register_names), std::end(register_names));
486 }
487
488 // Return empty string if no match is found
489 auto it = map.find(index);
490 if (it != map.end()) {
491 return it->second;
492 } else {
493 return std::string();
494 }
495}
496
497void Init() { 14void Init() {
498 g_state.Reset(); 15 g_state.Reset();
499} 16}
diff --git a/src/video_core/pica.h b/src/video_core/pica.h
index 099dc84f0..dc8aa6670 100644
--- a/src/video_core/pica.h
+++ b/src/video_core/pica.h
@@ -4,168 +4,9 @@
4 4
5#pragma once 5#pragma once
6 6
7#include <array>
8#include <cstddef>
9#include <string>
10
11#ifndef _MSC_VER
12#include <type_traits> // for std::enable_if
13#endif
14
15#include "common/assert.h"
16#include "common/bit_field.h"
17#include "common/common_funcs.h"
18#include "common/common_types.h"
19#include "common/logging/log.h"
20#include "common/vector_math.h"
21#include "video_core/regs_framebuffer.h"
22#include "video_core/regs_lighting.h"
23#include "video_core/regs_pipeline.h"
24#include "video_core/regs_rasterizer.h"
25#include "video_core/regs_shader.h"
26#include "video_core/regs_texturing.h" 7#include "video_core/regs_texturing.h"
27
28namespace Pica { 8namespace Pica {
29 9
30// Returns index corresponding to the Regs member labeled by field_name
31// TODO: Due to Visual studio bug 209229, offsetof does not return constant expressions
32// when used with array elements (e.g. PICA_REG_INDEX(vs_uniform_setup.set_value[1])).
33// For details cf.
34// https://connect.microsoft.com/VisualStudio/feedback/details/209229/offsetof-does-not-produce-a-constant-expression-for-array-members
35// Hopefully, this will be fixed sometime in the future.
36// For lack of better alternatives, we currently hardcode the offsets when constant
37// expressions are needed via PICA_REG_INDEX_WORKAROUND (on sane compilers, static_asserts
38// will then make sure the offsets indeed match the automatically calculated ones).
39#define PICA_REG_INDEX(field_name) (offsetof(Pica::Regs, field_name) / sizeof(u32))
40#if defined(_MSC_VER)
41#define PICA_REG_INDEX_WORKAROUND(field_name, backup_workaround_index) (backup_workaround_index)
42#else
43// NOTE: Yeah, hacking in a static_assert here just to workaround the lacking MSVC compiler
44// really is this annoying. This macro just forwards its first argument to PICA_REG_INDEX
45// and then performs a (no-op) cast to size_t iff the second argument matches the expected
46// field offset. Otherwise, the compiler will fail to compile this code.
47#define PICA_REG_INDEX_WORKAROUND(field_name, backup_workaround_index) \
48 ((typename std::enable_if<backup_workaround_index == PICA_REG_INDEX(field_name), \
49 size_t>::type)PICA_REG_INDEX(field_name))
50#endif // _MSC_VER
51
52struct Regs {
53 INSERT_PADDING_WORDS(0x10);
54 u32 trigger_irq;
55 INSERT_PADDING_WORDS(0x2f);
56 RasterizerRegs rasterizer;
57 TexturingRegs texturing;
58 FramebufferRegs framebuffer;
59 LightingRegs lighting;
60 PipelineRegs pipeline;
61 ShaderRegs gs;
62 ShaderRegs vs;
63 INSERT_PADDING_WORDS(0x20);
64
65 // Map register indices to names readable by humans
66 // Used for debugging purposes, so performance is not an issue here
67 static std::string GetCommandName(int index);
68
69 static constexpr size_t NumIds() {
70 return sizeof(Regs) / sizeof(u32);
71 }
72
73 const u32& operator[](int index) const {
74 const u32* content = reinterpret_cast<const u32*>(this);
75 return content[index];
76 }
77
78 u32& operator[](int index) {
79 u32* content = reinterpret_cast<u32*>(this);
80 return content[index];
81 }
82
83private:
84 /*
85 * Most physical addresses which Pica registers refer to are 8-byte aligned.
86 * This function should be used to get the address from a raw register value.
87 */
88 static inline u32 DecodeAddressRegister(u32 register_value) {
89 return register_value * 8;
90 }
91};
92
93// TODO: MSVC does not support using offsetof() on non-static data members even though this
94// is technically allowed since C++11. This macro should be enabled once MSVC adds
95// support for that.
96#ifndef _MSC_VER
97#define ASSERT_REG_POSITION(field_name, position) \
98 static_assert(offsetof(Regs, field_name) == position * 4, \
99 "Field " #field_name " has invalid position")
100
101ASSERT_REG_POSITION(trigger_irq, 0x10);
102
103ASSERT_REG_POSITION(rasterizer, 0x40);
104ASSERT_REG_POSITION(rasterizer.cull_mode, 0x40);
105ASSERT_REG_POSITION(rasterizer.viewport_size_x, 0x41);
106ASSERT_REG_POSITION(rasterizer.viewport_size_y, 0x43);
107ASSERT_REG_POSITION(rasterizer.viewport_depth_range, 0x4d);
108ASSERT_REG_POSITION(rasterizer.viewport_depth_near_plane, 0x4e);
109ASSERT_REG_POSITION(rasterizer.vs_output_attributes[0], 0x50);
110ASSERT_REG_POSITION(rasterizer.vs_output_attributes[1], 0x51);
111ASSERT_REG_POSITION(rasterizer.scissor_test, 0x65);
112ASSERT_REG_POSITION(rasterizer.viewport_corner, 0x68);
113ASSERT_REG_POSITION(rasterizer.depthmap_enable, 0x6D);
114
115ASSERT_REG_POSITION(texturing, 0x80);
116ASSERT_REG_POSITION(texturing.texture0_enable, 0x80);
117ASSERT_REG_POSITION(texturing.texture0, 0x81);
118ASSERT_REG_POSITION(texturing.texture0_format, 0x8e);
119ASSERT_REG_POSITION(texturing.fragment_lighting_enable, 0x8f);
120ASSERT_REG_POSITION(texturing.texture1, 0x91);
121ASSERT_REG_POSITION(texturing.texture1_format, 0x96);
122ASSERT_REG_POSITION(texturing.texture2, 0x99);
123ASSERT_REG_POSITION(texturing.texture2_format, 0x9e);
124ASSERT_REG_POSITION(texturing.tev_stage0, 0xc0);
125ASSERT_REG_POSITION(texturing.tev_stage1, 0xc8);
126ASSERT_REG_POSITION(texturing.tev_stage2, 0xd0);
127ASSERT_REG_POSITION(texturing.tev_stage3, 0xd8);
128ASSERT_REG_POSITION(texturing.tev_combiner_buffer_input, 0xe0);
129ASSERT_REG_POSITION(texturing.fog_mode, 0xe0);
130ASSERT_REG_POSITION(texturing.fog_color, 0xe1);
131ASSERT_REG_POSITION(texturing.fog_lut_offset, 0xe6);
132ASSERT_REG_POSITION(texturing.fog_lut_data, 0xe8);
133ASSERT_REG_POSITION(texturing.tev_stage4, 0xf0);
134ASSERT_REG_POSITION(texturing.tev_stage5, 0xf8);
135ASSERT_REG_POSITION(texturing.tev_combiner_buffer_color, 0xfd);
136
137ASSERT_REG_POSITION(framebuffer, 0x100);
138ASSERT_REG_POSITION(framebuffer.output_merger, 0x100);
139ASSERT_REG_POSITION(framebuffer.framebuffer, 0x110);
140
141ASSERT_REG_POSITION(lighting, 0x140);
142
143ASSERT_REG_POSITION(pipeline, 0x200);
144ASSERT_REG_POSITION(pipeline.vertex_attributes, 0x200);
145ASSERT_REG_POSITION(pipeline.index_array, 0x227);
146ASSERT_REG_POSITION(pipeline.num_vertices, 0x228);
147ASSERT_REG_POSITION(pipeline.vertex_offset, 0x22a);
148ASSERT_REG_POSITION(pipeline.trigger_draw, 0x22e);
149ASSERT_REG_POSITION(pipeline.trigger_draw_indexed, 0x22f);
150ASSERT_REG_POSITION(pipeline.vs_default_attributes_setup, 0x232);
151ASSERT_REG_POSITION(pipeline.command_buffer, 0x238);
152ASSERT_REG_POSITION(pipeline.gpu_mode, 0x245);
153ASSERT_REG_POSITION(pipeline.triangle_topology, 0x25e);
154ASSERT_REG_POSITION(pipeline.restart_primitive, 0x25f);
155
156ASSERT_REG_POSITION(gs, 0x280);
157ASSERT_REG_POSITION(vs, 0x2b0);
158
159#undef ASSERT_REG_POSITION
160#endif // !defined(_MSC_VER)
161
162// The total number of registers is chosen arbitrarily, but let's make sure it's not some odd value
163// anyway.
164static_assert(sizeof(Regs) <= 0x300 * sizeof(u32),
165 "Register set structure larger than it should be");
166static_assert(sizeof(Regs) >= 0x300 * sizeof(u32),
167 "Register set structure smaller than it should be");
168
169/// Initialize Pica state 10/// Initialize Pica state
170void Init(); 11void Init();
171 12
diff --git a/src/video_core/pica_state.h b/src/video_core/pica_state.h
index 785d05650..af7536d11 100644
--- a/src/video_core/pica_state.h
+++ b/src/video_core/pica_state.h
@@ -7,8 +7,8 @@
7#include <array> 7#include <array>
8#include "common/bit_field.h" 8#include "common/bit_field.h"
9#include "common/common_types.h" 9#include "common/common_types.h"
10#include "video_core/pica.h"
11#include "video_core/primitive_assembly.h" 10#include "video_core/primitive_assembly.h"
11#include "video_core/regs.h"
12#include "video_core/shader/shader.h" 12#include "video_core/shader/shader.h"
13 13
14namespace Pica { 14namespace Pica {
diff --git a/src/video_core/rasterizer.cpp b/src/video_core/rasterizer.cpp
index f053143f1..ca09c9d0e 100644
--- a/src/video_core/rasterizer.cpp
+++ b/src/video_core/rasterizer.cpp
@@ -16,10 +16,10 @@
16#include "core/hw/gpu.h" 16#include "core/hw/gpu.h"
17#include "core/memory.h" 17#include "core/memory.h"
18#include "video_core/debug_utils/debug_utils.h" 18#include "video_core/debug_utils/debug_utils.h"
19#include "video_core/pica.h"
20#include "video_core/pica_state.h" 19#include "video_core/pica_state.h"
21#include "video_core/pica_types.h" 20#include "video_core/pica_types.h"
22#include "video_core/rasterizer.h" 21#include "video_core/rasterizer.h"
22#include "video_core/regs.h"
23#include "video_core/shader/shader.h" 23#include "video_core/shader/shader.h"
24#include "video_core/texture/texture_decode.h" 24#include "video_core/texture/texture_decode.h"
25#include "video_core/utils.h" 25#include "video_core/utils.h"
diff --git a/src/video_core/regs.cpp b/src/video_core/regs.cpp
new file mode 100644
index 000000000..f47e9e763
--- /dev/null
+++ b/src/video_core/regs.cpp
@@ -0,0 +1,493 @@
1// Copyright 2015 Citra Emulator Project
2// Licensed under GPLv2 or any later version
3// Refer to the license.txt file included.
4
5#include <iterator>
6#include <unordered_map>
7#include <utility>
8
9#include "common/common_types.h"
10#include "video_core/regs.h"
11
12namespace Pica {
13
14static const std::pair<u16, const char*> register_names[] = {
15 {0x010, "GPUREG_FINALIZE"},
16
17 {0x040, "GPUREG_FACECULLING_CONFIG"},
18 {0x041, "GPUREG_VIEWPORT_WIDTH"},
19 {0x042, "GPUREG_VIEWPORT_INVW"},
20 {0x043, "GPUREG_VIEWPORT_HEIGHT"},
21 {0x044, "GPUREG_VIEWPORT_INVH"},
22
23 {0x047, "GPUREG_FRAGOP_CLIP"},
24 {0x048, "GPUREG_FRAGOP_CLIP_DATA0"},
25 {0x049, "GPUREG_FRAGOP_CLIP_DATA1"},
26 {0x04A, "GPUREG_FRAGOP_CLIP_DATA2"},
27 {0x04B, "GPUREG_FRAGOP_CLIP_DATA3"},
28
29 {0x04D, "GPUREG_DEPTHMAP_SCALE"},
30 {0x04E, "GPUREG_DEPTHMAP_OFFSET"},
31 {0x04F, "GPUREG_SH_OUTMAP_TOTAL"},
32 {0x050, "GPUREG_SH_OUTMAP_O0"},
33 {0x051, "GPUREG_SH_OUTMAP_O1"},
34 {0x052, "GPUREG_SH_OUTMAP_O2"},
35 {0x053, "GPUREG_SH_OUTMAP_O3"},
36 {0x054, "GPUREG_SH_OUTMAP_O4"},
37 {0x055, "GPUREG_SH_OUTMAP_O5"},
38 {0x056, "GPUREG_SH_OUTMAP_O6"},
39
40 {0x061, "GPUREG_EARLYDEPTH_FUNC"},
41 {0x062, "GPUREG_EARLYDEPTH_TEST1"},
42 {0x063, "GPUREG_EARLYDEPTH_CLEAR"},
43 {0x064, "GPUREG_SH_OUTATTR_MODE"},
44 {0x065, "GPUREG_SCISSORTEST_MODE"},
45 {0x066, "GPUREG_SCISSORTEST_POS"},
46 {0x067, "GPUREG_SCISSORTEST_DIM"},
47 {0x068, "GPUREG_VIEWPORT_XY"},
48
49 {0x06A, "GPUREG_EARLYDEPTH_DATA"},
50
51 {0x06D, "GPUREG_DEPTHMAP_ENABLE"},
52 {0x06E, "GPUREG_RENDERBUF_DIM"},
53 {0x06F, "GPUREG_SH_OUTATTR_CLOCK"},
54
55 {0x080, "GPUREG_TEXUNIT_CONFIG"},
56 {0x081, "GPUREG_TEXUNIT0_BORDER_COLOR"},
57 {0x082, "GPUREG_TEXUNIT0_DIM"},
58 {0x083, "GPUREG_TEXUNIT0_PARAM"},
59 {0x084, "GPUREG_TEXUNIT0_LOD"},
60 {0x085, "GPUREG_TEXUNIT0_ADDR1"},
61 {0x086, "GPUREG_TEXUNIT0_ADDR2"},
62 {0x087, "GPUREG_TEXUNIT0_ADDR3"},
63 {0x088, "GPUREG_TEXUNIT0_ADDR4"},
64 {0x089, "GPUREG_TEXUNIT0_ADDR5"},
65 {0x08A, "GPUREG_TEXUNIT0_ADDR6"},
66 {0x08B, "GPUREG_TEXUNIT0_SHADOW"},
67
68 {0x08E, "GPUREG_TEXUNIT0_TYPE"},
69 {0x08F, "GPUREG_LIGHTING_ENABLE0"},
70
71 {0x091, "GPUREG_TEXUNIT1_BORDER_COLOR"},
72 {0x092, "GPUREG_TEXUNIT1_DIM"},
73 {0x093, "GPUREG_TEXUNIT1_PARAM"},
74 {0x094, "GPUREG_TEXUNIT1_LOD"},
75 {0x095, "GPUREG_TEXUNIT1_ADDR"},
76 {0x096, "GPUREG_TEXUNIT1_TYPE"},
77
78 {0x099, "GPUREG_TEXUNIT2_BORDER_COLOR"},
79 {0x09A, "GPUREG_TEXUNIT2_DIM"},
80 {0x09B, "GPUREG_TEXUNIT2_PARAM"},
81 {0x09C, "GPUREG_TEXUNIT2_LOD"},
82 {0x09D, "GPUREG_TEXUNIT2_ADDR"},
83 {0x09E, "GPUREG_TEXUNIT2_TYPE"},
84
85 {0x0A8, "GPUREG_TEXUNIT3_PROCTEX0"},
86 {0x0A9, "GPUREG_TEXUNIT3_PROCTEX1"},
87 {0x0AA, "GPUREG_TEXUNIT3_PROCTEX2"},
88 {0x0AB, "GPUREG_TEXUNIT3_PROCTEX3"},
89 {0x0AC, "GPUREG_TEXUNIT3_PROCTEX4"},
90 {0x0AD, "GPUREG_TEXUNIT3_PROCTEX5"},
91
92 {0x0AF, "GPUREG_PROCTEX_LUT"},
93 {0x0B0, "GPUREG_PROCTEX_LUT_DATA0"},
94 {0x0B1, "GPUREG_PROCTEX_LUT_DATA1"},
95 {0x0B2, "GPUREG_PROCTEX_LUT_DATA2"},
96 {0x0B3, "GPUREG_PROCTEX_LUT_DATA3"},
97 {0x0B4, "GPUREG_PROCTEX_LUT_DATA4"},
98 {0x0B5, "GPUREG_PROCTEX_LUT_DATA5"},
99 {0x0B6, "GPUREG_PROCTEX_LUT_DATA6"},
100 {0x0B7, "GPUREG_PROCTEX_LUT_DATA7"},
101
102 {0x0C0, "GPUREG_TEXENV0_SOURCE"},
103 {0x0C1, "GPUREG_TEXENV0_OPERAND"},
104 {0x0C2, "GPUREG_TEXENV0_COMBINER"},
105 {0x0C3, "GPUREG_TEXENV0_COLOR"},
106 {0x0C4, "GPUREG_TEXENV0_SCALE"},
107
108 {0x0C8, "GPUREG_TEXENV1_SOURCE"},
109 {0x0C9, "GPUREG_TEXENV1_OPERAND"},
110 {0x0CA, "GPUREG_TEXENV1_COMBINER"},
111 {0x0CB, "GPUREG_TEXENV1_COLOR"},
112 {0x0CC, "GPUREG_TEXENV1_SCALE"},
113
114 {0x0D0, "GPUREG_TEXENV2_SOURCE"},
115 {0x0D1, "GPUREG_TEXENV2_OPERAND"},
116 {0x0D2, "GPUREG_TEXENV2_COMBINER"},
117 {0x0D3, "GPUREG_TEXENV2_COLOR"},
118 {0x0D4, "GPUREG_TEXENV2_SCALE"},
119
120 {0x0D8, "GPUREG_TEXENV3_SOURCE"},
121 {0x0D9, "GPUREG_TEXENV3_OPERAND"},
122 {0x0DA, "GPUREG_TEXENV3_COMBINER"},
123 {0x0DB, "GPUREG_TEXENV3_COLOR"},
124 {0x0DC, "GPUREG_TEXENV3_SCALE"},
125
126 {0x0E0, "GPUREG_TEXENV_UPDATE_BUFFER"},
127 {0x0E1, "GPUREG_FOG_COLOR"},
128
129 {0x0E4, "GPUREG_GAS_ATTENUATION"},
130 {0x0E5, "GPUREG_GAS_ACCMAX"},
131 {0x0E6, "GPUREG_FOG_LUT_INDEX"},
132
133 {0x0E8, "GPUREG_FOG_LUT_DATA0"},
134 {0x0E9, "GPUREG_FOG_LUT_DATA1"},
135 {0x0EA, "GPUREG_FOG_LUT_DATA2"},
136 {0x0EB, "GPUREG_FOG_LUT_DATA3"},
137 {0x0EC, "GPUREG_FOG_LUT_DATA4"},
138 {0x0ED, "GPUREG_FOG_LUT_DATA5"},
139 {0x0EE, "GPUREG_FOG_LUT_DATA6"},
140 {0x0EF, "GPUREG_FOG_LUT_DATA7"},
141 {0x0F0, "GPUREG_TEXENV4_SOURCE"},
142 {0x0F1, "GPUREG_TEXENV4_OPERAND"},
143 {0x0F2, "GPUREG_TEXENV4_COMBINER"},
144 {0x0F3, "GPUREG_TEXENV4_COLOR"},
145 {0x0F4, "GPUREG_TEXENV4_SCALE"},
146
147 {0x0F8, "GPUREG_TEXENV5_SOURCE"},
148 {0x0F9, "GPUREG_TEXENV5_OPERAND"},
149 {0x0FA, "GPUREG_TEXENV5_COMBINER"},
150 {0x0FB, "GPUREG_TEXENV5_COLOR"},
151 {0x0FC, "GPUREG_TEXENV5_SCALE"},
152 {0x0FD, "GPUREG_TEXENV_BUFFER_COLOR"},
153
154 {0x100, "GPUREG_COLOR_OPERATION"},
155 {0x101, "GPUREG_BLEND_FUNC"},
156 {0x102, "GPUREG_LOGIC_OP"},
157 {0x103, "GPUREG_BLEND_COLOR"},
158 {0x104, "GPUREG_FRAGOP_ALPHA_TEST"},
159 {0x105, "GPUREG_STENCIL_TEST"},
160 {0x106, "GPUREG_STENCIL_OP"},
161 {0x107, "GPUREG_DEPTH_COLOR_MASK"},
162
163 {0x110, "GPUREG_FRAMEBUFFER_INVALIDATE"},
164 {0x111, "GPUREG_FRAMEBUFFER_FLUSH"},
165 {0x112, "GPUREG_COLORBUFFER_READ"},
166 {0x113, "GPUREG_COLORBUFFER_WRITE"},
167 {0x114, "GPUREG_DEPTHBUFFER_READ"},
168 {0x115, "GPUREG_DEPTHBUFFER_WRITE"},
169 {0x116, "GPUREG_DEPTHBUFFER_FORMAT"},
170 {0x117, "GPUREG_COLORBUFFER_FORMAT"},
171 {0x118, "GPUREG_EARLYDEPTH_TEST2"},
172
173 {0x11B, "GPUREG_FRAMEBUFFER_BLOCK32"},
174 {0x11C, "GPUREG_DEPTHBUFFER_LOC"},
175 {0x11D, "GPUREG_COLORBUFFER_LOC"},
176 {0x11E, "GPUREG_FRAMEBUFFER_DIM"},
177
178 {0x120, "GPUREG_GAS_LIGHT_XY"},
179 {0x121, "GPUREG_GAS_LIGHT_Z"},
180 {0x122, "GPUREG_GAS_LIGHT_Z_COLOR"},
181 {0x123, "GPUREG_GAS_LUT_INDEX"},
182 {0x124, "GPUREG_GAS_LUT_DATA"},
183
184 {0x126, "GPUREG_GAS_DELTAZ_DEPTH"},
185
186 {0x130, "GPUREG_FRAGOP_SHADOW"},
187
188 {0x140, "GPUREG_LIGHT0_SPECULAR0"},
189 {0x141, "GPUREG_LIGHT0_SPECULAR1"},
190 {0x142, "GPUREG_LIGHT0_DIFFUSE"},
191 {0x143, "GPUREG_LIGHT0_AMBIENT"},
192 {0x144, "GPUREG_LIGHT0_XY"},
193 {0x145, "GPUREG_LIGHT0_Z"},
194 {0x146, "GPUREG_LIGHT0_SPOTDIR_XY"},
195 {0x147, "GPUREG_LIGHT0_SPOTDIR_Z"},
196
197 {0x149, "GPUREG_LIGHT0_CONFIG"},
198 {0x14A, "GPUREG_LIGHT0_ATTENUATION_BIAS"},
199 {0x14B, "GPUREG_LIGHT0_ATTENUATION_SCALE"},
200
201 {0x150, "GPUREG_LIGHT1_SPECULAR0"},
202 {0x151, "GPUREG_LIGHT1_SPECULAR1"},
203 {0x152, "GPUREG_LIGHT1_DIFFUSE"},
204 {0x153, "GPUREG_LIGHT1_AMBIENT"},
205 {0x154, "GPUREG_LIGHT1_XY"},
206 {0x155, "GPUREG_LIGHT1_Z"},
207 {0x156, "GPUREG_LIGHT1_SPOTDIR_XY"},
208 {0x157, "GPUREG_LIGHT1_SPOTDIR_Z"},
209
210 {0x159, "GPUREG_LIGHT1_CONFIG"},
211 {0x15A, "GPUREG_LIGHT1_ATTENUATION_BIAS"},
212 {0x15B, "GPUREG_LIGHT1_ATTENUATION_SCALE"},
213
214 {0x160, "GPUREG_LIGHT2_SPECULAR0"},
215 {0x161, "GPUREG_LIGHT2_SPECULAR1"},
216 {0x162, "GPUREG_LIGHT2_DIFFUSE"},
217 {0x163, "GPUREG_LIGHT2_AMBIENT"},
218 {0x164, "GPUREG_LIGHT2_XY"},
219 {0x165, "GPUREG_LIGHT2_Z"},
220 {0x166, "GPUREG_LIGHT2_SPOTDIR_XY"},
221 {0x167, "GPUREG_LIGHT2_SPOTDIR_Z"},
222
223 {0x169, "GPUREG_LIGHT2_CONFIG"},
224 {0x16A, "GPUREG_LIGHT2_ATTENUATION_BIAS"},
225 {0x16B, "GPUREG_LIGHT2_ATTENUATION_SCALE"},
226
227 {0x170, "GPUREG_LIGHT3_SPECULAR0"},
228 {0x171, "GPUREG_LIGHT3_SPECULAR1"},
229 {0x172, "GPUREG_LIGHT3_DIFFUSE"},
230 {0x173, "GPUREG_LIGHT3_AMBIENT"},
231 {0x174, "GPUREG_LIGHT3_XY"},
232 {0x175, "GPUREG_LIGHT3_Z"},
233 {0x176, "GPUREG_LIGHT3_SPOTDIR_XY"},
234 {0x177, "GPUREG_LIGHT3_SPOTDIR_Z"},
235
236 {0x179, "GPUREG_LIGHT3_CONFIG"},
237 {0x17A, "GPUREG_LIGHT3_ATTENUATION_BIAS"},
238 {0x17B, "GPUREG_LIGHT3_ATTENUATION_SCALE"},
239
240 {0x180, "GPUREG_LIGHT4_SPECULAR0"},
241 {0x181, "GPUREG_LIGHT4_SPECULAR1"},
242 {0x182, "GPUREG_LIGHT4_DIFFUSE"},
243 {0x183, "GPUREG_LIGHT4_AMBIENT"},
244 {0x184, "GPUREG_LIGHT4_XY"},
245 {0x185, "GPUREG_LIGHT4_Z"},
246 {0x186, "GPUREG_LIGHT4_SPOTDIR_XY"},
247 {0x187, "GPUREG_LIGHT4_SPOTDIR_Z"},
248
249 {0x189, "GPUREG_LIGHT4_CONFIG"},
250 {0x18A, "GPUREG_LIGHT4_ATTENUATION_BIAS"},
251 {0x18B, "GPUREG_LIGHT4_ATTENUATION_SCALE"},
252
253 {0x190, "GPUREG_LIGHT5_SPECULAR0"},
254 {0x191, "GPUREG_LIGHT5_SPECULAR1"},
255 {0x192, "GPUREG_LIGHT5_DIFFUSE"},
256 {0x193, "GPUREG_LIGHT5_AMBIENT"},
257 {0x194, "GPUREG_LIGHT5_XY"},
258 {0x195, "GPUREG_LIGHT5_Z"},
259 {0x196, "GPUREG_LIGHT5_SPOTDIR_XY"},
260 {0x197, "GPUREG_LIGHT5_SPOTDIR_Z"},
261
262 {0x199, "GPUREG_LIGHT5_CONFIG"},
263 {0x19A, "GPUREG_LIGHT5_ATTENUATION_BIAS"},
264 {0x19B, "GPUREG_LIGHT5_ATTENUATION_SCALE"},
265
266 {0x1A0, "GPUREG_LIGHT6_SPECULAR0"},
267 {0x1A1, "GPUREG_LIGHT6_SPECULAR1"},
268 {0x1A2, "GPUREG_LIGHT6_DIFFUSE"},
269 {0x1A3, "GPUREG_LIGHT6_AMBIENT"},
270 {0x1A4, "GPUREG_LIGHT6_XY"},
271 {0x1A5, "GPUREG_LIGHT6_Z"},
272 {0x1A6, "GPUREG_LIGHT6_SPOTDIR_XY"},
273 {0x1A7, "GPUREG_LIGHT6_SPOTDIR_Z"},
274
275 {0x1A9, "GPUREG_LIGHT6_CONFIG"},
276 {0x1AA, "GPUREG_LIGHT6_ATTENUATION_BIAS"},
277 {0x1AB, "GPUREG_LIGHT6_ATTENUATION_SCALE"},
278
279 {0x1B0, "GPUREG_LIGHT7_SPECULAR0"},
280 {0x1B1, "GPUREG_LIGHT7_SPECULAR1"},
281 {0x1B2, "GPUREG_LIGHT7_DIFFUSE"},
282 {0x1B3, "GPUREG_LIGHT7_AMBIENT"},
283 {0x1B4, "GPUREG_LIGHT7_XY"},
284 {0x1B5, "GPUREG_LIGHT7_Z"},
285 {0x1B6, "GPUREG_LIGHT7_SPOTDIR_XY"},
286 {0x1B7, "GPUREG_LIGHT7_SPOTDIR_Z"},
287
288 {0x1B9, "GPUREG_LIGHT7_CONFIG"},
289 {0x1BA, "GPUREG_LIGHT7_ATTENUATION_BIAS"},
290 {0x1BB, "GPUREG_LIGHT7_ATTENUATION_SCALE"},
291
292 {0x1C0, "GPUREG_LIGHTING_AMBIENT"},
293
294 {0x1C2, "GPUREG_LIGHTING_NUM_LIGHTS"},
295 {0x1C3, "GPUREG_LIGHTING_CONFIG0"},
296 {0x1C4, "GPUREG_LIGHTING_CONFIG1"},
297 {0x1C5, "GPUREG_LIGHTING_LUT_INDEX"},
298 {0x1C6, "GPUREG_LIGHTING_ENABLE1"},
299
300 {0x1C8, "GPUREG_LIGHTING_LUT_DATA0"},
301 {0x1C9, "GPUREG_LIGHTING_LUT_DATA1"},
302 {0x1CA, "GPUREG_LIGHTING_LUT_DATA2"},
303 {0x1CB, "GPUREG_LIGHTING_LUT_DATA3"},
304 {0x1CC, "GPUREG_LIGHTING_LUT_DATA4"},
305 {0x1CD, "GPUREG_LIGHTING_LUT_DATA5"},
306 {0x1CE, "GPUREG_LIGHTING_LUT_DATA6"},
307 {0x1CF, "GPUREG_LIGHTING_LUT_DATA7"},
308 {0x1D0, "GPUREG_LIGHTING_LUTINPUT_ABS"},
309 {0x1D1, "GPUREG_LIGHTING_LUTINPUT_SELECT"},
310 {0x1D2, "GPUREG_LIGHTING_LUTINPUT_SCALE"},
311
312 {0x1D9, "GPUREG_LIGHTING_LIGHT_PERMUTATION"},
313
314 {0x200, "GPUREG_ATTRIBBUFFERS_LOC"},
315 {0x201, "GPUREG_ATTRIBBUFFERS_FORMAT_LOW"},
316 {0x202, "GPUREG_ATTRIBBUFFERS_FORMAT_HIGH"},
317 {0x203, "GPUREG_ATTRIBBUFFER0_OFFSET"},
318 {0x204, "GPUREG_ATTRIBBUFFER0_CONFIG1"},
319 {0x205, "GPUREG_ATTRIBBUFFER0_CONFIG2"},
320 {0x206, "GPUREG_ATTRIBBUFFER1_OFFSET"},
321 {0x207, "GPUREG_ATTRIBBUFFER1_CONFIG1"},
322 {0x208, "GPUREG_ATTRIBBUFFER1_CONFIG2"},
323 {0x209, "GPUREG_ATTRIBBUFFER2_OFFSET"},
324 {0x20A, "GPUREG_ATTRIBBUFFER2_CONFIG1"},
325 {0x20B, "GPUREG_ATTRIBBUFFER2_CONFIG2"},
326 {0x20C, "GPUREG_ATTRIBBUFFER3_OFFSET"},
327 {0x20D, "GPUREG_ATTRIBBUFFER3_CONFIG1"},
328 {0x20E, "GPUREG_ATTRIBBUFFER3_CONFIG2"},
329 {0x20F, "GPUREG_ATTRIBBUFFER4_OFFSET"},
330 {0x210, "GPUREG_ATTRIBBUFFER4_CONFIG1"},
331 {0x211, "GPUREG_ATTRIBBUFFER4_CONFIG2"},
332 {0x212, "GPUREG_ATTRIBBUFFER5_OFFSET"},
333 {0x213, "GPUREG_ATTRIBBUFFER5_CONFIG1"},
334 {0x214, "GPUREG_ATTRIBBUFFER5_CONFIG2"},
335 {0x215, "GPUREG_ATTRIBBUFFER6_OFFSET"},
336 {0x216, "GPUREG_ATTRIBBUFFER6_CONFIG1"},
337 {0x217, "GPUREG_ATTRIBBUFFER6_CONFIG2"},
338 {0x218, "GPUREG_ATTRIBBUFFER7_OFFSET"},
339 {0x219, "GPUREG_ATTRIBBUFFER7_CONFIG1"},
340 {0x21A, "GPUREG_ATTRIBBUFFER7_CONFIG2"},
341 {0x21B, "GPUREG_ATTRIBBUFFER8_OFFSET"},
342 {0x21C, "GPUREG_ATTRIBBUFFER8_CONFIG1"},
343 {0x21D, "GPUREG_ATTRIBBUFFER8_CONFIG2"},
344 {0x21E, "GPUREG_ATTRIBBUFFER9_OFFSET"},
345 {0x21F, "GPUREG_ATTRIBBUFFER9_CONFIG1"},
346 {0x220, "GPUREG_ATTRIBBUFFER9_CONFIG2"},
347 {0x221, "GPUREG_ATTRIBBUFFER10_OFFSET"},
348 {0x222, "GPUREG_ATTRIBBUFFER10_CONFIG1"},
349 {0x223, "GPUREG_ATTRIBBUFFER10_CONFIG2"},
350 {0x224, "GPUREG_ATTRIBBUFFER11_OFFSET"},
351 {0x225, "GPUREG_ATTRIBBUFFER11_CONFIG1"},
352 {0x226, "GPUREG_ATTRIBBUFFER11_CONFIG2"},
353 {0x227, "GPUREG_INDEXBUFFER_CONFIG"},
354 {0x228, "GPUREG_NUMVERTICES"},
355 {0x229, "GPUREG_GEOSTAGE_CONFIG"},
356 {0x22A, "GPUREG_VERTEX_OFFSET"},
357
358 {0x22D, "GPUREG_POST_VERTEX_CACHE_NUM"},
359 {0x22E, "GPUREG_DRAWARRAYS"},
360 {0x22F, "GPUREG_DRAWELEMENTS"},
361
362 {0x231, "GPUREG_VTX_FUNC"},
363 {0x232, "GPUREG_FIXEDATTRIB_INDEX"},
364 {0x233, "GPUREG_FIXEDATTRIB_DATA0"},
365 {0x234, "GPUREG_FIXEDATTRIB_DATA1"},
366 {0x235, "GPUREG_FIXEDATTRIB_DATA2"},
367
368 {0x238, "GPUREG_CMDBUF_SIZE0"},
369 {0x239, "GPUREG_CMDBUF_SIZE1"},
370 {0x23A, "GPUREG_CMDBUF_ADDR0"},
371 {0x23B, "GPUREG_CMDBUF_ADDR1"},
372 {0x23C, "GPUREG_CMDBUF_JUMP0"},
373 {0x23D, "GPUREG_CMDBUF_JUMP1"},
374
375 {0x242, "GPUREG_VSH_NUM_ATTR"},
376
377 {0x244, "GPUREG_VSH_COM_MODE"},
378 {0x245, "GPUREG_START_DRAW_FUNC0"},
379
380 {0x24A, "GPUREG_VSH_OUTMAP_TOTAL1"},
381
382 {0x251, "GPUREG_VSH_OUTMAP_TOTAL2"},
383 {0x252, "GPUREG_GSH_MISC0"},
384 {0x253, "GPUREG_GEOSTAGE_CONFIG2"},
385 {0x254, "GPUREG_GSH_MISC1"},
386
387 {0x25E, "GPUREG_PRIMITIVE_CONFIG"},
388 {0x25F, "GPUREG_RESTART_PRIMITIVE"},
389
390 {0x280, "GPUREG_GSH_BOOLUNIFORM"},
391 {0x281, "GPUREG_GSH_INTUNIFORM_I0"},
392 {0x282, "GPUREG_GSH_INTUNIFORM_I1"},
393 {0x283, "GPUREG_GSH_INTUNIFORM_I2"},
394 {0x284, "GPUREG_GSH_INTUNIFORM_I3"},
395
396 {0x289, "GPUREG_GSH_INPUTBUFFER_CONFIG"},
397 {0x28A, "GPUREG_GSH_ENTRYPOINT"},
398 {0x28B, "GPUREG_GSH_ATTRIBUTES_PERMUTATION_LOW"},
399 {0x28C, "GPUREG_GSH_ATTRIBUTES_PERMUTATION_HIGH"},
400 {0x28D, "GPUREG_GSH_OUTMAP_MASK"},
401
402 {0x28F, "GPUREG_GSH_CODETRANSFER_END"},
403 {0x290, "GPUREG_GSH_FLOATUNIFORM_INDEX"},
404 {0x291, "GPUREG_GSH_FLOATUNIFORM_DATA0"},
405 {0x292, "GPUREG_GSH_FLOATUNIFORM_DATA1"},
406 {0x293, "GPUREG_GSH_FLOATUNIFORM_DATA2"},
407 {0x294, "GPUREG_GSH_FLOATUNIFORM_DATA3"},
408 {0x295, "GPUREG_GSH_FLOATUNIFORM_DATA4"},
409 {0x296, "GPUREG_GSH_FLOATUNIFORM_DATA5"},
410 {0x297, "GPUREG_GSH_FLOATUNIFORM_DATA6"},
411 {0x298, "GPUREG_GSH_FLOATUNIFORM_DATA7"},
412
413 {0x29B, "GPUREG_GSH_CODETRANSFER_INDEX"},
414 {0x29C, "GPUREG_GSH_CODETRANSFER_DATA0"},
415 {0x29D, "GPUREG_GSH_CODETRANSFER_DATA1"},
416 {0x29E, "GPUREG_GSH_CODETRANSFER_DATA2"},
417 {0x29F, "GPUREG_GSH_CODETRANSFER_DATA3"},
418 {0x2A0, "GPUREG_GSH_CODETRANSFER_DATA4"},
419 {0x2A1, "GPUREG_GSH_CODETRANSFER_DATA5"},
420 {0x2A2, "GPUREG_GSH_CODETRANSFER_DATA6"},
421 {0x2A3, "GPUREG_GSH_CODETRANSFER_DATA7"},
422
423 {0x2A5, "GPUREG_GSH_OPDESCS_INDEX"},
424 {0x2A6, "GPUREG_GSH_OPDESCS_DATA0"},
425 {0x2A7, "GPUREG_GSH_OPDESCS_DATA1"},
426 {0x2A8, "GPUREG_GSH_OPDESCS_DATA2"},
427 {0x2A9, "GPUREG_GSH_OPDESCS_DATA3"},
428 {0x2AA, "GPUREG_GSH_OPDESCS_DATA4"},
429 {0x2AB, "GPUREG_GSH_OPDESCS_DATA5"},
430 {0x2AC, "GPUREG_GSH_OPDESCS_DATA6"},
431 {0x2AD, "GPUREG_GSH_OPDESCS_DATA7"},
432
433 {0x2B0, "GPUREG_VSH_BOOLUNIFORM"},
434 {0x2B1, "GPUREG_VSH_INTUNIFORM_I0"},
435 {0x2B2, "GPUREG_VSH_INTUNIFORM_I1"},
436 {0x2B3, "GPUREG_VSH_INTUNIFORM_I2"},
437 {0x2B4, "GPUREG_VSH_INTUNIFORM_I3"},
438
439 {0x2B9, "GPUREG_VSH_INPUTBUFFER_CONFIG"},
440 {0x2BA, "GPUREG_VSH_ENTRYPOINT"},
441 {0x2BB, "GPUREG_VSH_ATTRIBUTES_PERMUTATION_LOW"},
442 {0x2BC, "GPUREG_VSH_ATTRIBUTES_PERMUTATION_HIGH"},
443 {0x2BD, "GPUREG_VSH_OUTMAP_MASK"},
444
445 {0x2BF, "GPUREG_VSH_CODETRANSFER_END"},
446 {0x2C0, "GPUREG_VSH_FLOATUNIFORM_INDEX"},
447 {0x2C1, "GPUREG_VSH_FLOATUNIFORM_DATA0"},
448 {0x2C2, "GPUREG_VSH_FLOATUNIFORM_DATA1"},
449 {0x2C3, "GPUREG_VSH_FLOATUNIFORM_DATA2"},
450 {0x2C4, "GPUREG_VSH_FLOATUNIFORM_DATA3"},
451 {0x2C5, "GPUREG_VSH_FLOATUNIFORM_DATA4"},
452 {0x2C6, "GPUREG_VSH_FLOATUNIFORM_DATA5"},
453 {0x2C7, "GPUREG_VSH_FLOATUNIFORM_DATA6"},
454 {0x2C8, "GPUREG_VSH_FLOATUNIFORM_DATA7"},
455
456 {0x2CB, "GPUREG_VSH_CODETRANSFER_INDEX"},
457 {0x2CC, "GPUREG_VSH_CODETRANSFER_DATA0"},
458 {0x2CD, "GPUREG_VSH_CODETRANSFER_DATA1"},
459 {0x2CE, "GPUREG_VSH_CODETRANSFER_DATA2"},
460 {0x2CF, "GPUREG_VSH_CODETRANSFER_DATA3"},
461 {0x2D0, "GPUREG_VSH_CODETRANSFER_DATA4"},
462 {0x2D1, "GPUREG_VSH_CODETRANSFER_DATA5"},
463 {0x2D2, "GPUREG_VSH_CODETRANSFER_DATA6"},
464 {0x2D3, "GPUREG_VSH_CODETRANSFER_DATA7"},
465
466 {0x2D5, "GPUREG_VSH_OPDESCS_INDEX"},
467 {0x2D6, "GPUREG_VSH_OPDESCS_DATA0"},
468 {0x2D7, "GPUREG_VSH_OPDESCS_DATA1"},
469 {0x2D8, "GPUREG_VSH_OPDESCS_DATA2"},
470 {0x2D9, "GPUREG_VSH_OPDESCS_DATA3"},
471 {0x2DA, "GPUREG_VSH_OPDESCS_DATA4"},
472 {0x2DB, "GPUREG_VSH_OPDESCS_DATA5"},
473 {0x2DC, "GPUREG_VSH_OPDESCS_DATA6"},
474 {0x2DD, "GPUREG_VSH_OPDESCS_DATA7"},
475};
476
477std::string Regs::GetCommandName(int index) {
478 static std::unordered_map<u32, const char*> map;
479
480 if (map.empty()) {
481 map.insert(std::begin(register_names), std::end(register_names));
482 }
483
484 // Return empty string if no match is found
485 auto it = map.find(index);
486 if (it != map.end()) {
487 return it->second;
488 } else {
489 return std::string();
490 }
491}
492
493} // namespace Pica
diff --git a/src/video_core/regs.h b/src/video_core/regs.h
new file mode 100644
index 000000000..f25edde27
--- /dev/null
+++ b/src/video_core/regs.h
@@ -0,0 +1,164 @@
1// Copyright 2017 Citra Emulator Project
2// Licensed under GPLv2 or any later version
3// Refer to the license.txt file included.
4
5#pragma once
6
7#include <array>
8#include <cstddef>
9#include <string>
10#ifndef _MSC_VER
11#include <type_traits> // for std::enable_if
12#endif
13
14#include "common/common_funcs.h"
15#include "common/common_types.h"
16#include "video_core/regs_framebuffer.h"
17#include "video_core/regs_lighting.h"
18#include "video_core/regs_pipeline.h"
19#include "video_core/regs_rasterizer.h"
20#include "video_core/regs_shader.h"
21#include "video_core/regs_texturing.h"
22
23namespace Pica {
24
25// Returns index corresponding to the Regs member labeled by field_name
26// TODO: Due to Visual studio bug 209229, offsetof does not return constant expressions
27// when used with array elements (e.g. PICA_REG_INDEX(vs_uniform_setup.set_value[1])).
28// For details cf.
29// https://connect.microsoft.com/VisualStudio/feedback/details/209229/offsetof-does-not-produce-a-constant-expression-for-array-members
30// Hopefully, this will be fixed sometime in the future.
31// For lack of better alternatives, we currently hardcode the offsets when constant
32// expressions are needed via PICA_REG_INDEX_WORKAROUND (on sane compilers, static_asserts
33// will then make sure the offsets indeed match the automatically calculated ones).
34#define PICA_REG_INDEX(field_name) (offsetof(Pica::Regs, field_name) / sizeof(u32))
35#if defined(_MSC_VER)
36#define PICA_REG_INDEX_WORKAROUND(field_name, backup_workaround_index) (backup_workaround_index)
37#else
38// NOTE: Yeah, hacking in a static_assert here just to workaround the lacking MSVC compiler
39// really is this annoying. This macro just forwards its first argument to PICA_REG_INDEX
40// and then performs a (no-op) cast to size_t iff the second argument matches the expected
41// field offset. Otherwise, the compiler will fail to compile this code.
42#define PICA_REG_INDEX_WORKAROUND(field_name, backup_workaround_index) \
43 ((typename std::enable_if<backup_workaround_index == PICA_REG_INDEX(field_name), \
44 size_t>::type)PICA_REG_INDEX(field_name))
45#endif // _MSC_VER
46
47struct Regs {
48 INSERT_PADDING_WORDS(0x10);
49 u32 trigger_irq;
50 INSERT_PADDING_WORDS(0x2f);
51 RasterizerRegs rasterizer;
52 TexturingRegs texturing;
53 FramebufferRegs framebuffer;
54 LightingRegs lighting;
55 PipelineRegs pipeline;
56 ShaderRegs gs;
57 ShaderRegs vs;
58 INSERT_PADDING_WORDS(0x20);
59
60 // Map register indices to names readable by humans
61 // Used for debugging purposes, so performance is not an issue here
62 static std::string GetCommandName(int index);
63
64 static constexpr size_t NumIds() {
65 return sizeof(Regs) / sizeof(u32);
66 }
67
68 const u32& operator[](int index) const {
69 const u32* content = reinterpret_cast<const u32*>(this);
70 return content[index];
71 }
72
73 u32& operator[](int index) {
74 u32* content = reinterpret_cast<u32*>(this);
75 return content[index];
76 }
77
78private:
79 /*
80 * Most physical addresses which Pica registers refer to are 8-byte aligned.
81 * This function should be used to get the address from a raw register value.
82 */
83 static inline u32 DecodeAddressRegister(u32 register_value) {
84 return register_value * 8;
85 }
86};
87
88// TODO: MSVC does not support using offsetof() on non-static data members even though this
89// is technically allowed since C++11. This macro should be enabled once MSVC adds
90// support for that.
91#ifndef _MSC_VER
92#define ASSERT_REG_POSITION(field_name, position) \
93 static_assert(offsetof(Regs, field_name) == position * 4, \
94 "Field " #field_name " has invalid position")
95
96ASSERT_REG_POSITION(trigger_irq, 0x10);
97
98ASSERT_REG_POSITION(rasterizer, 0x40);
99ASSERT_REG_POSITION(rasterizer.cull_mode, 0x40);
100ASSERT_REG_POSITION(rasterizer.viewport_size_x, 0x41);
101ASSERT_REG_POSITION(rasterizer.viewport_size_y, 0x43);
102ASSERT_REG_POSITION(rasterizer.viewport_depth_range, 0x4d);
103ASSERT_REG_POSITION(rasterizer.viewport_depth_near_plane, 0x4e);
104ASSERT_REG_POSITION(rasterizer.vs_output_attributes[0], 0x50);
105ASSERT_REG_POSITION(rasterizer.vs_output_attributes[1], 0x51);
106ASSERT_REG_POSITION(rasterizer.scissor_test, 0x65);
107ASSERT_REG_POSITION(rasterizer.viewport_corner, 0x68);
108ASSERT_REG_POSITION(rasterizer.depthmap_enable, 0x6D);
109
110ASSERT_REG_POSITION(texturing, 0x80);
111ASSERT_REG_POSITION(texturing.texture0_enable, 0x80);
112ASSERT_REG_POSITION(texturing.texture0, 0x81);
113ASSERT_REG_POSITION(texturing.texture0_format, 0x8e);
114ASSERT_REG_POSITION(texturing.fragment_lighting_enable, 0x8f);
115ASSERT_REG_POSITION(texturing.texture1, 0x91);
116ASSERT_REG_POSITION(texturing.texture1_format, 0x96);
117ASSERT_REG_POSITION(texturing.texture2, 0x99);
118ASSERT_REG_POSITION(texturing.texture2_format, 0x9e);
119ASSERT_REG_POSITION(texturing.tev_stage0, 0xc0);
120ASSERT_REG_POSITION(texturing.tev_stage1, 0xc8);
121ASSERT_REG_POSITION(texturing.tev_stage2, 0xd0);
122ASSERT_REG_POSITION(texturing.tev_stage3, 0xd8);
123ASSERT_REG_POSITION(texturing.tev_combiner_buffer_input, 0xe0);
124ASSERT_REG_POSITION(texturing.fog_mode, 0xe0);
125ASSERT_REG_POSITION(texturing.fog_color, 0xe1);
126ASSERT_REG_POSITION(texturing.fog_lut_offset, 0xe6);
127ASSERT_REG_POSITION(texturing.fog_lut_data, 0xe8);
128ASSERT_REG_POSITION(texturing.tev_stage4, 0xf0);
129ASSERT_REG_POSITION(texturing.tev_stage5, 0xf8);
130ASSERT_REG_POSITION(texturing.tev_combiner_buffer_color, 0xfd);
131
132ASSERT_REG_POSITION(framebuffer, 0x100);
133ASSERT_REG_POSITION(framebuffer.output_merger, 0x100);
134ASSERT_REG_POSITION(framebuffer.framebuffer, 0x110);
135
136ASSERT_REG_POSITION(lighting, 0x140);
137
138ASSERT_REG_POSITION(pipeline, 0x200);
139ASSERT_REG_POSITION(pipeline.vertex_attributes, 0x200);
140ASSERT_REG_POSITION(pipeline.index_array, 0x227);
141ASSERT_REG_POSITION(pipeline.num_vertices, 0x228);
142ASSERT_REG_POSITION(pipeline.vertex_offset, 0x22a);
143ASSERT_REG_POSITION(pipeline.trigger_draw, 0x22e);
144ASSERT_REG_POSITION(pipeline.trigger_draw_indexed, 0x22f);
145ASSERT_REG_POSITION(pipeline.vs_default_attributes_setup, 0x232);
146ASSERT_REG_POSITION(pipeline.command_buffer, 0x238);
147ASSERT_REG_POSITION(pipeline.gpu_mode, 0x245);
148ASSERT_REG_POSITION(pipeline.triangle_topology, 0x25e);
149ASSERT_REG_POSITION(pipeline.restart_primitive, 0x25f);
150
151ASSERT_REG_POSITION(gs, 0x280);
152ASSERT_REG_POSITION(vs, 0x2b0);
153
154#undef ASSERT_REG_POSITION
155#endif // !defined(_MSC_VER)
156
157// The total number of registers is chosen arbitrarily, but let's make sure it's not some odd value
158// anyway.
159static_assert(sizeof(Regs) <= 0x300 * sizeof(u32),
160 "Register set structure larger than it should be");
161static_assert(sizeof(Regs) >= 0x300 * sizeof(u32),
162 "Register set structure smaller than it should be");
163
164} // namespace Pica
diff --git a/src/video_core/regs_framebuffer.h b/src/video_core/regs_framebuffer.h
index 40d8aea0c..366782080 100644
--- a/src/video_core/regs_framebuffer.h
+++ b/src/video_core/regs_framebuffer.h
@@ -6,9 +6,11 @@
6 6
7#include <array> 7#include <array>
8 8
9#include "common/assert.h"
9#include "common/bit_field.h" 10#include "common/bit_field.h"
10#include "common/common_funcs.h" 11#include "common/common_funcs.h"
11#include "common/common_types.h" 12#include "common/common_types.h"
13#include "common/logging/log.h"
12 14
13namespace Pica { 15namespace Pica {
14 16
diff --git a/src/video_core/regs_lighting.h b/src/video_core/regs_lighting.h
index b14500ff7..548a6c4d5 100644
--- a/src/video_core/regs_lighting.h
+++ b/src/video_core/regs_lighting.h
@@ -6,9 +6,11 @@
6 6
7#include <array> 7#include <array>
8 8
9#include "common/assert.h"
9#include "common/bit_field.h" 10#include "common/bit_field.h"
10#include "common/common_funcs.h" 11#include "common/common_funcs.h"
11#include "common/common_types.h" 12#include "common/common_types.h"
13#include "common/vector_math.h"
12 14
13namespace Pica { 15namespace Pica {
14 16
diff --git a/src/video_core/renderer_opengl/gl_rasterizer.cpp b/src/video_core/renderer_opengl/gl_rasterizer.cpp
index 967c3159f..75736c99f 100644
--- a/src/video_core/renderer_opengl/gl_rasterizer.cpp
+++ b/src/video_core/renderer_opengl/gl_rasterizer.cpp
@@ -14,8 +14,8 @@
14#include "common/microprofile.h" 14#include "common/microprofile.h"
15#include "common/vector_math.h" 15#include "common/vector_math.h"
16#include "core/hw/gpu.h" 16#include "core/hw/gpu.h"
17#include "video_core/pica.h"
18#include "video_core/pica_state.h" 17#include "video_core/pica_state.h"
18#include "video_core/regs.h"
19#include "video_core/renderer_opengl/gl_rasterizer.h" 19#include "video_core/renderer_opengl/gl_rasterizer.h"
20#include "video_core/renderer_opengl/gl_shader_gen.h" 20#include "video_core/renderer_opengl/gl_shader_gen.h"
21#include "video_core/renderer_opengl/gl_shader_util.h" 21#include "video_core/renderer_opengl/gl_shader_util.h"
diff --git a/src/video_core/renderer_opengl/gl_rasterizer.h b/src/video_core/renderer_opengl/gl_rasterizer.h
index 3e6850302..bfee911b6 100644
--- a/src/video_core/renderer_opengl/gl_rasterizer.h
+++ b/src/video_core/renderer_opengl/gl_rasterizer.h
@@ -16,10 +16,10 @@
16#include "common/hash.h" 16#include "common/hash.h"
17#include "common/vector_math.h" 17#include "common/vector_math.h"
18#include "core/hw/gpu.h" 18#include "core/hw/gpu.h"
19#include "video_core/pica.h"
20#include "video_core/pica_state.h" 19#include "video_core/pica_state.h"
21#include "video_core/pica_types.h" 20#include "video_core/pica_types.h"
22#include "video_core/rasterizer_interface.h" 21#include "video_core/rasterizer_interface.h"
22#include "video_core/regs.h"
23#include "video_core/renderer_opengl/gl_rasterizer_cache.h" 23#include "video_core/renderer_opengl/gl_rasterizer_cache.h"
24#include "video_core/renderer_opengl/gl_resource_manager.h" 24#include "video_core/renderer_opengl/gl_resource_manager.h"
25#include "video_core/renderer_opengl/gl_state.h" 25#include "video_core/renderer_opengl/gl_state.h"
diff --git a/src/video_core/renderer_opengl/gl_rasterizer_cache.h b/src/video_core/renderer_opengl/gl_rasterizer_cache.h
index 2812b4bf6..4072ed49e 100644
--- a/src/video_core/renderer_opengl/gl_rasterizer_cache.h
+++ b/src/video_core/renderer_opengl/gl_rasterizer_cache.h
@@ -21,7 +21,7 @@
21#include "common/common_funcs.h" 21#include "common/common_funcs.h"
22#include "common/common_types.h" 22#include "common/common_types.h"
23#include "core/hw/gpu.h" 23#include "core/hw/gpu.h"
24#include "video_core/pica.h" 24#include "video_core/regs.h"
25#include "video_core/renderer_opengl/gl_resource_manager.h" 25#include "video_core/renderer_opengl/gl_resource_manager.h"
26 26
27namespace MathUtil { 27namespace MathUtil {
diff --git a/src/video_core/renderer_opengl/gl_shader_gen.cpp b/src/video_core/renderer_opengl/gl_shader_gen.cpp
index 0467cccfd..3ea25f302 100644
--- a/src/video_core/renderer_opengl/gl_shader_gen.cpp
+++ b/src/video_core/renderer_opengl/gl_shader_gen.cpp
@@ -7,7 +7,7 @@
7#include "common/assert.h" 7#include "common/assert.h"
8#include "common/bit_field.h" 8#include "common/bit_field.h"
9#include "common/logging/log.h" 9#include "common/logging/log.h"
10#include "video_core/pica.h" 10#include "video_core/regs.h"
11#include "video_core/renderer_opengl/gl_rasterizer.h" 11#include "video_core/renderer_opengl/gl_rasterizer.h"
12#include "video_core/renderer_opengl/gl_shader_gen.h" 12#include "video_core/renderer_opengl/gl_shader_gen.h"
13#include "video_core/renderer_opengl/gl_shader_util.h" 13#include "video_core/renderer_opengl/gl_shader_util.h"
diff --git a/src/video_core/renderer_opengl/pica_to_gl.h b/src/video_core/renderer_opengl/pica_to_gl.h
index 97c044918..4b98dafc4 100644
--- a/src/video_core/renderer_opengl/pica_to_gl.h
+++ b/src/video_core/renderer_opengl/pica_to_gl.h
@@ -12,7 +12,7 @@
12#include "common/common_funcs.h" 12#include "common/common_funcs.h"
13#include "common/common_types.h" 13#include "common/common_types.h"
14#include "common/logging/log.h" 14#include "common/logging/log.h"
15#include "video_core/pica.h" 15#include "video_core/regs.h"
16 16
17using GLvec2 = std::array<GLfloat, 2>; 17using GLvec2 = std::array<GLfloat, 2>;
18using GLvec3 = std::array<GLfloat, 3>; 18using GLvec3 = std::array<GLfloat, 3>;
diff --git a/src/video_core/shader/shader.cpp b/src/video_core/shader/shader.cpp
index 840777a66..c860375a1 100644
--- a/src/video_core/shader/shader.cpp
+++ b/src/video_core/shader/shader.cpp
@@ -7,8 +7,8 @@
7#include "common/bit_set.h" 7#include "common/bit_set.h"
8#include "common/logging/log.h" 8#include "common/logging/log.h"
9#include "common/microprofile.h" 9#include "common/microprofile.h"
10#include "video_core/pica.h"
11#include "video_core/pica_state.h" 10#include "video_core/pica_state.h"
11#include "video_core/regs.h"
12#include "video_core/shader/shader.h" 12#include "video_core/shader/shader.h"
13#include "video_core/shader/shader_interpreter.h" 13#include "video_core/shader/shader_interpreter.h"
14#ifdef ARCHITECTURE_x86_64 14#ifdef ARCHITECTURE_x86_64
diff --git a/src/video_core/shader/shader.h b/src/video_core/shader/shader.h
index a469e294b..d52682479 100644
--- a/src/video_core/shader/shader.h
+++ b/src/video_core/shader/shader.h
@@ -12,8 +12,8 @@
12#include "common/common_funcs.h" 12#include "common/common_funcs.h"
13#include "common/common_types.h" 13#include "common/common_types.h"
14#include "common/vector_math.h" 14#include "common/vector_math.h"
15#include "video_core/pica.h"
16#include "video_core/pica_types.h" 15#include "video_core/pica_types.h"
16#include "video_core/regs.h"
17 17
18using nihstro::RegisterType; 18using nihstro::RegisterType;
19using nihstro::SourceRegister; 19using nihstro::SourceRegister;
diff --git a/src/video_core/vertex_loader.cpp b/src/video_core/vertex_loader.cpp
index 20e2370be..37c5224a9 100644
--- a/src/video_core/vertex_loader.cpp
+++ b/src/video_core/vertex_loader.cpp
@@ -8,9 +8,9 @@
8#include "common/vector_math.h" 8#include "common/vector_math.h"
9#include "core/memory.h" 9#include "core/memory.h"
10#include "video_core/debug_utils/debug_utils.h" 10#include "video_core/debug_utils/debug_utils.h"
11#include "video_core/pica.h"
12#include "video_core/pica_state.h" 11#include "video_core/pica_state.h"
13#include "video_core/pica_types.h" 12#include "video_core/pica_types.h"
13#include "video_core/regs_pipeline.h"
14#include "video_core/shader/shader.h" 14#include "video_core/shader/shader.h"
15#include "video_core/vertex_loader.h" 15#include "video_core/vertex_loader.h"
16 16
diff --git a/src/video_core/vertex_loader.h b/src/video_core/vertex_loader.h
index 7815715bc..02db10aee 100644
--- a/src/video_core/vertex_loader.h
+++ b/src/video_core/vertex_loader.h
@@ -2,7 +2,7 @@
2 2
3#include <array> 3#include <array>
4#include "common/common_types.h" 4#include "common/common_types.h"
5#include "video_core/pica.h" 5#include "video_core/regs_pipeline.h"
6 6
7namespace Pica { 7namespace Pica {
8 8