i965: Make a helper function for the renderbuffer temporary mt workaround.
authorEric Anholt <eric@anholt.net>
Wed, 8 Aug 2012 16:29:46 +0000 (09:29 -0700)
committerEric Anholt <eric@anholt.net>
Tue, 16 Oct 2012 20:13:44 +0000 (13:13 -0700)
We now have a case of wanting to do that on gen6+ as well, so make this logic
usable elsewhere.

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

index abdcb8478bae79dc5b22986b362bd2d362c2da31..25ee55731a28c6d37f2b9937254ce5d7aefa8708 100644 (file)
@@ -1136,28 +1136,7 @@ brw_update_renderbuffer_surface(struct brw_context *brw,
          * select the image.  So, instead, we just make a new single-level
          * miptree and render into that.
          */
-        struct intel_context *intel = intel_context(ctx);
-        struct intel_texture_image *intel_image =
-           intel_texture_image(irb->tex_image);
-        struct intel_mipmap_tree *new_mt;
-        int width, height, depth;
-
-        intel_miptree_get_dimensions_for_image(irb->tex_image, &width, &height, &depth);
-
-        new_mt = intel_miptree_create(intel, irb->tex_image->TexObject->Target,
-                                      intel_image->base.Base.TexFormat,
-                                      intel_image->base.Base.Level,
-                                      intel_image->base.Base.Level,
-                                      width, height, depth,
-                                      true,
-                                       0 /* num_samples */,
-                                       INTEL_MSAA_LAYOUT_NONE);
-
-        intel_miptree_copy_teximage(intel, intel_image, new_mt);
-        intel_miptree_reference(&irb->mt, intel_image->mt);
-        intel_renderbuffer_set_draw_offset(irb);
-        intel_miptree_release(&new_mt);
-
+        intel_renderbuffer_move_to_temp(intel, irb);
         mt = irb->mt;
       }
    }
index feac7024583e98fabad15a5e8d6a0361750c924a..10a8c7fac392b3517938f2864071ca55851f1474 100644 (file)
@@ -936,6 +936,32 @@ intel_renderbuffer_resolve_depth(struct intel_context *intel,
    return false;
 }
 
+void
+intel_renderbuffer_move_to_temp(struct intel_context *intel,
+                                struct intel_renderbuffer *irb)
+{
+   struct intel_texture_image *intel_image =
+      intel_texture_image(irb->tex_image);
+   struct intel_mipmap_tree *new_mt;
+   int width, height, depth;
+
+   intel_miptree_get_dimensions_for_image(irb->tex_image, &width, &height, &depth);
+
+   new_mt = intel_miptree_create(intel, irb->tex_image->TexObject->Target,
+                                 intel_image->base.Base.TexFormat,
+                                 intel_image->base.Base.Level,
+                                 intel_image->base.Base.Level,
+                                 width, height, depth,
+                                 true,
+                                 irb->mt->num_samples,
+                                 irb->mt->msaa_layout);
+
+   intel_miptree_copy_teximage(intel, intel_image, new_mt);
+   intel_miptree_reference(&irb->mt, intel_image->mt);
+   intel_renderbuffer_set_draw_offset(irb);
+   intel_miptree_release(&new_mt);
+}
+
 /**
  * Do one-time context initializations related to GL_EXT_framebuffer_object.
  * Hook in device driver functions.
index 3db80de7cd177f747afa7e3f0f6d55c732e92f09..9ae961e476e2786f53de4ac31aa5cd737146dd42 100644 (file)
@@ -197,6 +197,9 @@ bool
 intel_renderbuffer_resolve_depth(struct intel_context *intel,
                                 struct intel_renderbuffer *irb);
 
+void intel_renderbuffer_move_to_temp(struct intel_context *intel,
+                                     struct intel_renderbuffer *irb);
+
 unsigned
 intel_quantize_num_samples(struct intel_screen *intel, unsigned num_samples);