summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Subv2015-02-21 12:52:21 -0500
committerGravatar Subv2015-02-21 12:52:21 -0500
commit9a03e9c61d0f2d3d28dad66cd05656d256468027 (patch)
tree036697bc827ea4716d8d3c5b31f30f4e9b7c0615 /src
parentMerge pull request #587 from archshift/assert (diff)
downloadyuzu-9a03e9c61d0f2d3d28dad66cd05656d256468027.tar.gz
yuzu-9a03e9c61d0f2d3d28dad66cd05656d256468027.tar.xz
yuzu-9a03e9c61d0f2d3d28dad66cd05656d256468027.zip
Pica/VertexShader: Fixed LOOP with more than one iteration.
Previously it wouldn't jump back to the start of the loop code once it reached the end of the block. Fixes the texture problems in a lot of games.
Diffstat (limited to 'src')
-rw-r--r--src/video_core/vertex_shader.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/video_core/vertex_shader.cpp b/src/video_core/vertex_shader.cpp
index def868ac7..bc8c0041c 100644
--- a/src/video_core/vertex_shader.cpp
+++ b/src/video_core/vertex_shader.cpp
@@ -90,6 +90,7 @@ struct VertexShaderState {
90 u8 repeat_counter; // How often to repeat until this call stack element is removed 90 u8 repeat_counter; // How often to repeat until this call stack element is removed
91 u8 loop_increment; // Which value to add to the loop counter after an iteration 91 u8 loop_increment; // Which value to add to the loop counter after an iteration
92 // TODO: Should this be a signed value? Does it even matter? 92 // TODO: Should this be a signed value? Does it even matter?
93 u32 loop_address; // The address where we'll return to after each loop iteration
93 }; 94 };
94 95
95 // TODO: Is there a maximal size for this? 96 // TODO: Is there a maximal size for this?
@@ -115,6 +116,8 @@ static void ProcessShaderCode(VertexShaderState& state) {
115 if (top.repeat_counter-- == 0) { 116 if (top.repeat_counter-- == 0) {
116 state.program_counter = &shader_memory[top.return_address]; 117 state.program_counter = &shader_memory[top.return_address];
117 state.call_stack.pop(); 118 state.call_stack.pop();
119 } else {
120 state.program_counter = &shader_memory[top.loop_address];
118 } 121 }
119 122
120 // TODO: Is "trying again" accurate to hardware? 123 // TODO: Is "trying again" accurate to hardware?
@@ -129,7 +132,7 @@ static void ProcessShaderCode(VertexShaderState& state) {
129 static auto call = [](VertexShaderState& state, u32 offset, u32 num_instructions, 132 static auto call = [](VertexShaderState& state, u32 offset, u32 num_instructions,
130 u32 return_offset, u8 repeat_count, u8 loop_increment) { 133 u32 return_offset, u8 repeat_count, u8 loop_increment) {
131 state.program_counter = &shader_memory[offset] - 1; // -1 to make sure when incrementing the PC we end up at the correct offset 134 state.program_counter = &shader_memory[offset] - 1; // -1 to make sure when incrementing the PC we end up at the correct offset
132 state.call_stack.push({ offset + num_instructions, return_offset, repeat_count, loop_increment }); 135 state.call_stack.push({ offset + num_instructions, return_offset, repeat_count, loop_increment, offset });
133 }; 136 };
134 u32 binary_offset = state.program_counter - shader_memory.data(); 137 u32 binary_offset = state.program_counter - shader_memory.data();
135 138