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 6 of 6

Thread: Question regarding the compatibility of multiple color attachments

  1. #1
    Intern Newbie
    Join Date
    Feb 2013
    Posts
    39

    Question regarding the compatibility of multiple color attachments

    Hi.

    I'm writing a deferred renderer, targeting OpenGL >= 3.1. Assuming that I stick to the required color-renderable formats given in the spec - is it legal to have several color attachments of different formats? That is, can I create a framebuffer with an RGBA8888 attachment and an RG16F attachment, and expect to be able to render to both buffers without issue?

    The spec seems vague on the matter. I've seen people discussing DirectX claiming that it's not doable there, but I've also seen blog posts discussing their own configurations that do seem to have color attachments with multiple formats (without mentioning whether they were referring to DirectX or OpenGL). Assuming that the blog posts aren't outright lies, I assume the DirectX limitation is just a limitation imposed by the specification, and that most hardware built in the last five years or so is capable of doing it?

  2. #2
    Senior Member OpenGL Pro
    Join Date
    Apr 2010
    Location
    Germany
    Posts
    1,136
    Quote Originally Posted by GL3.1 Spec
    Each color attachment may be in any of the required color formats for textures and renderbuffers described in sections 3.8.1 and 4.4.2.
    I don't see why not. BTW, just to get my daily nitpicking on, the GL doesn't know the format RGBA8888. It's RGBA8.

    Also, if you attach multiple images with different base/internal types and the completeness check returns true, the FBO must be usable for rendering. Otherwise it's either an implementation bug in the completeness check or the handling of FBOs.

  3. #3
    Intern Contributor
    Join Date
    Mar 2014
    Location
    San Jose, CA
    Posts
    58
    I don't think it's excluded by the spec. It can be platform dependent if certain combinations of formats are supported. The key part of the spec is this:

    "Although the GL defines a wide variety of internal formats for framebuffer-attachable images, such as texture images and renderbuffer images, some implementations may not support rendering to particular combinations of internal formats. If the combination of formats of the images attached to a framebuffer object are not supported by the implementation, then the framebuffer is not complete under the clause labeled FRAMEBUFFER_UNSUPPORTED."

    Maybe DirectX wanted to avoid these kinds of platform dependencies, and only specifies the lowest common denominator?

  4. #4
    Senior Member OpenGL Pro
    Join Date
    Apr 2010
    Location
    Germany
    Posts
    1,136
    Thanks reto, skipped over that.

    Quote Originally Posted by reto.koradi
    Maybe DirectX wanted to avoid these kinds of platform dependencies, and only specifies the lowest common denominator?
    I'd assume that at least for the most common formats, with RGBA8 and RG16F definitely among them, most if not all vendors support combining them.

    Guess you have no choice but to check all platforms you're targetting for one more feature ... but hey, that's been the GL way for a long time now.

  5. #5
    Intern Newbie
    Join Date
    Feb 2013
    Posts
    39
    Quote Originally Posted by thokra View Post
    I don't see why not.
    This is OpenGL we're talking about, yes?

    Quote Originally Posted by thokra
    BTW, just to get my daily nitpicking on, the GL doesn't know the format RGBA8888. It's RGBA8.
    Nitpicking is appreciated!

    Quote Originally Posted by thokra
    Also, if you attach multiple images with different base/internal types and the completeness check returns true, the FBO must be usable for rendering. Otherwise it's either an implementation bug in the completeness check or the handling of FBOs.
    Yep, that much was already assumed.

    Quote Originally Posted by reto.koradi
    Maybe DirectX wanted to avoid these kinds of platform dependencies, and only specifies the lowest common denominator?
    That was my thinking too.

    Is pretty much why I asked in the first place; the spec says "these specific formats are supported" and then effectively says "there's no guarantee that you can have them in any particular combination" by what it says regarding FRAMEBUFFER_UNSUPPORTED.

    Quote Originally Posted by thokra
    Guess you have no choice but to check all platforms you're targetting for one more feature...
    Yep, as it always is.

  6. #6
    Senior Member OpenGL Pro
    Join Date
    Apr 2010
    Location
    Germany
    Posts
    1,136
    This is OpenGL we're talking about, yes?
    Damn, and there I thought this was a PHP board. O_O All this time wasted ...

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
  •