share_depth_buffer: non matching multisamples

I wish to have my buffers all share the depth with base.win.

I can have all my new buffers share depth with each-other just fine, but if I try and make them share with base.win I get this error:

:display:gsg:glgsg(error): share_depth_buffer: non matching multisamples

and shareDepthBuffer returns false, and the depths are not shared.

This indicates that I have multisamples somewhere, but my FrameBufferProperties don’t show any:
The requested values:
depth_bits=1 alpha_bits=1 aux_rgba=2
base.win’s values:
depth_bits=24 color_bits=24 alpha_bits=8 back_buffers=1 force_hardware=1
the values of the returned buffer that can not share depth with base.win:
depth_bits=1 color_bits=1 alpha_bits=8 stencil_bits=1 aux_rgba=2 force_hardware=1

No multisamples at all. I tried setting multisamples to 0 in my prc, as well as setting them to 0 in the FrameBufferProperties objects, and reading them from the FrameBufferProperties objects (they were 0).

How can I get past this to share depth with base.win?

I’m using panda 1.7.2 on mac.

My Code, derived from the fireflies sample:

    def makeFBO(self, name, auxrgba, shareDepthWith=None):
        # This routine creates an offscreen buffer.  All the complicated
        # parameters are basically demanding capabilities from the offscreen
        # buffer - we demand that it be able to render to texture on every
        # bitplane, that it can support aux bitplanes, that it track
        # the size of the host window, that it can render to texture
        # cumulatively, and so forth.
        winprops = base.win.getProperties()#WindowProperties()
        props = FrameBufferProperties()
        props.setRgbColor(1)
        props.setAlphaBits(1)
        props.setDepthBits(1)
        props.setAuxRgba(auxrgba)
        print base.win.getFbProperties()
        print props
        out = base.graphicsEngine.makeOutput(
             base.pipe, name+" buffer", -2,
             props, winprops,
             GraphicsPipe.BFSizeTrackHost | GraphicsPipe.BFCanBindEvery | 
             GraphicsPipe.BFRttCumulative | GraphicsPipe.BFRefuseWindow,
             base.win.getGsg(), base.win)
        print out.getFbProperties()
        if shareDepthWith:
            shared=out.shareDepthBuffer(shareDepthWith)
            if not shared:
                print "Failed to share depth"
            out.setClearDepthActive(False)
        return out

Thanks!

Hey Craig,

Some lucky with that? I tried using the following code and got the same error message.

buffer->share_depth_buffer(window->get_graphics_window());

I came to this line that returns some weird number (random, maybe uninitialized):

DCAST (CLP(GraphicsBuffer), window->get_graphics_output())->get_multisample_count()

Maybe that helps to find the bug…

I’m still stuck with it. Current work around is to write the depth buffer of the main window from my shader (I draw a full screen quad, and use the depth texture to write the depth values in the shader. I already had to draw the quad and had the depth texture, so easy hack). I’m sure this is much slower than proper depth buffer sharing.

heek_ are you also on mac? I haven’t tested this yet on anything else.

I’m on linux.
Hey, if you’re running your own compiled version of panda, maybe you should try to comment the checking and try until it’s fixed… I’d do that, but I’m short on time… =)

glGraphicsBuffer_src.cxx - 1073.

     //Check multisample compatibility.
    if ( this->get_multisample_count() != input_graphics_output->get_multisample_count() ) {
      GLCAT.error() << "share_depth_buffer: non matching multisamples \n";
      state = false;    
    }

I guess finding the error might not be so difficult… Maybe someone (rdb, XD) with the environment ready can do that quickly… :wink:

I have verified this issue on windows, so that makes it broken on mac, windows and linux. In the end, I don’t think I actually need it, but its still a bug in panda.