i965g: special case setup when fs has no inputs

This commit is contained in:
Keith Whitwell 2009-11-19 19:15:21 -08:00
parent 47cef2bb8f
commit 34a01929d5
3 changed files with 55 additions and 25 deletions

View File

@ -64,32 +64,42 @@ static enum pipe_error compile_sf_prog( struct brw_context *brw,
c.prog_data.urb_read_length = c.nr_attr_regs; c.prog_data.urb_read_length = c.nr_attr_regs;
c.prog_data.urb_entry_size = c.nr_setup_regs * 2; c.prog_data.urb_entry_size = c.nr_setup_regs * 2;
/* Special case when there are no attributes to setup.
/* Which primitive? Or all three? *
* XXX: should be able to set nr_setup_attrs to nr_attrs-1 -- but
* breaks vp-tris.c
*/ */
switch (key->primitive) { if (c.nr_attrs - 1 == 0) {
case SF_TRIANGLES: c.nr_verts = 0;
c.nr_verts = 3; brw_emit_null_setup( &c );
brw_emit_tri_setup( &c, GL_TRUE ); }
break; else {
case SF_LINES: /* Which primitive? Or all three?
c.nr_verts = 2; */
brw_emit_line_setup( &c, GL_TRUE ); switch (key->primitive) {
break; case SF_TRIANGLES:
case SF_POINTS: c.nr_verts = 3;
c.nr_verts = 1; brw_emit_tri_setup( &c, GL_TRUE );
if (key->do_point_sprite) break;
brw_emit_point_sprite_setup( &c, GL_TRUE ); case SF_LINES:
else c.nr_verts = 2;
brw_emit_point_setup( &c, GL_TRUE ); brw_emit_line_setup( &c, GL_TRUE );
break; break;
case SF_UNFILLED_TRIS: case SF_POINTS:
c.nr_verts = 3; c.nr_verts = 1;
brw_emit_anyprim_setup( &c ); if (key->do_point_sprite)
break; brw_emit_point_sprite_setup( &c, GL_TRUE );
default: else
assert(0); brw_emit_point_setup( &c, GL_TRUE );
return PIPE_ERROR_BAD_INPUT; break;
case SF_UNFILLED_TRIS:
c.nr_verts = 3;
brw_emit_anyprim_setup( &c );
break;
default:
assert(0);
return PIPE_ERROR_BAD_INPUT;
}
} }
/* get the program /* get the program

View File

@ -112,6 +112,7 @@ struct brw_sf_compile {
}; };
void brw_emit_null_setup( struct brw_sf_compile *c );
void brw_emit_tri_setup( struct brw_sf_compile *c, GLboolean allocate ); void brw_emit_tri_setup( struct brw_sf_compile *c, GLboolean allocate );
void brw_emit_line_setup( struct brw_sf_compile *c, GLboolean allocate ); void brw_emit_line_setup( struct brw_sf_compile *c, GLboolean allocate );
void brw_emit_point_setup( struct brw_sf_compile *c, GLboolean allocate ); void brw_emit_point_setup( struct brw_sf_compile *c, GLboolean allocate );

View File

@ -352,6 +352,25 @@ static GLboolean calculate_masks( struct brw_sf_compile *c,
} }
void brw_emit_null_setup( struct brw_sf_compile *c )
{
struct brw_compile *p = &c->func;
/* m0 is implicitly copied from r0 in the send instruction:
*/
brw_urb_WRITE(p,
brw_null_reg(),
0,
brw_vec8_grf(0, 0), /* r0, will be copied to m0 */
0, /* allocate */
1, /* used */
1, /* msg len */
0, /* response len */
1, /* eot */
1, /* writes complete */
0, /* offset */
BRW_URB_SWIZZLE_TRANSPOSE);
}
void brw_emit_tri_setup( struct brw_sf_compile *c, GLboolean allocate) void brw_emit_tri_setup( struct brw_sf_compile *c, GLboolean allocate)
{ {