diff options
| author | 2018-01-11 20:07:44 -0700 | |
|---|---|---|
| committer | 2018-01-12 19:11:03 -0700 | |
| commit | 1d28b2e142f845773e2b90e267d9632e196a99b9 (patch) | |
| tree | 027a3586a0fc927731afb3711c328c6dafc8551f /src/video_core/regs.h | |
| parent | Massive removal of unused modules (diff) | |
| download | yuzu-1d28b2e142f845773e2b90e267d9632e196a99b9.tar.gz yuzu-1d28b2e142f845773e2b90e267d9632e196a99b9.tar.xz yuzu-1d28b2e142f845773e2b90e267d9632e196a99b9.zip | |
Remove references to PICA and rasterizers in video_core
Diffstat (limited to 'src/video_core/regs.h')
| -rw-r--r-- | src/video_core/regs.h | 149 |
1 files changed, 0 insertions, 149 deletions
diff --git a/src/video_core/regs.h b/src/video_core/regs.h deleted file mode 100644 index 6d5f98cac..000000000 --- a/src/video_core/regs.h +++ /dev/null | |||
| @@ -1,149 +0,0 @@ | |||
| 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 | |||
| 23 | namespace 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 | |||
| 47 | struct Regs { | ||
| 48 | static constexpr size_t NUM_REGS = 0x300; | ||
| 49 | |||
| 50 | union { | ||
| 51 | struct { | ||
| 52 | INSERT_PADDING_WORDS(0x10); | ||
| 53 | u32 trigger_irq; | ||
| 54 | INSERT_PADDING_WORDS(0x2f); | ||
| 55 | RasterizerRegs rasterizer; | ||
| 56 | TexturingRegs texturing; | ||
| 57 | FramebufferRegs framebuffer; | ||
| 58 | LightingRegs lighting; | ||
| 59 | PipelineRegs pipeline; | ||
| 60 | ShaderRegs gs; | ||
| 61 | ShaderRegs vs; | ||
| 62 | INSERT_PADDING_WORDS(0x20); | ||
| 63 | }; | ||
| 64 | std::array<u32, NUM_REGS> reg_array; | ||
| 65 | }; | ||
| 66 | |||
| 67 | /// Map register indices to names readable by humans | ||
| 68 | static const char* GetRegisterName(u16 index); | ||
| 69 | }; | ||
| 70 | |||
| 71 | static_assert(sizeof(Regs) == Regs::NUM_REGS * sizeof(u32), "Regs struct has wrong size"); | ||
| 72 | |||
| 73 | // TODO: MSVC does not support using offsetof() on non-static data members even though this | ||
| 74 | // is technically allowed since C++11. This macro should be enabled once MSVC adds | ||
| 75 | // support for that. | ||
| 76 | #ifndef _MSC_VER | ||
| 77 | #define ASSERT_REG_POSITION(field_name, position) \ | ||
| 78 | static_assert(offsetof(Regs, field_name) == position * 4, \ | ||
| 79 | "Field " #field_name " has invalid position") | ||
| 80 | |||
| 81 | ASSERT_REG_POSITION(trigger_irq, 0x10); | ||
| 82 | |||
| 83 | ASSERT_REG_POSITION(rasterizer, 0x40); | ||
| 84 | ASSERT_REG_POSITION(rasterizer.cull_mode, 0x40); | ||
| 85 | ASSERT_REG_POSITION(rasterizer.viewport_size_x, 0x41); | ||
| 86 | ASSERT_REG_POSITION(rasterizer.viewport_size_y, 0x43); | ||
| 87 | ASSERT_REG_POSITION(rasterizer.viewport_depth_range, 0x4d); | ||
| 88 | ASSERT_REG_POSITION(rasterizer.viewport_depth_near_plane, 0x4e); | ||
| 89 | ASSERT_REG_POSITION(rasterizer.vs_output_attributes[0], 0x50); | ||
| 90 | ASSERT_REG_POSITION(rasterizer.vs_output_attributes[1], 0x51); | ||
| 91 | ASSERT_REG_POSITION(rasterizer.scissor_test, 0x65); | ||
| 92 | ASSERT_REG_POSITION(rasterizer.viewport_corner, 0x68); | ||
| 93 | ASSERT_REG_POSITION(rasterizer.depthmap_enable, 0x6D); | ||
| 94 | |||
| 95 | ASSERT_REG_POSITION(texturing, 0x80); | ||
| 96 | ASSERT_REG_POSITION(texturing.main_config, 0x80); | ||
| 97 | ASSERT_REG_POSITION(texturing.texture0, 0x81); | ||
| 98 | ASSERT_REG_POSITION(texturing.texture0_format, 0x8e); | ||
| 99 | ASSERT_REG_POSITION(texturing.fragment_lighting_enable, 0x8f); | ||
| 100 | ASSERT_REG_POSITION(texturing.texture1, 0x91); | ||
| 101 | ASSERT_REG_POSITION(texturing.texture1_format, 0x96); | ||
| 102 | ASSERT_REG_POSITION(texturing.texture2, 0x99); | ||
| 103 | ASSERT_REG_POSITION(texturing.texture2_format, 0x9e); | ||
| 104 | ASSERT_REG_POSITION(texturing.proctex, 0xa8); | ||
| 105 | ASSERT_REG_POSITION(texturing.proctex_noise_u, 0xa9); | ||
| 106 | ASSERT_REG_POSITION(texturing.proctex_noise_v, 0xaa); | ||
| 107 | ASSERT_REG_POSITION(texturing.proctex_noise_frequency, 0xab); | ||
| 108 | ASSERT_REG_POSITION(texturing.proctex_lut, 0xac); | ||
| 109 | ASSERT_REG_POSITION(texturing.proctex_lut_offset, 0xad); | ||
| 110 | ASSERT_REG_POSITION(texturing.proctex_lut_config, 0xaf); | ||
| 111 | ASSERT_REG_POSITION(texturing.tev_stage0, 0xc0); | ||
| 112 | ASSERT_REG_POSITION(texturing.tev_stage1, 0xc8); | ||
| 113 | ASSERT_REG_POSITION(texturing.tev_stage2, 0xd0); | ||
| 114 | ASSERT_REG_POSITION(texturing.tev_stage3, 0xd8); | ||
| 115 | ASSERT_REG_POSITION(texturing.tev_combiner_buffer_input, 0xe0); | ||
| 116 | ASSERT_REG_POSITION(texturing.fog_mode, 0xe0); | ||
| 117 | ASSERT_REG_POSITION(texturing.fog_color, 0xe1); | ||
| 118 | ASSERT_REG_POSITION(texturing.fog_lut_offset, 0xe6); | ||
| 119 | ASSERT_REG_POSITION(texturing.fog_lut_data, 0xe8); | ||
| 120 | ASSERT_REG_POSITION(texturing.tev_stage4, 0xf0); | ||
| 121 | ASSERT_REG_POSITION(texturing.tev_stage5, 0xf8); | ||
| 122 | ASSERT_REG_POSITION(texturing.tev_combiner_buffer_color, 0xfd); | ||
| 123 | |||
| 124 | ASSERT_REG_POSITION(framebuffer, 0x100); | ||
| 125 | ASSERT_REG_POSITION(framebuffer.output_merger, 0x100); | ||
| 126 | ASSERT_REG_POSITION(framebuffer.framebuffer, 0x110); | ||
| 127 | |||
| 128 | ASSERT_REG_POSITION(lighting, 0x140); | ||
| 129 | |||
| 130 | ASSERT_REG_POSITION(pipeline, 0x200); | ||
| 131 | ASSERT_REG_POSITION(pipeline.vertex_attributes, 0x200); | ||
| 132 | ASSERT_REG_POSITION(pipeline.index_array, 0x227); | ||
| 133 | ASSERT_REG_POSITION(pipeline.num_vertices, 0x228); | ||
| 134 | ASSERT_REG_POSITION(pipeline.vertex_offset, 0x22a); | ||
| 135 | ASSERT_REG_POSITION(pipeline.trigger_draw, 0x22e); | ||
| 136 | ASSERT_REG_POSITION(pipeline.trigger_draw_indexed, 0x22f); | ||
| 137 | ASSERT_REG_POSITION(pipeline.vs_default_attributes_setup, 0x232); | ||
| 138 | ASSERT_REG_POSITION(pipeline.command_buffer, 0x238); | ||
| 139 | ASSERT_REG_POSITION(pipeline.gpu_mode, 0x245); | ||
| 140 | ASSERT_REG_POSITION(pipeline.triangle_topology, 0x25e); | ||
| 141 | ASSERT_REG_POSITION(pipeline.restart_primitive, 0x25f); | ||
| 142 | |||
| 143 | ASSERT_REG_POSITION(gs, 0x280); | ||
| 144 | ASSERT_REG_POSITION(vs, 0x2b0); | ||
| 145 | |||
| 146 | #undef ASSERT_REG_POSITION | ||
| 147 | #endif // !defined(_MSC_VER) | ||
| 148 | |||
| 149 | } // namespace Pica | ||