1use crate::capacity::floor;
2use crate::{StateCapacity, StateDemand, StateInputs, StateStreams};
3use dynamis_abi::Counters;
4use dynamis_domain::{Domain, Run, StepFacts};
5use dynamis_gpu::GpuContext;
6use dynamis_gpu::Resources;
7use dynamis_pass::{PassGroup, Pipeline, Schedule};
8use wgpu::CommandEncoder;
9
10pub struct StateDomain;
11
12#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)]
13pub struct StateWork {
14 pub queries: u32,
15 pub shape_uploads: bool,
16}
17
18impl Domain for StateDomain {
19 const ID: u32 = 0;
20
21 const SIMULATES: bool = false;
22
23 const PASS_EDGES: dynamis_pass::PassEdges = &[];
24
25 type Demand = StateDemand;
26 type Inputs = StateInputs;
27 type Work = StateWork;
28 type Streams = StateStreams;
29 type Planner = ();
30 type Passes = ();
31 type Runtime = ();
32 type Frame = ();
33 type Capacity = StateCapacity;
34
35 fn minimum() -> StateDemand {
36 floor()
37 }
38
39 fn occupied(_: &StateInputs) -> bool {
40 true
41 }
42
43 fn pending(work: &StateWork) -> bool {
44 work.queries > 0 || work.shape_uploads
45 }
46
47 fn active(_: &Counters) -> bool {
48 false
49 }
50
51 fn pass_groups() -> &'static [PassGroup] {
52 &[]
53 }
54
55 fn resolve(_: &Pipeline) {}
56
57 fn build(_: &GpuContext, _: &impl Resources, _: ()) {}
58
59 fn frame(_: &StepFacts, _: &StateInputs, _: Run) {}
60
61 fn capacity(streams: &StateStreams) -> StateCapacity {
62 crate::capacity(streams)
63 }
64
65 fn record(
66 _: &(),
67 _: u32,
68 _: &mut Schedule,
69 _: &mut CommandEncoder,
70 _: &impl Resources,
71 _: &(),
72 ) {
73 }
74}