On 21 July 2012 17:36, Chad Versace <chad.vers...@linux.intel.com> wrote:

> Actually, this patch forces an automatic downsample during
> intel_miptree_map.  And this should occur only due to glReadPixels.
>
> 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 | 10 ++++++++++
>  1 file changed, 10 insertions(+)
>
> diff --git a/src/mesa/drivers/dri/intel/intel_mipmap_tree.c
> b/src/mesa/drivers/dri/intel/intel_mipmap_tree.c
> index c4496ea..26002c2 100644
> --- a/src/mesa/drivers/dri/intel/intel_mipmap_tree.c
> +++ b/src/mesa/drivers/dri/intel/intel_mipmap_tree.c
> @@ -1339,6 +1339,15 @@ intel_miptree_map(struct intel_context *intel,
>  {
>     struct intel_miptree_map *map;
>
> +   if (mt->num_samples > 0 && (mode & GL_MAP_WRITE_BIT)) {
> +      /* We choose not support swrast on multisample buffers because
> +       * it would require an upsample on unmap. As of 2012-07-20, this
> +       * warning occurs only on glDrawPixels(GL_STENCIL_INDEX).
> +       */
> +      _mesa_warning(&intel->ctx, "unsupported fallback to software "
> +                    "rasterization on a multisample buffer");
> +   }
> +
>     map = calloc(1, sizeof(struct intel_miptree_map));
>     if (!map){
>        *out_ptr = NULL;
> @@ -1354,6 +1363,7 @@ intel_miptree_map(struct intel_context *intel,
>     map->w = w;
>     map->h = h;
>
> +   intel_miptree_downsample(intel, mt);
>     intel_miptree_slice_resolve_depth(intel, mt, level, slice);
>     if (map->mode & GL_MAP_WRITE_BIT) {
>        intel_miptree_slice_set_needs_hiz_resolve(mt, level, slice);
> --
> 1.7.11.2
>
>
It seems to me that we also need to write some code to ensure that
glReadPixels() reads from mt->singlesample_mt rather than mt.  (Otherwise,
on Gen6, glReadPixels() will see something awful, and on Gen7,
glReadPixels() will read from the first slice of the UMS/CMS buffer, which
will look ok like no multisampled occurred).  Or am I missing something?
_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to