Skip to content

Commit 0ada09e

Browse files
committed
Document backend and adapter options
1 parent 968ce6b commit 0ada09e

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed

README.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,51 @@ There is both `enable-dawn-features=comma,separated,toggles` and `disable-dawn-f
4343

4444
The available options are listed [here](https://dawn.googlesource.com/dawn/+/refs/heads/main/src/dawn/native/Toggles.cpp)
4545

46+
There are also a few dawn node specific options
47+
48+
* `backend`
49+
50+
Let's you specify the backend like 'null', 'webgpu', 'd3d11', 'd3d12', 'metal', 'vulkan', 'opengl', 'opengles'
51+
52+
Example:
53+
54+
```js
55+
const navigator = { gpu: create(['backend=opengl']) };
56+
```
57+
58+
Passing in a non-existent backend will print out the list of backends
59+
60+
* `adapter`
61+
62+
Let's you specify which adapter to use. To get a list of adapters
63+
pass in a non-existent adapter name.
64+
65+
```js
66+
const navigator = { gpu: create(['adapter=foo']) };
67+
```
68+
69+
prints something like
70+
71+
```
72+
Error: no suitable backends found
73+
Available adapters:
74+
* backend: 'metal', name: 'Apple M1 Max'
75+
```
76+
77+
At which point you can use something like
78+
79+
```js
80+
const navigator = { gpu: create(['adapter=Apple M1 Max']) };
81+
```
82+
83+
Note: Normally you select a GPU by using the WebGPU API
84+
85+
```js
86+
const adapter = navigator.gpu.requestAdapter({
87+
powerPreference: 'high-performance', // or 'low-power'
88+
});
89+
```
90+
4691
## Notes
4792

4893
### Lifetime

0 commit comments

Comments
 (0)