Type Mapping¶
This section describes how WebGPU types map to Kotlin Multiplatform implementations across the project's modules. It is the reference for keeping the portable API, the descriptors, and the JavaScript bindings consistent while remaining type-safe and portable.
Modules¶
The mapping is spread over four published modules:
webgpu-api— portable interfaces and type definitions.webgpu-descriptors— descriptor implementations built on the portable API.webgpu-web-bindings— generated JavaScript bindings and Kotlin JS/Wasm interop.webgpu-browser— browser implementation: resource wrappers, descriptor converters, and canvas surfaces.
Mapping inputs¶
The WebIDL definitions at w3.org/TR/webgpu are the foundation for the portable mappings. Enumeration values and naming conventions follow the WebGPU C headers described by wgpu.yml.
Principles¶
- Platform agnosticism — core types are defined in a platform-agnostic way so they behave the same on every target.
- Type safety — Kotlin's type system provides compile-time safety for WebGPU operations.
- Performance — direct mappings to native types are used where possible.
- Extensibility — the interface-based design allows different implementations and extensions.
- Consistency — naming conventions and values align with the official WebGPU specifications.