[Mesa-dev] [PATCH] i965: Mask the cut index based on the index buffer type in 3DSTATE_VF.

Paul Berry stereotype441 at gmail.com
Thu May 23 16:18:44 PDT 2013


On 23 May 2013 15:46, Kenneth Graunke <kenneth at whitecape.org> wrote:

> According to the documentation: "The Cut Index is compared to the
> fetched (and possibly-sign-extended) vertex index, and if these values
> are equal, the current primitive topology is terminated.  Note that,
> for index buffers <32bpp, it is possible to set the Cut Index to a
> (large) value that will never match a sign-extended vertex index."
>
> This suggests that we should not set the value to 0xFFFFFFFF for
> unsigned byte or short index buffers, but rather 0xFF or 0xFFFF.
>
> Fixes sporadic failures in the ES 3 instanced_arrays_primitive_restart
> conformance test when run in combination with other tests.  No Piglit
> regressions.
>
> Cc: Ian Romanick <idr at freedesktop.org
> Cc: Paul Berry <stereotype441 at gmail.com>
> Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
> ---
>  src/mesa/drivers/dri/i965/brw_primitive_restart.c | 27
> ++++++++++++++++-------
>  1 file changed, 19 insertions(+), 8 deletions(-)
>
> diff --git a/src/mesa/drivers/dri/i965/brw_primitive_restart.c
> b/src/mesa/drivers/dri/i965/brw_primitive_restart.c
> index f824915..cf4a1ea 100644
> --- a/src/mesa/drivers/dri/i965/brw_primitive_restart.c
> +++ b/src/mesa/drivers/dri/i965/brw_primitive_restart.c
> @@ -183,19 +183,30 @@ haswell_upload_cut_index(struct brw_context *brw)
>     if (!intel->is_haswell)
>        return;
>
> -   const unsigned cut_index_setting =
> -      ctx->Array._PrimitiveRestart ? HSW_CUT_INDEX_ENABLE : 0;
> -
> -   BEGIN_BATCH(2);
> -   OUT_BATCH(_3DSTATE_VF << 16 | cut_index_setting | (2 - 2));
> -   OUT_BATCH(ctx->Array._RestartIndex);
> -   ADVANCE_BATCH();
> +   if (ctx->Array._PrimitiveRestart) {
> +      int cut_index = ctx->Array._RestartIndex;
> +
> +      if (brw->ib.type == GL_UNSIGNED_BYTE)
>

Can we put a "/* BRW_NEW_INDEX_BUFFER */" comment above this line?  With
that, this patch is:

Reviewed-by: Paul Berry <stereotype441 at gmail.com>


> +         cut_index &= 0xff;
> +      else if (brw->ib.type == GL_UNSIGNED_SHORT)
> +         cut_index &= 0xffff;
> +
> +      BEGIN_BATCH(2);
> +      OUT_BATCH(_3DSTATE_VF << 16 | HSW_CUT_INDEX_ENABLE | (2 - 2));
> +      OUT_BATCH(cut_index);
> +      ADVANCE_BATCH();
> +   } else {
> +      BEGIN_BATCH(2);
> +      OUT_BATCH(_3DSTATE_VF << 16 | (2 - 2));
> +      OUT_BATCH(0);
> +      ADVANCE_BATCH();
> +   }
>  }
>
>  const struct brw_tracked_state haswell_cut_index = {
>     .dirty = {
>        .mesa  = _NEW_TRANSFORM,
> -      .brw   = 0,
> +      .brw   = BRW_NEW_INDEX_BUFFER,
>        .cache = 0,
>     },
>     .emit = haswell_upload_cut_index,
> --
> 1.8.2.2
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20130523/b2b61712/attachment.html>


More information about the mesa-dev mailing list