Taos API Reference
    Preparing search index...

    Interface RenderContextOptions

    Options accepted by RenderContext.create.

    interface RenderContextOptions {
        enableErrorHandling?: boolean;
        depthFormat?: GPUTextureFormat | null;
        xrCompatible?: boolean;
        hdr?: boolean;
        maxPixelRatio?: number;
        reversedZ?: boolean;
    }
    Index

    Properties

    enableErrorHandling?: boolean

    Install an uncapturederror listener and enable per-pass/frame validation scopes.

    depthFormat?: GPUTextureFormat | null
    xrCompatible?: boolean
    hdr?: boolean

    Force the swap-chain color space. Leave undefined (default) to auto-detect an HDR (rgba16float + display-p3 + extended tonemapping) canvas and fall back to SDR. Pass false to skip the HDR attempt and configure a plain SDR swap chain (getPreferredCanvasFormat()). WebXR needs this: the WebGPU XR projection layer only accepts rgba8unorm/bgra8unorm, and the engine's final blit pipeline is keyed on ctx.format, so an HDR canvas both breaks createProjectionLayer and mismatches the blit. (true is treated the same as undefined — HDR is still only used when the display actually supports it.)

    maxPixelRatio?: number

    Upper bound on the effective device pixel ratio used to size the canvas backing store. Native devicePixelRatio on phones is commonly 3 (and climbing on tablets), which for a deferred renderer means ~9× the fragment work of a 1×-DPR canvas — enough to tank performance on mobile GPUs. Defaults to 1.2. Pass 0 to disable the clamp and render at native DPR.

    reversedZ?: boolean

    Use a reversed-Z depth buffer (near→1, far→0) instead of the standard near→0/far→1 mapping. Paired with the default depth32float buffer this gives near-uniform depth precision across the whole frustum, so a huge far/near ratio (e.g. standing on a planet while another body hangs far off in space) no longer z-fights. Opt-in (default false): passes read RenderContext.reversedZ to flip their depth clear value, depth-compare direction, and projection. Off → the engine's long-standing standard-Z behavior, unchanged.