[Mesa-dev] [PATCH 12/41] intel: Track the miptree layer wrapped by a renderbuffer

Kenneth Graunke kenneth at whitecape.org
Fri Nov 18 16:04:06 PST 2011


On 11/17/2011 07:58 PM, Chad Versace wrote:
> Add two fields to intel_renderbuffer:
>     mt_level
>     mt_layer
> 
> Multiple renderbuffers may simultaneously wrap a single texture and each
> provide a different view into that texture. [Consider
> glFramebufferTextureLayer()].  The new fields indicate which slice of the
> miptree is wrapped by the renderbuffer.
> 
> The buffer resolve operations, to be introduced in the future, require
> these fields in order to resolve the correct slice in the miptree.
> 
> Signed-off-by: Chad Versace <chad.versace at linux.intel.com>
> ---
>  src/mesa/drivers/dri/intel/intel_fbo.c |   24 ++++++++++++++++++++++++
>  src/mesa/drivers/dri/intel/intel_fbo.h |   17 +++++++++++++++++
>  2 files changed, 41 insertions(+), 0 deletions(-)
> 
> diff --git a/src/mesa/drivers/dri/intel/intel_fbo.c b/src/mesa/drivers/dri/intel/intel_fbo.c
> index 8c41956..ed58078 100644
> --- a/src/mesa/drivers/dri/intel/intel_fbo.c
> +++ b/src/mesa/drivers/dri/intel/intel_fbo.c
> @@ -973,15 +973,39 @@ intel_update_wrapper(struct gl_context *ctx, struct intel_renderbuffer *irb,
>     irb->Base.Delete = intel_delete_renderbuffer;
>     irb->Base.AllocStorage = intel_nop_alloc_storage;
>  
> +   irb->mt_level = att->TextureLevel;
> +   if (att->CubeMapFace > 0) {
> +      assert(att->Zoffset == 0);
> +      irb->mt_layer = att->CubeMapFace;
> +   } else {
> +      irb->mt_layer= att->Zoffset;
> +   }

Ditto...relying on the unclear property that att->Zoffset == 0 when
att->CubeMapFace == 0.  Maybe att->Texture->Target ==
GL_TEXTURE_CUBE_MAP?  (Hopefully att->Texture is guaranteed to be !=
NULL...)

> +
>     if (intel_image->stencil_rb) {
>        /*  The tex image has packed depth/stencil format, but is using separate
>         *  stencil. It shares its embedded depth and stencil renderbuffers with
>         *  the renderbuffer wrapper.
> +       *
> +       *  FIXME: glFramebufferTexture*() is broken for depthstencil textures
> +       *  FIXME: with separate stencil. To fix this, we must create a separate
> +       *  FIXME: pair of depth/stencil renderbuffers for each attached slice
> +       *  FIXME: of the miptree.
>         */
> +      struct intel_renderbuffer *depth_irb;
> +      struct intel_renderbuffer *stencil_irb;
> +
>        _mesa_reference_renderbuffer(&irb->wrapped_depth,
>  				   intel_image->depth_rb);
>        _mesa_reference_renderbuffer(&irb->wrapped_stencil,
>  				   intel_image->stencil_rb);
> +
> +      depth_irb = intel_renderbuffer(intel_image->depth_rb);
> +      depth_irb->mt_level = irb->mt_level;
> +      depth_irb->mt_layer = irb->mt_layer;
> +
> +      stencil_irb = intel_renderbuffer(intel_image->stencil_rb);
> +      stencil_irb->mt_level = irb->mt_level;
> +      stencil_irb->mt_layer = irb->mt_layer;
>     } else {
>        intel_miptree_reference(&irb->mt, intel_image->mt);
>     }
> diff --git a/src/mesa/drivers/dri/intel/intel_fbo.h b/src/mesa/drivers/dri/intel/intel_fbo.h
> index 34d2f9a..3a21374 100644
> --- a/src/mesa/drivers/dri/intel/intel_fbo.h
> +++ b/src/mesa/drivers/dri/intel/intel_fbo.h
> @@ -52,6 +52,23 @@ struct intel_renderbuffer
>     GLbitfield map_mode;
>  
>     /**
> +    * \name Miptree view
> +    * \{
> +    *
> +    * Multiple renderbuffers may simultaneously wrap a single texture and each
> +    * provide a different view into that texture. The fields below indicate
> +    * which miptree slice is wrapped by this renderbuffer.  The fields' values
> +    * are consistent with the 'level' and 'layer' parameters of
> +    * glFramebufferTextureLayer().
> +    *
> +    * For renderbuffers not created with glFramebufferTexture*(), mt_level and
> +    * mt_layer are 0.
> +    */
> +   unsigned int mt_level;
> +   unsigned int mt_layer;
> +   /** \} */
> +
> +   /**
>      * \name Packed depth/stencil unwrappers
>      *
>      * If the intel_context is using separate stencil and this renderbuffer has



More information about the mesa-dev mailing list