[Mesa-dev] [PATCH 0/9] i965/gen7 geometry shader support, series 4

Paul Berry stereotype441 at gmail.com
Mon Sep 9 08:20:37 PDT 2013


This is the next installment of geometry shader support for i965 gen7.
Patches 1-2 are a rewrite of patches 21-22 of series 3 (confusingly
called "Initial geometry shader support, part 2" on the mailing
list--sorry about that), modified according to Ken's comments.  Once
these two patches land, i965/gen7 users should be able to try out
geometry shaders by setting the environment variables:

MESA_GL_VERSION_OVERRIDE=3.2
MESA_GLSL_VERSION_OVERRIDE=150

Patches 3-9 implement EndPrimitive() functionality.  This is tricky on
gen7 since all geometry shader output vertices are buffered in the URB
until the thread terminates, and then they are all processed as one
unit by the fixed function pipeline.  The hardware requires us to keep
track of when EndPrimitive() was called relative to EmitVertex(), and
populate a bitfield at the top of the URB with that information.  The
bitfield has one bit per vertex, indicating 0 if EndPrimitive() wasn't
called after emitting that vertex, 1 if it was.

It's difficult in GEN assembly to address a bitfield whose size is
greater than 32 bits, so we prepare 32 EndPrimitive bits at a time,
and write them out to the URB as soon as each batch of 32 bits is
completed.  This requires a little extra bookkeeping, but IMHO it's
much less work than if we'd tried to maintain all 256 bits in
registers and output them at the end.  Also, an advantage of the "32
bits at a time" scheme is that most of the extra bookkeeping goes away
for the common case of geometry shaders that set max_vertices <= 32.

[PATCH 1/9] i965/gen7: Extract a function for setting up a shader stage's constants.
[PATCH 2/9] i965/gs: Add a state atom to set up geometry shader state.
[PATCH 3/9] glsl: During linking, record whether a GS uses EndPrimitive().
[PATCH 4/9] i965/gs: Set control data header size/format appropriately for EndPrimitive().
[PATCH 5/9] i965/gen7: Allow URB_WRITE channel masks to be used.
[PATCH 6/9] i965/gen7: Add the ability to send URB_WRITE_OWORD messages.
[PATCH 7/9] i965/gs: Add opcodes needed for EndPrimitive().
[PATCH 8/9] i965/vec4: Add the ability to emit opcodes with just a dst register.
[PATCH 9/9] i965/gs: implement EndPrimitive() functionality in the visitor.


More information about the mesa-dev mailing list