mirror of
https://github.com/storytold/wgpu.git
synced 2026-11-19 14:01:08 +01:00
* init files, dir structure * wip: it's working need to suss out the readme and some of the consts... * ok that's probably good enough for a first pass... * chore: spelling * chore: readme tweaks * chore: clippy and fmt * chore: add self and changes to changelog.md * fix: typo and remove env_logger via cfg flag for wasm builds (which this doesn't supprot anyway) * refactor: bring inline with newer wgpu * refactor: bring inline with newer wgpu * chore: work on the readme a bit... * refactor: remove a bunch of everything, be simple * wip: get a test going * wip: remove unrequired pub(s)... * refactor: remove a bunch of everything, be simple wip: get a test going * wip: remove unrequired pub(s)... wip: remove unrequired pub(s)... * chore: cleanups, typos, simplifying * chore: reconcile changelog diffs * fix: re-add our change to the changelog * wip: finess the docs a bit per request... * chore: trying to get the woring right... * chore: trying to get the woring right... * fix: typos * fix: spelling * Update mod.rs swap all loops over to 'for' by request. Flume's sender is already Send/Sync chunks will already split for us .unwraps() unwraps everywhere! * Update CHANGELOG.md Co-authored-by: Jim Blandy <jimb@red-bean.com> * 1GB as the example says we'll do - 1GB as the example says we'll do - update readme for windows users. * init files, dir structure * wip: it's working need to suss out the readme and some of the consts... * ok that's probably good enough for a first pass... * chore: spelling * chore: readme tweaks * chore: clippy and fmt * chore: add self and changes to changelog.md * fix: typo and remove env_logger via cfg flag for wasm builds (which this doesn't supprot anyway) * refactor: bring inline with newer wgpu * refactor: bring inline with newer wgpu * chore: work on the readme a bit... * refactor: remove a bunch of everything, be simple * wip: get a test going * wip: remove unrequired pub(s)... * wip: remove unrequired pub(s)... wip: remove unrequired pub(s)... * chore: cleanups, typos, simplifying * fix: re-add our change to the changelog * wip: finess the docs a bit per request... * chore: trying to get the woring right... * chore: trying to get the woring right... * fix: typos * fix: spelling * Update mod.rs swap all loops over to 'for' by request. Flume's sender is already Send/Sync chunks will already split for us .unwraps() unwraps everywhere! * Update CHANGELOG.md Co-authored-by: Jim Blandy <jimb@red-bean.com> * 1GB as the example says we'll do - 1GB as the example says we'll do - update readme for windows users. * bring up to date with trunk sync with trunk. make more of Jim's changes * some of the consts have changed name. * small tweaks * what is the flag called now? what is the flag called now? * Update shader.wgsl naming things betterer * Update README.md reword readme * Update README.md simplify readme * Update mod.rs remove unused * well at least it compiles again * BUG: ... it seems to run forever and never complete. * nicer shader module creation * ... add logging to track down infinite hangtime... * use 2 buffers in the test * test and example pass (now they do the same number of buffers.. * that's better... * fix: remove duplicate entries * fix: whitespace * move changelog entry to #unreleased per request * fix: target_arch != wasm to satiate pipeline * fix: target_arch != wasm to satiate pipeline * pipeline want's us to allow allows... * savage hacks to make the wasm build ignore our test * fix: allow the allowing of allows that allow the dead_code. * Fix: no tests on wasm --------- Co-authored-by: Jim Blandy <jimb@red-bean.com>
big-compute-buffers
NOTE: binding_array is Vulkan only.
This example assumes you're familiar with the other GP-GPU compute examples in this repository, if you're not you should go look at those first.
This example also assumes you've specifically come here looking to do this, because you want at least the following:
- To be working on your 'data' in your shader treating it contiguously, not batching etc.
- The data you are wanting to work on does not fit within a single buffer on your device, see the hello example for how to print information about your unique device to explore its maximum supported buffer size.
Demonstrates how to split larger datasets (things too big to fit into a single buffer), across multiple buffers.
- Creates a set of buffers totalling
1GB, full of0.0f32. - Moves those buffers to the DEVICE.
- Increments each element in each set of buffers by
1.0, on the DEVICE. - Returns those modified buffers full of
1.0values as a back to the HOST.
Caution
- Large buffers can fail to allocate due to fragmentation issues, you will always need not only the appropriate amount of space required for your buffer(s) but, that space will also need to be contiguous within GPU/Device memory for this strategy to work.
You can read more about fragmentation here.
To Run
# linux/mac
RUST_LOG=wgpu_examples::big_compute_buffers=info cargo run -r --bin wgpu-examples -- big_compute_buffers
# windows (Powershell)
$env:WGPU_BACKEND="Vulkan"; $env:RUST_LOG="wgpu_examples::big_compute_buffers=info"; cargo run -r --bin wgpu-examples -- big_compute_buffers
Example Output
[2024-09-29T11:47:55Z INFO wgpu_examples::big_compute_buffers] All 0.0s
[2024-09-29T11:47:58Z INFO wgpu_examples::big_compute_buffers] GPU RUNTIME: 3228ms
[2024-09-29T11:47:58Z INFO wgpu_examples::big_compute_buffers] All 1.0s