diff options
author | quou <quou@disroot.org> | 2025-01-01 10:52:05 +1100 |
---|---|---|
committer | quou <quou@disroot.org> | 2025-01-01 10:52:05 +1100 |
commit | 87393ae98fa459715b0c9616b986a23650e373b6 (patch) | |
tree | 163d019f483d79d2563b97865e0b230c422c8040 | |
parent | 933ef51c7978c1baa414ba294a5b9b4db2cf6d4c (diff) |
vram allocator debug hooks
-rw-r--r-- | video.cpp | 17 | ||||
-rw-r--r-- | video.hpp | 2 |
2 files changed, 19 insertions, 0 deletions
@@ -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 @@ -423,6 +423,8 @@ struct Device_Debug_Hooks { virtual void on_acquire(Context& ctx); virtual void on_submit(Context& ctx); virtual void on_present(Context& ctx); + virtual void on_page_alloc(size_t size); + virtual void on_vram_alloc(size_t size, size_t align); }; struct Context; |