8000 [non-normative] Explain -srgb formats are not color managed/tagged (#… · gpuweb/gpuweb@8b5896b · GitHub
[go: up one dir, main page]

Skip to content

Commit 8b5896b

Browse files
authored
[non-normative] Explain -srgb formats are not color managed/tagged (#4597)
Fixes #4587
1 parent b1882e7 commit 8b5896b

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

spec/index.bs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2135,6 +2135,24 @@ WebGPU allows all of the color spaces in the {{PredefinedColorSpace}} enum.
21352135
Note, each color space is defined over an extended range, as defined by the referenced CSS definitions,
21362136
to represent color values outside of its space (in both chrominance and luminance).
21372137

2138+
<div class=note heading>
2139+
As described above, {{GPUTexture}}s are not color managed. This includes `-srgb` formats,
2140+
which despite their are not *tagged* with an sRGB color space (like those described by
2141+
{{PredefinedColorSpace}} and the CSS color spaces <a value for=color()>srgb</a> and
2142+
<a value for=color()>srgb-linear</a>).
2143+
2144+
However, `-srgb` texture formats *do* have gamma-encoding/decoding properties which are
2145+
algorithmically close to those used for gamma encoding in {{PredefinedColorSpace/"srgb"}} and
2146+
{{PredefinedColorSpace/"display-p3"}}. For example, a fragment
2147+
shader can output an "sRGB-linear"-encoded (physically linear) color value into an `-srgb`
2148+
format texture, which will gamma-encode the value when it is written.
2149+
Then, the value in the texture will be correctly encoded for use on a
2150+
{{PredefinedColorSpace/"srgb"}}-tagged (approximately perceptually-linear) canvas.
2151+
2152+
It is similarly possible to take advantage of these properties using
2153+
{{GPUQueue/copyExternalImageToTexture()}}; see its description for additional information.
2154+
</div>
2155+
21382156
An <dfn dfn>out-of-gamut premultiplied RGBA value</dfn> is one where any of the R/G/B channel values
21392157
exceeds the alpha channel value. For example, the premultiplied sRGB RGBA value [1.0, 0, 0, 0.5]
21402158
represents the (unpremultiplied) color [2, 0, 0] with 50% alpha, written `rgb(srgb 2 0 0 / 50%)` in CSS.

0 commit comments

Comments
 (0)
0