summaryrefslogtreecommitdiff
path: root/src/core/hw/gpu.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/hw/gpu.cpp')
-rw-r--r--src/core/hw/gpu.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/core/hw/gpu.cpp b/src/core/hw/gpu.cpp
index 308ea2035..0ad7e2963 100644
--- a/src/core/hw/gpu.cpp
+++ b/src/core/hw/gpu.cpp
@@ -29,8 +29,7 @@ namespace GPU {
29Regs g_regs; 29Regs g_regs;
30 30
31/// True if the current frame was skipped 31/// True if the current frame was skipped
32bool g_skip_frame = false; 32bool g_skip_frame;
33
34/// 268MHz / gpu_refresh_rate frames per second 33/// 268MHz / gpu_refresh_rate frames per second
35static u64 frame_ticks; 34static u64 frame_ticks;
36/// Event id for CoreTiming 35/// Event id for CoreTiming
@@ -38,7 +37,7 @@ static int vblank_event;
38/// Total number of frames drawn 37/// Total number of frames drawn
39static u64 frame_count; 38static u64 frame_count;
40/// True if the last frame was skipped 39/// True if the last frame was skipped
41static bool last_skip_frame = false; 40static bool last_skip_frame;
42 41
43template <typename T> 42template <typename T>
44inline void Read(T &var, const u32 raw_addr) { 43inline void Read(T &var, const u32 raw_addr) {
@@ -320,6 +319,8 @@ static void VBlankCallback(u64 userdata, int cycles_late) {
320 319
321/// Initialize hardware 320/// Initialize hardware
322void Init() { 321void Init() {
322 memset(&g_regs, 0, sizeof(g_regs));
323
323 auto& framebuffer_top = g_regs.framebuffer_config[0]; 324 auto& framebuffer_top = g_regs.framebuffer_config[0];
324 auto& framebuffer_sub = g_regs.framebuffer_config[1]; 325 auto& framebuffer_sub = g_regs.framebuffer_config[1];
325 326
@@ -349,6 +350,7 @@ void Init() {
349 frame_ticks = 268123480 / Settings::values.gpu_refresh_rate; 350 frame_ticks = 268123480 / Settings::values.gpu_refresh_rate;
350 last_skip_frame = false; 351 last_skip_frame = false;
351 g_skip_frame = false; 352 g_skip_frame = false;
353 frame_count = 0;
352 354
353 vblank_event = CoreTiming::RegisterEvent("GPU::VBlankCallback", VBlankCallback); 355 vblank_event = CoreTiming::RegisterEvent("GPU::VBlankCallback", VBlankCallback);
354 CoreTiming::ScheduleEvent(frame_ticks, vblank_event); 356 CoreTiming::ScheduleEvent(frame_ticks, vblank_event);