GPUColor: remove sequence overload from the union#1079
Closed
kainino0x wants to merge 1 commit intogpuweb:mainfrom
Closed
GPUColor: remove sequence overload from the union#1079kainino0x wants to merge 1 commit intogpuweb:mainfrom
kainino0x wants to merge 1 commit intogpuweb:mainfrom
Conversation
The overload adds complexity for not much benefit
(`{r: 0, g: 0, b: 0, a: 0}` vs `[0, 0, 0, 0]`).
More importantly, in certain contexts, the ordering of `[0, 0, 0, 0]` is
not obvious. For example, when used as the clear color of a BGRA
texture: does it use the "canonical" RGBA ordering, or does it match the
format? This removes the ambiguity.
Contributor
Author
|
inb4 being asked to change this to CSS color strings later on |
Kangz
approved these changes
Sep 16, 2020
kvark
approved these changes
Sep 16, 2020
Contributor
kvark
left a comment
There was a problem hiding this comment.
me always appreciates strictly disciplined APIs :)
Contributor
|
|
Contributor
Author
|
@jdashg what if we did something like Metal's |
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.
The overload adds complexity for not much benefit (
{r: 0, g: 0, b: 0, a: 0}vs[0, 0, 0, 0]).More importantly, in certain contexts, the ordering of
[0, 0, 0, 0]is not obvious. For example, when used as the clear color of a BGRA texture: does it use the "canonical" RGBA ordering, or does it match the format? This removes the ambiguity.We previously decided to add this overload for convenience, and it was done in #319. However I think I was the main voice pushing for it. I still like the convenience, but unfortunately I think the ambiguity is a bigger problem.
Preview | Diff