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? > + 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. > +static void > +intel_miptree_unmap_multisample(struct intel_context *intel, > + struct intel_mipmap_tree *mt, > + unsigned int level, > + unsigned int slice) > +{ > + struct intel_miptree_map *map = mt->level[level].slice[slice].map; > + > + assert(mt->num_samples > 1); > + > + if (!map) > + return; > + > + intel_miptree_unmap_singlesample(intel, mt->singlesample_mt, level, > slice); > + > + mt->need_downsample = false; > + if (map->mode & GL_MAP_WRITE_BIT) > + intel_miptree_upsample(intel, mt); > + > + if (map->singlesample_mt_is_tmp) > + intel_miptree_release(&mt->singlesample_mt); > + > + intel_miptree_release_map(mt, level, slice); > +}
pgpaVGLmuEo9F.pgp
Description: PGP signature
_______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev