Sitelet https://github.com/gpuweb/gpuweb/pull/1978/files
Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 18 additions & 3 deletions spec/index.bs
Original file line number Diff line number Diff line change
Expand Up @@ -2810,7 +2810,7 @@ or a 32-bit IEEE 754 floating point value ("depth32float").

Issue: add something on GPUAdapter(?) that gives an estimate of the bytes per texel of "stencil8"

The {{GPUTextureFormat/stencil8}}) format may be implemented as
The {{GPUTextureFormat/stencil8}} format may be implemented as
either a real "stencil8", or "depth24stencil8", where the depth aspect is
hidden and inaccessible.

Expand Down Expand Up @@ -4019,7 +4019,7 @@ any specific point in the code at all.
: <dfn>message</dfn>
::
A human-readable string containing the message generated during the shader compilation.

: <dfn>type</dfn>
::
The severity level of the message.
Expand All @@ -4029,7 +4029,7 @@ any specific point in the code at all.
The line number in the shader {{GPUShaderModuleDescriptor/code}} the
{{GPUCompilationMessage/message}} corresponds to. Value is one-based, such that a lineNum of
`1` indicates the first line of the shader {{GPUShaderModuleDescriptor/code}}.

If the {{GPUCompilationMessage/message}} corresponds to a substring this points to
the line on which the substring begins. Must be `0` if the {{GPUCompilationMessage/message}}
does not correspond to any specific point in the shader {{GPUShaderModuleDescriptor/code}}.
Expand Down Expand Up @@ -9524,6 +9524,7 @@ None of the depth formats can be filtered.
<th>Bytes per texel
<th>Aspect
<th>{{GPUTextureSampleType}}
<th>Returned in shaders as...
<th>Copy aspect from Buffer
<th>Copy aspect into Buffer
</thead>
Expand All @@ -9532,38 +9533,52 @@ None of the depth formats can be filtered.
<td>1 &minus; 4
<td>stencil
<td>{{GPUTextureSampleType/"uint"}}
<td>`vec4<u32>(S, X, X, X)`
<td colspan=2>&checkmark;
<tr>
<td>{{GPUTextureFormat/depth16unorm}}
<td>2
<td>depth
<td>{{GPUTextureSampleType/"depth"}}
<td>`f32(D)`
<td colspan=2>&checkmark;
<tr>
<td>{{GPUTextureFormat/depth24plus}}
<td>4
<td>depth
<td>{{GPUTextureSampleType/"depth"}}
<td>`f32(D)`
<td colspan=2>&cross;
<tr>
<td rowspan=2 style='white-space:nowrap'>{{GPUTextureFormat/depth24plus-stencil8}}
<td rowspan=2>4 &minus; 8
<td>depth
<td>{{GPUTextureSampleType/"depth"}}
<td>`f32(D)`
<td colspan=2>&cross;
<tr>
<td>stencil
<td>{{GPUTextureSampleType/"uint"}}
<td>`vec4<u32>(S, X, X, X)`
<td colspan=2>&checkmark;
<tr>
<td>{{GPUTextureFormat/depth32float}}
<td>4
<td>depth
<td>{{GPUTextureSampleType/"depth"}}
<td>`f32(D)`
<td colspan=1>&cross;
<td colspan=1>&checkmark;
</table>

Stencil formats must sample as `vec4<u32>(S, X, X, X)`, where S is the stencil value and each X is an implementation-defined unspecified value.
Authors must not rely on these `.y`, `.z`, and `.w` components, as their behavior is non-portable.

Note:
Short of adding a new more constrained stencil sampler type (like depth), it's infeasible for implementations to efficiently paper over the driver differences for stencil reads.
As this was not a portability pain point for WebGL, it's not expected to be problematic in WebGPU.
In practice, expect either `vec4<u32>(S, S, S, S)` or `vec4<u32>(S, 0, 0, 1)`, depending on hardware.

<dfn dfn>Copies of depth and stencil textures</dfn> can only happen within the following sets of formats:
- {{GPUTextureFormat/stencil8}}, {{GPUTextureFormat/depth24plus-stencil8}} (stencil component), {{GPUTextureFormat/r8uint}}
- {{GPUTextureFormat/depth16unorm}}, {{GPUTextureFormat/r16uint}}
Expand Down