/* Need to use a computed jump to copy flatshaded attributes as the * vertices are ordered according to y-coordinate before reaching this * point, so the PV could be anywhere. */ static void do_flatshade_triangle( struct brw_sf_compile *c ) { struct brw_compile *p = &c->func; struct brw_context *brw = p->brw; GLuint nr; GLuint jmpi = 1; /* Already done in clip program: */ if (c->key.primitive == SF_UNFILLED_TRIS) return; if (brw->gen == 5) jmpi = 2; nr = count_flatshaded_attributes(c); brw_MUL(p, c->pv, c->pv, brw_imm_d(jmpi*(nr*2+1))); brw_JMPI(p, c->pv, BRW_PREDICATE_NONE); copy_flatshaded_attributes(c, c->vert[1], c->vert[0]); copy_flatshaded_attributes(c, c->vert[2], c->vert[0]); brw_JMPI(p, brw_imm_d(jmpi*(nr*4+1)), BRW_PREDICATE_NONE); copy_flatshaded_attributes(c, c->vert[0], c->vert[1]); copy_flatshaded_attributes(c, c->vert[2], c->vert[1]); brw_JMPI(p, brw_imm_d(jmpi*nr*2), BRW_PREDICATE_NONE); copy_flatshaded_attributes(c, c->vert[0], c->vert[2]); copy_flatshaded_attributes(c, c->vert[1], c->vert[2]); }
static void do_flatshade_line( struct brw_sf_compile *c ) { struct brw_compile *p = &c->func; struct brw_context *brw = p->brw; struct brw_reg ip = brw_ip_reg(); GLuint nr; GLuint jmpi = 1; /* Already done in clip program: */ if (c->key.primitive == SF_UNFILLED_TRIS) return; if (brw->gen == 5) jmpi = 2; nr = count_flatshaded_attributes(c); brw_MUL(p, c->pv, c->pv, brw_imm_d(jmpi*(nr+1))); brw_JMPI(p, ip, ip, c->pv); copy_flatshaded_attributes(c, c->vert[1], c->vert[0]); brw_JMPI(p, ip, ip, brw_imm_ud(jmpi*nr)); copy_flatshaded_attributes(c, c->vert[0], c->vert[1]); }
static void do_flatshade_line( struct brw_sf_compile *c ) { struct brw_codegen *p = &c->func; GLuint nr; GLuint jmpi = 1; /* Already done in clip program: */ if (c->key.primitive == SF_UNFILLED_TRIS) return; if (p->devinfo->gen == 5) jmpi = 2; nr = count_flatshaded_attributes(c); brw_MUL(p, c->pv, c->pv, brw_imm_d(jmpi*(nr+1))); brw_JMPI(p, c->pv, BRW_PREDICATE_NONE); copy_flatshaded_attributes(c, c->vert[1], c->vert[0]); brw_JMPI(p, brw_imm_ud(jmpi*nr), BRW_PREDICATE_NONE); copy_flatshaded_attributes(c, c->vert[0], c->vert[1]); }