MCPcopy Index your code
hub / github.com/adobe/swan

github.com/adobe/swan @dawn-chromium-stable-148.0.7778.217

Chat with this repo
repository ↗ · DeepWiki ↗ · release dawn-chromium-stable-148.0.7778.217 ↗ · + Follow
587 symbols 1,145 edges 11 files 44 documented · 7%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Swan


Status

[!IMPORTANT] * The bindings to Dawn are complete and a subset of them have been well tested * The Wasm bindings are still in early development.


Swift WebGPU Bindings for Dawn and Web

A set of Swift APIs for using WebGPU across multiple platforms.

Goals

The goal is to be able to write GPU code, using Swift, that works everywhere, including (eventually) the web.

The initial implementation is a Swift binding to Google's Dawn library.

Non-Goals

Swan is not intended to be a full rendering engine. It does not provide any rendering primitives beyond what is in WebGPU spec. For example, we do not specify a 4x4 matrix implementation, although we may use one in our examples.

Quick Start

The following snippet shows how to add Swan to your Swift package:

// swift-tools-version: 6.1
import PackageDescription

let package = Package(
    name: "YourApp",
    dependencies: [
        .package(url: "https://github.com/adobe/swan", from: "0.0.1")
    ],
    targets: [
        .target(
            name: "YourApp",
            dependencies: [
                .product(name: "Logging", package: "swan")
            ]
        )
    ]
)

Usage

You can run the demos by:

swift run GameOfLife
swift run BitonicSort

Updating Dawn

More docs to come...

swift package plugin --allow-writing-to-package-directory generate-dawn-bindings-swift
swift package plugin --allow-writing-to-package-directory generate-dawn-apinotes

Alternatives

  • swift-webgpu is another binding for WebGPU that takes a different approach.
swift-webgpu swift-wgpu (this project)
Dawn binding generation Swift code generated from dawn.json acts as wrappers C headers from Dawn are used directly in conjunction with an apinotes file generated from dawn.json
JavaScript binding generation N/A In progress

Contributing

Contributions are welcomed! Read the Contributing Guide for more information.

Licensing

This project is licensed under the BSD 3-Clause License. See LICENSE for more information.

Core symbols most depended-on inside this repo

Shape

Function 445
Class 133
Method 6
Enum 3

Languages

C++90%
Python10%
C1%
TypeScript1%

Modules by API surface

Demos/RGFW/include/RGFW.h519 symbols
Dawn/dawn_builder.py21 symbols
Dawn/archive_builder.py15 symbols
Dawn/dawn_source.py13 symbols
Sources/CDawn/include/Dawn.h7 symbols
Dawn/ci_build_dawn.py6 symbols
Demos/RGFW/implementation.c2 symbols
Dawn/ci_targets.py2 symbols
Sources/CDawn/implementation.cpp1 symbols
Scripts/sdk-install.mjs1 symbols

For agents

$ claude mcp add swan \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page