Stencil fbo attachments

H. Verbeet hverbeet at
Wed Jul 18 02:24:55 CDT 2007

On 18/07/07, Stefan Dösinger <stefandoesinger at> wrote:
> Hi Henri,
> Apparently I have debugged Splinter Cell in a wrong direction. The depth copy
> can hardly be the problem because splinter cell renders everything offscreen,
> except the final composition and the HUD.
> I think the problem is the lack of a stencil attachment to our fbos.
> Implementing them looks rather simple - just adjust the internal format of
> D24S8 to the packed depth stencil format and set the same texture for depth
> and stencil attachments.
> However, I think I remember that you tried that before and it failed for some
> reason. There are two extensions, GL_NV_packed_depth_stencil and
> GL_EXT_packed_depth_stencil, whereas the NV one is the only one supported on
> my nvidia card and the EXT one the only one supported on my ATI card(on
> macos). The EXT one seems to be the only one that is written with fbos in
> mind. fglrx does not support either extension.
Setting the stencil attachment isn't very hard. The problem is that we
currently can't do much with extensions in the texture format table,
and that we can't detect whether we should attach / detach the stencil
attachment. (Except for checking the surface format in
set_depth_stencil_fbo, but that's ugly.)

Another thing (unrelated to this) I'd like to change about the format
table is adding a field for format caps (ie, the stuff
CheckDeviceFormat checks, like offscreen rendering, filtering, VTF,
etc) and filling that when the WineD3D object is created.

> As a fallback a combined depth stencil surface could contain an extra 8 bit gl
> texture(luminance, or GL_RED, or whatever) and just use it as a separate
> stencil buffer. We just have to watch out when locking the texture, and using
> such a surface for texuring will be tricky. (Stencil texture? Is that
> possible even? The EXT_packed_stencil extension says yes).
That won't work on any current card, afaik. Depth and stencil
attachments have to be the same texture on current cards.

More information about the wine-devel mailing list