On 21 July 2012 17:36, Chad Versace <span dir="ltr"><<a href="mailto:chad.versace@linux.intel.com" target="_blank">chad.versace@linux.intel.com</a>></span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Do this immediately after drawing is complete and at the same time that we<br>
mark the depth buffer as needing a depth resolve.<br>
<br>
CC: Eric Anholt <<a href="mailto:eric@anholt.net" target="_blank">eric@anholt.net</a>><br>
CC: Paul Berry <<a href="mailto:stereotype441@gmail.com" target="_blank">stereotype441@gmail.com</a>><br>
Signed-off-by: Chad Versace <<a href="mailto:chad.versace@linux.intel.com" target="_blank">chad.versace@linux.intel.com</a>><br>
---<br>
src/mesa/drivers/dri/i965/brw_draw.c | 17 ++++++++++++++---<br>
1 file changed, 14 insertions(+), 3 deletions(-)<br>
<br>
diff --git a/src/mesa/drivers/dri/i965/brw_draw.c b/src/mesa/drivers/dri/i965/brw_draw.c<br>
index 1069a63..ca44ff8 100644<br>
--- a/src/mesa/drivers/dri/i965/brw_draw.c<br>
+++ b/src/mesa/drivers/dri/i965/brw_draw.c<br>
@@ -326,18 +326,29 @@ brw_predraw_resolve_buffers(struct brw_context *brw)<br>
* If the depth buffer was written to and if it has an accompanying HiZ<br>
* buffer, then mark that it needs a depth resolve.<br>
*<br>
- * (In the future, this will also mark needed MSAA resolves).<br>
+ * If the color buffer is a multisampled window system buffer, then<br>
+ * mark that it needs a downsample resolve.<br>
*/<br>
static void brw_postdraw_set_buffers_need_resolve(struct brw_context *brw)<br>
{<br>
struct gl_context *ctx = &brw->intel.ctx;<br>
struct gl_framebuffer *fb = ctx->DrawBuffer;<br>
- struct intel_renderbuffer *depth_irb =<br>
- intel_get_renderbuffer(fb, BUFFER_DEPTH);<br>
+<br>
+ gl_buffer_index color_buffer = brw->intel.is_front_buffer_rendering<br>
+ ? BUFFER_FRONT_LEFT<br>
+ : BUFFER_BACK_LEFT;<br></blockquote><div><br>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.<br>
</div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
+<br>
+ struct intel_renderbuffer *depth_irb = intel_get_renderbuffer(fb, BUFFER_DEPTH);<br>
+ struct intel_renderbuffer *color_irb = intel_get_renderbuffer(fb, color_buffer);<br>
<br>
if (depth_irb && ctx->Depth.Mask) {<br>
intel_renderbuffer_set_needs_depth_resolve(depth_irb);<br>
}<br>
+<br>
+ if (color_irb && color_irb->mt->singlesample_mt) {<br>
+ assert(fb->Name == 0);<br></blockquote><div><br>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).<br>
</div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
+ color_irb->mt->need_downsample = true;<br>
+ }<br>
}<br>
<br>
static int<br>
<span><font color="#888888">--<br>
1.7.11.2<br>
<br>
</font></span></blockquote></div><br>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 :)<br>