summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChad Versace <[email protected]>2011-11-15 18:20:57 -0800
committerChad Versace <[email protected]>2011-11-22 10:50:51 -0800
commit1eede4aa8771c058bc560123d4b7c5625e23c8b6 (patch)
treebf1aca339c259171b244071d060f2554cb980edb
parent3b0d295e122f8ca6e0ebe4593a1e0660308a18c3 (diff)
intel: Refactor intelSpanRenderStart
Factor the mapping loops from intelSpanRenderStart() into intel_span_map_buffers(). This in preparation for the next commit, which resolves the buffers before mapping. Reviewed-by: Eric Anholt <[email protected]> Signed-off-by: Chad Versace <[email protected]>
-rw-r--r--src/mesa/drivers/dri/intel/intel_span.c41
1 files changed, 25 insertions, 16 deletions
diff --git a/src/mesa/drivers/dri/intel/intel_span.c b/src/mesa/drivers/dri/intel/intel_span.c
index 83676b9313d..e73e804c548 100644
--- a/src/mesa/drivers/dri/intel/intel_span.c
+++ b/src/mesa/drivers/dri/intel/intel_span.c
@@ -254,6 +254,30 @@ intel_framebuffer_unmap(struct intel_context *intel, struct gl_framebuffer *fb)
}
/**
+ * Map the regions needed by intelSpanRenderStart().
+ */
+static void
+intel_span_map_buffers(struct intel_context *intel)
+{
+ struct gl_context *ctx = &intel->ctx;
+ struct intel_texture_object *tex_obj;
+
+ 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);
+ intel_tex_map_images(intel, tex_obj,
+ GL_MAP_READ_BIT | GL_MAP_WRITE_BIT);
+ }
+
+ intel_framebuffer_map(intel, ctx->DrawBuffer);
+ if (ctx->ReadBuffer != ctx->DrawBuffer) {
+ intel_framebuffer_map(intel, ctx->ReadBuffer);
+ }
+}
+
+/**
* Prepare for software rendering. Map current read/draw framebuffers'
* renderbuffes and all currently bound texture objects.
*
@@ -263,25 +287,10 @@ void
intelSpanRenderStart(struct gl_context * ctx)
{
struct intel_context *intel = intel_context(ctx);
- GLuint i;
intel_flush(&intel->ctx);
intel_prepare_render(intel);
-
- for (i = 0; i < ctx->Const.MaxTextureImageUnits; i++) {
- if (ctx->Texture.Unit[i]._ReallyEnabled) {
- struct gl_texture_object *texObj = ctx->Texture.Unit[i]._Current;
-
- intel_finalize_mipmap_tree(intel, i);
- intel_tex_map_images(intel, intel_texture_object(texObj),
- GL_MAP_READ_BIT | GL_MAP_WRITE_BIT);
- }
- }
-
- intel_framebuffer_map(intel, ctx->DrawBuffer);
- if (ctx->ReadBuffer != ctx->DrawBuffer) {
- intel_framebuffer_map(intel, ctx->ReadBuffer);
- }
+ intel_span_map_buffers(intel);
}
/**