aboutsummaryrefslogtreecommitdiff
path: root/src/video_core/command_processor.cpp
diff options
context:
space:
mode:
authorYuri Kunde Schlesner <yuriks@yuriks.net>2017-01-27 14:29:10 -0300
committerGitHub <noreply@github.com>2017-01-27 14:29:10 -0300
commitbf14f4be2263b4769e97800b35951717192c2d1c (patch)
tree9c1c47f5a05e9907257f620d8426a0cebaf0cf78 /src/video_core/command_processor.cpp
parentf8523699864b6000572affaa0e36d9a4d89ffce6 (diff)
parent0e9081b97348c65029c96697443acb0dbbc58756 (diff)
Merge pull request #2346 from yuriks/shader-refactor2
More shader refactoring
Diffstat (limited to 'src/video_core/command_processor.cpp')
-rw-r--r--src/video_core/command_processor.cpp22
1 files changed, 14 insertions, 8 deletions
diff --git a/src/video_core/command_processor.cpp b/src/video_core/command_processor.cpp
index ea58e9f54..eb79974a8 100644
--- a/src/video_core/command_processor.cpp
+++ b/src/video_core/command_processor.cpp
@@ -142,16 +142,18 @@ static void WritePicaReg(u32 id, u32 value, u32 mask) {
MICROPROFILE_SCOPE(GPU_Drawing);
immediate_attribute_id = 0;
- Shader::UnitState shader_unit;
- g_state.vs.Setup();
+ auto* shader_engine = Shader::GetEngine();
+ shader_engine->SetupBatch(g_state.vs, regs.vs.main_offset);
// Send to vertex shader
if (g_debug_context)
g_debug_context->OnEvent(DebugContext::Event::VertexShaderInvocation,
static_cast<void*>(&immediate_input));
- g_state.vs.Run(shader_unit, immediate_input, regs.vs.num_input_attributes + 1);
- Shader::OutputVertex output_vertex =
- shader_unit.output_registers.ToVertex(regs.vs);
+ Shader::UnitState shader_unit;
+ shader_unit.LoadInputVertex(immediate_input, regs.vs.num_input_attributes + 1);
+ shader_engine->Run(g_state.vs, shader_unit);
+ auto output_vertex = Shader::OutputVertex::FromRegisters(
+ shader_unit.registers.output, regs, regs.vs.output_mask);
// Send to renderer
using Pica::Shader::OutputVertex;
@@ -243,8 +245,10 @@ static void WritePicaReg(u32 id, u32 value, u32 mask) {
unsigned int vertex_cache_pos = 0;
vertex_cache_ids.fill(-1);
+ auto* shader_engine = Shader::GetEngine();
Shader::UnitState shader_unit;
- g_state.vs.Setup();
+
+ shader_engine->SetupBatch(g_state.vs, regs.vs.main_offset);
for (unsigned int index = 0; index < regs.num_vertices; ++index) {
// Indexed rendering doesn't use the start offset
@@ -283,10 +287,12 @@ static void WritePicaReg(u32 id, u32 value, u32 mask) {
if (g_debug_context)
g_debug_context->OnEvent(DebugContext::Event::VertexShaderInvocation,
(void*)&input);
- g_state.vs.Run(shader_unit, input, loader.GetNumTotalAttributes());
+ shader_unit.LoadInputVertex(input, loader.GetNumTotalAttributes());
+ shader_engine->Run(g_state.vs, shader_unit);
// Retrieve vertex from register data
- output_vertex = shader_unit.output_registers.ToVertex(regs.vs);
+ output_vertex = Shader::OutputVertex::FromRegisters(shader_unit.registers.output,
+ regs, regs.vs.output_mask);
if (is_indexed) {
vertex_cache[vertex_cache_pos] = output_vertex;