summaryrefslogtreecommitdiffstats
path: root/src/video_core/pica_state.h
diff options
context:
space:
mode:
authorDwayne Slater <ds84182@gmail.com>2016-03-03 04:16:38 +0100
committerDwayne Slater <ds84182@gmail.com>2016-03-03 04:16:38 +0100
commit6b775034dd8343c06369b64bf073d6a70f35f510 (patch)
treef2a9099637bcb218ff0cc789f98151689f65c903 /src/video_core/pica_state.h
parentMerge pull request #1434 from Kloen/legend (diff)
downloadyuzu-6b775034dd8343c06369b64bf073d6a70f35f510.tar
yuzu-6b775034dd8343c06369b64bf073d6a70f35f510.tar.gz
yuzu-6b775034dd8343c06369b64bf073d6a70f35f510.tar.bz2
yuzu-6b775034dd8343c06369b64bf073d6a70f35f510.tar.lz
yuzu-6b775034dd8343c06369b64bf073d6a70f35f510.tar.xz
yuzu-6b775034dd8343c06369b64bf073d6a70f35f510.tar.zst
yuzu-6b775034dd8343c06369b64bf073d6a70f35f510.zip
Diffstat (limited to 'src/video_core/pica_state.h')
-rw-r--r--src/video_core/pica_state.h60
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 @@
+// Copyright 2016 Citra Emulator Project
+// Licensed under GPLv2 or any later version
+// Refer to the license.txt file included.
+
+#pragma once
+
+#include "video_core/pica.h"
+#include "video_core/primitive_assembly.h"
+#include "video_core/shader/shader.h"
+
+namespace Pica {
+
+/// Struct used to describe current Pica state
+struct State {
+ /// Pica registers
+ Regs regs;
+
+ Shader::ShaderSetup vs;
+ Shader::ShaderSetup gs;
+
+ struct {
+ union LutEntry {
+ // Used for raw access
+ u32 raw;
+
+ // LUT value, encoded as 12-bit fixed point, with 12 fraction bits
+ BitField< 0, 12, u32> value;
+
+ // Used by HW for efficient interpolation, Citra does not use these
+ BitField<12, 12, u32> difference;
+
+ float ToFloat() {
+ return static_cast<float>(value) / 4095.f;
+ }
+ };
+
+ std::array<std::array<LutEntry, 256>, 24> luts;
+ } lighting;
+
+ /// Current Pica command list
+ struct {
+ const u32* head_ptr;
+ const u32* current_ptr;
+ u32 length;
+ } cmd_list;
+
+ /// Struct used to describe immediate mode rendering state
+ struct ImmediateModeState {
+ Shader::InputVertex input;
+ // This is constructed with a dummy triangle topology
+ PrimitiveAssembler<Shader::OutputVertex> primitive_assembler;
+ int attribute_id = 0;
+
+ ImmediateModeState() : primitive_assembler(Regs::TriangleTopology::List) {}
+ } immediate;
+};
+
+extern State g_state; ///< Current Pica state
+
+} // namespace