You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Specify copyTextureToTexture format compatibility (#2329)
* Specify copyTextureToTexture format compatibility
Specify that copyTextureToTexture is only valid between equal formats,
or if the formats diffen only in whether they have `-srgb`.
Clean up a few bits of text regarding depth/stencil formats.
Add the optional-feature depth/stencil formats to the format table.
Fixes#2322Fixes#1464
* subsection titles, typo
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.
10034
+
#### Reading and Sampling Depth/Stencil Textures #### {#reading-depth-stencil}
10035
+
10036
+
When reading or sampling a depth channel via a `texture_depth_*`-typed binding, the value is
10037
+
returned as an `f32` value.
10038
+
10039
+
Issue(gpuweb/gpuweb#2094): Depending on the resolution of this issue, allow reading/sampling via
10040
+
`texture_2d` etc. in the table above and specify the behavior. (`vec4<f32>(D, X, X, X)`?)
10041
+
Update the note below which would become slightly outdated.
10042
+
10043
+
Reading or sampling a stencil channel must be done via a normal texture binding
10044
+
(`texture_2d`, `texture_2d_array`, `texture_cube`, or `texture_cube_array`).
10045
+
When doing so, the value is returned as `vec4<u32>(S, X, X, X)`, where S is the stencil value and each X is an implementation-defined unspecified value.
10020
10046
Authors must not rely on these `.y`, `.z`, and `.w` components, as their behavior is non-portable.
10021
10047
10022
10048
Note:
10023
10049
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.
10024
10050
As this was not a portability pain point for WebGL, it's not expected to be problematic in WebGPU.
10025
10051
In practice, expect either `vec4<u32>(S, S, S, S)` or `vec4<u32>(S, 0, 0, 1)`, depending on hardware.
10026
10052
10027
-
<dfn dfn>Copies of depth and stencil textures</dfn> can only happen within the following sets of formats:
Additionally, {{GPUTextureFormat/depth32float}} textures can be copied into {{GPUTextureFormat/depth32float}} and {{GPUTextureFormat/r32float}} textures.
10055
+
<div algorithm>
10056
+
Two {{GPUTextureFormat}}s |format1| and |format2| are <dfn dfn>copy-compatible</dfn> if:
10057
+
10058
+
- |format1| equals |format2|, or
10059
+
- |format1| and |format2| differ only in whether they are `srgb` formats (have the `-srgb` suffix).
10060
+
</div>
10033
10061
10034
10062
Note:
10035
10063
{{GPUTextureFormat/depth32float}} texel values have a limited range. As a result, copies into
10036
10064
{{GPUTextureFormat/depth32float}} textures are only valid from other {{GPUTextureFormat/depth32float}} textures.
10037
10065
10038
-
Issue: clarify if `depth24plus-stencil8` is copyable into `depth24plus` in all target backend APIs.
10039
-
10040
10066
### Packed formats ### {#packed-formats}
10041
10067
10042
10068
All packed texture formats support {{GPUTextureUsage/COPY_SRC}}, {{GPUTextureUsage/COPY_DST}}, and {{GPUTextureUsage/TEXTURE_BINDING}} usages. All of these formats have {{GPUTextureSampleType/"float"}} type and can be filtered on sampling.
0 commit comments