Framebuffer incomplete when attaching color buffers of different sizes with DSA

Attaching color buffers of different sizes to FBO with Direct State Access in OpenGL 4.5 leads to GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT.

Steps to Reproduce:

// Create textures
GLuint tex[2];
glCreateTextures(GL_TEXTURE_2D, 2, tex);
glTextureStorage2D(tex[0], 1, GL_RGB8, 2048, 2048);
glTextureStorage2D(tex[1], 1, GL_RGB8, 1024, 1024);
// Create FBO
GLuint fbo;
glCreateFramebuffers(1, &fbo);
glNamedFramebufferTexture(fbo, GL_COLOR_ATTACHMENT0, tex[0], 0);
glNamedFramebufferTexture(fbo, GL_COLOR_ATTACHMENT1, tex[1], 0);
// Check completeness
GLenum comp = glCheckNamedFramebufferStatus(fbo, GL_FRAMEBUFFER);

I’d expect completeness to be GL_FRAMEBUFFER_COMPLETE, however, in my case glCheckNamedFramebufferStatus returns GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT.

But if I create FBO in the traditional way, it won’t give me this error:
Just replace

glCreateFramebuffers(1, &fbo);

with

glGenFramebuffers(1, &fbo);
glBindFramebuffer(GL_FRAMEBUFFER, fbo); // make it valid

In this case, completeness is GL_FRAMEBUFFER_COMPLETE. Even other functions are in the form of glNamed*.

My environment:
Graphics card: GeForce GTX 1660 Ti
Driver version: 512.15
Operating system: Windows 10 Enterprise 64-bit

Hello @BloCamLimb and welcome to the NVIDIA developer forums.

I cannot immediately answer your question, but since your question looks exactly like a similar question on Stackoverflow from 4 years ago, I think I should clarify that contrary to that posting this was not, to my knowledge, officially identified as an NVIDIA bug.

I try to get more information on this, but in the meantime you might want to check glError in the intermediate steps after creating and storing the textures, creating the Framebuffer and using glNamedFrameBufferTexture. Maybe that will already show you some clues on what might cause this difference.

One Addendum: Which version of OpenGL are you using?

Hello @MarkusHoHo
I’m using GLFW to create the window.

  • OpenGL version: 4.6.0 NVIDIA 512.15
  • OpenGL vendor: NVIDIA Corporation
  • OpenGL renderer: NVIDIA GeForce GTX 1660 Ti/PCIe/SSE2

I did glGetError after each gl* call, all of them are GL_NO_ERROR, the comp is GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT.

GLuint tex[2];
glCreateTextures(GL_TEXTURE_2D, 2, tex);
GLenum error = glGetError(); // GL_NO_ERROR
glTextureStorage2D(tex[0], 1, GL_RGB8, 2048, 2048);
error = glGetError(); // GL_NO_ERROR
glTextureStorage2D(tex[1], 1, GL_RGB8, 1024, 1024);
error = glGetError(); // GL_NO_ERROR

GLuint fbo;
glCreateFramebuffers(1, &fbo);
error = glGetError(); // GL_NO_ERROR
glNamedFramebufferTexture(fbo, GL_COLOR_ATTACHMENT0, tex[0], 0);
error = glGetError(); // GL_NO_ERROR
glNamedFramebufferTexture(fbo, GL_COLOR_ATTACHMENT1, tex[1], 0);
error = glGetError(); // GL_NO_ERROR

GLenum comp = glCheckNamedFramebufferStatus(fbo, GL_FRAMEBUFFER);
error = glGetError(); // GL_NO_ERROR

I also tried glGenFramebuffers and glBindFramebuffer, all of them are also GL_NO_ERROR, and comp is GL_FRAMEBUFFER_COMPLETE.

Then I tried these code with my AMD integrated graphics, glCreateFramebuffers and glGenFramebuffers, both comp is GL_FRAMEBUFFER_COMPLETE.

  • OpenGL version: 4.6.13596 Compatibility Profile Context 20.10.32.06 27.20.11032.6002
  • OpenGL vendor: ATI Technologies Inc.
  • OpenGL renderer: AMD Radeon™ Graphics

OpenGL specification allows color attachments with different dimensions, but the effective dimension is their intersection. Therefore, it should be determined that it is an NVIDIA bug, when used with Direct State Access.