[Mesa-dev] [PATCH] mesa: GLES2 should return different error enums for invalid fbo queries
Ian Romanick
idr at freedesktop.org
Wed Jul 20 18:20:48 PDT 2011
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 07/20/2011 01:38 PM, Marek Olšák wrote:
> Alright, here's an updated patch:
Reviewed-by: Ian Romanick <ian.d.romanick at intel.com>
> ---
> src/mesa/main/fbobject.c | 23 ++++++++++++++++-------
> 1 files changed, 16 insertions(+), 7 deletions(-)
>
> diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c
> index 8496936..82eb7fb 100644
> --- a/src/mesa/main/fbobject.c
> +++ b/src/mesa/main/fbobject.c
> @@ -2134,10 +2134,14 @@
> _mesa_GetFramebufferAttachmentParameterivEXT(GLenum target, GLenum
> attachment,
> {
> const struct gl_renderbuffer_attachment *att;
> struct gl_framebuffer *buffer;
> + GLenum err;
> GET_CURRENT_CONTEXT(ctx);
>
> ASSERT_OUTSIDE_BEGIN_END(ctx);
>
> + /* The error differs in GL and GLES. */
> + err = ctx->API == API_OPENGL ? GL_INVALID_OPERATION : GL_INVALID_ENUM;
> +
> buffer = get_framebuffer_target(ctx, target);
> if (!buffer) {
> _mesa_error(ctx, GL_INVALID_ENUM,
> @@ -2188,7 +2192,12 @@
> _mesa_GetFramebufferAttachmentParameterivEXT(GLenum target, GLenum
> attachment,
> }
> else {
> assert(att->Type == GL_NONE);
> - *params = 0;
> + if (ctx->API == API_OPENGL) {
> + *params = 0;
> + } else {
> + _mesa_error(ctx, GL_INVALID_ENUM,
> + "glGetFramebufferAttachmentParameterivEXT(pname)");
> + }
> }
> return;
> case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_EXT:
> @@ -2196,7 +2205,7 @@
> _mesa_GetFramebufferAttachmentParameterivEXT(GLenum target, GLenum
> attachment,
> *params = att->TextureLevel;
> }
> else if (att->Type == GL_NONE) {
> - _mesa_error(ctx, GL_INVALID_OPERATION,
> + _mesa_error(ctx, err,
> "glGetFramebufferAttachmentParameterivEXT(pname)");
> }
> else {
> @@ -2214,7 +2223,7 @@
> _mesa_GetFramebufferAttachmentParameterivEXT(GLenum target, GLenum
> attachment,
> }
> }
> else if (att->Type == GL_NONE) {
> - _mesa_error(ctx, GL_INVALID_OPERATION,
> + _mesa_error(ctx, err,
> "glGetFramebufferAttachmentParameterivEXT(pname)");
> }
> else {
> @@ -2232,7 +2241,7 @@
> _mesa_GetFramebufferAttachmentParameterivEXT(GLenum target, GLenum
> attachment,
> }
> }
> else if (att->Type == GL_NONE) {
> - _mesa_error(ctx, GL_INVALID_OPERATION,
> + _mesa_error(ctx, err,
> "glGetFramebufferAttachmentParameterivEXT(pname)");
> }
> else {
> @@ -2246,7 +2255,7 @@
> _mesa_GetFramebufferAttachmentParameterivEXT(GLenum target, GLenum
> attachment,
> "glGetFramebufferAttachmentParameterivEXT(pname)");
> }
> else if (att->Type == GL_NONE) {
> - _mesa_error(ctx, GL_INVALID_OPERATION,
> + _mesa_error(ctx, err,
> "glGetFramebufferAttachmentParameterivEXT(pname)");
> }
> else {
> @@ -2267,7 +2276,7 @@
> _mesa_GetFramebufferAttachmentParameterivEXT(GLenum target, GLenum
> attachment,
> return;
> }
> else if (att->Type == GL_NONE) {
> - _mesa_error(ctx, GL_INVALID_OPERATION,
> + _mesa_error(ctx, err,
> "glGetFramebufferAttachmentParameterivEXT(pname)");
> }
> else {
> @@ -2301,7 +2310,7 @@
> _mesa_GetFramebufferAttachmentParameterivEXT(GLenum target, GLenum
> attachment,
> "glGetFramebufferAttachmentParameterivEXT(pname)");
> }
> else if (att->Type == GL_NONE) {
> - _mesa_error(ctx, GL_INVALID_OPERATION,
> + _mesa_error(ctx, err,
> "glGetFramebufferAttachmentParameterivEXT(pname)");
> }
> else if (att->Texture) {
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/
iEYEARECAAYFAk4nfu8ACgkQX1gOwKyEAw+gNgCfeC12yH8X74aaviEe3iz/MTy1
3i8An3PrjeMSsok7Co0EWpqr8KzLn5RJ
=di+b
-----END PGP SIGNATURE-----
More information about the mesa-dev
mailing list