BabylonJS/Babylon.js · error

Invalid Space Warp framebuffer

Error message

Invalid Space Warp framebuffer

What it means

When using WebVR/XR Space Warp, Babylon binds the space warp texture's framebuffer and attaches multiview texture arrays via the OVR_multiview2 extension. If either _colorTextureArray or _depthStencilTextureArray is missing on the texture, the binding cannot proceed and this error is thrown. It indicates the space warp render target was created without the required multiview texture arrays (extension or creation path failed).

Source

Thrown at packages/dev/core/src/Engines/Extensions/engine.multiview.pure.ts:124

        } else {
            // eslint-disable-next-line no-throw-literal
            throw "Invalid multiview frame buffer";
        }
    };

    Engine.prototype.bindSpaceWarpFramebuffer = function (_spaceWarpTexture: RenderTargetWrapper) {
        const spaceWarpTexture = _spaceWarpTexture as WebGLRenderTargetWrapper;

        const gl: any = this._gl;
        const ext = this.getCaps().oculusMultiview || this.getCaps().multiview;

        this.bindFramebuffer(spaceWarpTexture, undefined, undefined, undefined, true);
        gl.bindFramebuffer(gl.DRAW_FRAMEBUFFER, spaceWarpTexture._framebuffer);
        if (spaceWarpTexture._colorTextureArray && spaceWarpTexture._depthStencilTextureArray) {
            ext.framebufferTextureMultiviewOVR(gl.DRAW_FRAMEBUFFER, gl.COLOR_ATTACHMENT0, spaceWarpTexture._colorTextureArray, 0, 0, 2);
            ext.framebufferTextureMultiviewOVR(gl.DRAW_FRAMEBUFFER, gl.DEPTH_ATTACHMENT, spaceWarpTexture._depthStencilTextureArray, 0, 0, 2);
        } else {
            throw new Error("Invalid Space Warp framebuffer");
        }
    };

    Camera.prototype._useMultiviewToSingleView = false;

    Camera.prototype._multiviewTexture = null;

    Camera.prototype._resizeOrCreateMultiviewTexture = function (width: number, height: number) {
        if (!this._multiviewTexture) {
            this._multiviewTexture = new MultiviewRenderTarget(this.getScene(), { width: width, height: height });
        } else if (this._multiviewTexture.getRenderWidth() != width || this._multiviewTexture.getRenderHeight() != height) {
            this._multiviewTexture.dispose();
            this._multiviewTexture = new MultiviewRenderTarget(this.getScene(), { width: width, height: height });
        }
    };

    Scene.prototype._transformMatrixR = Matrix.Zero();

View on GitHub (pinned to 0592b347b8)

Solutions

  1. Verify OVR_multiview2 support before enabling space warp (check webGLContext extensions)
  2. Check WebXR space warp support on the device/runtime (isSessionSupported / feature availability)
  3. Update Babylon.js to a version where space warp texture creation matches the binding code
  4. Disable space warp and fall back to standard XR rendering
  5. Test on a device/runtime known to support space warp (e.g. Quest with proper runtime)

Example fix

// before
await webXRSessionManager.enableSpaceWarp();
// after
if (webXRSessionManager.session?.interactionMode && engine._gl.getExtension('OVR_multiview2')) {
  await webXRSessionManager.enableSpaceWarp();
} else {
  // fall back to standard XR rendering
}
Defensive patterns

Strategy: validation

Validate before calling

const multiviewExt = engine._gl?.getExtension('OVR_multiview2');
const canSpaceWarp = !!multiviewExt && typeof multiviewExt.framebufferTextureMultiviewOVR === 'function';
if (!canSpaceWarp) { /* skip enableSpaceWarp() */ }

Type guard

function supportsSpaceWarp(engine): boolean {
  const ext = (engine as any)._gl?.getExtension('OVR_multiview2');
  return !!ext && typeof ext.framebufferTextureMultiviewOVR === 'function';
}

Try / catch

try {
  await webXRSessionManager.enableSpaceWarp();
} catch (e) {
  if (String(e?.message).includes('Space Warp')) {
    // continue without space warp
  } else { throw e; }
}

Prevention

When it happens

Trigger: Enabling Space Warp (webXRSessionManager.enableSpaceWarp()) when the underlying texture was created without OVR_multiview2 texture arrays — e.g. the framebufferTextureMultiviewOVR extension is unavailable or the texture was not produced by the multiview creation path.

Common situations: Devices/drivers lacking OVR_multiview2 support; enabling space warp on non-supported XR runtimes; upgrading engine versions where texture internals (_colorTextureArray) differ; misconfigured WebXR feature flags.

Related errors


AI-assisted analysis of BabylonJS/Babylon.js@0592b347b8 (2026-08-30). Data as JSON: /api/errors/414e66a4a3360470. Report an issue: GitHub.