51 lines
857 B
C++

#pragma once
#if !defined(VK_CAPTURE_DATA_POOL_HPP_INCLUDED)
#define VK_CAPTURE_DATA_POOL_HPP_INCLUDED 1
#include <array>
#include <cstddef>
#include <cstdint>
#include <memory>
#include <vector>
namespace vk_capture
{
//
// public defines
//
//
// public constants
//
//
// public types
//
struct DataPool
{
static constexpr std::size_t PAGE_SIZE = 4096 * 1024;
static_assert(PAGE_SIZE % alignof(std::max_align_t) == 0);
struct alignas(std::max_align_t) Page : std::array<std::uint8_t, PAGE_SIZE> {};
using page_ptr_t = std::unique_ptr<Page>;
std::vector<page_ptr_t> pages;
std::size_t offset = 0;
void* allocate(std::size_t bytes, std::size_t alignment = 1);
inline void reset() { offset = 0; }
};
//
// public functions
//
} // namespace vk_capture
#endif // !defined(VK_CAPTURE_DATA_POOL_HPP_INCLUDED)