gpu,gpu/shaders: [compute] decode sRGB texels in shader when EXT_sRGB is missing

This change avoids the hard dependency on GPU support for sRGB encoded
textures in the compute renderer.

With this change and the previously added CPU fallback, Gio no longer
rely on any GPU functionality outside the OpenGL ES 2.0 level.

Fixes gio#49
Fixes gio#154
Fixes gio#97
Fixes gio#36
Fixes gio#172

Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
Elias Naur
2021-07-29 08:15:50 +02:00
parent d8f8740574
commit 8cec7e04eb
4 changed files with 107 additions and 32 deletions
+1 -5
View File
@@ -9,7 +9,6 @@ package gpu
import (
"encoding/binary"
"errors"
"fmt"
"image"
"image/color"
@@ -361,11 +360,8 @@ func New(api API) (GPU, error) {
defer d.EndFrame()
forceCompute := os.Getenv("GIORENDERER") == "forcecompute"
feats := d.Caps().Features
if !feats.Has(driver.FeatureSRGB) {
return nil, errors.New("gpu: no sRGB texture formats found")
}
switch {
case !forceCompute && feats.Has(driver.FeatureFloatRenderTargets):
case !forceCompute && feats.Has(driver.FeatureFloatRenderTargets) && feats.Has(driver.FeatureSRGB):
return newGPU(d)
}
return newCompute(d)