Repository navigation
Open
Labels
enhancementNew feature or request
Description
Parent epic: #22
Implementation order: 14 of 20.
Depends on: #35.
Outcome
Provide a real WebGL 1 implementation that remains usable independently of WebGPU and composes through the shared GPU canvas path.
Implementation
- Expose WebGLRenderingContext and typed WebGL object wrappers/constants through native V8 and pinned WebIDL definitions.
- Implement getContext('webgl') and the supported legacy alias, context attributes, exclusive canvas mode/identity, drawingBuffer dimensions and default framebuffer behavior.
- Create ANGLE contexts in WebGL compatibility mode with appropriate robustness/initialization. ANGLE's GLES implementation does not replace browser-side validation, ownership, origin-clean rules or JS conversions.
- Implement shaders/programs/uniforms, buffers/attributes, textures/samplers, renderbuffers/framebuffers, state, draw calls, queries and readPixels with specified validation/error behavior.
- Implement GLSL ES validation/diagnostics, getError, getParameter, supported extension enumeration and extension object identity. Expose only implemented/qualified extensions.
- Preserve preserveDrawingBuffer and default-framebuffer clear/presentation semantics; integrate single-sample images/MSAA with scene leases and Canvas2D snapshots.
- Batch ordered native context work while answering synchronous queries correctly. Flush required work without depending on the UI thread; avoid unnecessary redundant GL state changes.
- Implement context loss/restoration and WEBGL_lose_context testing where supported. Explicitly activate WebGl1 capability only for the verified implementation.
Tests
- Pinned WebGL 1 conformance shards through WebScene JS, not only ANGLE tests.
- Indexed/non-indexed draws, texture upload/readback, shader failures, framebuffer completeness, buffer bounds and stale/wrong-context objects.
- Attribute/state/query conversion and getError ordering; data mutation/detachment after uploads.
- Context attributes, preserveDrawingBuffer, resize clearing, context loss/restore and cross-canvas drawImage.
- Force WebGPU disabled/adapter unavailable and verify WebGL renders in both presenters without CPU pixel presentation.
Verification evidence
Attach conformance denominator/results, shader logs, actual pixels, context-loss events and API/command/copy counters.
Acceptance
- WebGL 1 core surface is implemented with browser-observable semantics.
- Independent WebGL operation works without a usable WebGPU adapter.
- ANGLE GPU output composes correctly and exports through common canvas paths.
- Validation, synchronous queries and context lifecycle are tested.
- No API is advertised as supported through a successful no-op stub.
Completion requirements
Link the implementation PR, exact test commands, native/runtime/framework revisions and verification artifacts before closing. Follow the epic's architecture and copy/lifetime invariants. Any unavailable mandatory hardware or missing required functionality remains incomplete, not a pass.
Metadata
Metadata
Assignees
Labels
enhancementNew feature or request
Activity