Skip to content

[GPU 09/20] Implement V8 WebGPU objects, discovery, resource bindings and capabilities #31

Open

Description

@danwalmsley

Parent epic: #22
Implementation order: 09 of 20.
Depends on: #29, #30.

Outcome

Expose browser-shaped WebGPU discovery and resource APIs through native V8, with correct object identity, conversions, capability reporting and failures.

Implementation

  • Extend pinned WebIDL exposure generation for WebGPU interfaces/constants/prototypes and descriptor conversions. Generate catalog/glue where appropriate, but implement semantics explicitly; do not import Node runtime infrastructure.
  • Implement navigator.gpu, requestAdapter, requestDevice, preferred canvas format, supported limits/features and adapter information with browser exposure rules and accurate adapter availability.
  • Add typed native wrappers for GPUDevice/Queue, buffers, textures/views, samplers, bind-group layouts/groups and pipeline layouts, including labels and destroy/release behavior.
  • Implement correct WebIDL dictionary defaults, unions/sequences, enum validation, nullable values, integer/range conversions, typed-array offsets and wrong-device/object checks.
  • Expose WebGPU only according to supported secure-context/origin policy; secure API exposure and adapter availability are distinct. Never spoof global isSecureContext.
  • Add host graphics options (automatic/default hardware; disable WebGPU; disable hardware for testing) and capability snapshots that distinguish installed implementation, usable adapter and conformance status.
  • Add explicit WebGl1/WebGl2 capability identifiers for later activation; retain OpenGl without implying WebGL. Extend manifest alternatives so optional WebGPU does not prevent an application's WebGL fallback from starting.
  • Keep backend-native extensions/private features out of the JavaScript-visible standards surface.

Tests

  • WebIDL object/prototype/brand/identity tests and descriptor-conversion errors.
  • Absent/disabled adapter, unsupported required features/limits, insecure origin, wrong-device resources and device destruction.
  • Valid buffer/texture/resource descriptors plus overflow, detached/offset data and unsupported formats/usages.
  • Manifest alternative capability selection and truthful advertised runtime state.

Verification evidence

Provide API coverage inventory with exact spec/IDL/Dawn pins, native and V8 test outputs and sample capability JSON. Every exposed API must perform its behavior or fail as specified; no successful no-op stubs.

Acceptance

  • Resource/discovery APIs work directly through native V8.
  • JS-visible features/limits and secure-context behavior are accurate.
  • Independent devices and cross-device validation are correct.
  • Unsupported WebGPU leaves application fallback available.
  • No per-resource/draw C# host-object dispatch is introduced.

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

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions