mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-01 07:35:40 +00:00
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:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user