Pluralize GPU.requestAdapters #1314
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Proposes (again) returning multiple adapters in response to an adapter request.
See #524 for previous discussion and rationale. (But note this PR differs in some small ways.)
It is now our opinion that this is the right solution. Like #1273, it's a highly flexible API that allows UAs to do device bucketing ahead of time, or even lazily during accesses to the returned array. Most apps will use item
[0], and such behavior can be observed by the UA if needed.This design should avoid any pitfalls that would cause an otherwise well-written app (which chooses adapters properly on various hardware configurations, which is not hard) to fail on a UA which chooses to limit the set of returned adapters in any way; such a response would look equivalent to some other reasonable hardware configuration (e.g. a 2-gpu system looking like a 1-gpu system).
New in this PR, it requires specific predictable behavior, so that developers don't have to worry about some UAs e.g. requiring multiple calls to requestAdapters where others would not. (powerPreference must not affect the set of adapters returned, only the order.) I have further changes to propose after this that will require more predictable behavior for when device creation should fail, as well.
Preview | Diff