static void copy_colors( struct brw_sf_compile *c, struct brw_reg dst, struct brw_reg src) { struct brw_compile *p = &c->func; GLuint i; for (i = VERT_RESULT_COL0; i <= VERT_RESULT_COL1; i++) { if (have_attr(c,i)) brw_MOV(p, get_vert_attr(c, dst, i), get_vert_attr(c, src, i)); } }
/*********************************************************************** * Twoside lighting */ static void copy_bfc( struct brw_sf_compile *c, struct brw_reg vert ) { struct brw_compile *p = &c->func; GLuint i; for (i = 0; i < 2; i++) { if (have_attr(c, VERT_RESULT_COL0+i) && have_attr(c, VERT_RESULT_BFC0+i)) brw_MOV(p, get_vert_attr(c, vert, VERT_RESULT_COL0+i), get_vert_attr(c, vert, VERT_RESULT_BFC0+i)); } }
/** * Sets VERT_RESULT_FOGC.Y for gl_FrontFacing * * This is currently executed if the fragment program uses VERT_RESULT_FOGC * at all, but this could be eliminated with a scan of the FP contents. */ static void do_front_facing( struct brw_sf_compile *c ) { struct brw_compile *p = &c->func; int i; if (!have_attr(c, VERT_RESULT_FOGC)) return; brw_push_insn_state(p); brw_CMP(p, brw_null_reg(), c->key.frontface_ccw ? BRW_CONDITIONAL_G : BRW_CONDITIONAL_L, c->det, brw_imm_f(0)); brw_set_predicate_control(p, BRW_PREDICATE_NONE); for (i = 0; i < 3; i++) { struct brw_reg fogc = get_vert_attr(c, c->vert[i],FRAG_ATTRIB_FOGC); brw_MOV(p, get_element(fogc, 1), brw_imm_f(0)); brw_set_predicate_control(p, BRW_PREDICATE_NORMAL); brw_MOV(p, get_element(fogc, 1), brw_imm_f(1)); brw_set_predicate_control(p, BRW_PREDICATE_NONE); } brw_pop_insn_state(p); }