FBO rendering … avoiding the need for 100 useless depth/stencil attachments

This topic contains 2 replies, has 2 voices, and was last updated by  Dark_Photon 2 years, 6 months ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #48257

    Let me pose the question in the form of an example:

    Suppose you have a cache of 100 color textures (same res, internal format) to be rendered via FBOs, and you might need to re-render 1-60 of those in one frame.

    Suppose also that you need depth and/or stencil FBO attachments to render these color textures properly, and that you don’t care about the final depth/stencil result.

    The question is: Can we avoid the needless memory consumption for 60-100 depth/stencil attachments (one per color texture) to avoid depth/stencil texture/renderbuffer ghosting IF we merely:

    1. Call gl{Discard,Invalidate}Framebuffer on the DEPTH/STENCIL attachment(s) at the end of the frame, and
    2. Allocate/share “one” depth/stencil attachment across all FBOs.

    Given that we may be talking up to 100MB for 100 depth/stencil attachments (depending on PowerVR’s internal depth and/or stencil renderbuffer/texture representation), I’m very motivated to avoid this waste if possible.

    Thanks!

    #48329

    pauls
    Member

    Hello Dark_Photon,

    Yes – sharing one depth/stencil across all FBOs will work fine. The complication for ghosting/stalling occurs when the attachment (in this case a depth buffer) is subsequently used by another render e.g. used as a texture elsewhere.

    Thanks,
    Paul

    #48334

    Thanks  a bunch!  We’ll implement that approach.

Viewing 3 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic.