mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-03 16:35:36 +00:00
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:
+1
-5
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user