intel: Stop creating the wrapped depth irb.
authorEric Anholt <eric@anholt.net>
Thu, 8 Dec 2011 16:33:28 +0000 (08:33 -0800)
committerEric Anholt <eric@anholt.net>
Mon, 19 Dec 2011 21:20:11 +0000 (13:20 -0800)
All the operations were just trying to get at irb->wrapped_depth->mt,
which is the same as irb->mt now.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
src/mesa/drivers/dri/intel/intel_fbo.c
src/mesa/drivers/dri/intel/intel_fbo.h

index 17118036128cbb0156301634350a7f8da40db289..c60b57ed4041a017798c7a88cdb7a2f9d0f5aca3 100644 (file)
@@ -113,8 +113,6 @@ intel_delete_renderbuffer(struct gl_renderbuffer *rb)
 
    intel_miptree_release(&irb->mt);
 
-   _mesa_reference_renderbuffer(&irb->wrapped_depth, NULL);
-
    free(irb);
 }
 
@@ -260,34 +258,6 @@ intel_alloc_renderbuffer_storage(struct gl_context * ctx, struct gl_renderbuffer
       }
    }
 
-   if (irb->mt->stencil_mt) {
-      bool ok;
-      struct intel_renderbuffer *depth_irb;
-
-      /* The RB got allocated as separate stencil.  Hook up our wrapped
-       * renderbuffer so that consumers of intel_get_renderbuffer(BUFFER_DEPTH)
-       * end up with pointers to the separate depth.
-       */
-      if (!irb->wrapped_depth) {
-        _mesa_reference_renderbuffer(&irb->wrapped_depth,
-                                     intel_new_renderbuffer(ctx, ~0));
-      }
-
-      depth_irb = intel_renderbuffer(irb->wrapped_depth);
-      if (!depth_irb) {
-        intel_miptree_release(&irb->mt);
-        return false;
-      }
-
-      assert(irb->mt->format == MESA_FORMAT_S8_Z24 ||
-            irb->mt->format == MESA_FORMAT_X8_Z24);
-      ok = intel_renderbuffer_update_wrapper(intel, depth_irb, irb->mt,
-                                            0, 0, /* level, layer */
-                                            MESA_FORMAT_X8_Z24,
-                                            GL_DEPTH_COMPONENT24);
-      assert(ok);
-   }
-
    return true;
 }
 
@@ -533,45 +503,14 @@ intel_renderbuffer_update_wrapper(struct intel_context *intel,
    irb->mt_layer = layer;
 
    intel_miptree_reference(&irb->mt, mt);
-   if (mt->stencil_mt && _mesa_is_depthstencil_format(rb->InternalFormat)) {
-      struct intel_renderbuffer *depth_irb;
-
-      if (!irb->wrapped_depth) {
-        depth_irb = intel_renderbuffer_wrap_miptree(intel,
-                                                    mt, level, layer,
-                                                    MESA_FORMAT_X8_Z24,
-                                                    GL_DEPTH_COMPONENT24);
-        _mesa_reference_renderbuffer(&irb->wrapped_depth, &depth_irb->Base);
-
-        if (!irb->wrapped_depth) {
-           intel_miptree_release(&irb->mt);
-           return false;
-        }
-      } else {
-        bool ok = true;
-
-        depth_irb = intel_renderbuffer(irb->wrapped_depth);
-
-        ok &= intel_renderbuffer_update_wrapper(intel,
-                                                depth_irb,
-                                                mt,
-                                                level, layer,
-                                                MESA_FORMAT_X8_Z24,
-                                                GL_DEPTH_COMPONENT24);
-        if (!ok) {
-           intel_miptree_release(&irb->mt);
-           return false;
-        }
-      }
-   } else {
-      intel_renderbuffer_set_draw_offset(irb);
 
-      if (mt->hiz_mt == NULL &&
-         intel->vtbl.is_hiz_depth_format(intel, rb->Format)) {
-        intel_miptree_alloc_hiz(intel, mt);
-         if (!mt->hiz_mt)
-            return false;
-      }
+   intel_renderbuffer_set_draw_offset(irb);
+
+   if (mt->hiz_mt == NULL &&
+       intel->vtbl.is_hiz_depth_format(intel, rb->Format)) {
+      intel_miptree_alloc_hiz(intel, mt);
+      if (!mt->hiz_mt)
+        return false;
    }
 
    return true;
@@ -982,11 +921,6 @@ intel_renderbuffer_set_needs_hiz_resolve(struct intel_renderbuffer *irb)
       intel_miptree_slice_set_needs_hiz_resolve(irb->mt,
                                                 irb->mt_level,
                                                 irb->mt_layer);
-   } else if (irb->wrapped_depth) {
-      intel_renderbuffer_set_needs_hiz_resolve(
-           intel_renderbuffer(irb->wrapped_depth));
-   } else {
-      return;
    }
 }
 
@@ -997,11 +931,6 @@ intel_renderbuffer_set_needs_depth_resolve(struct intel_renderbuffer *irb)
       intel_miptree_slice_set_needs_depth_resolve(irb->mt,
                                                   irb->mt_level,
                                                   irb->mt_layer);
-   } else if (irb->wrapped_depth) {
-      intel_renderbuffer_set_needs_depth_resolve(
-           intel_renderbuffer(irb->wrapped_depth));
-   } else {
-      return;
    }
 }
 
@@ -1014,9 +943,6 @@ intel_renderbuffer_resolve_hiz(struct intel_context *intel,
                                              irb->mt,
                                              irb->mt_level,
                                              irb->mt_layer);
-   if (irb->wrapped_depth)
-      return intel_renderbuffer_resolve_hiz(intel,
-                                           intel_renderbuffer(irb->wrapped_depth));
 
    return false;
 }
@@ -1031,10 +957,6 @@ intel_renderbuffer_resolve_depth(struct intel_context *intel,
                                                irb->mt_level,
                                                irb->mt_layer);
 
-   if (irb->wrapped_depth)
-      return intel_renderbuffer_resolve_depth(intel,
-                                              intel_renderbuffer(irb->wrapped_depth));
-
    return false;
 }
 
index b8dbb34135440794fb06c4610ece624a3653afe8..edba8e66226af61cc3943a5bc3604a2223288ecd 100644 (file)
@@ -64,16 +64,6 @@ struct intel_renderbuffer
    unsigned int mt_layer;
    /** \} */
 
-   /**
-    * \name Packed depth/stencil unwrappers
-    *
-    * If the intel_context is using separate stencil and this renderbuffer has
-    * a packed depth/stencil format, then wrapped_depth and wrapped_stencil
-    * are the real renderbuffers.
-    */
-   struct gl_renderbuffer *wrapped_depth;
-   /** \} */
-
    GLuint draw_x, draw_y; /**< Offset of drawing within the region */
 };
 
@@ -115,7 +105,6 @@ static INLINE struct intel_renderbuffer *
 intel_get_renderbuffer(struct gl_framebuffer *fb, gl_buffer_index attIndex)
 {
    struct gl_renderbuffer *rb;
-   struct intel_renderbuffer *irb;
 
    assert((unsigned)attIndex < ARRAY_SIZE(fb->Attachment));
 
@@ -123,21 +112,7 @@ intel_get_renderbuffer(struct gl_framebuffer *fb, gl_buffer_index attIndex)
    if (!rb)
       return NULL;
 
-   irb = intel_renderbuffer(rb);
-   if (!irb)
-      return NULL;
-
-   switch (attIndex) {
-   case BUFFER_DEPTH:
-      if (irb->wrapped_depth) {
-        irb = intel_renderbuffer(irb->wrapped_depth);
-      }
-      break;
-   default:
-      break;
-   }
-
-   return irb;
+   return intel_renderbuffer(rb);
 }
 
 bool