Interface SurfaceContext
canvas: RenderCanvas;
engine: EngineContext;
format: GPUTextureFormat;
maxDevicePixelRatio: number;
msaaSamples: number;
scRT: RenderTarget;
}
Hierarchy (View Summary)
- SurfaceContext
Properties
Readonlycanvas
Canvas this surface presents to.
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).
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.
Per-canvas rendering surface — owns the GPU canvas context, swapchain format, MSAA configuration, and the list of
RenderingContexts (scenes, effect renderers, frame-graph contexts, sprite/text renderers) that present to this canvas.The
EngineContextis itself aSurfaceContext(the primary one, bound to the canvas passed intocreateEngine). Additional surfaces for auxiliary canvases are created via createSurface. GPU resources (textures, buffers, pipelines, bind groups) live on the EngineContext (device-scoped) and are shared across all surfaces of the same engine — only the swapchain output is per-surface.