[Mesa-dev] first attempt at shader stencil export

Dave Airlie airlied at gmail.com
Sun Oct 3 04:14:51 PDT 2010

>> No this won't work as you can't read a z24s8 format a i32 (not the same
>> typeless group, number of components needs to be the same as well as all
>> components need to have same number of bits).
>> But the format list suggests this is possible. For z24s8 you could
>> presumably use DXGI_FORMAT_R24G8_TYPELESS. For depthstencil view it
>> should be possible to then use DXGI_FORMAT_D24_UNORM_S8_UINT. For
>> reading depth use DXGI_FORMAT_R24_UNORM_X8_TYPELESS - for reading
>> stencil similarly use DXGI_FORMAT_X24_TYPELESS_G8_UINT. That's at least
>> my interpretation. Note you can't read both components at once (there is
>> no DXGI_FORMAT_R24_UNORM_G8_UINT format), you need different resource
>> views for that (presumably because the components don't have the same
>> type, so this is disallowed). Despite that reading depth will return
>> first (red) component, stencil second (green).
> Interesting.
> Gallium should have similar restraints: I recall Dave Airlie saying that
> AMD's recent ships have separate storage for depth and stencil, and
> DirectX10 rules accommodate that quite well.
> This means that Z24_S8 should be disallowed in sampler views: either it
> is Z24_X8 or X24_S8. And only one component is returned.
> It also means we need to add X24_S8 formats to gallium.

Okay I've updated the branch,


though I need to go back and rebase it so its in-order changes and cleaner.

I've added the two X24S8/S8X24 formats to gallium, moved to
and fixed the early Z check in softpipe.

The state tracker now uses sampler views into the same texture to get
the values.

I need to check it works on r600 when I get back to the hw, and add a
check in the st for the new formats being supported.


More information about the mesa-dev mailing list