Framebuffer not working on AMD GPUs

Hey I ran into a weird problem. My OpenGL application runs perfectly on my RTX Nvidia GPU but when trying to run it on an AMD Radeon GPU I get an error when checking if the framebuffer is complete (so it fails to complete the framebuffer). This is not that great because I render the whole scene onto a framebuffer for multisampling and post processing.
The application is running on OpenGL 4.6 Core. I use glad to create my OpenGL context and glfw to create the window.

What kind of error? Most kinds of framebuffer completeness violations are not hardware specific.

So I did some error checking with glGetError. I get an 1280 error code (so GL_INVALID_ENUM). This seems to happen right after I call:

glTexParameteri(GL_TEXTURE_2D_MULTISAMPLE, GL_TEXTURE_MIN_FILTER, GL_LINEAR);

The whole code section:

m_MSAASamples = Window::GetMSAASamples();
glGenTextures(1, &m_ColorAttachment);
glBindTexture(GL_TEXTURE_2D_MULTISAMPLE, m_ColorAttachment);
glTexImage2DMultisample(GL_TEXTURE_2D_MULTISAMPLE, m_MSAASamples, GL_RGBA8, m_Width, m_Height, GL_TRUE);
glTexParameteri(GL_TEXTURE_2D_MULTISAMPLE, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
err = glGetError();
AM_CORE_ERROR("OpenGL Error code (multisampled): {}", err);
glTexParameteri(GL_TEXTURE_2D_MULTISAMPLE, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D_MULTISAMPLE, m_ColorAttachment, 0);
glBindTexture(GL_TEXTURE_2D_MULTISAMPLE, 0);
            
// renderbuffer
glGenRenderbuffers(1, &m_RenderbufferAttachment);
glBindRenderbuffer(GL_RENDERBUFFER, m_RenderbufferAttachment);
glRenderbufferStorageMultisample(GL_RENDERBUFFER, Window::GetMSAASamples(), GL_DEPTH24_STENCIL8, m_Width, m_Height);
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_STENCIL_ATTACHMENT, GL_RENDERBUFFER, m_RenderbufferAttachment);
glBindRenderbuffer(GL_RENDERBUFFER, 0);

It’s a multisample texture. You cannot linearly interpolate them.

Oh… yeah makes sense. Now I get two more errors. The first one is in the glTexImage2DMultisample call (GL_INVALID_VALUE) and the second one on the glRenderbufferStorageMultisample (GL_INVALID_OPERATION).

Oh nvm. My AMD GPU appearently doesn’t support 16 MSAA Samples so setting that number down now it works. Still kind of weird that it did work with the linear interpolation on nvidia hardware.
Thanks anyway :slight_smile:

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.