Interface EngineContext
canvas: RenderCanvas;
drawCallCount: number;
engine: EngineContext;
format: GPUTextureFormat;
gpuFrameTimeMs: number;
maxDevicePixelRatio: number;
msaaSamples: number;
scRT: RenderTarget;
surfaces: readonly [SurfaceContext, SurfaceContext];
useFloatingOrigin: boolean;
useHighPrecisionMatrix: boolean;
}
Hierarchy (View Summary)
- SurfaceContext
- EngineContext
Properties
Readonlycanvas
Canvas this surface presents to.
draw Call Count
Number of GPU draw calls in the latest renderFrame call, summed across its selected surfaces.
Readonlyengine
Owning engine. For the engine's primary surface this points back to the engine
itself (engine.engine === engine).
Readonlyformat
Swapchain texture format for this surface. Use as the format for offscreen
RTs that will be composited onto this surface. When sRGB is enabled (see
SurfaceOptions.srgb) this is the *-srgb view format that pipelines and
the swapchain RenderTarget render through, not the format passed to
GPUCanvasContext.configure() (that is _configureFormat).
gpu Frame Time Ms
Instrumented GPU interval for the last measured frame, in milliseconds — from the beginning of the opening marker dispatch through the end of the closing marker dispatch, including every command recorded for the frame and the two marker dispatches themselves. It is 0 until the first measured frame and while timing is disabled. Readback is asynchronous and does not stall rendering.
max Device Pixel Ratio
Clamps the effective device pixel ratio used for this surface's swapchain backing
store. The backing store is sized at min(devicePixelRatio, maxDevicePixelRatio) * cssPixels.
maxDevicePixelRatio = 1 renders at native CSS-pixel resolution (no DPR upscaling);
the default Infinity is unclamped (full devicePixelRatio). Mutable at runtime — set
before the next resizeSurface to take effect (mirrors Babylon setHardwareScalingRatio).
Readonlymsaa Samples
MSAA sample count for the main render pass into this surface (1 or 4).
Readonlysc RT
Surface-owned color-only render target that wraps this canvas's swapchain texture.
Its _colorTexture/_colorView are re-acquired from context.getCurrentTexture()
once per frame (see _refreshScRT), so it is always single-sample and carries no
depth. Render/post-process/copy tasks target it (or resolve into it) to present to
the canvas. It is _eager — buildRenderTarget and disposeRenderTarget both
no-op on it and the surface owns its textures, so its shared _descriptor must
never be mutated.
Readonlysurfaces
Rendering surfaces attached to this engine, in registration order. Index 0 is
the engine itself (the primary surface) — the tuple type guarantees at least
one entry so engine.surfaces[0] is always defined. Use
createSurface(engine, canvas, ...) to append more.
use Floating Origin
When true, every scene on this engine uses the floating-origin (eye-relative
upload) trick to render large-world coordinates without F32 jitter. Requires
useHighPrecisionMatrix: true. Defaults to false.
LWR is engine-wide: all scenes created against this engine inherit the
mode. The LWR runtime module (large-world/floating-origin.js) is
dynamically imported during createEngine only when this flag is true,
so non-LWR engines never pull the module into their bundle.
use High Precision Matrix
When true, world matrices are computed using Float64 intermediate precision and downcast to Float32 at GPU upload time. Defaults to false.
Handle to the WebGPU engine — pure state, no attached methods.
The engine owns the
GPUDeviceand all device-scoped GPU resources (textures, buffers, pipelines, bind groups). It also is itself a SurfaceContext bound to the canvas passed intocreateEngine— the primary surface. Additional canvases can be attached viacreateSurface(engine, canvas, ...); GPU resources are shared across all surfaces because they're device-scoped, while each surface owns its own swapchain context.