summaryrefslogtreecommitdiff
path: root/src/video_core/macro_interpreter.cpp
diff options
context:
space:
mode:
authorGravatar bunnei2019-04-05 23:32:26 -0400
committerGravatar GitHub2019-04-05 23:32:26 -0400
commit8a1bcc3d30ecf907db569f09e7d026a24a0e363b (patch)
tree9fe8a7727546baa94cdaf0bb8d91189101e403fd /src/video_core/macro_interpreter.cpp
parentMerge pull request #2338 from lioncash/fs (diff)
parentvideo_core/macro_interpreter: Remove assertion within FetchParameter() (diff)
downloadyuzu-8a1bcc3d30ecf907db569f09e7d026a24a0e363b.tar.gz
yuzu-8a1bcc3d30ecf907db569f09e7d026a24a0e363b.tar.xz
yuzu-8a1bcc3d30ecf907db569f09e7d026a24a0e363b.zip
Merge pull request #2351 from lioncash/macro
video_core/macro_interpreter: Simplify GetRegister()
Diffstat (limited to 'src/video_core/macro_interpreter.cpp')
-rw-r--r--src/video_core/macro_interpreter.cpp20
1 files changed, 7 insertions, 13 deletions
diff --git a/src/video_core/macro_interpreter.cpp b/src/video_core/macro_interpreter.cpp
index 64f75db43..524d9ea5a 100644
--- a/src/video_core/macro_interpreter.cpp
+++ b/src/video_core/macro_interpreter.cpp
@@ -223,27 +223,21 @@ void MacroInterpreter::ProcessResult(ResultOperation operation, u32 reg, u32 res
223} 223}
224 224
225u32 MacroInterpreter::FetchParameter() { 225u32 MacroInterpreter::FetchParameter() {
226 ASSERT(next_parameter_index < parameters.size()); 226 return parameters.at(next_parameter_index++);
227 return parameters[next_parameter_index++];
228} 227}
229 228
230u32 MacroInterpreter::GetRegister(u32 register_id) const { 229u32 MacroInterpreter::GetRegister(u32 register_id) const {
231 // Register 0 is supposed to always return 0. 230 return registers.at(register_id);
232 if (register_id == 0)
233 return 0;
234
235 ASSERT(register_id < registers.size());
236 return registers[register_id];
237} 231}
238 232
239void MacroInterpreter::SetRegister(u32 register_id, u32 value) { 233void MacroInterpreter::SetRegister(u32 register_id, u32 value) {
240 // Register 0 is supposed to always return 0. NOP is implemented as a store to the zero 234 // Register 0 is hardwired as the zero register.
241 // register. 235 // Ensure no writes to it actually occur.
242 if (register_id == 0) 236 if (register_id == 0) {
243 return; 237 return;
238 }
244 239
245 ASSERT(register_id < registers.size()); 240 registers.at(register_id) = value;
246 registers[register_id] = value;
247} 241}
248 242
249void MacroInterpreter::SetMethodAddress(u32 address) { 243void MacroInterpreter::SetMethodAddress(u32 address) {