i965: old VS: use the VUE map to compute the URB entry size.

Previously, the old VS backend computed the URB entry size by adding
the number of vertex shader outputs to the size of the URB header.
This often produced a larger result than necessary, because some
vertex shader outputs are stored in the header, so they were being
double counted.  This patch changes the old VS backend to compute the
URB entry size directly from the number of slots in the VUE map.

Note: there's a subtle change in that we no longer count header
registers towards the size of the VF input.  I believe this is
correct, because the header is only emitted in the output of the VS
stage--it is not present in the input.  (As evidence for this, note
that brw_vs_state.c sets urb_entry_read_offset to 0--it does not
include space for the header as part of the VS input).

Reviewed-by: Eric Anholt <eric@anholt.net>
This commit is contained in:
Paul Berry 2011-08-22 22:09:02 -07:00
parent 3c17efd148
commit 85e57eb9ca
2 changed files with 7 additions and 25 deletions

View file

@ -65,7 +65,6 @@ struct brw_vs_compile {
struct brw_vue_map vue_map;
GLuint first_output;
GLuint nr_outputs;
GLuint last_scratch;
GLuint first_tmp;

View file

@ -405,36 +405,19 @@ static void brw_vs_alloc_regs( struct brw_vs_compile *c )
/* The VS VUEs are shared by VF (outputting our inputs) and VS, so size
* them to fit the biggest thing they need to.
*/
attributes_in_vue = MAX2(c->nr_outputs, c->nr_inputs);
attributes_in_vue = MAX2(c->vue_map.num_slots, c->nr_inputs);
/* See emit_vertex_write() for where the VUE's overhead on top of the
* attributes comes from.
*/
if (intel->gen >= 7) {
int header_regs = 2;
if (c->key.nr_userclip)
header_regs += 2;
/* Each attribute is 16 bytes (1 vec4), so dividing by 4 gives us the
* number of 64-byte (512-bit) units.
*/
c->prog_data.urb_entry_size = (attributes_in_vue + header_regs + 3) / 4;
} else if (intel->gen == 6) {
int header_regs = 2;
if (c->key.nr_userclip)
header_regs += 2;
/* Each attribute is 16 bytes (1 vec4), so dividing by 8 gives us the
if (intel->gen == 6) {
/* Each attribute is 32 bytes (2 vec4s), so dividing by 8 gives us the
* number of 128-byte (1024-bit) units.
*/
c->prog_data.urb_entry_size = (attributes_in_vue + header_regs + 7) / 8;
} else if (intel->gen == 5)
c->prog_data.urb_entry_size = ALIGN(attributes_in_vue, 8) / 8;
} else {
/* Each attribute is 16 bytes (1 vec4), so dividing by 4 gives us the
* number of 64-byte (512-bit) units.
*/
c->prog_data.urb_entry_size = (attributes_in_vue + 6 + 3) / 4;
else
c->prog_data.urb_entry_size = (attributes_in_vue + 2 + 3) / 4;
c->prog_data.urb_entry_size = ALIGN(attributes_in_vue, 4) / 4;
}
c->prog_data.total_grf = reg;