i965/gs: Allocate URB space for use by GS.

Graphics / Mesa 3D Graphics Library / Mesa - Paul Berry [gmail.com] - 31 August 2013 19:11 UTC

Previously, we gave all of the URB space (other than the small amount that is used for push constants) to the vertex shader. However, when a geometry shader is active, we need to divide it up between the
vertex and geometry shaders.

The size of the URB entries for the vertex and geometry shaders can
vary dramatically from one shader to the next. So it doesn't make sense to simply split the available space in two. In particular:

- On Ivy Bridge GT1, this would not leave enough space for the worst case geometry shader, which requires 64k of URB space.

- Due to hardware-imposed limits on the maximum number of URB entries, sometimes a given shader stage will only be capable of using a small amount of URB space. When this happens, it may make sense to allocate substantially less than half of the available space to that stage.

Our algorithm for dividing space between the two stages is to first compute (a) the minimum amount of URB space that each stage needs in order to function properly, and (b) the amount of additional URB space that each stage "wants" (i.e. that it would be capable of making use of). If the total amount of space available is not enough to satisfy needs + wants, then each stage's "wants" amount is scaled back by the same factor in order to fit.

When only a vertex shader is active, this algorithm produces equivalent results to the old algorithm (if the vertex shader stage can make use of all the available URB space, we assign all the space to it; if it can't, we let it use as much as it can).

In the future, when we need to support tessellation control and tessellation evaluation pipeline stages, it should be straightforward to expand this algorithm to cover them.

v2: Use "unsigned" rather than "GLuint".

fffba41 i965/gs: Allocate URB space for use by GS.
src/mesa/drivers/dri/i965/brw_context.h | 6 +-
src/mesa/drivers/dri/i965/gen7_blorp.cpp | 16 +--
src/mesa/drivers/dri/i965/gen7_urb.c | 156 +++++++++++++++++++++++++-----
3 files changed, 143 insertions(+), 35 deletions(-)

Upstream: cgit.freedesktop.org


  • Share