PDA

View Full Version : FBO missing attachment issue



DmitryM
04-29-2013, 08:59 PM
Hello folks,

I'm getting a weird GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT status on an FBO that contains only a depth attachment. This didn't happen on my OSX station, so I suspect Linux drivers to be at fault. Here is what apitrace thinks is going on.
Texture & FBO creation:


529 glBindTexture(target = GL_TEXTURE_2D, texture = 37)
530 glTexImage2D(target = GL_TEXTURE_2D, level = 0, internalformat = GL_DEPTH_COMPONENT, width = 512, height = 512, border = 0, format = GL_DEPTH_COMPONENT, type = GL_UNSIGNED_BYTE, pixels = NULL)
531 glGenFramebuffers(n = 1, framebuffers = &4)

Framebuffer binding:


1134 glBindFramebuffer(target = GL_DRAW_FRAMEBUFFER, framebuffer = 4)
1135 glFramebufferTexture(target = GL_DRAW_FRAMEBUFFER, attachment = GL_DEPTH_ATTACHMENT, texture = 37, level = 0)
1136 glDrawBuffer(mode = GL_ZERO)
1137 glCheckFramebufferStatus(target = GL_DRAW_FRAMEBUFFER) = GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT

The description for this FBO status is "No images are attached to the framebuffer". In my case, there is clearly an image (depth texture) attached to it, so the status is at least misleading.

System Info:
Linux mezon 3.8.10-1-ARCH #1 SMP PREEMPT Sat Apr 27 12:36:59 CEST 2013 x86_64 GNU/Linux
OpenGL vendor string: X.Org
OpenGL renderer string: Gallium 0.4 on AMD RV730
OpenGL core profile version string: 3.1 (Core Profile) Mesa 9.1.1

thokra
04-30-2013, 02:35 AM
Any GL errors during resource creation or when trying to attach the depth buffer?

DmitryM
04-30-2013, 06:51 AM
Any GL errors during resource creation or when trying to attach the depth buffer?

Good suggestion, thanks! There is indeed an InvalidOperation caused by line 1135 (glFramebufferTexture). I got so used to OSX's GL profiler thhat breaks on errors that I skipped the glGetError calls mostly during development...

The doc says InvalidOperation is issued when the texture is not compatible with the slot I'm binding it to. It's not the case for my code though.

For an experiment, I replaced glFramebufferTexture by glFramebufferTexture2D, and it went just right. This returns us to the point of a suspected bug in the driver withing support for glFramebufferTexture.