<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Nov 29, 2016 at 12:24 PM, Nanley Chery <span dir="ltr"><<a href="mailto:nanleychery@gmail.com" target="_blank">nanleychery@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On Mon, Nov 28, 2016 at 03:45:41PM -0800, Jason Ekstrand wrote:<br>
> ---<br>
>  src/intel/vulkan/genX_cmd_<wbr>buffer.c | 51 ++++++++++++++++++++++++++++++<wbr>++++++--<br>
>  1 file changed, 49 insertions(+), 2 deletions(-)<br>
><br>
<br>
</span>This patch does not match the one you've merged<br>
(<wbr>d4ef87c1bb4290293148cbd6cb7827<wbr>64df38f8f4). The committed code<br>
introduces the following buggy hunk:<br>
<br>
@@ -2106,7 +2152,12 @@ cmd_buffer_emit_depth_stencil(<wbr>struct anv_cmd_buffer *cmd_buffer)<br>
<span class="">        * be combined with a stencil buffer so we use D32_FLOAT instead.<br>
        */<br>
       anv_batch_emit(&cmd_buffer-><wbr>batch, GENX(3DSTATE_DEPTH_BUFFER), db) {<br>
-         db.SurfaceType          = SURFTYPE_2D;<br>
</span>+         if (has_stencil) {<br>
+            db.SurfaceType       = SURFTYPE_2D;<br>
+               depth_stencil_surface_type(<wbr>image->stencil_surface.isl.<wbr>dim);<br>
+         } else {<br>
+            db.SurfaceType       = SURFTYPE_2D;<br>
+         }<br>
<span class="">          db.SurfaceFormat        = D32_FLOAT;<br>
          db.Width                = fb->width - 1;<br>
          db.Height               = fb->height - 1;<br></span></blockquote><div><br></div><div>Yes, it introduces that hunk.  What's buggy about it?  The old code made Jenkins explode.  Maybe I should have sent a v2.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">
<br>
</span>-Nanley<br>
<div><div class="h5"><br>
> diff --git a/src/intel/vulkan/genX_cmd_<wbr>buffer.c b/src/intel/vulkan/genX_cmd_<wbr>buffer.c<br>
> index a965cd6..c953b93 100644<br>
> --- a/src/intel/vulkan/genX_cmd_<wbr>buffer.c<br>
> +++ b/src/intel/vulkan/genX_cmd_<wbr>buffer.c<br>
> @@ -2033,6 +2033,51 @@ genX(cmd_buffer_emit_gen7_<wbr>depth_flush)(struct anv_cmd_buffer *cmd_buffer)<br>
>     }<br>
>  }<br>
><br>
> +static uint32_t<br>
> +depth_stencil_surface_type(<wbr>enum isl_surf_dim dim)<br>
> +{<br>
> +   switch (dim) {<br>
> +   case ISL_SURF_DIM_1D:<br>
> +      if (GEN_GEN >= 9) {<br>
> +         /* From the Sky Lake PRM, 3DSTATAE_DEPTH_BUFFER::<wbr>SurfaceType<br>
> +          *<br>
> +          *    Programming Notes:<br>
> +          *    The Surface Type of the depth buffer must be the same as the<br>
> +          *    Surface Type of the render target(s) (defined in<br>
> +          *    SURFACE_STATE), unless either the depth buffer or render<br>
> +          *    targets are SURFTYPE_NULL (see exception below for SKL).  1D<br>
> +          *    surface type not allowed for depth surface and stencil surface.<br>
> +          *<br>
> +          *    Workaround:<br>
> +          *    If depth/stencil is enabled with 1D render target,<br>
> +          *    depth/stencil surface type needs to be set to 2D surface type<br>
> +          *    and height set to 1. Depth will use (legacy) TileY and stencil<br>
> +          *    will use TileW. For this case only, the Surface Type of the<br>
> +          *    depth buffer can be 2D while the Surface Type of the render<br>
> +          *    target(s) are 1D, representing an exception to a programming<br>
> +          *    note above.<br>
> +          */<br>
> +         return SURFTYPE_2D;<br>
> +      } else {<br>
> +         return SURFTYPE_1D;<br>
> +      }<br>
> +   case ISL_SURF_DIM_2D:<br>
> +      return SURFTYPE_2D;<br>
> +   case ISL_SURF_DIM_3D:<br>
> +      if (GEN_GEN >= 9) {<br>
> +         /* The Sky Lake docs list the value for 3D as "Reserved".  However,<br>
> +          * they have the exact same layout as 2D arrays on gen9+, so we can<br>
> +          * just use 2D here.<br>
> +          */<br>
> +         return SURFTYPE_2D;<br>
> +      } else {<br>
> +         return SURFTYPE_3D;<br>
> +      }<br>
> +   default:<br>
> +      unreachable("Invalid surface dimension");<br>
> +   }<br>
> +}<br>
> +<br>
>  static void<br>
>  cmd_buffer_emit_depth_stencil(<wbr>struct anv_cmd_buffer *cmd_buffer)<br>
>  {<br>
> @@ -2054,7 +2099,8 @@ cmd_buffer_emit_depth_stencil(<wbr>struct anv_cmd_buffer *cmd_buffer)<br>
>     /* Emit 3DSTATE_DEPTH_BUFFER */<br>
>     if (has_depth) {<br>
>        anv_batch_emit(&cmd_buffer-><wbr>batch, GENX(3DSTATE_DEPTH_BUFFER), db) {<br>
> -         db.SurfaceType                   = SURFTYPE_2D;<br>
> +         db.SurfaceType                   =<br>
> +            depth_stencil_surface_type(<wbr>image->depth_surface.isl.dim);<br>
>           db.DepthWriteEnable              = true;<br>
>           db.StencilWriteEnable            = has_stencil;<br>
><br>
> @@ -2106,7 +2152,8 @@ cmd_buffer_emit_depth_stencil(<wbr>struct anv_cmd_buffer *cmd_buffer)<br>
>         * be combined with a stencil buffer so we use D32_FLOAT instead.<br>
>         */<br>
>        anv_batch_emit(&cmd_buffer-><wbr>batch, GENX(3DSTATE_DEPTH_BUFFER), db) {<br>
> -         db.SurfaceType          = SURFTYPE_2D;<br>
> +         db.SurfaceType          =<br>
> +            depth_stencil_surface_type(<wbr>image->depth_surface.isl.dim);<br>
>           db.SurfaceFormat        = D32_FLOAT;<br>
>           db.Width                = fb->width - 1;<br>
>           db.Height               = fb->height - 1;<br>
> --<br>
> 2.5.0.400.gff86faf<br>
><br>
</div></div>> ______________________________<wbr>_________________<br>
> mesa-dev mailing list<br>
> <a href="mailto:mesa-dev@lists.freedesktop.org">mesa-dev@lists.freedesktop.org</a><br>
> <a href="https://lists.freedesktop.org/mailman/listinfo/mesa-dev" rel="noreferrer" target="_blank">https://lists.freedesktop.org/<wbr>mailman/listinfo/mesa-dev</a><br>
</blockquote></div><br></div></div>