Function createRenderTexture2D
-
createRenderTexture2D(
engine: EngineContext,
width: number,
height: number,
options?: RenderTexture2DOptions,
): Texture2DParameters
- engine: EngineContext
- width: number
- height: number
- options: RenderTexture2DOptions = {}
Returns Texture2D
Create an empty
Texture2Dusable as both a render target and a sampled texture (RENDER_ATTACHMENT | TEXTURE_BINDING). This is the building block for offscreen render-to-texture: render a pass intotex.view, then sampletexin a later pass (e.g. a fullscreen post-process). Defaults to the engine's swapchain format + a linear sampler so the result can be presented directly.To use the result as a
SpriteRenderertarget (viasetSpriteRendererTarget), leaveformatat its defaultengine.format— sprite pipelines bake in that format, so a differently-formatted target trips WebGPU validation at render-pass begin. A customformatis for offscreen targets driven by some other pass, not the sprite renderer.