From 1eede4aa8771c058bc560123d4b7c5625e23c8b6 Mon Sep 17 00:00:00 2001 From: Chad Versace Date: Tue, 15 Nov 2011 18:20:57 -0800 Subject: [PATCH] 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 Signed-off-by: Chad Versace --- src/mesa/drivers/dri/intel/intel_span.c | 41 +++++++++++++++---------- 1 file 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 @@ -253,6 +253,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); } /** -- 2.30.2