PDA

View Full Version : glBlitFramebuffer crash with msaa depth -> msaa depth blit on Radeon HD 4800



eodabash
03-03-2013, 07:59 PM
The following code crashes on a Radeon HD 4800 (Win7 64-bit, latest drivers)


GLuint fbo1 = 0;

// setup FBO 1
{
glGenFramebuffers(1, &fbo1);
glBindFramebuffer(GL_FRAMEBUFFER, fbo1);

GLuint rb1 = 0;
glGenRenderbuffers(1, &rb1);
glBindRenderbuffer(GL_RENDERBUFFER, rb1);
glRenderbufferStorageMultisample(GL_RENDERBUFFER, 4, GL_DEPTH24_STENCIL8, 1024, 1024);
//glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH24_STENCIL8, 1024, 1024);


glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, rb1);
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, GL_RENDERBUFFER, rb1);


glReadBuffer(GL_NONE);
glDrawBuffer(GL_NONE);


GLenum fboStatus1 = glCheckFramebufferStatus(GL_FRAMEBUFFER);
assert(fboStatus1 == GL_FRAMEBUFFER_COMPLETE);


check_gl_error();
}


GLuint fbo2 = 0;


// setup FBO 2
{
glGenFramebuffers(1, &fbo2);
glBindFramebuffer(GL_FRAMEBUFFER, fbo2);


GLuint rb2 = 0;
glGenRenderbuffers(1, &rb2);
glBindRenderbuffer(GL_RENDERBUFFER, rb2);
glRenderbufferStorageMultisample(GL_RENDERBUFFER, 4, GL_DEPTH24_STENCIL8, 1024, 1024);
//glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH24_STENCIL8, 1024, 1024);


glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, rb2);
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, GL_RENDERBUFFER, rb2);


glReadBuffer(GL_NONE);
glDrawBuffer(GL_NONE);


GLenum fboStatus2 = glCheckFramebufferStatus(GL_FRAMEBUFFER);
assert(fboStatus2 == GL_FRAMEBUFFER_COMPLETE);


check_gl_error();
}


glBindFramebuffer(GL_FRAMEBUFFER,0);


glBindFramebuffer(GL_READ_FRAMEBUFFER, fbo1);
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, fbo2);


GLenum readStatus = glCheckFramebufferStatus(GL_READ_FRAMEBUFFER);
assert(readStatus == GL_FRAMEBUFFER_COMPLETE);


GLenum drawStatus = glCheckFramebufferStatus(GL_DRAW_FRAMEBUFFER);
assert(drawStatus == GL_FRAMEBUFFER_COMPLETE);


check_gl_error();


// crash here
glBlitFramebuffer(0, 0, 1024, 1024, 0, 0, 1024, 1024, GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT, GL_NEAREST);

Is this code somehow incorrect, or is this probably a bug in AMD's drivers?

Alfonse Reinheart
03-03-2013, 10:44 PM
In general, unless you're throwing a pointer at the implementation, a crash is always a driver bug.

Nowhere-01
03-04-2013, 12:34 AM
try blitting depth and stencil separately in two glBlitFramebuffer calls. if it works, report here (http://devgurus.amd.com/community/graphics_programming) a driver bug. i've already seen topics mentioning that AMD drivers fail to blit depth and stencil together.

eodabash
03-04-2013, 11:38 AM
try blitting depth and stencil separately in two glBlitFramebuffer calls. if it works, report here (http://devgurus.amd.com/community/graphics_programming) a driver bug. i've already seen topics mentioning that AMD drivers fail to blit depth and stencil together.

It crashes when blitting just depth too. I added the stencil bit thinking maybe the problem was with blitting just one half of the packed depth-stencil buffer. I reported at the AMD forums already, I was just hoping someone here might spot something in my usage that isn't correct.

Nowhere-01
03-04-2013, 07:54 PM
does it work without multisample? because i am blitting depth buffer in my application too and i've tested it on amd card, it works. the only difference is i don't have multisample.

eodabash
03-05-2013, 03:20 PM
does it work without multisample? because i am blitting depth buffer in my application too and i've tested it on amd card, it works. the only difference is i don't have multisample.

Yeah it works without the multisampled renderbuffers. I also tested on a Radeon HD 6700 and it works fine with msaa, so it seems to just be a problem with older Radeons.