101 u32 readbackBytes = 0;
102 u32 collisionMode = 0;
108 bool ensureEventKernels();
109 void ensureEmpties();
110 void pollReadbacks();
111 Slot* ensureSlot(Entity entity,
u32 capacity);
112 void freeSlot(Slot& slot);
121 u32 paramsCapacity_ = 0;
123 u32 controlCapacity_ = 0;
129 u32 collidersCapacity_ = 0;
132 u32 depthW_ = 0, depthH_ = 0;
133 u32 depthGridMax_ = 640;
134 bool depthValid_ =
false;
135 bool depthCopied_ =
false;
136 bool wantsDepth_ =
false;
137 bool wantsDepthNext_ =
false;
138 glm::mat4 depthClip_{1.0f};
139 glm::mat4 depthWorld_{1.0f};
140 glm::vec3 depthOrigin_{0.0f};
141 bool failed_ =
false;
143 u32 lastDispatches_ = 0;
145 std::unordered_map<u32, Slot> slots_;
146 std::vector<Job> jobs_;
147 std::vector<Job*> order_;
148 std::vector<u8> placed_;
149 std::vector<i32> parent_;
150 std::vector<u8> staging_;
151 std::vector<u8> control_staging_;
void beginFrame()
A new frame: the previous frame's jobs are gone, and a slot nobody asked for in a while is given back...
u32 lastDispatches() const
u32 depthGridWidth() const
GpuParticles(const GpuParticles &)=delete
GpuParticles & operator=(const GpuParticles &)=delete
bool submit(Entity entity, const ecs::ParticleEmitter &emitter, const ecs::Transform &transform, particle::ParticleSystem &system, const particle::GpuStep &step, const glm::vec4 &eye, BufferHandle &instances, BufferHandle &segments, u32 &segmentCount)
Queues the step an emitter needs and says where its particles are. The step is committed to the emitt...
bool wantsDepth() const
An emitter collided with the depth last frame, so the scene must draw into a target whose depth can b...
void setDepthGridMax(u32 texels)
rg::ResourceId declare(rg::RenderGraph &graph)
Adds the compute pass for what was submitted. The resource it writes must be named by the pass that d...
void declareDepthCopy(rg::RenderGraph &graph, rg::ResourceId scene, u32 sceneW, u32 sceneH, const glm::mat4 &clip)
Copies the scene's depth for next frame's kernel, once a frame. clip is the view that drew it,...
u32 slotCount() const
Slots live right now, for the stats.
GpuParticles(GfxDevice &device)
bool available() const
Whether the device can run the kernel at all.
u32 drawnSlots() const
Particle slots handed to a draw this frame, over every emitter and camera: what the GPU is asked to d...
What one frame asks of a GPU-simulated emitter: how long to advance, how many to spawn and where in t...