View Full Version : Stencil buffer
Is it true that the stencil buffer is emulated in 16bit color depth? on my gf2 running in fullscreen 16bpp the stencil buffer slows my app to a crawl and draws nothing but in 32bpp it runs fine... what gives?
08-06-2001, 07:16 PM
That is correct behavior for that card. And has to do with the fact that the hardware stencil support is based on a stencil/depth interleaved buffer format, 24 bits for depth, and 8 for stencil. When using a 16 bit depth buffer, stencil support would complicate matters (alignment issues), so it is all done by software. Now notice that to use 24 bit z, you must be in a 32 bit color mode, and when using a 16 bit z, you must be in a 16 bit color mode. That's why at one color resolution stencil is fast, but at all others is slow. Note however, not all cards behave this way, if I remember correctly the Geforce 2 MX series can support 24 bit z (and hence 8 bit stencil) while in 16 bit color mode. I think the Geforce 3 also has that capability. The Geforce 256, Geforce 2, and TNT series all suffer from this behavior for sure. As do other non NVIDIA cards I would assume.
Geforce 2 MX supports 16 bit z in 32 bit color mode, but not 24/8 z/stencil in 16 bit color mode. So it would also suffer from the same problem.
[This message has been edited by DFrey (edited 08-07-2001).]
08-06-2001, 10:05 PM
Sorry, AFAIK the GeForce2 MX does also not support 24 bit z (+ 8 bit stencil) in 16 bit color mode http://www.opengl.org/discussion_boards/ubb/wink.gif
(I've got that card..)
thanks that clears things up nice for me... but now how would a good app handle this issue? if the color depth is set to 16bpp ->disable stencil ? or let the user turn off the feature that uses the stencil buffer? or perhaps is there a way to tell if the stencil is being emulated?
08-07-2001, 02:26 AM
AFAIK you can check the pixelformat to see if the stencilbuffer is supported or not.
08-07-2001, 04:49 AM
But there is a problem with that approach. Stencil support be it software or hardware, is required by OpenGL. So any time you request an 8 bit stencil buffer on windows, you will get it. And it will either be software driven or hardware, there is no immediate flag you can check to determine.
However it would be trivial to test the performance of the stencil operations to determine if stenciling is hardware accelerated or not.
Powered by vBulletin® Version 4.2.2 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.