summaryrefslogtreecommitdiff
path: root/src/video_core
diff options
context:
space:
mode:
authorGravatar bunnei2014-12-10 09:20:05 -0500
committerGravatar bunnei2014-12-10 09:20:05 -0500
commitae3c6e82f70e84b4a2823ece9aeabf6fa1127956 (patch)
tree5305a9a909f0ed8c35aad59c81f910203f4c0aa2 /src/video_core
parentMerge pull request #269 from archshift/le (diff)
parentGSP: Trigger GPU interrupts at more accurate locations. (diff)
downloadyuzu-ae3c6e82f70e84b4a2823ece9aeabf6fa1127956.tar.gz
yuzu-ae3c6e82f70e84b4a2823ece9aeabf6fa1127956.tar.xz
yuzu-ae3c6e82f70e84b4a2823ece9aeabf6fa1127956.zip
Merge pull request #243 from bunnei/fix-gsp-synch
Fix gsp synch
Diffstat (limited to 'src/video_core')
-rw-r--r--src/video_core/command_processor.cpp9
-rw-r--r--src/video_core/pica.h10
2 files changed, 17 insertions, 2 deletions
diff --git a/src/video_core/command_processor.cpp b/src/video_core/command_processor.cpp
index 298b04c51..431139cc2 100644
--- a/src/video_core/command_processor.cpp
+++ b/src/video_core/command_processor.cpp
@@ -8,6 +8,7 @@
8#include "pica.h" 8#include "pica.h"
9#include "primitive_assembly.h" 9#include "primitive_assembly.h"
10#include "vertex_shader.h" 10#include "vertex_shader.h"
11#include "core/hle/service/gsp_gpu.h"
11 12
12#include "debug_utils/debug_utils.h" 13#include "debug_utils/debug_utils.h"
13 14
@@ -40,6 +41,11 @@ static inline void WritePicaReg(u32 id, u32 value, u32 mask) {
40 DebugUtils::OnPicaRegWrite(id, registers[id]); 41 DebugUtils::OnPicaRegWrite(id, registers[id]);
41 42
42 switch(id) { 43 switch(id) {
44 // Trigger IRQ
45 case PICA_REG_INDEX(trigger_irq):
46 GSP_GPU::SignalInterrupt(GSP_GPU::InterruptId::P3D);
47 return;
48
43 // It seems like these trigger vertex rendering 49 // It seems like these trigger vertex rendering
44 case PICA_REG_INDEX(trigger_draw): 50 case PICA_REG_INDEX(trigger_draw):
45 case PICA_REG_INDEX(trigger_draw_indexed): 51 case PICA_REG_INDEX(trigger_draw_indexed):
@@ -272,8 +278,9 @@ static std::ptrdiff_t ExecuteCommandBlock(const u32* first_command_word) {
272 278
273void ProcessCommandList(const u32* list, u32 size) { 279void ProcessCommandList(const u32* list, u32 size) {
274 u32* read_pointer = (u32*)list; 280 u32* read_pointer = (u32*)list;
281 u32 list_length = size / sizeof(u32);
275 282
276 while (read_pointer < list + size) { 283 while (read_pointer < list + list_length) {
277 read_pointer += ExecuteCommandBlock(read_pointer); 284 read_pointer += ExecuteCommandBlock(read_pointer);
278 } 285 }
279} 286}
diff --git a/src/video_core/pica.h b/src/video_core/pica.h
index e7ca38978..8bac178ca 100644
--- a/src/video_core/pica.h
+++ b/src/video_core/pica.h
@@ -45,10 +45,16 @@ struct Regs {
45#define INSERT_PADDING_WORDS_HELPER2(x, y) INSERT_PADDING_WORDS_HELPER1(x, y) 45#define INSERT_PADDING_WORDS_HELPER2(x, y) INSERT_PADDING_WORDS_HELPER1(x, y)
46#define INSERT_PADDING_WORDS(num_words) u32 INSERT_PADDING_WORDS_HELPER2(pad, __LINE__)[(num_words)]; 46#define INSERT_PADDING_WORDS(num_words) u32 INSERT_PADDING_WORDS_HELPER2(pad, __LINE__)[(num_words)];
47 47
48 INSERT_PADDING_WORDS(0x41); 48 INSERT_PADDING_WORDS(0x10);
49
50 u32 trigger_irq;
51
52 INSERT_PADDING_WORDS(0x30);
49 53
50 BitField<0, 24, u32> viewport_size_x; 54 BitField<0, 24, u32> viewport_size_x;
55
51 INSERT_PADDING_WORDS(0x1); 56 INSERT_PADDING_WORDS(0x1);
57
52 BitField<0, 24, u32> viewport_size_y; 58 BitField<0, 24, u32> viewport_size_y;
53 59
54 INSERT_PADDING_WORDS(0x9); 60 INSERT_PADDING_WORDS(0x9);
@@ -544,6 +550,7 @@ struct Regs {
544 map.insert({i, #name + std::string("+") + std::to_string(i-PICA_REG_INDEX(name))}); \ 550 map.insert({i, #name + std::string("+") + std::to_string(i-PICA_REG_INDEX(name))}); \
545 } while(false) 551 } while(false)
546 552
553 ADD_FIELD(trigger_irq);
547 ADD_FIELD(viewport_size_x); 554 ADD_FIELD(viewport_size_x);
548 ADD_FIELD(viewport_size_y); 555 ADD_FIELD(viewport_size_y);
549 ADD_FIELD(viewport_depth_range); 556 ADD_FIELD(viewport_depth_range);
@@ -607,6 +614,7 @@ private:
607#ifndef _MSC_VER 614#ifndef _MSC_VER
608#define ASSERT_REG_POSITION(field_name, position) static_assert(offsetof(Regs, field_name) == position * 4, "Field "#field_name" has invalid position") 615#define ASSERT_REG_POSITION(field_name, position) static_assert(offsetof(Regs, field_name) == position * 4, "Field "#field_name" has invalid position")
609 616
617ASSERT_REG_POSITION(trigger_irq, 0x10);
610ASSERT_REG_POSITION(viewport_size_x, 0x41); 618ASSERT_REG_POSITION(viewport_size_x, 0x41);
611ASSERT_REG_POSITION(viewport_size_y, 0x43); 619ASSERT_REG_POSITION(viewport_size_y, 0x43);
612ASSERT_REG_POSITION(viewport_depth_range, 0x4d); 620ASSERT_REG_POSITION(viewport_depth_range, 0x4d);