Bevy Sly Compute

Plugin aims to provide easy way access data created or modified on the GPU, back in app world. Current approach uses channel to send data back to app world. Uses Events to trigger and notify compute is complete.

Note: This is a work in progress, and an experment. I got it working and plan on dog fooding it for a while.

Currently requires:

See Compute in App branch for first attempt at this. It duplicating render resources in app world like from bevy-app-compute Kinda worked. For context see PR #8440

Staging

See AsBindGroup for more information on how to use the attributes.

The only additional option is 'staging', which when used with ComputePlugin will arrange to have copied back to the app world after the compute shader is run.

  • uniform - TODO (haven't found a need for this myself)
  • storage - 'staging' - have resource updated after compute
    • Vec<T> works if T: Pod, Color doesn't work
    • TODO: Look into encase ReadFrom and WriteTo
  • storage_texture - 'staging' - image transfered after compute and Assets<Image> updated with AssetModified event
  • buffer - TODO

Issues

Github issues

Examples

You will most likely want to run in release mode. See Examples:

  • basic-wgsl - The Simplest use case
  • image-wgsl - Compute image and use it in material, and save image it to file
  • terrain - generates mesh and collider from image, brush to let you paint on it
  • paint - (doesn't use staging), lets you paint to different standard materials entities
  • many-(uses basic) - Multiple ComputePlugins

TODO

  • Data:

    • Uniform
    • Storage
    • StorageTexture
      • Tested with R32Float, R8uint, Rgba8Unorm
      • add error to macro when and check for readwrite support depending on format notes
    • Buffer
    • Texture
  • Examples:

    • Basic
    • Inspect
    • Image
    • Many - Multiple ComputeWorkerPlugins
  • AssetEvent::Modified

    • Egui Inspector - added patch to bevy-inspector-egui to clear resized images on asset modified events
    • Any Material - See mark_shader_modified, StandardMaterial added by default
  • Instancing

  • Components - Big TODO

  • Multiple Entry Points

  • Multiple Passes

  • Many Plugin Instances

References

Bevy support table

bevy bevy_sly_compute
0.13 *forked 0.2