Skip to content

Commit

Permalink
Added placeholder wasi-webgpu backend
Browse files Browse the repository at this point in the history
  • Loading branch information
MendyBerger committed Mar 7, 2024
1 parent 5d5c6f2 commit 104db31
Show file tree
Hide file tree
Showing 10 changed files with 1,638 additions and 2 deletions.
149 changes: 147 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions wgpu/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ vulkan-portability = ["wgc?/vulkan"]
## Enables the WebGPU backend on Wasm. Disabled when targeting `emscripten`.
webgpu = ["naga?/wgsl-out"]

## Enables the WASI-WebGPU backend.
wasi-webgpu = []

## Enables the GLES backend on Wasm
##
## * ⚠️ WIP: Currently will also enable GLES dependencies on any other targets.
Expand Down Expand Up @@ -167,6 +170,8 @@ raw-window-handle = { workspace = true, features = ["std"] }
serde = { workspace = true, features = ["derive"], optional = true }
smallvec.workspace = true
static_assertions.workspace = true
# TODO: only for wasi-webgpu
wit-bindgen = "0.19.0"

[dependencies.naga]
workspace = true
Expand Down
1 change: 1 addition & 0 deletions wgpu/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ fn main() {
native: { not(target_arch = "wasm32") },
webgl: { all(target_arch = "wasm32", not(target_os = "emscripten"), feature = "webgl") },
webgpu: { all(target_arch = "wasm32", not(target_os = "emscripten"), feature = "webgpu") },
wasi_webgpu: { all(target_arch = "wasm32", not(target_os = "emscripten"), feature = "wasi_webgpu") },
Emscripten: { all(target_arch = "wasm32", target_os = "emscripten") },
wgpu_core: { any(native, webgl, emscripten) },
send_sync: { any(
Expand Down
5 changes: 5 additions & 0 deletions wgpu/src/backend/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,8 @@ pub(crate) use webgpu::{get_browser_gpu_property, ContextWebGpu};
mod wgpu_core;
#[cfg(wgpu_core)]
pub(crate) use wgpu_core::ContextWgpuCore;

#[cfg(wasi_webgpu)]
mod wasi_webgpu;
#[cfg(wasi_webgpu)]
pub(crate) use wasi_webgpu::ContextWasiWebgpu;
Loading

0 comments on commit 104db31

Please sign in to comment.