From: Chad Versace Date: Wed, 16 Nov 2011 02:20:57 +0000 (-0800) Subject: intel: Refactor intelSpanRenderStart X-Git-Tag: 062012170305~3067^2~11 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=1eede4aa8771c058bc560123d4b7c5625e23c8b6;p=profile%2Fivi%2Fmesa.git 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 --- diff --git a/src/mesa/drivers/dri/intel/intel_span.c b/src/mesa/drivers/dri/intel/intel_span.c index 83676b9..e73e804 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); } /**