mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-01 07:35:40 +00:00
gpu/internal/opengl: give up on OpenGL ES 3.1 compute
There are too many driver issues with ES 3.1 compute shaders. Most devices support Vulkan but some, such as the Samsung J2, will fall back to the CPU renderer. Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
@@ -172,6 +172,13 @@ func init() {
|
||||
driver.NewOpenGLDevice = newOpenGLDevice
|
||||
}
|
||||
|
||||
// Supporting compute programs is theoretically possible with OpenGL ES 3.1. In
|
||||
// practice, there are too many driver issues, especially on Android (e.g.
|
||||
// Google Pixel, Samsung J2 are both broken i different ways). Disable support
|
||||
// and rely on Vulkan for devices that support it, and the CPU fallback for
|
||||
// devices that don't.
|
||||
const brokenGLES31 = true
|
||||
|
||||
func newOpenGLDevice(api driver.OpenGL) (driver.Device, error) {
|
||||
f, err := gl.NewFunctions(api.Context, api.ES)
|
||||
if err != nil {
|
||||
@@ -201,7 +208,7 @@ func newOpenGLDevice(api driver.OpenGL) (driver.Device, error) {
|
||||
if ffboErr == nil {
|
||||
b.feats.Features |= driver.FeatureFloatRenderTargets
|
||||
}
|
||||
if gles31 {
|
||||
if gles31 && !brokenGLES31 {
|
||||
b.feats.Features |= driver.FeatureCompute
|
||||
}
|
||||
if hasExtension(exts, "GL_EXT_disjoint_timer_query_webgl2") || hasExtension(exts, "GL_EXT_disjoint_timer_query") {
|
||||
@@ -851,7 +858,9 @@ func (b *Backend) clearOutput(colR, colG, colB, colA float32) {
|
||||
}
|
||||
|
||||
func (b *Backend) NewComputeProgram(src shader.Sources) (driver.Program, error) {
|
||||
p, err := gl.CreateComputeProgram(b.funcs, src.GLSL310ES)
|
||||
// We don't support ES 3.1 compute, see brokenGLES31 above.
|
||||
const GLES31Source = ""
|
||||
p, err := gl.CreateComputeProgram(b.funcs, GLES31Source)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("%s: %v", src.Name, err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user