summaryrefslogtreecommitdiffstats
path: root/src/video_core/command_processor.cpp
diff options
context:
space:
mode:
authorYuri Kunde Schlesner <yuriks@yuriks.net>2017-02-04 22:02:48 +0100
committerGitHub <noreply@github.com>2017-02-04 22:02:48 +0100
commit97e06b0a0daccd3347ae1bcaf294093b5af32e85 (patch)
tree59e1997c90558f58f7368d6974c355e1f20d8f32 /src/video_core/command_processor.cpp
parentMerge pull request #2414 from yuriks/texture-decode (diff)
parentVideoCore: Make PrimitiveAssembler const-correct (diff)
downloadyuzu-97e06b0a0daccd3347ae1bcaf294093b5af32e85.tar
yuzu-97e06b0a0daccd3347ae1bcaf294093b5af32e85.tar.gz
yuzu-97e06b0a0daccd3347ae1bcaf294093b5af32e85.tar.bz2
yuzu-97e06b0a0daccd3347ae1bcaf294093b5af32e85.tar.lz
yuzu-97e06b0a0daccd3347ae1bcaf294093b5af32e85.tar.xz
yuzu-97e06b0a0daccd3347ae1bcaf294093b5af32e85.tar.zst
yuzu-97e06b0a0daccd3347ae1bcaf294093b5af32e85.zip
Diffstat (limited to 'src/video_core/command_processor.cpp')
-rw-r--r--src/video_core/command_processor.cpp33
1 files changed, 18 insertions, 15 deletions
diff --git a/src/video_core/command_processor.cpp b/src/video_core/command_processor.cpp
index eb79974a8..4955ff9f9 100644
--- a/src/video_core/command_processor.cpp
+++ b/src/video_core/command_processor.cpp
@@ -125,20 +125,21 @@ static void WritePicaReg(u32 id, u32 value, u32 mask) {
// TODO: Verify that this actually modifies the register!
if (setup.index < 15) {
- g_state.vs_default_attributes[setup.index] = attribute;
+ g_state.input_default_attributes.attr[setup.index] = attribute;
setup.index++;
} else {
- // Put each attribute into an immediate input buffer.
- // When all specified immediate attributes are present, the Vertex Shader is invoked
- // and everything is
- // sent to the primitive assembler.
+ // Put each attribute into an immediate input buffer. When all specified immediate
+ // attributes are present, the Vertex Shader is invoked and everything is sent to
+ // the primitive assembler.
auto& immediate_input = g_state.immediate.input_vertex;
auto& immediate_attribute_id = g_state.immediate.current_attribute;
- immediate_input.attr[immediate_attribute_id++] = attribute;
+ immediate_input.attr[immediate_attribute_id] = attribute;
- if (immediate_attribute_id >= regs.vs.num_input_attributes + 1) {
+ if (immediate_attribute_id < regs.max_input_attrib_index) {
+ immediate_attribute_id += 1;
+ } else {
MICROPROFILE_SCOPE(GPU_Drawing);
immediate_attribute_id = 0;
@@ -150,10 +151,11 @@ static void WritePicaReg(u32 id, u32 value, u32 mask) {
g_debug_context->OnEvent(DebugContext::Event::VertexShaderInvocation,
static_cast<void*>(&immediate_input));
Shader::UnitState shader_unit;
- shader_unit.LoadInputVertex(immediate_input, regs.vs.num_input_attributes + 1);
+ Shader::AttributeBuffer output{};
+
+ shader_unit.LoadInput(regs.vs, immediate_input);
shader_engine->Run(g_state.vs, shader_unit);
- auto output_vertex = Shader::OutputVertex::FromRegisters(
- shader_unit.registers.output, regs, regs.vs.output_mask);
+ shader_unit.WriteOutput(regs.vs, output);
// Send to renderer
using Pica::Shader::OutputVertex;
@@ -162,7 +164,8 @@ static void WritePicaReg(u32 id, u32 value, u32 mask) {
VideoCore::g_renderer->Rasterizer()->AddTriangle(v0, v1, v2);
};
- g_state.primitive_assembler.SubmitVertex(output_vertex, AddTriangle);
+ g_state.primitive_assembler.SubmitVertex(
+ Shader::OutputVertex::FromAttributeBuffer(regs, output), AddTriangle);
}
}
}
@@ -280,19 +283,19 @@ static void WritePicaReg(u32 id, u32 value, u32 mask) {
if (!vertex_cache_hit) {
// Initialize data for the current vertex
- Shader::InputVertex input;
+ Shader::AttributeBuffer input, output{};
loader.LoadVertex(base_address, index, vertex, input, memory_accesses);
// Send to vertex shader
if (g_debug_context)
g_debug_context->OnEvent(DebugContext::Event::VertexShaderInvocation,
(void*)&input);
- shader_unit.LoadInputVertex(input, loader.GetNumTotalAttributes());
+ shader_unit.LoadInput(regs.vs, input);
shader_engine->Run(g_state.vs, shader_unit);
+ shader_unit.WriteOutput(regs.vs, output);
// Retrieve vertex from register data
- output_vertex = Shader::OutputVertex::FromRegisters(shader_unit.registers.output,
- regs, regs.vs.output_mask);
+ output_vertex = Shader::OutputVertex::FromAttributeBuffer(regs, output);
if (is_indexed) {
vertex_cache[vertex_cache_pos] = output_vertex;