From 88bec7008fa02176d4151da576aa0cc7de8c50d6 Mon Sep 17 00:00:00 2001 From: Andrei Alexeyev Date: Fri, 7 May 2021 00:23:28 +0300 Subject: [PATCH] glcommon: ignore GL_EXT_texture_norm16 on WebGL Works around a Chromium bug. See comment for details. Related: #287 --- src/renderer/glcommon/opengl.c | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/src/renderer/glcommon/opengl.c b/src/renderer/glcommon/opengl.c index 17c79d3a..022737d3 100644 --- a/src/renderer/glcommon/opengl.c +++ b/src/renderer/glcommon/opengl.c @@ -316,7 +316,26 @@ static void glcommon_ext_texture_norm16(void) { EXT_FLAG(texture_norm16); CHECK_CORE(!glext.version.is_es); - CHECK_EXT(GL_EXT_texture_norm16); + + /* + * Quote from the WEBGL_EXT_texture_norm16 spec + * (https://www.khronos.org/registry/webgl/extensions/EXT_texture_norm16/): + * + * This extension provides a set of new 16-bit signed normalized and unsigned normalized fixed + * point texture, renderbuffer and texture buffer formats. The 16-bit normalized fixed point + * types R16_EXT, RG16_EXT and RGBA16_EXT become available as color-renderable formats. + * Renderbuffers can be created in these formats. These and textures created with type = + * UNSIGNED_SHORT, which will have one of these internal formats, can be attached to + * framebuffer object color attachments for rendering. + * + * The wording suggests that both renderbuffers and textures can be attached to a framebuffer + * object. However, Chromium/ANGLE seems to violate the spec here and does not permit textures. + * + * Exclude WebGL to be safe. + */ + if(!glext.version.is_webgl) { + CHECK_EXT(GL_EXT_texture_norm16); + } EXT_MISSING(); }