Skip to content

Graceful fallback when renderbufferStorageMultisample is unsupported #749

Closed

Description

@kvvasuu

Is your feature request related to a problem?

Rough edge in EffectComposer: when multisampling is set above 0 on WebGL2, it needs gl.renderbufferStorageMultisample. Some contexts report as WebGL2 but don't implement it, e.g. expo-gl (React Native). Their docs list it as unimplemented: https://docs.expo.dev/versions/latest/sdk/gl-view/

Instead of skipping multisampling, it throws and crashes the whole app. Repro'd via @react-three/postprocessing + N8AO on Android emulator: multisampling > 0 crashes on first frame, multisampling={0} works fine. Root cause is in EffectComposer, not the wrapper or N8AO. Note that wrapper sets a non-zero default on its own, so users can hit this without asking for MSAA.

Related: pmndrs/react-postprocessing#339

Describe the solution you'd like

multisampling's setter already clamps samples to gl.getParameter(gl.MAX_SAMPLES). Extend that to also check if renderbufferStorageMultisample actually works, not just that it exists (on expo-gl it exists as a stub that throws when called), and fall back to samples = 0 if not.

Describe alternatives you've considered

Leave as is and document it, or handle it in wrappers instead. Raising it here since this is the one place that fixes it for every consumer at once.

Additional context

More a proposal than a bug report, not sure it's worth the complexity since it seems specific to partial WebGL2 implementations like React Native.

Activity

  1. vanruesc commented on Jul 31, 2026

    @vanruesc
    Member

    Interesting, I guess it won't hurt to add a check for this.

  2. added
    enhancementEnhancement of existing functionality
    compatibilityA problem that affects compatibility with external libraries
    and removed on Jul 31, 2026
  3. vanruesc commented on Aug 16, 2026

    @vanruesc
    Member

    This sort of check would actually make more sense in three because postprocessing v6 can't reliably check if custom passes/effects create render targets with samples > 0. However, I doubt they would add a workaround for this specific case since this failure is more or less self-inflicted by expo.gl.

    I'll add a fallback in postprocessing, but in v6 it will only apply to the main multisampling setting in EffectPass. In v7, all render targets are managed centrally, so it should be possible to add a broader check there.

  4. added a commit that references this issue on Aug 16, 2026
    03cbe76
  5. vanruesc commented on Sep 9, 2026

    @vanruesc
    Member

    Fixed in v6.39.5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    compatibilityA problem that affects compatibility with external librariesenhancementEnhancement of existing functionality

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions