From 9842cbd30bfbb39774b506206339c789a38a03a4 Mon Sep 17 00:00:00 2001 From: Elias Naur Date: Tue, 28 Apr 2020 14:54:59 +0200 Subject: [PATCH] gpu/gl: detect float FBO support under Safari's WebGL1 implementation Safari's WebGL does not advertise support for EXT_color_buffer_half_float, but does support rendering to float FBOs. Signed-off-by: Elias Naur --- gpu/gl/backend.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/gpu/gl/backend.go b/gpu/gl/backend.go index ee82f509..0a785db4 100644 --- a/gpu/gl/backend.go +++ b/gpu/gl/backend.go @@ -751,7 +751,11 @@ func floatTripleFor(f Functions, ver [2]int, exts []string) (textureTriple, erro if ver[0] >= 3 { triples = append(triples, textureTriple{R16F, Enum(RED), Enum(HALF_FLOAT)}) } - if hasExtension(exts, "GL_OES_texture_half_float") && hasExtension(exts, "GL_EXT_color_buffer_half_float") { + // According to the OES_texture_half_float specification, EXT_color_buffer_half_float is needed to + // render to FBOs. However, the Safari WebGL1 implementation does support half-float FBOs but does not + // report EXT_color_buffer_half_float support. The triples are verified below, so it doesn't matter if we're + // wrong. + if hasExtension(exts, "GL_OES_texture_half_float") || hasExtension(exts, "GL_EXT_color_buffer_half_float") { // Try single channel. triples = append(triples, textureTriple{LUMINANCE, Enum(LUMINANCE), Enum(HALF_FLOAT_OES)}) // Fallback to 4 channels.