Files
Renderive/Core/base/Frame_Memory.h
T
2026-08-01 20:09:45 +08:00

25 lines
703 B
C++

#pragma once
#include <cstddef>
#include <cstdint>
#include <memory_resource>
#include <optional>
#include "../architecture/global.h"
#include "Object_Semantics.h"
#ifndef RENDERIVE_FRAME_ARENA_GROW
#define RENDERIVE_FRAME_ARENA_GROW 1
#endif
namespace renderive {
struct Thread_Frame_Scratch;
class LIB_DECL Frame_Arena : Immovable {
public:
explicit Frame_Arena(std::size_t initial_buffer_size = 64 * 1024);
~Frame_Arena();
std::pmr::memory_resource* resource() noexcept;
private:
Thread_Frame_Scratch* scratch{};
std::pmr::memory_resource* previous{};
std::optional<std::pmr::monotonic_buffer_resource> arena;
};
LIB_DECL std::pmr::memory_resource* frame_memory_resource();
}