Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 10 of 10

Thread: reasons for lack of programmable depth/stencil?

Threaded View

  1. #1
    Member Regular Contributor Nowhere-01's Avatar
    Join Date
    Feb 2011
    Location
    Novosibirsk
    Posts
    251

    Question reasons for lack of programmable depth/stencil?

    i guess, there's a big reason for that, which i am missing. so that's why this topic is not in the suggestions forum. but googling "opengl programmable depth/stencil" gave me only the topics there people desired to sample and write depth\stencil buffer for some reason. but i don't expect it to be accessible from vertex\geometry\fragment programs. i think, depth+stencil should be a separate shader stage. here's an approximation of what i am talking about:

    Code :
    void main() 
    {
        if( gl_fragDepth < gl_inDepthValue ) { //gl_inDepthValue  - current depth-buffer value
            if( gl_inStencilValue == 3 ) {     //gl_inStencilValue - current stencil-buffer value
                discard();                     //do not execute fragment program if possible. or prevent it from writing to color buffer, if gl_fragDepth is modified.
            } else {
                gl_outStencilValue = gl_inStencilValue + 1;
            }
        } else {
            discard();
        }
    }

    i'm not proposing it as actual syntax, it's just to give an idea. i'm not the person who is capable of writing actual spec. but even if currently there's a reason for not doing this... i'm 100% sure there's gonna be properly programmable depth+stencil. because state-based approach is awful. it's very error prone(it's hell to control all the states affecting stencil and depth in big project with multipass rendering) and ugly. i guess that it's gonna be hard to squeeze the same performance out of programmable section of pipeline. but it's the most straightforward, obvious way to do that. and in many cases, user defined code should be simpler(faster?), than fixed pipeline. sooner or later, hardware should be optimized for that functionality. better be soon, current functionality for depth\stencil looks archaic and out of place.
    Last edited by Nowhere-01; 02-05-2013 at 05:30 AM.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •