Conversation
We don't normally include reflection info (e.g. texture dimensions) on
objects. Removing them on GPUDevice as well is consistent and makes
specification simpler.
For internal usage, GPUDevice.[[device]].{[[adapter]],[[features]],[[limits]]}
still exist.
| interface GPUDevice : EventTarget { | ||
| [SameObject] readonly attribute GPUAdapter adapter; | ||
| readonly attribute FrozenArray<GPUFeatureName> features; | ||
| readonly attribute object limits; |
There was a problem hiding this comment.
This was a way to know the default limits from WebGPU by looking at what's in device.limits. How do we envision applications should do this?
There was a problem hiding this comment.
Good question. Perhaps a default constructor to GPUAdapterFeatures? Or a member on navigator.gpu? It would also tell you what limits are understood by the browser without having to request adapters.
There was a problem hiding this comment.
well, we have the default limits in the spec, wouldn't this make the other means of discovery unnecessary?
There was a problem hiding this comment.
Other than feature detection, I think so. It would be handy for certain architectures and middlewares but so would a lot of other things we don't provide (like texture size).
There was a problem hiding this comment.
I guess we could the default limits for all the things in a utility library, it just seems slightly unnecessary.
|
I actually would love to see us go the other way on offering reflection of e.g. parent objects. It's such a great quality-of-life thing, and I use it all the time e.g. Worth noting that having this sort of reflection (e.g. GetDesc) is something that generally makes D3D nicer to work with than other less "reflective" APIs. It seems like having this reflection shouldn't make specification any harder than having them be hidden, other than the boilerplate specification of "here's a readonly accessor". |
|
Honestly I might be fine with adding reflection of the provided parent object (e.g. |
|
|
I'd love us to have a solid and consistent approach here. If we want to expose the parents, and do it for all objects, that seems fine, since it's self-contained. But if we expose the Another aspect to keep in mind is what the effect of this is on webgpu-native. Keeping an extra link or two per object may have a stronger effect than it does on the Web. |
|
I think webgpu-native can make this decision independently. But as long as we have weakrefs then we still avoid cycles. |
One thing to keep in mind: descriptors are dictionaries, and any unknown keys are ignored. If we're going to retain these descriptors, we'll have to decide whether we want to retain the unknown keys or not. Also, any version of retaining the descriptors has to do a deep copy instead of a shallow copy, because we don't want JS modifying a dictionary after the fact to change the object's reported characteristics. Therefore, if we want to retain those objects, we might have to say like "we'll only do a deep copy of the object if its shallowclonable (or whatever) and if it's not we'll do a shallow copy." But this is getting into a world of hurt. I wish we could just ignore unknown keys (and misparsed values) (Also, the CSS Font Loading API discards unknown keys.) There's also another benefit to returning the parsed values - web authors can figure out what the browser accepts and what it doesn't, in order to have fallback logic. I'm not sure how much value this would have in WebGPU specifically, where I think we're encouraging authors to do this fallback at the extension level and not at the individual function call level... but this approach of "round-trip stuff through the browser to see what it understands" is at least idiomatic JavaScript. |
|
I agree we would not retain unknown keys. Since the create methods take dictionaries, the original object and extra keys are invisible to us. This applies recursively to dictionary and sequence types. Reference types (interface, object, any) would need to keep pointing to the same JS wrapper, but we don't have many of those. (And I would imagine not doing reflection for e.g. bind group internals.) |
|
Editors discussed and decided that GPUDevice.features and .limits are useful for a lot of stuff, and we should keep them. I'll open a separate PR to remove .adapter. |
This PR adds unimplemented specs for the `asin` builtin. Issue: gpuweb#1213
We don't normally include reflection info (e.g. texture dimensions) on objects. Removing them on GPUDevice as well is consistent and makes specification and implementation simpler.
For internal usage,
GPUDevice.[[device]].{[[adapter]],[[features]],[[limits]]} still exist.Preview | Diff