Skip to content

Pack multiple effects per particle slab#508

Merged
djeedai merged 1 commit intomainfrom
u/slab-batch
Oct 17, 2025
Merged

Pack multiple effects per particle slab#508
djeedai merged 1 commit intomainfrom
u/slab-batch

Conversation

@djeedai
Copy link
Owner

@djeedai djeedai commented Oct 17, 2025

Sub-allocate each particle slab with the content of multiple effects.

  • Introduce a base_particle value per effect instance, which is the equivalent of the base_vertex for rendering, and corresponds to the index of the first particle in the sub-allocated slice for that effect, inside the overall slab buffer.
  • Store that base_particle in the Spawner and give access to all shaders which need it (most of them).
  • Restore the default 64k particle count per slab, which allows packing multiple effects per buffer/slab.

When debug_assertions is active (in Debug build), fill the first value of each particle to a NaN (0xFFFFFFFF) to make it easier to see in RenderDoc or any other GPU debugger that the particle is unused.

Sub-allocate each particle slab with the content of multiple effects.
- Introduce a `base_particle` value per effect instance, which is the
  equivalent of the `base_vertex` for rendering, and corresponds to the
  index of the first particle in the sub-allocated slice for that
  effect, inside the overall slab buffer.
- Store that `base_particle` in the `Spawner` and give access to all
  shaders which need it (most of them).
- Restore the default 64k particle count per slab, which allows packing
  multiple effects per buffer/slab.

When `debug_assertions` is active (in Debug build), fill the first value
of each particle to a `NaN` (0xFFFFFFFF) to make it easier to see in
RenderDoc or any other GPU debugger that the particle is unused.
@djeedai djeedai added C - enhancement New feature or request A - internal Internal change on a core system A - shaders Compute and render shaders labels Oct 17, 2025
@djeedai djeedai merged commit 03d355d into main Oct 17, 2025
14 of 15 checks passed
@djeedai djeedai deleted the u/slab-batch branch October 17, 2025 22:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A - internal Internal change on a core system A - shaders Compute and render shaders C - enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant