[Mesa-dev] [PATCH] i965: Reserve space for "Vertex Count" in GS outputs.

Paul Berry stereotype441 at gmail.com
Mon Jan 20 23:19:35 PST 2014


On 20 January 2014 22:56, Kenneth Graunke <kenneth at whitecape.org> wrote:

> v2: Also increment ir->offset in the GS visitor, rather than at the
>     final assembly generation stage (requested by Paul).
>
> Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
> ---
>  src/mesa/drivers/dri/i965/brw_vec4_gs.c           | 6 ++++++
>  src/mesa/drivers/dri/i965/brw_vec4_gs_visitor.cpp | 7 +++++++
>  2 files changed, 13 insertions(+)
>
> Hey Paul,
>
> I think I implemented all of your feedback from last time.  (Previously,
> I'd done this in gen8_vec4_generator, and you asked me to move it to the
> visitor.  This patch does that - and it is indeed much nicer.)
>
>  --Ken
>

Looks good, thanks!

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


>
> diff --git a/src/mesa/drivers/dri/i965/brw_vec4_gs.c
> b/src/mesa/drivers/dri/i965/brw_vec4_gs.c
> index 018b0b6..c40112b 100644
> --- a/src/mesa/drivers/dri/i965/brw_vec4_gs.c
> +++ b/src/mesa/drivers/dri/i965/brw_vec4_gs.c
> @@ -194,6 +194,12 @@ do_gs_prog(struct brw_context *brw,
>        c.prog_data.output_vertex_size_hwords * 32 *
> gp->program.VerticesOut;
>     output_size_bytes += 32 * c.prog_data.control_data_header_size_hwords;
>
> +   /* Broadwell stores "Vertex Count" as a full 8 DWord (32 byte) URB
> output,
> +    * which comes before the control header.
> +    */
> +   if (brw->gen >= 8)
> +      output_size_bytes += 32;
> +
>     assert(output_size_bytes >= 1);
>     if (output_size_bytes > GEN7_MAX_GS_URB_ENTRY_SIZE_BYTES)
>        return false;
> diff --git a/src/mesa/drivers/dri/i965/brw_vec4_gs_visitor.cpp
> b/src/mesa/drivers/dri/i965/brw_vec4_gs_visitor.cpp
> index f33c80d..f0351ea 100644
> --- a/src/mesa/drivers/dri/i965/brw_vec4_gs_visitor.cpp
> +++ b/src/mesa/drivers/dri/i965/brw_vec4_gs_visitor.cpp
> @@ -267,6 +267,13 @@ vec4_gs_visitor::emit_urb_write_opcode(bool complete)
>
>     vec4_instruction *inst = emit(GS_OPCODE_URB_WRITE);
>     inst->offset = c->prog_data.control_data_header_size_hwords;
> +
> +   /* We need to increment Global Offset by 1 to make room for Broadwell's
> +    * extra "Vertex Count" payload at the beginning of the URB entry.
> +    */
> +   if (brw->gen >= 8)
> +      inst->offset++;
> +
>     inst->urb_write_flags = BRW_URB_WRITE_PER_SLOT_OFFSET;
>     return inst;
>  }
> --
> 1.8.5.2
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20140120/c04bd446/attachment.html>


More information about the mesa-dev mailing list