mesa/main: correct validation for GL_RGB565
authorErik Faye-Lund <erik.faye-lund@collabora.com>
Mon, 3 Dec 2018 19:00:34 +0000 (20:00 +0100)
committerErik Faye-Lund <erik.faye-lund@collabora.com>
Tue, 4 Dec 2018 20:14:16 +0000 (21:14 +0100)
Technically speaking, this validation was incorrect, because GL_RGB565
is only supported in OpenGL ES 1.x if OES_framebuffer_object is
supported. This couldn't lead to any real incorrect behavior, because
all drivers support OES_framebuffer_object. But let's keep the code
self-documenting, by correcting the check as per the spec.

Signed-off-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
src/mesa/main/glformats.c

index 7506c238232f61587b2f18d687c452192481dd4d..ea73068d025793ce20fabec72c9905a05465afd3 100644 (file)
@@ -2312,7 +2312,9 @@ _mesa_base_tex_format(const struct gl_context *ctx, GLint internalFormat)
       }
    }
 
-   if (_mesa_has_ARB_ES2_compatibility(ctx) || _mesa_is_gles(ctx)) {
+   if (_mesa_has_ARB_ES2_compatibility(ctx) ||
+       _mesa_has_OES_framebuffer_object(ctx) ||
+       ctx->API == API_OPENGLES2) {
       switch (internalFormat) {
       case GL_RGB565:
          return GL_RGB;