[Mesa-dev] [PATCH 2/2] anv: do not subtract the base layer to copute depth in 3DSTATE_DEPTH_BUFFER

Iago Toral itoral at igalia.com
Thu Mar 2 07:18:33 UTC 2017


On Wed, 2017-03-01 at 11:39 -0800, Jason Ekstrand wrote:
> On Tue, Feb 28, 2017 at 11:33 PM, Iago Toral <itoral at igalia.com>
> wrote:
> > On Fri, 2017-02-24 at 07:25 -0800, Jason Ekstrand wrote:
> > > On Feb 23, 2017 11:40 PM, "Iago Toral Quiroga" <itoral at igalia.com
> > >
> > > wrote:
> > > According to the PRM description of the Depth field:
> > >
> > >   "This field specifies the total number of levels for a volume
> > > texture
> > >    or the number of array elements allowed to be accessed
> > starting at
> > > the
> > >    Minimum Array Element for arrayed surfaces"
> > >
> > > However, ISL defines array_len as the length of the range
> > > [base_array_layer, base_array_layer + array_len], so it already
> > > represents
> > > a value relative to the base array layer like the hardware
> > expects.
> > >
> > > This fixes a number of new CTS tests that would crash otherwise:
> > > dEQP-VK.pipeline.render_to_image.*
> > > ---
> > >  src/intel/vulkan/genX_cmd_buffer.c | 3 +--
> > >  1 file changed, 1 insertion(+), 2 deletions(-)
> > >
> > > diff --git a/src/intel/vulkan/genX_cmd_buffer.c
> > > b/src/intel/vulkan/genX_cmd_buffer.c
> > > index 40a72f4..3c7b544 100644
> > > --- a/src/intel/vulkan/genX_cmd_buffer.c
> > > +++ b/src/intel/vulkan/genX_cmd_buffer.c
> > > @@ -2269,8 +2269,7 @@ cmd_buffer_emit_depth_stencil(struct
> > > anv_cmd_buffer *cmd_buffer)
> > >
> > >           assert(image->depth_surface.isl.dim !=
> > ISL_SURF_DIM_3D);
> > >           db.Depth =
> > > -         db.RenderTargetViewExtent =
> > > -            iview->isl.array_len - iview->isl.base_array_layer -
> > 1;
> > > +         db.RenderTargetViewExtent = iview->isl.array_len;
> > >
> > > Don't we still want the -1?
> > 
> > The PRM says this about the Depth field:
> > 
> > "This field specifies (...) the number of array elements allowed to
> > be
> > accessed starting at the Minimum Array Element for arrayed
> > surfaces"
> > 
> > And in anv_get_layerCount, we compute this value as:
> > 
> > range->layerCount == VK_REMAINING_ARRAY_LAYERS ?
> >    image->array_size - range->baseArrayLayer : range->layerCount;
> > 
> > Since we want the number of elements including Minimum Array
> > Element, I
> > think we don't want the subtraction.
> > 
> However, the field is a U11-1 field meaning it stores the actual
> value minus 1.  So for a single slice, the value in the field should
> be zero.

Right, I missed that, thanks!
I've just sent a v2 of the patch with that change.

> --Jason
>  
> > Iago
> > 
> > >  #if GEN_GEN >= 8
> > >           db.SurfaceQPitch =
> > > --
> > > 2.7.4
> > >
> > >
> > 


More information about the mesa-dev mailing list