[Mesa-dev] stencil texturing trouble

Roland Scheidegger sroland at vmware.com
Tue Dec 15 18:50:27 PST 2015


looking at some piglit failures, I was wondering what is actually the
correct thing to do with stencil texturing. What do you put in the
missing channels?
The GL spec seems to say depth texture mode is only applicable to depth
textures, so what it is then? It looks like nvidia is returning the same
value in all channels, but from all possibilities I can think of what
should be returned (honor depth texture mode, treat it like a GL_RED
texture, ...) this seems to be about the least likely to actually be

Any pointers? Or maybe it just doesn't matter? (Oh and before I forget,
the piglit texwrap test is quite busted wrt stencil textures, so don't
trust it...)

There's actually another problem related to gallium, right now mesa/st
uses (in contrast to depth textures) XYZW swizzle (albeit if it's a
depth/stencil texture in stencil sampling mode, it would use the swizzle
according to depth texture mode). That's quite problematic for several
reasons, not least because in gallium stencil textures essentially use
the "Y" component for sampling stencil, not X. Not to mention that the
other components do not map to anything (as opposed to "ordinary" color
There's also some interface mismatch there too which looks like it can't
be solved easily - we sample the Y component, however we still need to
use the X component from the border color. Hmm.


More information about the mesa-dev mailing list