Invalid framebuffer operation after glCheckFramebufferStatus

I get a strange OpenGL error when running my application on my HD4000 (Windows 64bit, driver version 15.28.20.64.3347).

I welded it to several OpenGL calls to reproduce it:

  • Create two framebuffer objects.
  • Create a texture and bind it as GL_COLOR_ATTACHMENT0 to both FBOs.
  • Call glTexImage2D a second time on a texture
  • Bind the first FBO and call glCheckFramebufferStatus (returns GL_FRAMEBUFFER_COMPLETE).
  • Bind a second FBO and call glClear. GlClear gives GL_INVALID_FRAMEBUFFER_OPERATION.

Steps 3 and 4 are necessary to reproduce the error, which I find particularly alarming for calling glCheckFramebufferStatus. The problem also does not occur on other video cards (including the Nvidia card on the same computer).

If you call glCheckFramebufferStatus in the second FBO, it also returns GL_FRAMEBUFFER_COMPLETE. However, when checking the internal state of OpenGL with apitrace, he says that the second FBO now has a color binding with a null object name.

Rebinding the texture to the second FBO after calling glCheckFramebufferStatus resolves the error. This currently works as a workaround, but I believe linking textures with different FBOs in each frame is not a good idea.

Here is the C ++ code that reproduces the error:

// Create a texture and bind it to two FBOs GLuint textureName; glGenTextures(1, &textureName); glBindTexture(GL_TEXTURE_RECTANGLE, textureName); glTexImage2D(GL_TEXTURE_RECTANGLE, 0, GL_RGBA, 2, 2, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL); GLuint fboNames[2]; glGenFramebuffers(2, fboNames); glBindFramebuffer(GL_FRAMEBUFFER, fboNames[0]); glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_RECTANGLE, textureName, 0); glBindFramebuffer(GL_FRAMEBUFFER, fboNames[1]); glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_RECTANGLE, textureName, 0); glBindTexture(GL_TEXTURE_RECTANGLE, textureName); glTexImage2D(GL_TEXTURE_RECTANGLE, 0, GL_RGBA, 2, 2, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL); glBindFramebuffer(GL_FRAMEBUFFER, fboNames[0]); // Removing this line resolves the error glCheckFramebufferStatus(GL_FRAMEBUFFER); // Returns GL_FRAMEBUFFER_COMPLETE glBindFramebuffer(GL_FRAMEBUFFER, fboNames[1]); GLenum bufferTarget = GL_COLOR_ATTACHMENT0; glDrawBuffers(1, &bufferTarget); // Adding this line resolves the error // glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_RECTANGLE, 1, 0); glCheckFramebufferStatus(GL_FRAMEBUFFER); // Returns GL_FRAMEBUFFER_COMPLETE //This call causes a GL_INVALID_FRAMEBUFFER_OPERATION error. glClear(GL_COLOR_BUFFER_BIT); 

Here is a minimal Visual Studio 2013 project to reproduce it: https://www.dropbox.com/s/5142j26d839gkp9/HD4000Error.zip

Now, my question is: am I doing something illegal with OpenGL here or is it just a driver error?

+1
source share
1 answer

We reported this issue to Intel and it looks like it was a bug. It is fixed in the current driver version.

0
source

Source: https://habr.com/ru/post/918405/


All Articles