[Mesa-dev] [mesa-dev][Bug 88079][PATCH] mesa: Enables GL_RGB/GL_RGBA in GLES3 glGetInternalformativ
Matt Turner
mattst88 at gmail.com
Thu Jan 8 17:42:56 PST 2015
Thanks for the patch!
> Subject: [Mesa-dev] [mesa-dev][Bug 88079][PATCH] mesa: Enables GL_RGB/GL_RGBA in GLES3 glGetInternalformativ
No need to prefix your subject with these things. The mailing list
itself will add [Mesa-dev], and we don't put [Bug ...] in the subject.
Put
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=88079
at the end of your commit summary instead.
Change "Enables" to "Enable" as well. Commit messages are in the imperative.
On Thu, Jan 8, 2015 at 5:20 PM, <michael.w.mason at intel.com> wrote:
> From: Mike Mason <michael.w.mason at intel.com>
>
> Removes commit 7894278 changes and moves fix to _mesa_GetInternalformativ().
> The original commit enabled the GL_RGB and GL_RGBA unsized internal formats
> as valid for render buffers in GLES3, but this is incorrect. Page 204 of
> the GLES 3.0.4 spec says render buffers "must be a sized internal format...".
We put spec citations and quotes in the code, rather than in the commit message.
> The original commit enabled GL_RGB and GL_RGBA too broadly.
> However, page 242 of the spec implies that GL_RGB and GL_RGBA
> are valid values for the internalformat parameter of GetInternalformativ(),
> which in GLES3 only supports render buffers. Thus, to be compliant, this
> commit allows those unsized formats in _mesa_GetInternalformativ().
> ---
> src/mesa/main/fbobject.c | 6 ------
> src/mesa/main/formatquery.c | 8 +++++++-
> 2 files changed, 7 insertions(+), 7 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..484f539 100644
> --- a/src/mesa/main/formatquery.c
> +++ b/src/mesa/main/formatquery.c
> @@ -89,8 +89,14 @@ _mesa_GetInternalformativ(GLenum target, GLenum internalformat, GLenum pname,
> * "If the <internalformat> parameter to GetInternalformativ is not
> * color-, depth- or stencil-renderable, then an INVALID_ENUM error is
> * generated."
> + *
> + * The GLES 3.0/3.1 specs don't allow renderbuffers to be created with
> + * unsized formats (GL_RGB and GL_RGBA), but do allow these formats as
> + * input to GetInternalformativ(), so we must allow them here. See pages 205
> + * and 243 of the GLES 3.0.4 spec for details.
Make this a spec quotation in the same style as the one immediately above it.
> */
> - if (_mesa_base_fbo_format(ctx, internalformat) == 0) {
> + if (internalformat != GL_RGB && internalformat != GL_RGBA &&
> + _mesa_base_fbo_format(ctx, internalformat) == 0) {
> _mesa_error(ctx, GL_INVALID_ENUM,
> "glGetInternalformativ(internalformat=%s)",
> _mesa_lookup_enum_by_nr(internalformat));
> --
> 1.9.1
Nice work tracking this down!
More information about the mesa-dev
mailing list