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.

Hi BloCamLimb, sorry this took a bit longer.

We now have an internal bug tracking this issue, engineering is working on reproducing this. i will share news if I receive them.

Meanwhile, did you ever try if this reproduces with different driver versions for you? Either older or the most current ones?

Thanks!

Hi MarkusHoHo and BloCamLimb.
I had this problem.
I create some frambuffer in different threads by glCreateFramebuffers.

#if 0

	GLCALL(glCreateFramebuffers(1, &m_hFrameBuffer));
	GLCALL(glCreateFramebuffers(1, &m_hInterReadFB));
	GLCALL(glBindFramebuffer(GL_DRAW_FRAMEBUFFER, m_hFrameBuffer));
	GLCALL(glBindFramebuffer(GL_READ_FRAMEBUFFER, m_hInterReadFB));
#else
	GLCALL(glGenFramebuffers(1, &m_hFrameBuffer));
	GLCALL(glGenFramebuffers(1, &m_hInterReadFB));
	GLCALL(glBindFramebuffer(GL_DRAW_FRAMEBUFFER, m_hFrameBuffer));
	GLCALL(glBindFramebuffer(GL_READ_FRAMEBUFFER, m_hInterReadFB));

#endif // 0

And bind texture use
GLCALL(glNamedFramebufferTexture(m_hFrameBuffer, GL_COLOR_ATTACHMENT0, m_hRenderTarget, 0));
ps:define GLCALL is while (glGetError() != GL_NO_ERROR); and so no.

After glNamedFramebufferTexture:

#if _DEBUG
	if (0)
	{
		GLenum  result = glCheckNamedFramebufferStatus(pCtx->GetFrameBuffer(), GL_DRAW_FRAMEBUFFER);
		GLASSERT(GL_FRAMEBUFFER_COMPLETE == result);
	}
#endif // _DEBUG

The result is GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT.

I was looking for a solution online and I came across this post.
So I change glGenFramebuffers and

	GLCALL(glBindFramebuffer(GL_DRAW_FRAMEBUFFER, m_hFrameBuffer));
	GLCALL(glFramebufferTexture(GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, m_hRenderTarget, 0));

It’s all right!!!

  • OpenGL version: 4.6.0 NVIDIA 516.40
  • OpenGL vendor: NVIDIA Corporation
  • OpenGL renderer: NVIDIA GeForce GTX 970

I hope that will be helpful:)