diff options
Diffstat (limited to 'src/video_core/pica_state.h')
| -rw-r--r-- | src/video_core/pica_state.h | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/src/video_core/pica_state.h b/src/video_core/pica_state.h new file mode 100644 index 000000000..c7616bc55 --- /dev/null +++ b/src/video_core/pica_state.h | |||
| @@ -0,0 +1,60 @@ | |||
| 1 | // Copyright 2016 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 "video_core/pica.h" | ||
| 8 | #include "video_core/primitive_assembly.h" | ||
| 9 | #include "video_core/shader/shader.h" | ||
| 10 | |||
| 11 | namespace Pica { | ||
| 12 | |||
| 13 | /// Struct used to describe current Pica state | ||
| 14 | struct State { | ||
| 15 | /// Pica registers | ||
| 16 | Regs regs; | ||
| 17 | |||
| 18 | Shader::ShaderSetup vs; | ||
| 19 | Shader::ShaderSetup gs; | ||
| 20 | |||
| 21 | struct { | ||
| 22 | union LutEntry { | ||
| 23 | // Used for raw access | ||
| 24 | u32 raw; | ||
| 25 | |||
| 26 | // LUT value, encoded as 12-bit fixed point, with 12 fraction bits | ||
| 27 | BitField< 0, 12, u32> value; | ||
| 28 | |||
| 29 | // Used by HW for efficient interpolation, Citra does not use these | ||
| 30 | BitField<12, 12, u32> difference; | ||
| 31 | |||
| 32 | float ToFloat() { | ||
| 33 | return static_cast<float>(value) / 4095.f; | ||
| 34 | } | ||
| 35 | }; | ||
| 36 | |||
| 37 | std::array<std::array<LutEntry, 256>, 24> luts; | ||
| 38 | } lighting; | ||
| 39 | |||
| 40 | /// Current Pica command list | ||
| 41 | struct { | ||
| 42 | const u32* head_ptr; | ||
| 43 | const u32* current_ptr; | ||
| 44 | u32 length; | ||
| 45 | } cmd_list; | ||
| 46 | |||
| 47 | /// Struct used to describe immediate mode rendering state | ||
| 48 | struct ImmediateModeState { | ||
| 49 | Shader::InputVertex input; | ||
| 50 | // This is constructed with a dummy triangle topology | ||
| 51 | PrimitiveAssembler<Shader::OutputVertex> primitive_assembler; | ||
| 52 | int attribute_id = 0; | ||
| 53 | |||
| 54 | ImmediateModeState() : primitive_assembler(Regs::TriangleTopology::List) {} | ||
| 55 | } immediate; | ||
| 56 | }; | ||
| 57 | |||
| 58 | extern State g_state; ///< Current Pica state | ||
| 59 | |||
| 60 | } // namespace | ||