summaryrefslogtreecommitdiffstats
path: root/src/video_core/vertex_shader.cpp
diff options
context:
space:
mode:
authorSubv <subv2112@gmail.com>2015-02-21 18:52:21 +0100
committerSubv <subv2112@gmail.com>2015-02-21 18:52:21 +0100
commit9a03e9c61d0f2d3d28dad66cd05656d256468027 (patch)
tree036697bc827ea4716d8d3c5b31f30f4e9b7c0615 /src/video_core/vertex_shader.cpp
parentMerge pull request #587 from archshift/assert (diff)
downloadyuzu-9a03e9c61d0f2d3d28dad66cd05656d256468027.tar
yuzu-9a03e9c61d0f2d3d28dad66cd05656d256468027.tar.gz
yuzu-9a03e9c61d0f2d3d28dad66cd05656d256468027.tar.bz2
yuzu-9a03e9c61d0f2d3d28dad66cd05656d256468027.tar.lz
yuzu-9a03e9c61d0f2d3d28dad66cd05656d256468027.tar.xz
yuzu-9a03e9c61d0f2d3d28dad66cd05656d256468027.tar.zst
yuzu-9a03e9c61d0f2d3d28dad66cd05656d256468027.zip
Diffstat (limited to 'src/video_core/vertex_shader.cpp')
-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 {
u8 repeat_counter; // How often to repeat until this call stack element is removed
u8 loop_increment; // Which value to add to the loop counter after an iteration
// TODO: Should this be a signed value? Does it even matter?
+ u32 loop_address; // The address where we'll return to after each loop iteration
};
// TODO: Is there a maximal size for this?
@@ -115,6 +116,8 @@ static void ProcessShaderCode(VertexShaderState& state) {
if (top.repeat_counter-- == 0) {
state.program_counter = &shader_memory[top.return_address];
state.call_stack.pop();
+ } else {
+ state.program_counter = &shader_memory[top.loop_address];
}
// TODO: Is "trying again" accurate to hardware?
@@ -129,7 +132,7 @@ static void ProcessShaderCode(VertexShaderState& state) {
static auto call = [](VertexShaderState& state, u32 offset, u32 num_instructions,
u32 return_offset, u8 repeat_count, u8 loop_increment) {
state.program_counter = &shader_memory[offset] - 1; // -1 to make sure when incrementing the PC we end up at the correct offset
- state.call_stack.push({ offset + num_instructions, return_offset, repeat_count, loop_increment });
+ state.call_stack.push({ offset + num_instructions, return_offset, repeat_count, loop_increment, offset });
};
u32 binary_offset = state.program_counter - shader_memory.data();