#Unnecessary memory allocations when using multisampled render targets

1 messages · Page 1 of 1 (latest)

brazen meadow
#

I'm using EffectComposer to render to WebGLRenderTarget with samples > 0. My understanding is that it should create 2 render targets, and for each of them it should create 1 framebuffer, and two renderbuffers (1 color and 1 depth). However, when I inspect allocated memory with https://github.com/greggman/webgl-memory, I see that each render target creates 2 framebuffers, 3 renderbuffers and 1 texture. Looking at the code of WebGLTextures.setupRenderTarget I see there are two separate framebuffers, __webglFramebuffer and __webglMultisampleFramebuffer, with 2 multisample render buffers bound to the latter, and texture and regular depth buffer bound to the former. Yet when I look at the code in WebGLRenderer I see that __webglFramebuffer is never bound to anything when using multisample render target. My question is: is it a bug? Am I missing something?

vital helm
#

I don't know exactly but I suspect that since some effect passes do msaa or need that extra buffer, that the composer allocates it for them, so that every pass doesn't end up allocating its own unique one, and they can share it.
perhaps bc effectcomposer was created before hardware multisample rendertargets were even a thing.

brazen meadow
#

I'm not sure it is related to EffectComposer, since the code in question runs for any WebGLRenderTarget, even if it's created manually and not through EffectComposer