From 87393ae98fa459715b0c9616b986a23650e373b6 Mon Sep 17 00:00:00 2001 From: quou Date: Wed, 1 Jan 2025 10:52:05 +1100 Subject: vram allocator debug hooks --- video.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'video.cpp') diff --git a/video.cpp b/video.cpp index 1f58e00..372b851 100644 --- a/video.cpp +++ b/video.cpp @@ -3838,6 +3838,10 @@ void Vram_Allocator::Page::init( chunk->next = 0; chunk->free = true; chunks = chunk; +#ifdef DEBUG + if (dev->hooks) + dev->hooks->on_page_alloc(s); +#endif } Vram_Allocator::Allocation Vram_Allocator::Page::imp_alloc( @@ -3905,6 +3909,10 @@ Vram_Allocator::Allocation Vram_Allocator::Page::alloc( if (!a.chunk) return a; al = align_address((uintptr_t)a.chunk->offset, (size_t)align); a.chunk->pad = al - a.chunk->offset; +#if DEBUG + if (dev->hooks) + dev->hooks->on_vram_alloc(as, align); +#endif return a; } @@ -4043,3 +4051,12 @@ void Device_Debug_Hooks::on_submit(Context& ctx) { void Device_Debug_Hooks::on_present(Context& ctx) { (void)ctx; } + +void Device_Debug_Hooks::on_page_alloc(size_t size) { + (void)size; +} + +void Device_Debug_Hooks::on_vram_alloc(size_t size, size_t align) { + (void)size; + (void)align; +} \ No newline at end of file -- cgit v1.2.3-54-g00ecf