Skip to content

Commit

Permalink
Spec orientation of each cube face, using a diagram (gpuweb#4675)
Browse files Browse the repository at this point in the history
  • Loading branch information
kainino0x authored May 28, 2024
1 parent 0bfb5ca commit 6f92ce2
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 5 deletions.
45 changes: 45 additions & 0 deletions spec/img/cubemap.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
25 changes: 20 additions & 5 deletions spec/index.bs
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ p, ul, ol, dl {
color: var(--note-editorial-color);
}

/* Our SVGs aren't responsive to light/dark mode, so they're opaque with a
/* Some of our SVGs aren't responsive to light/dark mode, so they're opaque with a
* white or black background. Rounded corners make them a bit less jarring. */
object[type="image/svg+xml"] {
border-radius: .5em;
Expand Down Expand Up @@ -4292,7 +4292,22 @@ enum GPUTextureViewDimension {
: <dfn>"cube"</dfn>
::
The texture is viewed as a cubemap.
The view has 6 array layers, corresponding to the [+X, -X, +Y, -Y, +Z, -Z] faces of the cube.

The view has 6 array layers, each corresponding to a face of the cube in the order
`[+X, -X, +Y, -Y, +Z, -Z]` and the following orientations:

<figure>
<figcaption>
Cubemap faces.
The +U/+V axes indicate the individual faces' texture coordinates,
and thus the [=image copy=] memory layout of each face.
</figcaption>
<object type="image/svg+xml" data="img/cubemap.svg" width=350 height=260></object>
</figure>

Note: When viewed from the inside, this results in a left-handed coordinate system
where +X is right, +Y is up, and +Z is forward.

Sampling is done seamlessly across the faces of the cubemap.

Corresponding WGSL types:
Expand All @@ -4302,9 +4317,9 @@ enum GPUTextureViewDimension {

: <dfn>"cube-array"</dfn>
::
The texture is viewed as a packed array of `n` cubemaps,
each with 6 array layers corresponding to the [+X, -X, +Y, -Y, +Z, -Z] faces of the cube.
Sampling is done seamlessly across the faces of the cubemaps.
The texture is viewed as a packed array of |n| cubemaps,
each with 6 array layers behaving like one {{GPUTextureViewDimension/"cube"}} view,
for 6|n| array layers in total.

Corresponding WGSL types:

Expand Down

0 comments on commit 6f92ce2

Please sign in to comment.