mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-25 04:20:08 +01:00
i965: new VS: move clip distance computation (GEN5+) to a separate function.
Reviewed-by: Eric Anholt <eric@anholt.net>
This commit is contained in:
parent
d9eca0b279
commit
d1435a49e9
2 changed files with 23 additions and 13 deletions
|
|
@ -465,6 +465,7 @@ public:
|
|||
|
||||
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);
|
||||
|
|
|
|||
|
|
@ -1789,6 +1789,24 @@ vec4_visitor::emit_psiz_and_flags(struct brw_reg reg)
|
|||
}
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
|
|
@ -1814,7 +1832,8 @@ 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++;
|
||||
|
|
@ -1858,18 +1877,8 @@ vec4_visitor::emit_vue_header_gen6(int 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;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue