36 void init(
u32 initialVertexBytes = 2 * 1024 * 1024,
37 u32 initialIndexCount = 256 * 1024);
44 std::swap(streams_, other.streams_);
45 std::swap(initial_vertex_bytes_, other.initial_vertex_bytes_);
46 std::swap(initial_index_count_, other.initial_index_count_);
47 std::swap(initialized_, other.initialized_);
109 u32 texture_rows = 0;
110 std::vector<u8> texture_mirror;
112 u64 mirror_generation = 0;
113 std::vector<u8> vertex_staging;
114 std::vector<u32> index_staging;
115 u32 vertex_stride = 0;
116 u32 vertex_write_pos = 0;
117 u32 index_write_pos = 0;
118 u32 vbo_capacity = 0;
119 u32 ebo_capacity = 0;
123 void ensureStorage(
LayoutId layout);
124 void uploadInstanceRows(Stream& s,
u32& grows,
u32& writes);
126 void growVertexStaging(Stream& s,
u32 requiredBytes);
127 void growIndexStaging(Stream& s,
u32 requiredCount);
130 const Stream& stream(
LayoutId layout)
const;
133 std::array<Stream, LAYOUT_COUNT> streams_{};
134 u32 initial_vertex_bytes_ = 0;
135 u32 initial_index_count_ = 0;
136 bool initialized_ =
false;
Abstract graphics device interface.
Core type definitions and utilities for ESEngine.
Abstract graphics device interface.
VertexLayoutHandle layoutHandle(LayoutId layout) const
bool copyIndexRange(LayoutId layout, u32 offset, u32 count, u32 &copiedAt)
TransientBufferPool(GfxDevice &device)
u32 appendVertices(LayoutId layout, const void *data, u32 byteSize)
const u32 * indexData(LayoutId layout) const
void swap(TransientBufferPool &other) noexcept
Trades what the two pools hold, buffers and staging both; they must share one device.
BufferHandle vertexBuffer(LayoutId layout) const
GfxDevice & device()
The device the pool's buffers live on, for a plugin that keeps geometry of its own on it.
void bindInstanceLayout(LayoutId layout, u32 instanceByteOffset)
u32 allocIndices(LayoutId layout, u32 count)
u32 vertexStride(LayoutId layout) const
BufferHandle indexBuffer(LayoutId layout) const
TextureHandle instanceTexture() const
The frame's per-object records. Invalid until a frame writes some.
void init(u32 initialVertexBytes=2 *1024 *1024, u32 initialIndexCount=256 *1024)
void reserveStream(LayoutId layout)
void bindLayout(LayoutId layout)
u32 vertexBytesUsed(LayoutId layout) const
u32 indicesUsed(LayoutId layout) const
u32 appendIndices(LayoutId layout, const u32 *data, u32 count)
void writeVertices(LayoutId layout, u32 byteOffset, const void *data, u32 byteSize)
u8 * vertexData(LayoutId layout)
u32 allocVertices(LayoutId layout, u32 byteSize)
void bindInstanceBuffer(LayoutId layout, BufferHandle instances)
void writeIndices(LayoutId layout, u32 indexOffset, const u32 *data, u32 count)
std::uint64_t u64
Unsigned 64-bit integer.
std::uint32_t u32
Unsigned 32-bit integer.
static constexpr u32 MESH_INSTANCE_TEXTURE_WIDTH
std::uint8_t u8
Unsigned 8-bit integer.
LayoutId
Identifies a transient vertex stream / vertex format. Each layout has its own VBO+EBO+VAO in Transien...