MayaFlux 1.0.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches
MayaFlux::Portal::Graphics::PrimitiveMill Class Reference

Mills spans of mixed primitive topology into one TRIANGLE_LIST vertex buffer on the GPU. More...

#include <PrimitiveMill.hpp>

Collaboration diagram for MayaFlux::Portal::Graphics::PrimitiveMill:

Public Member Functions

uint32_t mill (const std::shared_ptr< Buffers::VKBuffer > &source, std::span< const DrawRun > runs, const MillView &view, std::optional< Kakshya::VertexLayout > layout=std::nullopt)
 Mill runs out of source into the owned buffer.
uint32_t milled_count () const
 Vertices written by the last mill().
PrimitiveMill & operator= (const PrimitiveMill &)=delete
PrimitiveMill & operator= (PrimitiveMill &&)=delete
std::shared_ptr< Buffers::VKBuffer > output () const
 The milled triangles: the ring slot the last mill() wrote.
 PrimitiveMill (const PrimitiveMill &)=delete
 PrimitiveMill (MillSpec spec={}, uint32_t output_ring=2)
 PrimitiveMill (PrimitiveMill &&)=delete
void release ()
 Destroy the kernel, pipeline and buffers.
void set_spec (const MillSpec &spec)
 Replace the spec.
const MillSpec & spec () const
 The current shaping parameters.
 ~PrimitiveMill ()

Static Public Member Functions

static uint32_t milled_vertex_count (std::span< const DrawRun > runs)
 Vertices runs would mill to.

Private Member Functions

void collect_completed ()
 Reclaim every dispatch that has finished, without waiting.
bool ensure_buffers (const std::shared_ptr< Buffers::VKBuffer > &source, const Kakshya::VertexLayout &layout, uint32_t total, size_t run_count)
 Grows the destination ring, run and prefix arenas to fit.
bool ensure_kernel ()
 Compiles the kernel and creates its pipeline with a push descriptor set, once.
void resolve_pending ()
 Wait on and reclaim every outstanding dispatch.

Private Attributes

std::vector< FenceID > m_in_flight
 Dispatches submitted and not yet observed complete, oldest first.
uint32_t m_milled_count { 0 }
uint32_t m_output_capacity { 0 }
uint32_t m_output_ring { 2 }
size_t m_output_slot { 0 }
std::vector< std::shared_ptr< Buffers::VKBuffer > > m_outputs
 Milled buffers rotated between dispatches, all at m_output_capacity.
ComputePipelineID m_pipeline { INVALID_COMPUTE_PIPELINE }
std::vector< uint32_t > m_prefix
std::unique_ptr< SlotArena > m_prefix_arena
size_t m_prefix_slot { 0 }
size_t m_push_constant_size { 0 }
std::unique_ptr< SlotArena > m_run_arena
size_t m_run_slot { 0 }
std::vector< uint32_t > m_run_words
ShaderID m_shader { INVALID_SHADER }
MillSpec m_spec

Detailed Description

Mills spans of mixed primitive topology into one TRIANGLE_LIST vertex buffer on the GPU.

Given a source vertex buffer, its layout and a list of DrawRun spans, produces one triangle buffer with the same vertex layout, so every span can be drawn by one non-indexed draw at one topology. Points become quads, line segments become ribbons and triangle spans reduce to lists. Positions are rewritten and texture coordinates optionally synthesised; every other attribute is copied bit-exact from the source vertex its corner belongs to, so a vertex shader written against the source layout consumes the result unchanged.

Owns its kernel, pipeline and destination buffers and dispatches through ComputePress. It is not a BufferProcessor: it has no processing token, attach or chain position, because milling is demand driven by whoever is about to draw, normally a render processor.

The output is a transient draw source, not authored geometry. It is regenerated whenever the spans or the viewpoint change, its vertices have no correspondence back to the source, and it is not an export or readback surface.

Limits

Ribbon width and point size are fixed in world units, so a ribbon thins on screen as the camera pulls back. Joins are mitred; there are no round joins or caps. A polyline emitted as duplicated vertex pairs mills twice the vertices it needs, since every second segment is a zero-length seam that is skipped but still counted.

Definition at line 127 of file PrimitiveMill.hpp.


The documentation for this class was generated from the following files: