You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: basic-3d-rendering/input-geometry/a-first-vertex-attribute.md
+36-24Lines changed: 36 additions & 24 deletions
Original file line number
Diff line number
Diff line change
@@ -139,22 +139,6 @@ And we get nothing more than required, so that if we forget to update the initia
139
139
140
140
This initial check is done by specifying a non null `requiredLimits` pointer in the device descriptor. I suggest that we create a method `GetRequiredLimits(Adapter adapter)` dedicated to setting our app requirements:
We do not really need the adapter to determine the required limits in our case, but I pass it as an argument because it **can become useful** in a scenario where a **different quality of device** is requested depending on the **adapter's capabilities**.
158
+
We then call this method while building the **device descriptor**:
Notice how I **initialized the required limits** object with `= Default` above. This is a syntactic helper provided by the `webgpu.hpp` wrapper for all structs to prevent us from manually setting default values. In this case it sets all limits to `WGPU_LIMIT_U32_UNDEFINED` or `WGPU_LIMIT_U64_UNDEFINED` to mean that there is no requirement.
274
-
```
275
-
276
272
```{lit} C++, Application implementation (hidden, append, also for tangle root "Vanilla")
277
273
{{GetRequiredLimits method}}
278
274
```
279
275
276
+
```{important}
277
+
Notice how I **initialized the required limits** object with `= Default` above. This is a syntactic helper provided by the `webgpu.hpp` wrapper for all structs to prevent us from manually setting default values. In this case it sets all limits to `WGPU_LIMIT_U32_UNDEFINED` or `WGPU_LIMIT_U64_UNDEFINED` to mean that there is no requirement.
278
+
```
279
+
280
280
I now get these more secure supported limits:
281
281
282
282
```
@@ -286,6 +286,18 @@ device.maxVertexBuffers: 1
286
286
287
287
I recommend you have a look at all the fields of the `WGPULimits` structure in `webgpu.h` so that you know when to add something to the required limits.
288
288
289
+
````{note}
290
+
There are two limits that may cause issue even if set to `WGPU_LIMIT_U32_UNDEFINED`, namely the one that set **minimums** rather than maximums. The default "undefined" value may not be supported by the adapter, so **in this case only** I suggest we forward values from the **supported limits**:
291
+
292
+
```{lit} C++, Other device limits (also for tangle root "Vanilla")
293
+
// These two limits are different because they are "minimum" limits,
294
+
// they are the only ones we are may forward from the adapter's supported
0 commit comments