For e.g. GPUOrigin2D, accept either dict or sequence.#319
Merged
kdashg merged 1 commit intogpuweb:masterfrom Jun 17, 2019
Merged
For e.g. GPUOrigin2D, accept either dict or sequence.#319kdashg merged 1 commit intogpuweb:masterfrom
kdashg merged 1 commit intogpuweb:masterfrom
Conversation
Kangz
approved these changes
Jun 6, 2019
Contributor
|
It seems better to only expose one of these variations for consistency – users will naturally tend towards one of these anyway. Personally I don't mind some verbosity here (I think the explicitness is useful) so I prefer the dict approach. But I think I'd still prefer the sequence alternative over having both. |
Contributor
|
In agreement with @grovesNL , I'm also wondering what this dichotomy is going to look like in a C header? |
Contributor
Author
|
The C header is not bound by the ergonomic choices of the WebIDL. |
Contributor
|
I agree, I think in C always using a struct here would be fine. Inline initialization would look the same as an array ( |
Contributor
Author
|
Agreed on the 2019June17 call. |
kainino0x
added a commit
to kainino0x/gpuweb
that referenced
this pull request
Sep 16, 2020
This overload adds complexity without providing much benefit of clarity. In all contexts, the semantics of the values in an array used as a GPUOrigin/Extent are clear; depending on the context, one of: - [width] - [width, arraysize] - [width, height] - [width, height, arraysize] - [width, height, depth] In order to implement this, this redefines GPUOrigin2D, GPUOrigin3D, and GPUExtent3D from scratch, as if they were specified in the WebIDL spec. These essentially implement a specific case of tuples with default values, which could be expressed in pseudo-WebIDL as: ``` typedef [GPUIntegerCoordinate = 0, GPUIntegerCoordinate = 0] GPUOrigin2D; typedef [GPUIntegerCoordinate = 0, GPUIntegerCoordinate = 0, GPUIntegerCoordinate = 0] GPUOrigin3D; typedef [GPUIntegerCoordinate, GPUIntegerCoordinate, GPUIntegerCoordinate] GPUExtent3D; ``` I previously proposed this in gpuweb#299. After discussion, we compromised on this union, and it was implemented in gpuweb#319. However there were a number of voices who didn't like the added complexity (and perceived loss of type expressivity), and since then I've come to agree that the unioned version is not the best choice.
kainino0x
added a commit
to kainino0x/gpuweb
that referenced
this pull request
Sep 16, 2020
This overload adds complexity without providing much benefit of clarity. The semantics of the values in an array are clear according to context: - 1d: [width] - 1d-array: [width, arraysize] - 2d: [width, height] - 2d-array/cube/cube-array: [width, height, arraysize] - 3d: [width, height, depth] In order to implement this, this redefines GPUOrigin2D, GPUOrigin3D, and GPUExtent3D from scratch, as if they were specified in the WebIDL spec. These essentially implement a specific case of tuples with default values, which could be expressed in pseudo-WebIDL as: ``` typedef [GPUIntegerCoordinate = 0, GPUIntegerCoordinate = 0] GPUOrigin2D; typedef [GPUIntegerCoordinate = 0, GPUIntegerCoordinate = 0, GPUIntegerCoordinate = 0] GPUOrigin3D; typedef [GPUIntegerCoordinate, GPUIntegerCoordinate, GPUIntegerCoordinate] GPUExtent3D; ``` I previously proposed this in gpuweb#299. After discussion, we compromised on this union, and it was implemented in gpuweb#319. However there were a number of voices who didn't like the added complexity (and perceived loss of type expressivity), and since then I've come to agree that the unioned version is not the best choice.
kainino0x
added a commit
to kainino0x/gpuweb
that referenced
this pull request
Sep 16, 2020
This overload adds complexity without providing much benefit of clarity. The semantics of the values in an array are clear according to context: - 1d: [width] - 1d-array: [width, arraysize] - 2d: [width, height] - 2d-array/cube/cube-array: [width, height, arraysize] - 3d: [width, height, depth] In order to implement this, this redefines GPUOrigin2D, GPUOrigin3D, and GPUExtent3D from scratch, as if they were specified in the WebIDL spec. These essentially implement a specific case of tuples with default values, which could be expressed in pseudo-WebIDL as: ``` typedef [GPUIntegerCoordinate = 0, GPUIntegerCoordinate = 0] GPUOrigin2D; typedef [GPUIntegerCoordinate = 0, GPUIntegerCoordinate = 0, GPUIntegerCoordinate = 0] GPUOrigin3D; typedef [GPUIntegerCoordinate, GPUIntegerCoordinate, GPUIntegerCoordinate] GPUExtent3D; ``` I previously proposed this in gpuweb#299. After discussion, we compromised on this union, and it was implemented in gpuweb#319. However there were a number of voices who didn't like the added complexity (and perceived loss of type expressivity), and since then I've come to agree that the unioned version is not the best choice.
ben-clayton
pushed a commit
to ben-clayton/gpuweb
that referenced
this pull request
Sep 6, 2022
* Allow marking tests as explicitly unimplemented This allows for test structure to be committed into the CTS before the tests themselves are implemented. * Make the testCreationStack slightly nicer
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Alternative to #299.