mirror of
https://github.com/gfx-rs/wgpu.git
synced 2024-11-22 06:44:14 +00:00
chore: cleanups, typos, simplifying
This commit is contained in:
parent
6c8e1936b0
commit
64f069755e
@ -110,7 +110,7 @@ By @bradwerth [#6216](https://github.com/gfx-rs/wgpu/pull/6216).
|
||||
|
||||
#### General
|
||||
|
||||
- Added an example that splits up large data across multiple buffers and accesses them as a single contiguous array in the shader, demonstrating the naga/wgsl only `binding_array`, and some of the, less documented `wgpu::Features`. By @alphastrata in [#6130](https://github.com/gfx-rs/wgpu/pull/6138)
|
||||
- Added an example that splits up large data across multiple buffers and accesses them as a single contiguous array in the shader, demonstrating the naga/wgsl only `binding_array`, and some of the, less documented `wgpu::Features`. By @alphastrata in [#6138](https://github.com/gfx-rs/wgpu/pull/6138)
|
||||
|
||||
- If GL context creation fails retry with GLES. By @Rapdorian in [#5996](https://github.com/gfx-rs/wgpu/pull/5996)
|
||||
- Fix profiling with `tracy`. By @waywardmonkeys in [#5988](https://github.com/gfx-rs/wgpu/pull/5988)
|
||||
|
@ -1,11 +1,8 @@
|
||||
# WIP
|
||||
|
||||
|
||||
# big-compute-buffers
|
||||
|
||||
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.
|
||||
|
||||
Showcases how to split larger datasets (things too big to fit into a single buffer), across multiple buffers whilst treating them as a single, contiguous buffer on the GPU.
|
||||
Demonstrates how to split larger datasets (things too big to fit into a single buffer), across multiple buffers whilst treating them as a single, contiguous buffer on the GPU.
|
||||
|
||||
- Creates a large set of buffers totalling `1GB`, full of `0.0f32`.
|
||||
- Moves those buffers to the DEVICE.
|
||||
@ -19,6 +16,10 @@ const MAX_BUFFER_SIZE: u64 = 1 << 27; // 134_217_728 // 134MB
|
||||
const MAX_DISPATCH_SIZE: u32 = (1 << 16) - 1; // 65_535
|
||||
```
|
||||
|
||||
Note:
|
||||
- Large buffers can fail to allocate due to fragmentation issues.
|
||||
- Working with large buffers is not always ideal, you should also see the pagination example to see if that approach suits your needs better.
|
||||
|
||||
## To Run
|
||||
```sh
|
||||
RUST_LOG=wgpu_examples::big_compute_buffers=info cargo run -r --bin wgpu-examples -- big_compute_buffers
|
||||
|
@ -1,6 +1,7 @@
|
||||
use std::{borrow::Cow, num::NonZeroU32, sync::Arc};
|
||||
use wgpu::{util::DeviceExt, Features};
|
||||
|
||||
// These are set by the minimum required defaults for webgpu.
|
||||
const MAX_BUFFER_SIZE: u64 = 1 << 27; // 134_217_728 // 134MB
|
||||
const MAX_DISPATCH_SIZE: u32 = (1 << 16) - 1;
|
||||
|
||||
@ -15,10 +16,11 @@ pub async fn execute_gpu(numbers: &[f32]) -> Option<Vec<f32>> {
|
||||
.request_device(
|
||||
&wgpu::DeviceDescriptor {
|
||||
label: None,
|
||||
required_features: Features::STORAGE_RESOURCE_BINDING_ARRAY |
|
||||
// These features are required to use `binding_array` in your wgsl.
|
||||
Features::BUFFER_BINDING_ARRAY |
|
||||
Features::UNIFORM_BUFFER_AND_STORAGE_TEXTURE_ARRAY_NON_UNIFORM_INDEXING,
|
||||
// Without them your shader may fail to compile.
|
||||
required_features: Features::STORAGE_RESOURCE_BINDING_ARRAY
|
||||
| Features::BUFFER_BINDING_ARRAY
|
||||
| Features::UNIFORM_BUFFER_AND_STORAGE_TEXTURE_ARRAY_NON_UNIFORM_INDEXING,
|
||||
|
||||
memory_hints: wgpu::MemoryHints::Performance,
|
||||
required_limits: wgpu::Limits {
|
||||
|
@ -2,7 +2,7 @@ use super::*;
|
||||
use wgpu_test::{gpu_test, GpuTestConfiguration, TestParameters};
|
||||
|
||||
#[gpu_test]
|
||||
static COMPUTE_1: GpuTestConfiguration = GpuTestConfiguration::new()
|
||||
static TWO_BUFFERS: GpuTestConfiguration = GpuTestConfiguration::new()
|
||||
.parameters(
|
||||
TestParameters::default()
|
||||
.features(
|
||||
|
Loading…
Reference in New Issue
Block a user