[Mesa-stable] [PATCH] mesa: Add an error condition in glGetFramebufferAttachmentParameteriv()

Brian Paul brianp at vmware.com
Wed Mar 12 06:26:37 PDT 2014


On 03/11/2014 06:33 PM, Anuj Phogat wrote:
>  From the OpenGL 4.4 spec page 275:
>    "If pname is FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE, param will
>     contain the format of components of the specified attachment,
>     one of FLOAT, INT, UNSIGNED_INT, SIGNED_NORMALIZED, or
>     UNSIGNED_NORMALIZED for floating-point, signed integer,
>     unsigned integer, signed normalized fixedpoint, or unsigned
>     normalized fixed-point components respectively. If no data
>     storage or texture image has been specified for the attachment,
>     param will contain NONE. This query cannot be performed for a
>     combined depth+stencil attachment, since it does not have a
>     single format."
>
> Fixes Khronos CTS test: packed_depth_stencil_parameters.test
>
> Signed-off-by: Anuj Phogat <anuj.phogat at gmail.com>
> Cc: <mesa-stable at lists.freedesktop.org>
> Khronos Bug# 9170
>
> Signed-off-by: Anuj Phogat <anuj.phogat at gmail.com>
> ---
>   src/mesa/main/fbobject.c | 11 +++++++++++
>   1 file changed, 11 insertions(+)
>
> diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c
> index a9dcc51..ac0d270 100644
> --- a/src/mesa/main/fbobject.c
> +++ b/src/mesa/main/fbobject.c
> @@ -2765,6 +2765,17 @@ _mesa_GetFramebufferAttachmentParameteriv(GLenum target, GLenum attachment,
>      }
>
>      if (attachment == GL_DEPTH_STENCIL_ATTACHMENT) {
> +      if (pname == GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE) {
> +         /* From the OpenGL 4.4 spec page 275:
> +          *   "This query cannot be performed for a combined depth+stencil
> +          *    attachment, since it does not have a single format."
> +          */
> +         _mesa_error(ctx, GL_INVALID_OPERATION,
> +                     "glGetFramebufferAttachmentParameterivEXT("
> +                     "GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE"
> +                     " query can't be made for depth+stencil attachment)");
> +         return;
> +      }
>         /* the depth and stencil attachments must point to the same buffer */
>         const struct gl_renderbuffer_attachment *depthAtt, *stencilAtt;
>         depthAtt = get_attachment(ctx, buffer, GL_DEPTH_ATTACHMENT);
>

Reviewed-by: Brian Paul <brianp at vmware.com>



More information about the mesa-stable mailing list