Merge branch 'mesa_7_7_branch'
[mesa.git] / src / mesa / drivers / dri / intel / intel_fbo.c
index fc502a87d37fe5557b93b4188f0c61c47fc9c10f..d58ffd95fa6fef38f26d43193bf70b5342fdb61a 100644 (file)
@@ -222,7 +222,6 @@ static void
 intel_resize_buffers(GLcontext *ctx, struct gl_framebuffer *fb,
                     GLuint width, GLuint height)
 {
-   struct intel_framebuffer *intel_fb = (struct intel_framebuffer*)fb;
    int i;
 
    _mesa_resize_framebuffer(ctx, fb, width, height);
@@ -233,9 +232,10 @@ intel_resize_buffers(GLcontext *ctx, struct gl_framebuffer *fb,
       return;
    }
 
+
    /* Make sure all window system renderbuffers are up to date */
-   for (i = 0; i < 2; i++) {
-      struct gl_renderbuffer *rb = &intel_fb->color_rb[i]->Base;
+   for (i = BUFFER_FRONT_LEFT; i <= BUFFER_BACK_RIGHT; i++) {
+      struct gl_renderbuffer *rb = fb->Attachment[i].Renderbuffer;
 
       /* only resize if size is changing */
       if (rb && (rb->Width != width || rb->Height != height)) {
@@ -427,7 +427,8 @@ intel_update_wrapper(GLcontext *ctx, struct intel_renderbuffer *irb,
       DBG("Render to DEPTH_STENCIL texture OK\n");
    }
    else {
-      DBG("Render to texture BAD FORMAT %d\n", texImage->TexFormat);
+      DBG("Render to texture BAD FORMAT %s\n",
+         _mesa_get_format_name(texImage->TexFormat));
       return GL_FALSE;
    }
 
@@ -590,11 +591,21 @@ intel_validate_framebuffer(GLcontext *ctx, struct gl_framebuffer *fb)
       intel_get_renderbuffer(fb, BUFFER_STENCIL);
    int i;
 
-   if (stencilRb && stencilRb != depthRb) {
-      /* we only support combined depth/stencil buffers, not separate
-       * stencil buffers.
-       */
-      fb->_Status = GL_FRAMEBUFFER_UNSUPPORTED_EXT;
+   if (depthRb && stencilRb && stencilRb != depthRb) {
+      if (ctx->DrawBuffer->Attachment[BUFFER_DEPTH].Type == GL_TEXTURE &&
+         ctx->DrawBuffer->Attachment[BUFFER_STENCIL].Type == GL_TEXTURE &&
+         (ctx->DrawBuffer->Attachment[BUFFER_DEPTH].Texture->Name ==
+          ctx->DrawBuffer->Attachment[BUFFER_STENCIL].Texture->Name)) {
+        /* OK */
+      } else {
+        /* we only support combined depth/stencil buffers, not separate
+         * stencil buffers.
+         */
+        DBG("Only supports combined depth/stencil (found %s, %s)\n",
+            depthRb ? _mesa_get_format_name(depthRb->Base.Format): "NULL",
+            stencilRb ? _mesa_get_format_name(stencilRb->Base.Format): "NULL");
+        fb->_Status = GL_FRAMEBUFFER_UNSUPPORTED_EXT;
+      }
    }
 
    for (i = 0; i < ctx->Const.MaxDrawBuffers; i++) {
@@ -605,6 +616,7 @@ intel_validate_framebuffer(GLcontext *ctx, struct gl_framebuffer *fb)
         continue;
 
       if (irb == NULL) {
+        DBG("software rendering renderbuffer\n");
         fb->_Status = GL_FRAMEBUFFER_UNSUPPORTED_EXT;
         continue;
       }