On 08/06/2012 07:32 PM, Eric Anholt wrote: > Chad Versace <chad.vers...@linux.intel.com> writes: > >> Add two new functions: intel_miptree_{map,unmap}_multisample, to which >> intel_miptree_{map,unmap} dispatch. Only mapping flat, renderbuffer-like >> miptrees are supported. >> >> v2: >> - Move the introduction of >> intel_mipmap_tree::singlesample_{width0,height0} to this patch, per >> Anholt. >> - Replace relations `mt->num_samples == 0` and `mt->num_samples > 0` >> with `<= 1` and `> 0`, per Anholt. >> - Don't downsample unnecessarily, found by Anholt. >> >> CC: Eric Anholt <e...@anholt.net> >> CC: Paul Berry <stereotype...@gmail.com> >> Signed-off-by: Chad Versace <chad.vers...@linux.intel.com> >> --- >> src/mesa/drivers/dri/intel/intel_mipmap_tree.c | 115 >> +++++++++++++++++++++++-- >> src/mesa/drivers/dri/intel/intel_mipmap_tree.h | 18 ++++ >> 2 files changed, 127 insertions(+), 6 deletions(-) >> >> diff --git a/src/mesa/drivers/dri/intel/intel_mipmap_tree.c >> b/src/mesa/drivers/dri/intel/intel_mipmap_tree.c >> index 23d84c0..6ecb48f 100644 >> --- a/src/mesa/drivers/dri/intel/intel_mipmap_tree.c >> +++ b/src/mesa/drivers/dri/intel/intel_mipmap_tree.c >> + if (!mt->singlesample_mt) { >> + map->singlesample_mt_is_tmp = true; >> + mt->need_downsample = true; > > Move this mt->need_downsample flag setup to after you've successfully > alloced?
Done. That's a sensible change, and removes the need for unsetting mt->need_downsample in the failure path. > >> + mt->singlesample_mt = >> + intel_miptree_create_for_renderbuffer(intel, >> + mt->format, >> + mt->singlesample_width0, >> + mt->singlesample_height0, >> + 0 /*num_samples*/); >> + if (!mt->singlesample_mt) { >> + mt->need_downsample = false; >> + goto fail; >> + } >> + } >> + >> + if (mode & GL_MAP_INVALIDATE_RANGE_BIT) >> + mt->need_downsample = false; >> + >> + intel_miptree_downsample(intel, mt); > > I don't think you can clear need_downsample for > GL_MAP_INVALIDATE_RANGE_BIT, because the GL_MAP_WRITE_BIT case in the > unmap (implied by INVALIDATE_RANGE) will upsample the whole singlesample > buffer back, not just the mapped subset. Dropping the INVALIDATE_RANGE > gets the series up to this patch my r-b. > Ah, your're right. Thanks for catching that subtle error. _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev