summaryrefslogtreecommitdiffstats
path: root/src/video_core/shader/shader_interpreter.cpp
diff options
context:
space:
mode:
authorYuri Kunde Schlesner <yuriks@yuriks.net>2016-12-17 10:21:16 +0100
committerYuri Kunde Schlesner <yuriks@yuriks.net>2017-01-26 03:53:24 +0100
commit114d6b2f97eb62c7d8c958ebb391b70b026130f9 (patch)
tree8600239b8ee804b78bc2c60fb6285a2e8cf2c4fa /src/video_core/shader/shader_interpreter.cpp
parentVideoCore/Shader: Rename shader_jit_x64{ => _compiler}.{cpp,h} (diff)
downloadyuzu-114d6b2f97eb62c7d8c958ebb391b70b026130f9.tar
yuzu-114d6b2f97eb62c7d8c958ebb391b70b026130f9.tar.gz
yuzu-114d6b2f97eb62c7d8c958ebb391b70b026130f9.tar.bz2
yuzu-114d6b2f97eb62c7d8c958ebb391b70b026130f9.tar.lz
yuzu-114d6b2f97eb62c7d8c958ebb391b70b026130f9.tar.xz
yuzu-114d6b2f97eb62c7d8c958ebb391b70b026130f9.tar.zst
yuzu-114d6b2f97eb62c7d8c958ebb391b70b026130f9.zip
Diffstat (limited to 'src/video_core/shader/shader_interpreter.cpp')
-rw-r--r--src/video_core/shader/shader_interpreter.cpp39
1 files changed, 34 insertions, 5 deletions
diff --git a/src/video_core/shader/shader_interpreter.cpp b/src/video_core/shader/shader_interpreter.cpp
index 20fb9754b..8e2b8c548 100644
--- a/src/video_core/shader/shader_interpreter.cpp
+++ b/src/video_core/shader/shader_interpreter.cpp
@@ -7,10 +7,12 @@
#include <cmath>
#include <numeric>
#include <boost/container/static_vector.hpp>
+#include <boost/range/algorithm/fill.hpp>
#include <nihstro/shader_bytecode.h>
#include "common/assert.h"
#include "common/common_types.h"
#include "common/logging/log.h"
+#include "common/microprofile.h"
#include "common/vector_math.h"
#include "video_core/pica_state.h"
#include "video_core/pica_types.h"
@@ -37,8 +39,8 @@ struct CallStackElement {
};
template <bool Debug>
-void RunInterpreter(const ShaderSetup& setup, UnitState& state, DebugData<Debug>& debug_data,
- unsigned offset) {
+static void RunInterpreter(const ShaderSetup& setup, UnitState& state, DebugData<Debug>& debug_data,
+ unsigned offset) {
// TODO: Is there a maximal size for this?
boost::container::static_vector<CallStackElement, 16> call_stack;
u32 program_counter = offset;
@@ -647,9 +649,36 @@ void RunInterpreter(const ShaderSetup& setup, UnitState& state, DebugData<Debug>
}
}
-// Explicit instantiation
-template void RunInterpreter(const ShaderSetup&, UnitState&, DebugData<false>&, unsigned offset);
-template void RunInterpreter(const ShaderSetup&, UnitState&, DebugData<true>&, unsigned offset);
+void InterpreterEngine::SetupBatch(const ShaderSetup* setup_) {
+ setup = setup_;
+}
+
+MICROPROFILE_DECLARE(GPU_Shader);
+
+void InterpreterEngine::Run(UnitState& state, unsigned int entry_point) const {
+ ASSERT(setup != nullptr);
+ ASSERT(entry_point < 1024);
+
+ MICROPROFILE_SCOPE(GPU_Shader);
+
+ DebugData<false> dummy_debug_data;
+ RunInterpreter(*setup, state, dummy_debug_data, entry_point);
+}
+
+DebugData<true> InterpreterEngine::ProduceDebugInfo(const InputVertex& input, int num_attributes,
+ unsigned int entry_point) const {
+ ASSERT(setup != nullptr);
+ ASSERT(entry_point < 1024);
+
+ UnitState state;
+ DebugData<true> debug_data;
+
+ // Setup input register table
+ boost::fill(state.registers.input, Math::Vec4<float24>::AssignToAll(float24::Zero()));
+ state.LoadInputVertex(input, num_attributes);
+ RunInterpreter(*setup, state, debug_data, entry_point);
+ return debug_data;
+}
} // namespace