TachyonUI 0.1.0
High-performance UI for building tools.
Loading...
Searching...
No Matches
tachyon::AllocationHooks Struct Reference

Memory functions a host gives the library, for the allocations that can be routed: Vulkan objects, VMA, vk-bootstrap and SDL. More...

#include <gui_core/memory/gui_allocation_hooks.h>

Public Member Functions

bool IsSet () const
 The hooks are used only when all three functions are set.

Public Attributes

void *(*) allocate (size_t size, size_t alignment, void *user) = nullptr
 Returns size bytes aligned to alignment (a power of two).
void *(*) reallocate (void *ptr, size_t size, size_t alignment, void *user) = nullptr
 Resizes ptr, keeping its alignment; ptr may be null (then it allocates).
void(*) free (void *ptr, void *user) = nullptr
 Frees ptr, which may be null.
void * user = nullptr
 passed to every call

Detailed Description

Memory functions a host gives the library, for the allocations that can be routed: Vulkan objects, VMA, vk-bootstrap and SDL.

They must be thread-safe (drivers call them from their own threads) and stay valid for the rest of the process: SDL can keep a few allocations past SDL_Quit (logged) and keeps using the hooks.

Member Function Documentation

◆ IsSet()

bool tachyon::AllocationHooks::IsSet ( ) const
inline

The hooks are used only when all three functions are set.

Member Data Documentation

◆ allocate

void *(*) tachyon::AllocationHooks::allocate(size_t size, size_t alignment, void *user) = nullptr

Returns size bytes aligned to alignment (a power of two).

◆ reallocate

void *(*) tachyon::AllocationHooks::reallocate(void *ptr, size_t size, size_t alignment, void *user) = nullptr

Resizes ptr, keeping its alignment; ptr may be null (then it allocates).

size is never 0.

◆ free

void(*) tachyon::AllocationHooks::free(void *ptr, void *user) = nullptr

Frees ptr, which may be null.

◆ user

void* tachyon::AllocationHooks::user = nullptr

passed to every call


The documentation for this struct was generated from the following file: