[Mesa-dev] first attempt at shader stencil export

Dave Airlie airlied at gmail.com
Wed Sep 29 23:41:15 PDT 2010


some background:

so on r600g, the only way to directly write to the stencil is via the
shader, using a transfer would require an extra step to flush the DS
buffer out via the pipe again to make it useable by the hw as a DS
buffer. So using the current gallium stencil draw would be a major
overhead, compared to just doing it properly.

So to do it properly I decided to expose the
GL_ARB_shader_stencil_export type functionality.

http://cgit.freedesktop.org/~airlied/mesa/log/?h=gallium-stencil-export

7 commits in here:

two simple one liners, add the cap to gallium headers, and add
FRAG_RESULT_STENCIL to mesa.
then a "fix" to the mesa texstore so it will store S8 in an 8/24 so we
can put the stencil values in a texture.
mesa state tracker support to use the new capability to hw accel
drawpixels on the stencil (outputs to Y of FRAG_RESULT_STENCIL).
r600g support for the capability take the second
TGSI_SEMANTIC_POSITION output and use its Y value as stencil (looking
at this now, I should probably be taking the X value really).
very initial mesa/GLSL support for the extension (completely untested).
initial softpipe support for the capability a demonstration.

TODO:
probably stop using Y (this was just because the hw uses Y), the GLSL
extension just defines an integer output for the fragprog.
fix the 24/8 texstore variant.
write some test code for piglit and test the GL extension/GLSL bits.

I'm a lot more interested in the non-GL extension bits as it allows
stencil writes to work properly on r600g.

Dave.


More information about the mesa-dev mailing list