brw_gs_emit.c File Reference

Include dependency graph for brw_gs_emit.c:

Go to the source code of this file.

Functions

static void brw_gs_alloc_regs (struct brw_gs_compile *c, unsigned nr_verts)
static void brw_gs_emit_vue (struct brw_gs_compile *c, struct brw_reg vert, boolean last, unsigned header)
void brw_gs_quads (struct brw_gs_compile *c)
void brw_gs_quad_strip (struct brw_gs_compile *c)
void brw_gs_tris (struct brw_gs_compile *c)
void brw_gs_lines (struct brw_gs_compile *c)
void brw_gs_points (struct brw_gs_compile *c)


Function Documentation

static void brw_gs_alloc_regs ( struct brw_gs_compile c,
unsigned  nr_verts 
) [static]

Definition at line 38 of file brw_gs_emit.c.

References BRW_REGISTER_TYPE_UD, brw_vec4_grf(), brw_vec8_grf(), brw_gs_compile::nr_regs, brw_gs_compile::prog_data, brw_gs_compile::R0, brw_gs_compile::reg, retype(), brw_gs_prog_data::total_grf, brw_gs_prog_data::urb_read_length, and brw_gs_compile::vertex.

00040 {
00041    unsigned i = 0,j;
00042 
00043    /* Register usage is static, precompute here:
00044     */
00045    c->reg.R0 = retype(brw_vec8_grf(i, 0), BRW_REGISTER_TYPE_UD); i++;
00046 
00047    /* Payload vertices plus space for more generated vertices:
00048     */
00049    for (j = 0; j < nr_verts; j++) {
00050       c->reg.vertex[j] = brw_vec4_grf(i, 0);
00051       i += c->nr_regs;
00052    }
00053 
00054    c->prog_data.urb_read_length = c->nr_regs; 
00055    c->prog_data.total_grf = i;
00056 }

static void brw_gs_emit_vue ( struct brw_gs_compile c,
struct brw_reg  vert,
boolean  last,
unsigned  header 
) [static]

Definition at line 59 of file brw_gs_emit.c.

References brw_copy8(), brw_imm_ud(), brw_message_reg(), brw_MOV(), brw_null_reg(), BRW_REGISTER_TYPE_UD, BRW_URB_SWIZZLE_NONE, brw_urb_WRITE(), brw_gs_compile::func, get_element_ud(), brw_gs_compile::nr_regs, brw_gs_compile::R0, brw_gs_compile::reg, and retype().

00063 {
00064    struct brw_compile *p = &c->func;
00065    boolean allocate = !last;
00066 
00067    /* Overwrite PrimType and PrimStart in the message header, for
00068     * each vertex in turn:
00069     */
00070    brw_MOV(p, get_element_ud(c->reg.R0, 2), brw_imm_ud(header));
00071 
00072    /* Copy the vertex from vertn into m1..mN+1:
00073     */
00074    brw_copy8(p, brw_message_reg(1), vert, c->nr_regs);
00075 
00076    /* Send each vertex as a seperate write to the urb.  This is
00077     * different to the concept in brw_sf_emit.c, where subsequent
00078     * writes are used to build up a single urb entry.  Each of these
00079     * writes instantiates a seperate urb entry, and a new one must be
00080     * allocated each time.
00081     */
00082    brw_urb_WRITE(p, 
00083                  allocate ? c->reg.R0 : retype(brw_null_reg(), BRW_REGISTER_TYPE_UD),
00084                  0,
00085                  c->reg.R0,
00086                  allocate,
00087                  1,             /* used */
00088                  c->nr_regs + 1, /* msg length */
00089                  allocate ? 1 : 0, /* response length */
00090                  allocate ? 0 : 1, /* eot */
00091                  1,             /* writes_complete */
00092                  0,             /* urb offset */
00093                  BRW_URB_SWIZZLE_NONE);
00094 }

void brw_gs_lines ( struct brw_gs_compile c  ) 

Definition at line 129 of file brw_gs_emit.c.

References _3DPRIM_LINESTRIP, brw_gs_alloc_regs(), brw_gs_emit_vue(), R02_PRIM_END, R02_PRIM_START, brw_gs_compile::reg, and brw_gs_compile::vertex.

00130 {
00131    brw_gs_alloc_regs(c, 2);
00132    brw_gs_emit_vue(c, c->reg.vertex[0], 0, ((_3DPRIM_LINESTRIP << 2) | R02_PRIM_START));
00133    brw_gs_emit_vue(c, c->reg.vertex[1], 1, ((_3DPRIM_LINESTRIP << 2) | R02_PRIM_END));
00134 }

void brw_gs_points ( struct brw_gs_compile c  ) 

Definition at line 136 of file brw_gs_emit.c.

References _3DPRIM_POINTLIST, brw_gs_alloc_regs(), brw_gs_emit_vue(), R02_PRIM_END, R02_PRIM_START, brw_gs_compile::reg, and brw_gs_compile::vertex.

00137 {
00138    brw_gs_alloc_regs(c, 1);
00139    brw_gs_emit_vue(c, c->reg.vertex[0], 1, ((_3DPRIM_POINTLIST << 2) | R02_PRIM_START | R02_PRIM_END));
00140 }

void brw_gs_quad_strip ( struct brw_gs_compile c  ) 

Definition at line 111 of file brw_gs_emit.c.

References _3DPRIM_POLYGON, brw_gs_alloc_regs(), brw_gs_emit_vue(), R02_PRIM_END, R02_PRIM_START, brw_gs_compile::reg, and brw_gs_compile::vertex.

00112 {
00113    brw_gs_alloc_regs(c, 4);
00114    
00115    brw_gs_emit_vue(c, c->reg.vertex[2], 0, ((_3DPRIM_POLYGON << 2) | R02_PRIM_START));
00116    brw_gs_emit_vue(c, c->reg.vertex[3], 0, (_3DPRIM_POLYGON << 2));
00117    brw_gs_emit_vue(c, c->reg.vertex[0], 0, (_3DPRIM_POLYGON << 2)); 
00118    brw_gs_emit_vue(c, c->reg.vertex[1], 1, ((_3DPRIM_POLYGON << 2) | R02_PRIM_END));
00119 }

void brw_gs_quads ( struct brw_gs_compile c  ) 

Definition at line 98 of file brw_gs_emit.c.

References _3DPRIM_POLYGON, brw_gs_alloc_regs(), brw_gs_emit_vue(), R02_PRIM_END, R02_PRIM_START, brw_gs_compile::reg, and brw_gs_compile::vertex.

00099 {
00100    brw_gs_alloc_regs(c, 4);
00101    
00102    /* Use polygons for correct edgeflag behaviour. Note that vertex 3
00103     * is the PV for quads, but vertex 0 for polygons:
00104     */
00105    brw_gs_emit_vue(c, c->reg.vertex[3], 0, ((_3DPRIM_POLYGON << 2) | R02_PRIM_START));
00106    brw_gs_emit_vue(c, c->reg.vertex[0], 0, (_3DPRIM_POLYGON << 2));
00107    brw_gs_emit_vue(c, c->reg.vertex[1], 0, (_3DPRIM_POLYGON << 2)); 
00108    brw_gs_emit_vue(c, c->reg.vertex[2], 1, ((_3DPRIM_POLYGON << 2) | R02_PRIM_END));
00109 }

void brw_gs_tris ( struct brw_gs_compile c  ) 

Definition at line 121 of file brw_gs_emit.c.

References _3DPRIM_TRILIST, brw_gs_alloc_regs(), brw_gs_emit_vue(), R02_PRIM_END, R02_PRIM_START, brw_gs_compile::reg, and brw_gs_compile::vertex.

00122 {
00123    brw_gs_alloc_regs(c, 3);
00124    brw_gs_emit_vue(c, c->reg.vertex[0], 0, ((_3DPRIM_TRILIST << 2) | R02_PRIM_START));
00125    brw_gs_emit_vue(c, c->reg.vertex[1], 0, (_3DPRIM_TRILIST << 2));
00126    brw_gs_emit_vue(c, c->reg.vertex[2], 1, ((_3DPRIM_TRILIST << 2) | R02_PRIM_END));
00127 }


Generated on Tue Sep 29 06:25:37 2009 for Gallium3D by  doxygen 1.5.4