summaryrefslogtreecommitdiffstats
path: root/src/core/hw/gpu.cpp
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2014-07-23 04:59:26 +0200
committerbunnei <bunneidev@gmail.com>2014-08-06 05:57:53 +0200
commitec14ffe1cda04cd098ce07f3d3ad96c253e91eed (patch)
treefe459fc75a4ba62ed1a730e8a4ccbdffa2846dca /src/core/hw/gpu.cpp
parentMemMap: Fixed typo with GetPointer to VRAM address. (diff)
downloadyuzu-ec14ffe1cda04cd098ce07f3d3ad96c253e91eed.tar
yuzu-ec14ffe1cda04cd098ce07f3d3ad96c253e91eed.tar.gz
yuzu-ec14ffe1cda04cd098ce07f3d3ad96c253e91eed.tar.bz2
yuzu-ec14ffe1cda04cd098ce07f3d3ad96c253e91eed.tar.lz
yuzu-ec14ffe1cda04cd098ce07f3d3ad96c253e91eed.tar.xz
yuzu-ec14ffe1cda04cd098ce07f3d3ad96c253e91eed.tar.zst
yuzu-ec14ffe1cda04cd098ce07f3d3ad96c253e91eed.zip
Diffstat (limited to '')
-rw-r--r--src/core/hw/gpu.cpp22
1 files changed, 19 insertions, 3 deletions
diff --git a/src/core/hw/gpu.cpp b/src/core/hw/gpu.cpp
index c00be2a83..41976d989 100644
--- a/src/core/hw/gpu.cpp
+++ b/src/core/hw/gpu.cpp
@@ -7,7 +7,11 @@
#include "core/core.h"
#include "core/mem_map.h"
+
+#include "core/hle/hle.h"
#include "core/hle/kernel/thread.h"
+#include "core/hle/service/gsp.h"
+
#include "core/hw/gpu.h"
#include "video_core/video_core.h"
@@ -17,7 +21,8 @@ namespace GPU {
RegisterSet<u32, Regs> g_regs;
-u64 g_last_ticks = 0; ///< Last CPU ticks
+u32 g_cur_line = 0; ///< Current vertical screen line
+u64 g_last_ticks = 0; ///< Last CPU ticks
/**
* Sets whether the framebuffers are in the GSP heap (FCRAM) or VRAM
@@ -249,17 +254,28 @@ template void Write<u8>(u32 addr, const u8 data);
void Update() {
u64 current_ticks = Core::g_app_core->GetTicks();
- // Fake a vertical blank
- if ((current_ticks - g_last_ticks) >= kFrameTicks) {
+ // Synchronize line...
+ if ((current_ticks - g_last_ticks) >= GPU::kFrameTicks / 400) {
+ GSP_GPU::SignalInterrupt(GSP_GPU::GXInterruptId::PDC0);
+ g_cur_line++;
g_last_ticks = current_ticks;
+ }
+
+ // Synchronize frame...
+ if (g_cur_line >= 400) {
+ g_cur_line = 0;
+ GSP_GPU::SignalInterrupt(GSP_GPU::GXInterruptId::PDC1);
VideoCore::g_renderer->SwapBuffers();
Kernel::WaitCurrentThread(WAITTYPE_VBLANK);
+ HLE::Reschedule(__func__);
}
}
/// Initialize hardware
void Init() {
+ g_cur_line = 0;
g_last_ticks = Core::g_app_core->GetTicks();
+
// SetFramebufferLocation(FRAMEBUFFER_LOCATION_FCRAM);
SetFramebufferLocation(FRAMEBUFFER_LOCATION_VRAM);