glapi: add indexed blend functions (GL 4.0)
[mesa.git] / src / mesa / main / fbobject.c
index 7669a0c5df5eb301dc9bdb3613c7df79585066ea..ae3a418cd1c44f0f8dbccca99d9626558ecf2ef8 100644 (file)
@@ -500,6 +500,12 @@ _mesa_framebuffer_renderbuffer(struct gl_context *ctx,
    }
    else {
       remove_attachment(ctx, att);
+      if (attachment == GL_DEPTH_STENCIL_ATTACHMENT) {
+         /* detach stencil (depth was detached above) */
+         att = get_attachment(ctx, fb, GL_STENCIL_ATTACHMENT_EXT);
+         assert(att);
+         remove_attachment(ctx, att);
+      }
    }
 
    invalidate_framebuffer(fb);
@@ -1058,6 +1064,8 @@ _mesa_test_framebuffer_completeness(struct gl_context *ctx,
       if (att->Layered) {
          if (att_tex_target == GL_TEXTURE_CUBE_MAP)
             att_layer_count = 6;
+         else if (att_tex_target == GL_TEXTURE_1D_ARRAY)
+            att_layer_count = att->Renderbuffer->Height;
          else
             att_layer_count = att->Renderbuffer->Depth;
       } else {
@@ -2770,8 +2778,21 @@ _mesa_GetFramebufferAttachmentParameteriv(GLenum target, GLenum attachment,
    }
 
    if (attachment == GL_DEPTH_STENCIL_ATTACHMENT) {
-      /* the depth and stencil attachments must point to the same buffer */
       const struct gl_renderbuffer_attachment *depthAtt, *stencilAtt;
+      if (pname == GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE) {
+         /* This behavior is first specified in OpenGL 4.4 specification.
+          *
+          * 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,
+                     "glGetFramebufferAttachmentParameteriv("
+                     "GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE"
+                     " is invalid for depth+stencil attachment)");
+         return;
+      }
+      /* the depth and stencil attachments must point to the same buffer */
       depthAtt = get_attachment(ctx, buffer, GL_DEPTH_ATTACHMENT);
       stencilAtt = get_attachment(ctx, buffer, GL_STENCIL_ATTACHMENT);
       if (depthAtt->Renderbuffer != stencilAtt->Renderbuffer) {