gpu/internal/opengl: use the linear colorspace when EXT_sRGB is missing

The SRGBFBO emulates a framebuffer in the sRGB colorspace. However, some
low-end devices may not have EXT_sRGB support to store framebuffer content in
sRGB.

This change handles missing EXT_sRGB support by falling back to the linear RGB colorspace.
Falling back loses color precision but is better than failing.

Updates gio#49
Updates gio#154
Updates gio#97
Updates gio#36
Updates gio#172

Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
Elias Naur
2021-07-28 13:47:05 +02:00
parent 68fa64dfd5
commit d8f8740574
+2 -1
View File
@@ -38,7 +38,8 @@ func NewSRGBFBO(f *gl.Functions, state *glState) (*SRGBFBO, error) {
exts := strings.Split(f.GetString(gl.EXTENSIONS), " ")
srgbTriple, err := srgbaTripleFor(ver, exts)
if err != nil {
return nil, fmt.Errorf("srgb: missing sRGB format support")
// Fall back to the linear RGB colorspace, at the cost of color precision loss.
srgbTriple = textureTriple{gl.RGBA, gl.Enum(gl.RGBA), gl.Enum(gl.UNSIGNED_BYTE)}
}
s := &SRGBFBO{
c: f,