37 return { bytes.data(), bytes.size() - bytes.size() % m_stride };
51 const std::vector<uint8_t>& bytes,
52 std::optional<Portal::Graphics::PrimitiveTopology>
topology)
98 auto vk = std::dynamic_pointer_cast<VKBuffer>(
buffer);
100 error<std::invalid_argument>(
103 std::source_location::current(),
104 "FormaProcessor requires a VKBuffer");
143 auto vk = std::dynamic_pointer_cast<VKBuffer>(
buffer);
145 if (
auto rp = vk->get_render_processor()) {
159 auto vk = std::dynamic_pointer_cast<VKBuffer>(
buffer);
183 if (
auto layout =
buffer->get_vertex_layout()) {
185 buffer->set_vertex_layout(*layout);
188 auto render =
buffer->get_render_processor();
198 render->set_vertex_range(0, 0);
201 render->set_runs({ first });
203 render->set_runs({});
208 render->set_vertex_range(0, 0);
std::shared_ptr< NetworkGeometryBuffer > buffer
PrimitiveTopology topology
ProcessingToken m_processing_token
void remove(SliceId id)
Remove a block; later blocks shift down.
SliceId add(std::span< const uint8_t > bytes, std::optional< Portal::Graphics::PrimitiveTopology > topology=std::nullopt)
Append a block at the end of memory and draw order.
std::optional< std::vector< Portal::Graphics::DrawRun > > take_runs()
Runs for the visible blocks in draw order, if they changed.
void bring_to_front(SliceId id)
Draw a block after every other.
void send_to_back(SliceId id)
Draw a block before every other.
void update(SliceId id, std::span< const uint8_t > bytes)
Replace a block's vertices.
uint32_t vertex_count() const noexcept
Vertices in the mirror, hidden blocks included.
void flush(const std::shared_ptr< VKBuffer > &target, std::shared_ptr< VKBuffer > &staging)
Upload what changed since the last flush.
void set_visible(SliceId id, bool visible)
Hide or show a block without moving its data.
Many vertex blocks laid out in one buffer, drawn as few runs.
@ GRAPHICS_BACKEND
Standard graphics processing backend configuration.
std::shared_ptr< VKBuffer > create_staging_buffer(size_t size)
Create staging buffer for transfers.
@ BufferProcessing
Buffer processing (Buffers::BufferManager, processing chains)
@ Buffers
Buffers, Managers, processors and processing chains.
PrimitiveTopology
Vertex assembly primitive topology.
std::shared_ptr< Core::VKImage > image
uint32_t stride_bytes
Total bytes per vertex (stride in Vulkan terms) e.g., 3 floats (position) + 3 floats (normal) = 24 by...
static VertexLayout for_lines(uint32_t stride=60)
Factory: layout for LineVertex (position, color, thickness, uv, normal, tangent)
static VertexLayout for_meshes(uint32_t stride=60)
Factory: layout for MeshVertex (position, color, weight, uv, normal, tangent)
static VertexLayout for_points(uint32_t stride=60)
Factory: layout for PointVertex (position, color, size, uv, normal, tangent)
PrimitiveTopology topology
One contiguous span of vertices sharing a primitive topology.