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

Anuj Phogat anuj.phogat at gmail.com
Tue Mar 11 17:33:40 PDT 2014


>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);
-- 
1.8.3.1



More information about the mesa-stable mailing list