Skip to content

Commit

Permalink
Add reference to memory_hints
Browse files Browse the repository at this point in the history
  • Loading branch information
msfstef authored Aug 18, 2024
1 parent 6ca45ed commit a22513c
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion docs/beginner/tutorial2-surface/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,12 +129,13 @@ Let's use the `adapter` to create the device and queue.
required_features: wgpu::Features::empty(),
// WebGL doesn't support all of wgpu's features, so if
// we're building for the web, we'll have to disable some.
required_limits: if cfg!(target_arch = "wasm32") {
required_limits: if cfg!(target_arch = "wasm32") {
wgpu::Limits::downlevel_webgl2_defaults()
} else {
wgpu::Limits::default()
},
label: None,
memory_hints: Default::default(),
},
None, // Trace path
).await.unwrap();
Expand All @@ -154,6 +155,8 @@ You can view a full list of features [here](https://docs.rs/wgpu/latest/wgpu/str

The `limits` field describes the limit of certain types of resources that we can create. We'll use the defaults for this tutorial so we can support most devices. You can view a list of limits [here](https://docs.rs/wgpu/latest/wgpu/struct.Limits.html).

The `memory_hints` field provides the adapter with a preferred memory allocation strategy, if supproted. You can view the available options [here](https://wgpu.rs/doc/wgpu/enum.MemoryHints.html).

```rust
let surface_caps = surface.get_capabilities(&adapter);
// Shader code in this tutorial assumes an sRGB surface texture. Using a different
Expand Down

0 comments on commit a22513c

Please sign in to comment.