Skip to main content

dynamis_state/
lib.rs

1mod capacity;
2mod domain;
3mod streams;
4
5pub use capacity::{ShapeCapacity, StateCapacity, StateInputs, capacity, floor, plan};
6pub use domain::{StateDomain, StateWork};
7pub use streams::{
8    QUERY_RESULT_BYTES, StateDemand, StateStream, StateStreams, TRIANGLE_BYTES, VERTEX_BYTES,
9};
10
11use dynamis_abi::{COUNTER_DEVICE_COUNT, COUNTER_STRIDE};
12use dynamis_gpu::SlotRef;
13
14pub const MOVE_ENTRIES_PER_COMMAND: u32 = 2;
15
16pub fn counter(slot: usize) -> SlotRef {
17    assert!(
18        slot < COUNTER_DEVICE_COUNT,
19        "counter slot {slot} is outside the counter stream"
20    );
21    SlotRef::range(
22        StateStream::Counters.into(),
23        slot as u64 * COUNTER_STRIDE,
24        4,
25        StateStream::Counters.element(),
26    )
27}
28
29pub fn shape_resources() -> [(&'static str, SlotRef); 4] {
30    [
31        ("shape_sources", StateStream::ShapeSources.whole()),
32        ("shape_vertices", StateStream::ShapeVertices.whole()),
33        ("shape_triangles", StateStream::ShapeTriangles.whole()),
34        ("shape_nodes", StateStream::ShapeNodes.whole()),
35    ]
36}