这是indexloc提供的服务,不要输入任何密码
Skip to content

Conversation

@dj2
Copy link
Member

@dj2 dj2 commented Jun 9, 2020

This CL adds some initial spec text around the vector accessors and adds
in that rgba and xyzw are valid accessors for a vector.

Fixes #754

This CL adds some initial spec text around the vector accessors and adds
in that `rgba` and `xyzw` are valid accessors for a vector.

Fixes #754
@dj2 dj2 added the wgsl WebGPU Shading Language Issues label Jun 9, 2020
@dj2 dj2 requested review from dneto0, kvark and litherum June 9, 2020 20:26
@dj2 dj2 self-assigned this Jun 9, 2020
Copy link
Contributor

@kvark kvark left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, just have a few notes

@dneto0
Copy link
Contributor

dneto0 commented Jun 12, 2020

This talks about access generically, but looks like it mean only reading from a vector value.

This doesn't cover assignment to vector components. I suggest that needs to be done in a followup.

wgsl/index.bs Outdated

<table class='data'>
<tr><td>rgba<td>where r is the first component. Each letter is applied to the
components in order up to the size of the source vector.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"up to the size of the source vector" is ambigous.

At first I read it to mean you can only use as many letters as there are elements in the source vector. There's already a sentence later to limit the letters to avoid out-of-bounds access.

I'd rather see this:

... or using a sequence of convenience names, each mapping to an element of the source vector.

  • The colour set of convenience names: r, g, b, a for vector elements 0, 1, 2, or 3, respectively.
  • The dimensional set of convenience names: x, y, z, w for vector elements 0, 1, 2, or 3, respectively.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

wgsl/index.bs Outdated
<div class='example'>
<xmp highlight='rust'>
var a : vec3<f32> = vec3<f32>(1., 2., 3.);
var b : f32 = a.y;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest adding comments to indicate the actual value computed.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@kvark kvark changed the base branch from master to main June 23, 2020 13:14
Copy link
Contributor

@dneto0 dneto0 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@dj2 dj2 merged commit 72d546e into gpuweb:main Jul 6, 2020
@dj2 dj2 deleted the vector branch July 6, 2020 19:42
ben-clayton pushed a commit to ben-clayton/gpuweb that referenced this pull request Sep 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

wgsl WebGPU Shading Language Issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add .rgba aliases to .xyzw

3 participants