Storage Buffer Assets #23
Draft
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Challenge: Allow a custom material to read from the same storage buffer a compute shader writes to. #21
Adds a new example
shared_storage. It runs a compute pass every frame and writes heightmap values to a storage buffer. A vertex shader reads from that and sets vertex heights (mesh is a plane). Result is an animated wavy terrain surface. On the CPU, it writes the "time" uniform every frame for animation purposes.Adds a new function to the worker builder that allows you to retrieve a
Handle<ShaderStorageBuffer>which can then be used on a custom material like so:You can retrieve the handle from the worker and clone it when creating the material.
Notes:
bevy_app_computeseems to have been designed to run on the main subapp. So I had to extract them back to the main subapp, but since the actual data is being stored on the GPU we're just cloning wgpu handles around anyway.