Establish VSyncCallback rendering

This commit is contained in:
2024-10-05 13:22:09 +02:00
parent ea38436e35
commit 77c7f391d1
4 changed files with 52 additions and 18 deletions

View File

@@ -14,6 +14,11 @@
namespace JabyEngine {
namespace GPU {
namespace internal {
void render(const uint32_t* data, size_t words);
void render_dma(const uint32_t* data);
}
struct Display {
#ifdef JABYENGINE_PAL
static constexpr size_t Width = 320;
@@ -42,6 +47,7 @@ namespace JabyEngine {
static void set_offset(int16_t x, int16_t y);
};
using VSyncCallback = void (*)();
static uint32_t update_id() {
return Display::current_id;
@@ -51,10 +57,7 @@ namespace JabyEngine {
return Display::current_id ^ 1;
}
namespace internal {
void render(const uint32_t* data, size_t words);
void render_dma(const uint32_t* data);
}
void set_vsync_callback(VSyncCallback callback);
template<typename T>
static void render(const LinkedElement<T>& linked_primitives) {
@@ -75,6 +78,7 @@ namespace JabyEngine {
while(!GPU_IO::GPUSTAT.read().is_set(GPU_IO_Values::GPUSTAT::GP0ReadyForCMD));
}
void swap_buffers(bool clear_screen = true);
uint8_t swap_buffers_vsync(uint8_t syncs, bool clear_screen = true);
}
}