[Mesa-dev] [PATCH 10/15] i965: Mark winsys MSAA color buffer as needing resolve postdraw

Paul Berry stereotype441 at gmail.com
Mon Jul 23 15:45:48 PDT 2012


On 21 July 2012 17:36, Chad Versace <chad.versace at linux.intel.com> wrote:

> Do this immediately after drawing is complete and at the same time that we
> mark the depth buffer as needing a depth resolve.
>
> CC: Eric Anholt <eric at anholt.net>
> CC: Paul Berry <stereotype441 at gmail.com>
> Signed-off-by: Chad Versace <chad.versace at linux.intel.com>
> ---
>  src/mesa/drivers/dri/i965/brw_draw.c | 17 ++++++++++++++---
>  1 file changed, 14 insertions(+), 3 deletions(-)
>
> diff --git a/src/mesa/drivers/dri/i965/brw_draw.c
> b/src/mesa/drivers/dri/i965/brw_draw.c
> index 1069a63..ca44ff8 100644
> --- a/src/mesa/drivers/dri/i965/brw_draw.c
> +++ b/src/mesa/drivers/dri/i965/brw_draw.c
> @@ -326,18 +326,29 @@ brw_predraw_resolve_buffers(struct brw_context *brw)
>   * If the depth buffer was written to and if it has an accompanying HiZ
>   * buffer, then mark that it needs a depth resolve.
>   *
> - * (In the future, this will also mark needed MSAA resolves).
> + * If the color buffer is a multisampled window system buffer, then
> + * mark that it needs a downsample resolve.
>   */
>  static void brw_postdraw_set_buffers_need_resolve(struct brw_context *brw)
>  {
>     struct gl_context *ctx = &brw->intel.ctx;
>     struct gl_framebuffer *fb = ctx->DrawBuffer;
> -   struct intel_renderbuffer *depth_irb =
> -        intel_get_renderbuffer(fb, BUFFER_DEPTH);
> +
> +   gl_buffer_index color_buffer = brw->intel.is_front_buffer_rendering
> +                                ? BUFFER_FRONT_LEFT
> +                                : BUFFER_BACK_LEFT;
>

If we're rendering to GL_FRONT_AND_BACK, we need to set need_downsample on
both front and back buffers.  This code looks like it will only set
need_downsample on the front buffer in that case.


> +
> +   struct intel_renderbuffer *depth_irb = intel_get_renderbuffer(fb,
> BUFFER_DEPTH);
> +   struct intel_renderbuffer *color_irb = intel_get_renderbuffer(fb,
> color_buffer);
>
>     if (depth_irb && ctx->Depth.Mask) {
>        intel_renderbuffer_set_needs_depth_resolve(depth_irb);
>     }
> +
> +   if (color_irb && color_irb->mt->singlesample_mt) {
> +      assert(fb->Name == 0);
>

This would be clearer as "assert(_mesa_is_winsys_fbo(fb));".  (Note: I'm
working on a patch to clean a bunch of these up, but I want to wait until
some of my other patches land before doing so).


> +      color_irb->mt->need_downsample = true;
> +   }
>  }
>
>  static int
> --
> 1.7.11.2
>
>
A similar change also needs to be made to try_blorp_blit() (in
brw_blorp_blit.cpp), so that we'll set need_downsample if the client blits
to a multisampled window.  Or perhaps it would be better to do some
refactoring so that we don't have to repeat ourselves :)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20120723/f68bc658/attachment-0001.html>


More information about the mesa-dev mailing list