Skip to content

Unnecessary memory allocations when using multisampled render targets #30765

Closed as not planned
@codedpalette

Description

@codedpalette

Description

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?

Solution

Multisample render target should only allocate 1 framebuffer and 2 multisample render buffers

Alternatives

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions