[Mesa-dev] [PATCH 16/41] intel: Replace intel_texture_image::stencil_irb with intel_mipmap_tree::stencil_mt

Eric Anholt eric at anholt.net
Fri Nov 18 15:19:16 PST 2011


On Thu, 17 Nov 2011 19:58:43 -0800, Chad Versace <chad.versace at linux.intel.com> wrote:
> For depthstencil textures using separate stencil, we embedded a stencil
> buffer in intel_texture_image. The intention was that the embedded stencil
> buffer would be the golden copy of the texture's stencil bits. When
> necessary, we scattered/gathered the stencil bits between the texture
> miptree and the embedded stencil buffer.
> 
> This approach had a serious deficiency for mipmapped or multi-layer
> textures. Any given moment the embedded stencil buffer was consistent with
> exactly one miptree slice, the most recent one to be scattered. This
> permitted tests of type A to pass, but broke tests of type B.
> 
> Test A:
>     1. Create a depthstencil texture.
>     2. Upload data into (level=x1,layer=y1).
>     3. Read and test stencil data at (level=x1, layer=y1).
>     4. Upload data into (level=x2,layer=y2).
>     5. Read and test stencil data at (level=x2, layer=y2).
> 
> Test B:
>     1. Create a depthstencil texture.
>     2. Upload data into (level=x1,layer=y1).
>     3. Upload data into (level=x2,layer=y2).
>     4. Read and test stencil data at (level=x1, layer=y1).
>     5. Read and test stencil data at (level=x2, layer=y2).
> 
> Signed-off-by: Chad Versace <chad.versace at linux.intel.com>
> ---
>  src/mesa/drivers/dri/intel/intel_fbo.c         |  116 +++++++++++----------
>  src/mesa/drivers/dri/intel/intel_mipmap_tree.c |  134 +++++++++++++++++++++++-
>  src/mesa/drivers/dri/intel/intel_mipmap_tree.h |   37 +++++++
>  src/mesa/drivers/dri/intel/intel_tex.c         |   41 +++-----
>  src/mesa/drivers/dri/intel/intel_tex_image.c   |  128 ----------------------
>  src/mesa/drivers/dri/intel/intel_tex_obj.h     |   30 ------
>  6 files changed, 248 insertions(+), 238 deletions(-)
> 
> diff --git a/src/mesa/drivers/dri/intel/intel_fbo.c b/src/mesa/drivers/dri/intel/intel_fbo.c
> index a61c74c..7dc0c53 100644
> --- a/src/mesa/drivers/dri/intel/intel_fbo.c
> +++ b/src/mesa/drivers/dri/intel/intel_fbo.c
>  #ifdef I915
>     (void) intel;
>     if (intel->is_945)
> @@ -103,6 +116,23 @@ intel_miptree_create_internal(struct intel_context *intel,
>     brw_miptree_layout(intel, mt);
>  #endif
>  
> +   if (intel->has_separate_stencil &&
> +       _mesa_is_depthstencil_format(_mesa_get_format_base_format(format))) {

Shouldn't this be must_have_separate_stencil until patch 39/41?

> +      mt->stencil_mt = intel_miptree_create(intel,
> +                                            mt->target,
> +                                            MESA_FORMAT_S8,
> +                                            mt->first_level,
> +                                            mt->last_level,
> +                                            mt->width0,
> +                                            mt->height0,
> +                                            mt->depth0,
> +                                            true);
> +      if (!mt->stencil_mt) {
> +	 intel_miptree_release(&mt);
> +	 return NULL;
> +      }
> +   }
> +
>     return mt;
>  }
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20111118/828ef2a3/attachment.pgp>


More information about the mesa-dev mailing list