aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/video_core/vertex_shader.cpp
diff options
context:
space:
mode:
authorGravatar Tony Wasserka <NeoBrainX@gmail.com>2014-12-20 15:19:36 +0100
committerGravatar Tony Wasserka <NeoBrainX@gmail.com>2014-12-20 18:06:56 +0100
commit17f31de364df294337963cabad106a5f0a9d302b (patch)
tree0dd45962befc03afb985e8e6fa04bf1b1809c33b /src/video_core/vertex_shader.cpp
parenta664574ecbddb643dd12fb9815f4c4526f59f9ff (diff)
Pica/VertexShader: Small optimization.
Diffstat (limited to 'src/video_core/vertex_shader.cpp')
-rw-r--r--src/video_core/vertex_shader.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/video_core/vertex_shader.cpp b/src/video_core/vertex_shader.cpp
index 345f3c3f..de963f5e 100644
--- a/src/video_core/vertex_shader.cpp
+++ b/src/video_core/vertex_shader.cpp
@@ -118,9 +118,9 @@ static void ProcessShaderCode(VertexShaderState& state) {
const Instruction& instr = *(const Instruction*)state.program_counter;
const SwizzlePattern& swizzle = *(SwizzlePattern*)&swizzle_data[instr.common.operand_desc_id];
- auto call = [&](std::stack<VertexShaderState::CallStackElement>& stack, u32 offset, u32 num_instructions, u32 return_offset) {
+ auto call = [&](VertexShaderState& state, u32 offset, u32 num_instructions, u32 return_offset) {
state.program_counter = &shader_memory[offset] - 1; // -1 to make sure when incrementing the PC we end up at the correct offset
- stack.push({ offset + num_instructions, return_offset });
+ state.call_stack.push({ offset + num_instructions, return_offset });
};
u32 binary_offset = state.program_counter - shader_memory.data();
@@ -356,7 +356,7 @@ static void ProcessShaderCode(VertexShaderState& state) {
break;
case Instruction::OpCode::CALL:
- call(state.call_stack,
+ call(state,
instr.flow_control.dest_offset,
instr.flow_control.num_instructions,
binary_offset + 1);
@@ -367,12 +367,12 @@ static void ProcessShaderCode(VertexShaderState& state) {
case Instruction::OpCode::IFU:
if (shader_uniforms.b[instr.flow_control.bool_uniform_id]) {
- call(state.call_stack,
+ call(state,
binary_offset + 1,
instr.flow_control.dest_offset - binary_offset - 1,
instr.flow_control.dest_offset + instr.flow_control.num_instructions);
} else {
- call(state.call_stack,
+ call(state,
instr.flow_control.dest_offset,
instr.flow_control.num_instructions,
instr.flow_control.dest_offset + instr.flow_control.num_instructions);
@@ -407,12 +407,12 @@ static void ProcessShaderCode(VertexShaderState& state) {
}
if (results[2]) {
- call(state.call_stack,
+ call(state,
binary_offset + 1,
instr.flow_control.dest_offset - binary_offset - 1,
instr.flow_control.dest_offset + instr.flow_control.num_instructions);
} else {
- call(state.call_stack,
+ call(state,
instr.flow_control.dest_offset,
instr.flow_control.num_instructions,
instr.flow_control.dest_offset + instr.flow_control.num_instructions);