i965: Reserve space for "Vertex Count" in GS outputs.
authorKenneth Graunke <kenneth@whitecape.org>
Wed, 6 Nov 2013 00:55:06 +0000 (16:55 -0800)
committerKenneth Graunke <kenneth@whitecape.org>
Tue, 21 Jan 2014 08:20:14 +0000 (00:20 -0800)
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@whitecape.org>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
src/mesa/drivers/dri/i965/brw_vec4_gs.c
src/mesa/drivers/dri/i965/brw_vec4_gs_visitor.cpp

index 018b0b674611e1b08525ea0833ca6cdff6f101c9..c40112b0f1f9f568fd867d0b226d015a69249ee4 100644 (file)
@@ -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;
index f33c80dae3dcf9df766731a2955ac7771b1c1d74..f0351eaa32a2aac5fdd736c28065fdfc84aa8af8 100644 (file)
@@ -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;
 }