summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorChad Versace <[email protected]>2011-11-15 18:21:05 -0800
committerChad Versace <[email protected]>2011-11-22 10:50:51 -0800
commit622bae07a5da91bc966d173fd6df92a640e4f574 (patch)
tree447312bce69f11e63c38add2340593f0fd5c1ad9 /src
parent1eede4aa8771c058bc560123d4b7c5625e23c8b6 (diff)
intel: Resolve buffers in intelSpanRenderStart
Resolve all buffers that will be mapped by intelSpanRenderStart. This comprises resolving the depth buffer of each enabled texture and of the read and draw buffers. Reviewed-by: Eric Anholt <[email protected]> Signed-off-by: Chad Versace <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/mesa/drivers/dri/intel/intel_span.c40
1 files changed, 39 insertions, 1 deletions
diff --git a/src/mesa/drivers/dri/intel/intel_span.c b/src/mesa/drivers/dri/intel/intel_span.c
index e73e804c548..042bc30da7d 100644
--- a/src/mesa/drivers/dri/intel/intel_span.c
+++ b/src/mesa/drivers/dri/intel/intel_span.c
@@ -254,6 +254,42 @@ intel_framebuffer_unmap(struct intel_context *intel, struct gl_framebuffer *fb)
}
/**
+ * Resolve all buffers that will be mapped by intelSpanRenderStart().
+ *
+ * Resolve the depth buffer of each enabled texture and of the read and draw
+ * buffers.
+ *
+ * (Note: In the future this will also perform MSAA resolves.)
+ */
+static void
+intel_span_resolve_buffers(struct intel_context *intel)
+{
+ struct gl_context *ctx = &intel->ctx;
+ struct intel_renderbuffer *draw_irb;
+ struct intel_renderbuffer *read_irb;
+ struct intel_texture_object *tex_obj;
+
+ /* Resolve depth buffer of each enabled texture. */
+ for (int i = 0; i < ctx->Const.MaxTextureImageUnits; i++) {
+ if (!ctx->Texture.Unit[i]._ReallyEnabled)
+ continue;
+ tex_obj = intel_texture_object(ctx->Texture.Unit[i]._Current);
+ intel_finalize_mipmap_tree(intel, i);
+ if (!tex_obj || !tex_obj->mt)
+ continue;
+ intel_miptree_all_slices_resolve_depth(intel, tex_obj->mt);
+ }
+
+ /* Resolve each attached depth buffer. */
+ draw_irb = intel_get_renderbuffer(ctx->DrawBuffer, BUFFER_DEPTH);
+ read_irb = intel_get_renderbuffer(ctx->ReadBuffer, BUFFER_DEPTH);
+ if (draw_irb)
+ intel_renderbuffer_resolve_depth(intel, draw_irb);
+ if (read_irb != draw_irb && read_irb)
+ intel_renderbuffer_resolve_depth(intel, read_irb);
+}
+
+/**
* Map the regions needed by intelSpanRenderStart().
*/
static void
@@ -288,8 +324,10 @@ intelSpanRenderStart(struct gl_context * ctx)
{
struct intel_context *intel = intel_context(ctx);
- intel_flush(&intel->ctx);
+ intel_flush(ctx);
intel_prepare_render(intel);
+ intel_span_resolve_buffers(intel);
+ intel_flush(ctx);
intel_span_map_buffers(intel);
}