void emit_ndc_computation();
void emit_psiz_and_flags(struct brw_reg reg);
+ void emit_clip_distances(struct brw_reg reg, int offset);
int emit_vue_header_gen6(int header_mrf);
int emit_vue_header_gen4(int header_mrf);
void emit_urb_writes(void);
}
}
+void
+vec4_visitor::emit_clip_distances(struct brw_reg reg, int offset)
+{
+ if (intel->gen < 6) {
+ /* Clip distance slots are set aside in gen5, but they are not used. It
+ * is not clear whether we actually need to set aside space for them,
+ * but the performance cost is negligible.
+ */
+ return;
+ }
+
+ for (int i = 0; i + offset < c->key.nr_userclip && i < 4; ++i) {
+ emit(DP4(dst_reg(brw_writemask(reg, 1 << i)),
+ src_reg(output_reg[VERT_RESULT_HPOS]),
+ src_reg(c->userplane[i + offset])));
+ }
+}
+
int
vec4_visitor::emit_vue_header_gen4(int header_mrf)
{
src_reg(output_reg[VERT_RESULT_HPOS])));
/* user clip distance. */
- header_mrf += 2;
+ emit_clip_distances(brw_message_reg(header_mrf++), 0);
+ emit_clip_distances(brw_message_reg(header_mrf++), 4);
/* Pad so that vertex element data is aligned. */
header_mrf++;
current_annotation = "user clip distances";
if (c->key.nr_userclip) {
- for (int i = 0; i < c->key.nr_userclip; i++) {
- struct brw_reg m;
- if (i < 4)
- m = brw_message_reg(header_mrf);
- else
- m = brw_message_reg(header_mrf + 1);
-
- emit(DP4(dst_reg(brw_writemask(m, 1 << (i & 3))),
- src_reg(output_reg[VERT_RESULT_HPOS]),
- src_reg(c->userplane[i])));
- }
- header_mrf += 2;
+ emit_clip_distances(brw_message_reg(header_mrf++), 0);
+ emit_clip_distances(brw_message_reg(header_mrf++), 4);
}
current_annotation = NULL;