Hi,
I tried the following (C#) code, that basically allocates an FBO with a 4096x4096 depth texture at each iteration.
On an ATI Radeon 5450 with Catalyst 12.6, under WinXP 32bit, I get an AccessViolationException in the glCheckFramebufferStatusEXT() call after the 6th iteration.
On an ATI FirePro v3750 with Dell drivers (Driver Packaging Version 8.85.7) under Windows 7 64bit I can successfully get a GL_OUT_OF_MEMORY error and recover from this situation, without getting the AccessViolation.
Why is it crashing on the ATI Radeon?
Is it something to expect when using too much graphics memory, or is it a driver or operating system problem?
Thanks
void TestFBO()
{
customViewportLayout1.Grid.Visible = false;
int width = 4096;
int height = 4096;
uint[] textureId = new uint[100];
uint[] fbo = new uint[100];
uint[] rbDepth = new uint[100];
uint[] names = new uint[1];
for (int i = 0; i < 100; i++)
{
glGenTextures(1, names);
textureId[i] = names[0];
glBindTexture(GL_TEXTURE_2D, textureId[i]);
glTexParameteri(GL_TEXTURE_2D, gl.TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, gl.TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, gl.TEXTURE_WRAP_S, GL_CLAMP);
glTexParameteri(GL_TEXTURE_2D, gl.TEXTURE_WRAP_T, GL_CLAMP);
glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT, (int) width, (int) height, 0,
GL_DEPTH_COMPONENT, GL_UNSIGNED_BYTE, null);
glBindTexture(GL_TEXTURE_2D, 0);
fbo[i] = glGenFramebuffersEXT();
glBindFramebufferEXT(glFRAMEBUFFER_EXT, fbo[i]);
rbDepth[i] = glGenRenderbuffersEXT();
glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, rbDepth[i]);
glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_DEPTH_COMPONENT, width, height);
glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, GL_RENDERBUFFER_EXT, rbDepth[i]);
glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, GL_TEXTURE_2D, textureId[i], 0);
glDrawBuffer(gl.NONE);
glReadBuffer(gl.NONE);
int _status = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT);
Console.WriteLine(_status);
int error = glGetError();
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); // on ATI Radeon CRASHES Here 5450 (at iteration 12)!!!
if (error == GL_OUT_OF_MEMORY)
{
for (int j = 0; j <= i; j++)
{
ViewportLayout.DelTexture(ref textureId[j]);
glDeleteFramebuffersEXT(fbo[j]);
glDeleteRenderbuffersEXT(rbDepth[j]);
}
break;
}
}
}