Renderer. Create every
backend through await Renderer.create(...); direct new Renderer() and new Stage()
construction are unavailable so initialization always has one explicit asynchronous boundary.WebGLRenderer, WebGPURenderer, WebGLRenderTarget, and WebGPURenderTarget
classes and their backend-specific parameter and lifecycle types. The sole offscreen surface
remains the backend-neutral RenderTarget returned by Renderer.Renderer.isBackendSupported('webgpu', options).
Explicit backend requests remain fail-closed; auto still probes WebGPU without requesting a
device or allocating GPU resources.src/render and the RHI to src/render/rhi/{webgl2,webgpu}. Remove
the legacy src/renderer and src/rhi source trees and do not provide compatibility re-export
paths.RendererCommonOptions.renderPipeline,
reusable RenderPipelineFactory configurations, frame-scoped culling/renderer-list handles, a
narrow ScriptableRenderGraph, retained pass-parameter pools, recovery-aware persistent targets,
and shared scene, shadow, fullscreen, copy, and present pass primitives.ForwardRenderPipelineFactory feature injection with per-Renderer feature runtimes and
creation-time capability/limit/format requirements. The empty default feature set retains the
existing direct forward recorder with no intermediate scene target or public-facade draw cost.
WebGPU-only storage-buffer, storage-texture, compute-pass, and indirect-draw requirements
now participate in backend selection and device capability/limit/format validation.StorageLayout, renderer-owned StorageBuffer upload/readback/recovery semantics, public graph
buffer access, Direct WGSL ComputeShader validation through Naga, immutable ComputeKernel,
ComputeRenderPass, and uniform/storage/complete-2D sampled or write-only-storage-texture
bindings. Compute is a dedicated pass model rather than a Material subtype.GPUDrivenRenderPass, and
SceneRenderPass group-3 pass-global storage variants. Scene variants reuse ordinary renderer
lists and deterministically expand instanced batches to direct per-mesh draws.StorageBuffer objects imported per frame; each Renderer
accepts one pending storage-buffer readback. cpu-shadow recovery restores CPU bytes rather than
later GPU mutations, and Direct WGSL f16 remains fail-closed until the Naga validation path can
validate it end to end. Storage-aware graphics retains broader Material/Scene texture reflection,
while GPUDrivenRenderPass rejects non-2D graph texture bindings before backend execution.sampledDepth
option fail-closed; a custom SRP can explicitly compose depth prepass, compute culling, and a
storage-aware Scene pass for Forward+.Renderer.waitForIdle() for application completion fences. Native WebGL 2 or
WebGPU interoperability is opt-in through Renderer.getExtension() instead of public gl or
gpuDevice fields.renderToTarget() through the configured pipeline, make public graph handles unique across
invocations, reject nested rendering through record/prepare/execute, add transactional per-key
persistent-target release, preserve pre-draw Mesh event mutation before draw preparation, and
align after-scene events/face counts with every renderer-list occurrence actually drawn by live
graph passes.RHIFactory composition root for concrete RHI construction and support probes;
backend drivers receive the concrete RHI directly rather than a command-forwarding facade.waitForIdle() observes new
failures without hiding tracker/collection errors.validate:ci; the
physical-GPU lane remains a separate manual workflow.Renderer export with an abstract shared renderer base and a
separate RendererContract type. Backend implementations now inherit common frame planning,
render/light queues, diagnostics, and resource ownership from that base; the protected result is
available as the exported RenderGraphFramePlan type for custom subclasses.Renderer.renderFrame(callback) application-frame boundary. Custom
renderer implementations must provide it; callbacks may not return a Promise or retain the frame
facade after returning.UniformBuffer a backend-neutral CPU/std140 object. Remove its WebGL-native getBuffer(),
bind(), and destroy() methods; native allocations now belong to renderer-local WebGL/WebGPU
managers and are released through renderer resource ownership.Texture a backend-neutral CPU descriptor. Remove Texture.getCache(), reset(),
getGLTexture(), setGLTexture(), updateTexture(), the protected WebGL upload hooks, and the
root TextureWebGLState type; WebGL allocation, upload revision, descriptor snapshot, and native
cache ownership now belong to the renderer's texture manager/uploader.TextureBinding and MaterialTexture to engine Texture<unknown> objects so both
backends consume one real resource contract. Remove the WebGL-native location, type, size,
and glTypeInfo fields from ProgramBindingInfo.Shader.reset(gl?) to backend-independent Shader.reset(). Change RendererFrameCallback
to return unknown; the runtime rejects Promise-like results and escaped frame facades rather
than allowing asynchronous recording.GeometryData.glBuffer field. Geometry data now exposes only CPU
content/revisions, while each backend owns its buffer variants.WebGPUTextureManager mutations now preserve render-target ownership;
registerExternal() rejects target-owned textures instead of creating detached allocations.Class.create/Class.mix and EventMixin APIs in favor of native classes and
EventDispatcher; use backend-neutral releaseGPUResources() for renderer resource lifecycles.Stage.create() to default to backend: 'auto'. Auto selection uses the
public, device- and GPU-resource-free WebGPURenderer.isSupported() adapter probe and prefers
WebGPU when the fallback-adapter policy, required features/limits, and engine minimum limits are
satisfied; it otherwise creates WebGL 2 directly. The probe never requests a device or canvas
context and never initializes the shader compiler, pipelines, or resources. Supplying
preserveDrawingBuffer or requesting alpha: true, premultipliedAlpha: false straight-alpha
compositing selects WebGL 2 directly. Synchronous new Stage() remains WebGL 2 by default because
it cannot await adapter discovery.backend: 'webgpu' fail-closed with no fallback. Once auto has selected WebGPU,
device/context creation, compiler, pipeline, and resource initialization errors also reject
directly instead of being reinterpreted as capability failures.Renderer/RenderTarget the backend-neutral offscreen contract for WebGL 2 and WebGPU,
including MRT, 1×/4× MSAA, sampleable attachments, target rendering, resize, and asynchronous
readback. MeshPicker now accepts a Stage and returns Promise<Mesh[]> from a backend-neutral
GPU object-ID pass with no CPU fallback.Framebuffer, LightShadow, and CubeLightShadow types, public light
lightShadow fields, renderer-owned useFramebuffer/framebufferOption, implicit render-target
creation, and backend-specific framebuffer example. Native framebuffer and shadow allocation are
renderer internals; the replacement example uses the shared RenderTarget contract.logGLResource() export. Use
renderer.resourceManager.getDiagnostics(rootNode?) for stable backend-neutral ownership counts.capabilities and extensions singletons. WebGL 2 callers use the
owning WebGLRenderer.capabilities and WebGLRenderer.extensions; remaining public low-level
Program/Buffer/VAO cache inspection requires getCache(gl), while Texture native caches are
backend-private.ShadowCastingLightParameters. Area, ambient, and base lights reject shadow configuration before
backend selection instead of allowing a backend to ignore it.WebGPUTextureManager construction to receive an already initialized
NagaShaderTranslator; the optional resource-destroy callback moves to the third argument.KTXLoadRequest texture overrides to the exported KTXTextureOptions contract. Callers
may set sampler, lifecycle, name, UV, and anisotropy options, but container-owned texel format,
extent, image, mipmap, and compression metadata can no longer be overridden.FrameBlock, CameraBlock, SceneBlock,
LightBlock, MaterialBlock, ModelBlock, GeometryBlock, SkinningBlock, or MorphBlock
ABI. Custom ShaderMaterial numeric uniforms must migrate to a registered UBO; samplers are the
only classic uniform exception.KHR_techniques_webgl loading and its GLSL 1.00 sample assets because the extension's
arbitrary classic-uniform shader interface is incompatible with the fixed WebGL 2 UBO ABI.Texture.colorSpaceConversion boolean. External images now always use
the browser-standard sRGB-managed path, while raw TypedArray/DataView pixels remain explicit
untagged values on both backends.Texture.updateSubTexture(xOffset, yOffset, image) with the sole descriptor form
updateSubTexture({ mipLevel, face?, layer?, z?, x, y, width, height, depth?, image }). The
positional overload has been removed.SkinedMesh is now SkinnedMesh, needBasicUnifroms is
needBasicUniforms, ignoreTranparent is ignoreTransparent, and the
diffuse-environment/ambient-light material flag now uses its correctly spelled name.renderer/common, renderer/shader, renderer/webgl,
renderer/webgpu, rhi/webgl, and rhi/webgpu boundaries. Move GLSL-to-WGSL compilation above
the RHI, move WebGL shadow allocation under its renderer backend, and keep common frame planning
free of native graphics handles.webxr.html is explicitly WebGL 2-only while
browsers expose XR presentation through XRWebGLLayer, and compute_gpu_driven.html is
explicitly WebGPU-only because its required capabilities are not simulated on WebGL 2.OES_standard_derivatives and WEBGL_depth_texture requests because both are
WebGL 2 core features, and enforce this class of WebGL 1 extension wrapper in the modernity gate.@compute structurally associated with ComputeShader validation.@align/@size wrappers that work
with WebGPU's default language features; do not request or depend on the optional
uniform_buffer_standard_layout feature.sampler3D,
sampler2DArray, sampler2DArrayShadow, and every signed/unsigned integer sampler family for 2D,
3D, cube, and 2D-array textures now pass through Naga into dimension- and sample-type-correct bind
groups. Managed Texture supports 2D, cube, 3D, and 2D-array targets plus signed/unsigned integer
formats. Integer textures require nearest-only sampling, anisotropy 1, and explicit complete mip
chains; mipmapped 3D textures also require explicit complete chains. Both backends reject
compressed 3D textures before allocation, while native compressed 2D-array textures remain
supported.texture_depth_*; WebGPU enforces nearest-only non-filtering depth samplers, while WebGL 2
selects comparison mode from reflected sampler types.+X, -X, +Y, -Y, +Z, -Z order; add portable raw
depth16/depth32float and feature-gated depth32float-stencil8 uploads; reject nonportable raw depth
tuples before allocation; and use physical 4×4 upload extents for compressed 2×2/1×1 mip tails.Texture.needDestroy invalidates old allocations across every WebGL context and
WebGPU device instead of being consumed by only the first backend.MaterialBlock changes from a reusable snapshot of the final std140 bytes, including
direct mutations of nested color/matrix and texture-derived values, without requiring manual
isDirty; unchanged bytes do not advance revisions or upload again.flipY to TypedArray/DataView sources in the same deterministic byte order.HTMLVideoElement textures from decoded-frame callbacks through a private staging
canvas. Queue completion fences prevent the canvas from changing during a copy; source changes,
release, and device recovery cancel and rebuild observation without a WebGL or placeholder
fallback.mesh → pass owner → material/shader/instancing variant, cap each mesh at 32 variants
with LRU eviction, atomically union resources across passes, and reclaim failed-frame and replaced
identity resources without destroying shared final references.commonOptions
snapshots in every header and shader-variant key.webgpuDeviceLost, safely skip renders,
request a fresh equivalent adapter with the frozen initial options, revalidate the fallback policy
plus all required features and limits, and request a replacement device with the same effective
descriptor. Rebuild context/managers while preserving selected RenderTarget and attachment
identities, then emit webgpuDeviceRestored. Emit webgpuDeviceRecoveryFailed and make later
renders throw explicitly on failure; renderer destruction cancels in-flight or stale-generation
recovery.Texture-identity recovery backings for isImageCanRelease textures,
including immutable raw/cube/mipmap/sub-texture snapshots and private external-source references,
so a new WebGL 2 context allocation or WebGPU device can replay uploads without restoring access
to the released public image.releaseGPUResources() reusable on WebGPU by rebuilding main-canvas depth/MSAA attachments
immediately instead of tearing down the device. Scope shadow cameras and debug helpers per
renderer/light and prune them when debug, shadow, enabled, stage membership, release, recovery, or
destruction changes ownership.Texture identities survive resize and context/device recovery; WebGL 2
resize updates every draw/resolve/depth attachment transactionally. Both backends present through
fullscreen texture-load pipelines; WebGL 2 restores canvas and saved framebuffer state on every
clear/resolve failure instead of blitting into an antialiased default framebuffer. WebGPU keeps
its required 256-byte row alignment internal to the implementation.MeshPicker exclusively on the shared
render-target contract, with dual-backend interaction tests and no hidden fallback path.LINE_LOOP and TRIANGLE_FAN to explicit LINES and TRIANGLES indices before upload
for indexed, non-indexed, and glTF-loaded geometry, so WebGL 2 and WebGPU consume the same
topology.InstanceBlock instead of matrix vertex attributes.RenderTarget identity, and exact pre/post-recovery readback. It supplements the full
example-gallery WebGPU matrix; it is not the only WebGPU UI path.[64, 128, 200, 255] pixel readback.GPUQueue with onSubmittedWorkDone() before the
final instrumentation sample so delayed validation events cannot arrive after a passing result.
Interaction gates additionally require action-local draw/submit progress and GPU readback changes
for life-game attachment updates, ShaderToy pointer input, post-process kernels, and glTF Viewer
replacement. WebGPU color render-target allocations include COPY_DST, so public attachment
updateSubTexture() writes are real GPU updates rather than ignored validation errors.forceFallbackAdapter: false, disables Chromium's software rasterizer, rejects fallback
and known software adapters, and reuses the production draw/recovery/readback fixture without
pretending that physical GPU availability is a portable PR or release requirement. WebXR remains
excluded from the WebGPU gate.ivec*/uvec* inputs through strictly typed
vertexAttribIPointer calls. Keep point-shadow cube attachments square and complete. Refresh
CameraBlock for each of the six point-shadow faces even though the shadow camera object is
reused. Prepare ShaderToy derivatives in uniform control flow so the same GLSL compiles cleanly
through Naga and Dawn.LightBlock. Restrict shadow parameters to those three
light kinds and reject Area/Ambient/base-light shadow assignment before backend selection.COPY_WRITE_BUFFER_BINDING WebGL2 constant.