I'm currently trying to implement cascaded multisampled variance shadow maps. While my non-multisampled maps appear to be working fine, I'm having issues with resolving the multisampled array textures. OpenGL docs say I should be using a glBlitFramebuffer
call to resolve these textures. However, after looking at the resolved array textures in RenderDoc, only the first layer of the array appears to have been blitted.
I've narrowed down the problem thus far:
What are my options here? I'd ideally still like a 2D array texture to sample from during my lighting pass, but I'm not sure how I'm supposed to blit multiple array layers to resolve the multisampling.
Current resolving code:
with shadow_fbo[0]
as a framebuffer with GL_TEXTURE_2D_MULTISAMPLE_ARRAY
s bound, and shadow_fbo[1]
with GL_TEXTURE_2D_ARRAY
s bound to GL_COLOR_ATTACHMENT0
on both:
glBindFramebuffer(GL_READ_FRAMEBUFFER, shadow_fbo[0]);
glReadBuffer(GL_COLOR_ATTACHMENT0);
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, shadow_fbo[1]);
glBlitFramebuffer(0, 0, size, size, 0, 0, size, size, GL_COLOR_BUFFER_BIT, GL_NEAREST);
Blitting with layered images will only affect layer 0. If you want to do a blit involving all layers of the source and destination images, you will have to attach each pair of layers to the framebuffer, blit them, and then attach the next pair of layers, blit them, etc.