[Mesa-dev] [PATCH 3/5] mesa/es: Validate glGetFramebufferAttachmentParameter pname in Mesa code rather than the ES wrapper
Eric Anholt
eric at anholt.net
Fri Aug 24 14:21:55 PDT 2012
Ian Romanick <idr at freedesktop.org> writes:
> diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c
> index 77e9910..1d2047f 100644
> --- a/src/mesa/main/fbobject.c
> +++ b/src/mesa/main/fbobject.c
> @@ -2366,8 +2366,7 @@ _mesa_GetFramebufferAttachmentParameterivEXT(GLenum target, GLenum attachment,
> if (_mesa_is_desktop_gl(ctx)) {
> *params = 0;
> } else {
> - _mesa_error(ctx, GL_INVALID_ENUM,
> - "glGetFramebufferAttachmentParameterivEXT(pname)");
> + goto invalid_pname_enum;
> }
> }
gles3 spec p233:
"If the value of FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE is NONE, no
framebuffer is bound to target. In this case querying pname
FRAMEBUFFER_ATTACHMENT_OBJECT_NAME will return zero, and all other
queries will generate an INVALID_OPERATION error."
So we need "_mesa_is_desktop_gl(ctx) || _mesa_is_gles3(ctx)". Also, the
"err" value set up above needs "|| _mesa_is_gles3(ctx)"
> _mesa_error(ctx, err,
> @@ -2476,9 +2474,10 @@ _mesa_GetFramebufferAttachmentParameterivEXT(GLenum target, GLenum attachment,
> case GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE:
> case GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE:
> case GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE:
> - if (!ctx->Extensions.ARB_framebuffer_object) {
> - _mesa_error(ctx, GL_INVALID_ENUM,
> - "glGetFramebufferAttachmentParameterivEXT(pname)");
> + if ((ctx->API != API_OPENGL || !ctx->Extensions.ARB_framebuffer_object)
> + && ctx->API != API_OPENGL_CORE
Since API_OPENGL_CORE implies ARB_fbo, this could potentially be the
changed to the pattern I've seen elsewhere of
"!_mesa_is_desktop_gl(ctx) || !ctx->Extensions.ARB_fbo"
(possibly folding that !desktop negation)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20120824/174bee75/attachment.pgp>
More information about the mesa-dev
mailing list