From: Eric Anholt Date: Wed, 8 Aug 2012 16:29:46 +0000 (-0700) Subject: i965: Make a helper function for the renderbuffer temporary mt workaround. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=ddfa346e4a685269c576714eb0b14fd23d748217;p=mesa.git i965: Make a helper function for the renderbuffer temporary mt workaround. We now have a case of wanting to do that on gen6+ as well, so make this logic usable elsewhere. Reviewed-by: Kenneth Graunke --- diff --git a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c index abdcb8478ba..25ee55731a2 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c +++ b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c @@ -1136,28 +1136,7 @@ brw_update_renderbuffer_surface(struct brw_context *brw, * select the image. So, instead, we just make a new single-level * miptree and render into that. */ - struct intel_context *intel = intel_context(ctx); - struct intel_texture_image *intel_image = - intel_texture_image(irb->tex_image); - struct intel_mipmap_tree *new_mt; - int width, height, depth; - - intel_miptree_get_dimensions_for_image(irb->tex_image, &width, &height, &depth); - - new_mt = intel_miptree_create(intel, irb->tex_image->TexObject->Target, - intel_image->base.Base.TexFormat, - intel_image->base.Base.Level, - intel_image->base.Base.Level, - width, height, depth, - true, - 0 /* num_samples */, - INTEL_MSAA_LAYOUT_NONE); - - intel_miptree_copy_teximage(intel, intel_image, new_mt); - intel_miptree_reference(&irb->mt, intel_image->mt); - intel_renderbuffer_set_draw_offset(irb); - intel_miptree_release(&new_mt); - + intel_renderbuffer_move_to_temp(intel, irb); mt = irb->mt; } } diff --git a/src/mesa/drivers/dri/intel/intel_fbo.c b/src/mesa/drivers/dri/intel/intel_fbo.c index feac7024583..10a8c7fac39 100644 --- a/src/mesa/drivers/dri/intel/intel_fbo.c +++ b/src/mesa/drivers/dri/intel/intel_fbo.c @@ -936,6 +936,32 @@ intel_renderbuffer_resolve_depth(struct intel_context *intel, return false; } +void +intel_renderbuffer_move_to_temp(struct intel_context *intel, + struct intel_renderbuffer *irb) +{ + struct intel_texture_image *intel_image = + intel_texture_image(irb->tex_image); + struct intel_mipmap_tree *new_mt; + int width, height, depth; + + intel_miptree_get_dimensions_for_image(irb->tex_image, &width, &height, &depth); + + new_mt = intel_miptree_create(intel, irb->tex_image->TexObject->Target, + intel_image->base.Base.TexFormat, + intel_image->base.Base.Level, + intel_image->base.Base.Level, + width, height, depth, + true, + irb->mt->num_samples, + irb->mt->msaa_layout); + + intel_miptree_copy_teximage(intel, intel_image, new_mt); + intel_miptree_reference(&irb->mt, intel_image->mt); + intel_renderbuffer_set_draw_offset(irb); + intel_miptree_release(&new_mt); +} + /** * Do one-time context initializations related to GL_EXT_framebuffer_object. * Hook in device driver functions. diff --git a/src/mesa/drivers/dri/intel/intel_fbo.h b/src/mesa/drivers/dri/intel/intel_fbo.h index 3db80de7cd1..9ae961e476e 100644 --- a/src/mesa/drivers/dri/intel/intel_fbo.h +++ b/src/mesa/drivers/dri/intel/intel_fbo.h @@ -197,6 +197,9 @@ bool intel_renderbuffer_resolve_depth(struct intel_context *intel, struct intel_renderbuffer *irb); +void intel_renderbuffer_move_to_temp(struct intel_context *intel, + struct intel_renderbuffer *irb); + unsigned intel_quantize_num_samples(struct intel_screen *intel, unsigned num_samples);