[Mesa-dev] [PATCH] mesa: Accepts GL_RGB and GL_RGBA as valid internal formats only when querying
Eduardo Lima Mitev
elima at igalia.com
Fri Jan 9 07:50:12 PST 2015
Previous patch 78942787170615c9333810cf3a4819a13c9eb8e8 globally introduced
GL_RGB and GL_RGBA as valid internal formats on GLES 3.0.4, as the spec implies
(page 112). However, page 205 of the spec states that
for RenderbufferStorageMultisample, internal format must be a sized internal
format. For more detailed info, please look at the linked bug description.
This patch allows GL_RGB and GL_RGBA as internal format only when querying GL
state through glGetInternalformativ().
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=88079
---
src/mesa/main/fbobject.c | 6 ------
src/mesa/main/formatquery.c | 16 ++++++++++++----
2 files changed, 12 insertions(+), 10 deletions(-)
diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c
index 43b0886..f059750 100644
--- a/src/mesa/main/fbobject.c
+++ b/src/mesa/main/fbobject.c
@@ -1430,9 +1430,6 @@ _mesa_base_fbo_format(struct gl_context *ctx, GLenum internalFormat)
case GL_RGB8:
return GL_RGB;
case GL_RGB:
- if (_mesa_is_gles3(ctx))
- return GL_RGB;
- /* fallthrough */
case GL_R3_G3_B2:
case GL_RGB4:
case GL_RGB5:
@@ -1447,9 +1444,6 @@ _mesa_base_fbo_format(struct gl_context *ctx, GLenum internalFormat)
case GL_RGBA8:
return GL_RGBA;
case GL_RGBA:
- if (_mesa_is_gles3(ctx))
- return GL_RGBA;
- /* fallthrough */
case GL_RGBA2:
case GL_RGBA12:
case GL_RGBA16:
diff --git a/src/mesa/main/formatquery.c b/src/mesa/main/formatquery.c
index f6274fe..abcaf9e 100644
--- a/src/mesa/main/formatquery.c
+++ b/src/mesa/main/formatquery.c
@@ -91,10 +91,18 @@ _mesa_GetInternalformativ(GLenum target, GLenum internalformat, GLenum pname,
* generated."
*/
if (_mesa_base_fbo_format(ctx, internalformat) == 0) {
- _mesa_error(ctx, GL_INVALID_ENUM,
- "glGetInternalformativ(internalformat=%s)",
- _mesa_lookup_enum_by_nr(internalformat));
- return;
+ /* However, _mesa_base_fbo_format() doesn't consider the case that GL_RGB
+ * and GL_RGBA are valid internal formats on a OpenGL ES 3.0 profile. See
+ * table 3.3: "valid combinations of format, type, and unsized
+ * internalformat", page 113 of the GLES 3.0.4 spec.
+ */
+ if (!_mesa_is_gles3(ctx) ||
+ (internalformat != GL_RGB && internalformat != GL_RGBA)) {
+ _mesa_error(ctx, GL_INVALID_ENUM,
+ "glGetInternalformativ(internalformat=%s)",
+ _mesa_lookup_enum_by_nr(internalformat));
+ return;
+ }
}
/* The ARB_internalformat_query spec says:
--
2.1.3
More information about the mesa-dev
mailing list