From 104db31bacc63ad585322c3a2b09a0b3087d2f70 Mon Sep 17 00:00:00 2001 From: Mendy Berger <12537668+MendyBerger@users.noreply.github.com> Date: Wed, 6 Mar 2024 22:51:57 -0500 Subject: [PATCH] Added placeholder wasi-webgpu backend --- Cargo.lock | 149 +++- wgpu/Cargo.toml | 5 + wgpu/build.rs | 1 + wgpu/src/backend/mod.rs | 5 + wgpu/src/backend/wasi_webgpu.rs | 1450 +++++++++++++++++++++++++++++++ wgpu/src/lib.rs | 7 + wgpu/wit/.gitignore | 1 + wgpu/wit/deps.lock | 9 + wgpu/wit/deps.toml | 2 + wgpu/wit/main.wit | 11 + 10 files changed, 1638 insertions(+), 2 deletions(-) create mode 100644 wgpu/src/backend/wasi_webgpu.rs create mode 100644 wgpu/wit/.gitignore create mode 100644 wgpu/wit/deps.lock create mode 100644 wgpu/wit/deps.toml create mode 100644 wgpu/wit/main.wit diff --git a/Cargo.lock b/Cargo.lock index 41fb4c90e2..34b3927d74 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -898,7 +898,7 @@ name = "d3d12" version = "0.19.0" dependencies = [ "bitflags 2.4.1", - "libloading 0.7.4", + "libloading 0.8.1", "winapi", ] @@ -1676,6 +1676,9 @@ name = "heck" version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" +dependencies = [ + "unicode-segmentation", +] [[package]] name = "hermit-abi" @@ -1723,6 +1726,12 @@ dependencies = [ "objc2", ] +[[package]] +name = "id-arena" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "25a2bc672d1148e28034f176e01fffebb08b35768468cc954630da77a1449005" + [[package]] name = "ident_case" version = "1.0.1" @@ -1880,6 +1889,12 @@ version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" +[[package]] +name = "leb128" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "884e2677b40cc8c339eaefcb701c32ef1fd2493d71118dc0ca4b6a736c93bd67" + [[package]] name = "libc" version = "0.2.152" @@ -3190,6 +3205,15 @@ dependencies = [ "url", ] +[[package]] +name = "spdx" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29ef1a0fa1e39ac22972c8db23ff89aea700ab96aa87114e1fb55937a631a0c9" +dependencies = [ + "smallvec", +] + [[package]] name = "spin" version = "0.9.8" @@ -3746,6 +3770,42 @@ dependencies = [ "syn 2.0.48", ] +[[package]] +name = "wasm-encoder" +version = "0.200.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9e3fb0c8fbddd78aa6095b850dfeedbc7506cf5f81e633f69cf8f2333ab84b9" +dependencies = [ + "leb128", +] + +[[package]] +name = "wasm-metadata" +version = "0.200.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c31b8cc0c21f46d55b0aaa419cacce1eadcf28eaebd0e1488d6a6313ee71a586" +dependencies = [ + "anyhow", + "indexmap", + "serde", + "serde_derive", + "serde_json", + "spdx", + "wasm-encoder", + "wasmparser", +] + +[[package]] +name = "wasmparser" +version = "0.200.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a03f65ac876612140c57ff6c3b8fe4990067cce97c2cfdb07368a3cc3354b062" +dependencies = [ + "bitflags 2.4.1", + "indexmap", + "semver 1.0.21", +] + [[package]] name = "wayland-backend" version = "0.3.2" @@ -3980,6 +4040,7 @@ dependencies = [ "wgpu-core", "wgpu-hal", "wgpu-types", + "wit-bindgen", ] [[package]] @@ -4067,7 +4128,7 @@ dependencies = [ "js-sys", "khronos-egl", "libc", - "libloading 0.7.4", + "libloading 0.8.1", "log", "metal", "naga", @@ -4566,6 +4627,90 @@ dependencies = [ "winapi", ] +[[package]] +name = "wit-bindgen" +version = "0.19.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b37d270da94012e0ac490ac633ad5bdd76a10a3fb15069edb033c1b771ce931f" +dependencies = [ + "bitflags 2.4.1", + "wit-bindgen-rust-macro", +] + +[[package]] +name = "wit-bindgen-core" +version = "0.19.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9121070bebf9dda946f7ecffc9ec23a890b46c79be84ff6359f0c588223b20e7" +dependencies = [ + "anyhow", + "wit-parser", +] + +[[package]] +name = "wit-bindgen-rust" +version = "0.19.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1753606a880b4c7701da8870d3935e550e667261a9b570f709cfefc22136ea5" +dependencies = [ + "anyhow", + "heck", + "wasm-metadata", + "wit-bindgen-core", + "wit-component", +] + +[[package]] +name = "wit-bindgen-rust-macro" +version = "0.19.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "171482ae1eb3c417b61e7e1b487e4dded906a136e1ac5da35eab38bdff5554c5" +dependencies = [ + "anyhow", + "proc-macro2", + "quote", + "syn 2.0.48", + "wit-bindgen-core", + "wit-bindgen-rust", +] + +[[package]] +name = "wit-component" +version = "0.200.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "39979723340baea490b87b11b2abae05f149d86f2b55c18d41d78a2a2b284c16" +dependencies = [ + "anyhow", + "bitflags 2.4.1", + "indexmap", + "log", + "serde", + "serde_derive", + "serde_json", + "wasm-encoder", + "wasm-metadata", + "wasmparser", + "wit-parser", +] + +[[package]] +name = "wit-parser" +version = "0.200.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f717576b37f01c15696bda7f6f13868367b9c5913485f9f0ec8e59fd28c8e13" +dependencies = [ + "anyhow", + "id-arena", + "indexmap", + "log", + "semver 1.0.21", + "serde", + "serde_derive", + "serde_json", + "unicode-xid", + "wasmparser", +] + [[package]] name = "x11-dl" version = "2.21.0" diff --git a/wgpu/Cargo.toml b/wgpu/Cargo.toml index 813bc71f57..573b0704a8 100644 --- a/wgpu/Cargo.toml +++ b/wgpu/Cargo.toml @@ -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. @@ -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 diff --git a/wgpu/build.rs b/wgpu/build.rs index 1f07f7ebba..5eca3cf4fa 100644 --- a/wgpu/build.rs +++ b/wgpu/build.rs @@ -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( diff --git a/wgpu/src/backend/mod.rs b/wgpu/src/backend/mod.rs index 02d9632efb..4e0deebf70 100644 --- a/wgpu/src/backend/mod.rs +++ b/wgpu/src/backend/mod.rs @@ -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; diff --git a/wgpu/src/backend/wasi_webgpu.rs b/wgpu/src/backend/wasi_webgpu.rs new file mode 100644 index 0000000000..99a6457aa2 --- /dev/null +++ b/wgpu/src/backend/wasi_webgpu.rs @@ -0,0 +1,1450 @@ +use crate::{ + AdapterInfo, BindGroupDescriptor, BindGroupLayoutDescriptor, BufferDescriptor, + CommandEncoderDescriptor, ComputePassDescriptor, ComputePipelineDescriptor, + DownlevelCapabilities, Features, Limits, MapMode, PipelineLayoutDescriptor, + RenderBundleEncoderDescriptor, RenderPipelineDescriptor, SamplerDescriptor, + ShaderModuleDescriptor, ShaderModuleDescriptorSpirV, SurfaceStatus, SurfaceTargetUnsafe, + TextureDescriptor, TextureViewDescriptor, UncapturedErrorHandler, +}; + +use std::{future::Future, marker::PhantomData, ops::Range}; + +wit_bindgen::generate!({ + path: "wit", + world: "component:webgpu/example", + exports: { + world: ExampleTriangle, + }, +}); + +struct ExampleTriangle; + +// TODO: get rid of this. +impl Guest for ExampleTriangle { + fn start() {} +} + +// TODO: get rid of this type. +#[derive(Debug, Clone, Copy)] +pub struct PlaceholderType; +impl From for PlaceholderType { + fn from(_value: crate::context::ObjectId) -> Self { + todo!() + } +} +impl From for crate::context::ObjectId { + fn from(_value: PlaceholderType) -> Self { + todo!() + } +} + +// TODO: get rid of this type. +#[derive(Debug, Clone, Copy)] +pub struct PlaceholderFuture(PhantomData); + +impl Future for PlaceholderFuture { + type Output = T; + + fn poll( + self: std::pin::Pin<&mut Self>, + _cx: &mut std::task::Context<'_>, + ) -> std::task::Poll { + todo!() + } +} + +#[derive(Debug)] +pub struct ContextWasiWebgpu(()); + +impl crate::Context for ContextWasiWebgpu { + type AdapterId = PlaceholderType; + type AdapterData = PlaceholderType; + type DeviceId = PlaceholderType; + type DeviceData = PlaceholderType; + type QueueId = PlaceholderType; + type QueueData = PlaceholderType; + type ShaderModuleId = PlaceholderType; + type ShaderModuleData = PlaceholderType; + type BindGroupLayoutId = PlaceholderType; + type BindGroupLayoutData = PlaceholderType; + type BindGroupId = PlaceholderType; + type BindGroupData = PlaceholderType; + type TextureViewId = PlaceholderType; + type TextureViewData = PlaceholderType; + type SamplerId = PlaceholderType; + type SamplerData = PlaceholderType; + type BufferId = PlaceholderType; + type BufferData = PlaceholderType; + type TextureId = PlaceholderType; + type TextureData = PlaceholderType; + type QuerySetId = PlaceholderType; + type QuerySetData = PlaceholderType; + type PipelineLayoutId = PlaceholderType; + type PipelineLayoutData = PlaceholderType; + type RenderPipelineId = PlaceholderType; + type RenderPipelineData = PlaceholderType; + type ComputePipelineId = PlaceholderType; + type ComputePipelineData = PlaceholderType; + type CommandEncoderId = PlaceholderType; + type CommandEncoderData = PlaceholderType; + type ComputePassId = PlaceholderType; + type ComputePassData = PlaceholderType; + type RenderPassId = PlaceholderType; + type RenderPassData = PlaceholderType; + type CommandBufferId = PlaceholderType; + type CommandBufferData = PlaceholderType; + type RenderBundleEncoderId = PlaceholderType; + type RenderBundleEncoderData = PlaceholderType; + type RenderBundleId = PlaceholderType; + type RenderBundleData = PlaceholderType; + + type SurfaceId = PlaceholderType; + type SurfaceData = PlaceholderType; + type SurfaceOutputDetail = PlaceholderType; + type SubmissionIndex = PlaceholderType; + type SubmissionIndexData = PlaceholderFuture>; + + type RequestAdapterFuture = PlaceholderFuture>; + type RequestDeviceFuture = PlaceholderFuture< + Result< + ( + PlaceholderType, + PlaceholderType, + PlaceholderType, + PlaceholderType, + ), + crate::RequestDeviceError, + >, + >; + type PopErrorScopeFuture = PlaceholderFuture>; + + fn init(_instance_desc: wgt::InstanceDescriptor) -> Self { + todo!() + } + + unsafe fn instance_create_surface( + &self, + _target: SurfaceTargetUnsafe, + ) -> Result<(Self::SurfaceId, Self::SurfaceData), crate::CreateSurfaceError> { + todo!() + } + + fn instance_request_adapter( + &self, + _options: &crate::RequestAdapterOptions<'_, '_>, + ) -> Self::RequestAdapterFuture { + todo!() + } + + fn adapter_request_device( + &self, + _adapter: &Self::AdapterId, + _adapter_data: &Self::AdapterData, + _desc: &crate::DeviceDescriptor<'_>, + _trace_dir: Option<&std::path::Path>, + ) -> Self::RequestDeviceFuture { + todo!() + } + + fn instance_poll_all_devices(&self, _force_wait: bool) -> bool { + todo!() + } + + fn adapter_is_surface_supported( + &self, + _adapter: &Self::AdapterId, + _adapter_data: &Self::AdapterData, + _surface: &Self::SurfaceId, + _surface_data: &Self::SurfaceData, + ) -> bool { + todo!() + } + + fn adapter_features( + &self, + _adapter: &Self::AdapterId, + _adapter_data: &Self::AdapterData, + ) -> Features { + todo!() + } + + fn adapter_limits( + &self, + _adapter: &Self::AdapterId, + _adapter_data: &Self::AdapterData, + ) -> Limits { + todo!() + } + + fn adapter_downlevel_capabilities( + &self, + _adapter: &Self::AdapterId, + _adapter_data: &Self::AdapterData, + ) -> DownlevelCapabilities { + todo!() + } + + fn adapter_get_info( + &self, + _adapter: &Self::AdapterId, + _adapter_data: &Self::AdapterData, + ) -> AdapterInfo { + todo!() + } + + fn adapter_get_texture_format_features( + &self, + _adapter: &Self::AdapterId, + _adapter_data: &Self::AdapterData, + _format: wgt::TextureFormat, + ) -> wgt::TextureFormatFeatures { + todo!() + } + + fn adapter_get_presentation_timestamp( + &self, + _adapter: &Self::AdapterId, + _adapter_data: &Self::AdapterData, + ) -> wgt::PresentationTimestamp { + todo!() + } + + fn surface_get_capabilities( + &self, + _surface: &Self::SurfaceId, + _surface_data: &Self::SurfaceData, + _adapter: &Self::AdapterId, + _adapter_data: &Self::AdapterData, + ) -> wgt::SurfaceCapabilities { + todo!() + } + + fn surface_configure( + &self, + _surface: &Self::SurfaceId, + _surface_data: &Self::SurfaceData, + _device: &Self::DeviceId, + _device_data: &Self::DeviceData, + _config: &crate::SurfaceConfiguration, + ) { + todo!() + } + + fn surface_get_current_texture( + &self, + _surface: &Self::SurfaceId, + _surface_data: &Self::SurfaceData, + ) -> ( + Option, + Option, + SurfaceStatus, + Self::SurfaceOutputDetail, + ) { + todo!() + } + + fn surface_present(&self, _texture: &Self::TextureId, _detail: &Self::SurfaceOutputDetail) { + todo!() + } + + fn surface_texture_discard( + &self, + _texture: &Self::TextureId, + _detail: &Self::SurfaceOutputDetail, + ) { + todo!() + } + + fn device_features( + &self, + _device: &Self::DeviceId, + _device_data: &Self::DeviceData, + ) -> Features { + todo!() + } + + fn device_limits(&self, _device: &Self::DeviceId, _device_data: &Self::DeviceData) -> Limits { + todo!() + } + + fn device_downlevel_properties( + &self, + _device: &Self::DeviceId, + _device_data: &Self::DeviceData, + ) -> DownlevelCapabilities { + todo!() + } + + fn device_create_shader_module( + &self, + _device: &Self::DeviceId, + _device_data: &Self::DeviceData, + _desc: ShaderModuleDescriptor<'_>, + _shader_bound_checks: wgt::ShaderBoundChecks, + ) -> (Self::ShaderModuleId, Self::ShaderModuleData) { + todo!() + } + + unsafe fn device_create_shader_module_spirv( + &self, + _device: &Self::DeviceId, + _device_data: &Self::DeviceData, + _desc: &ShaderModuleDescriptorSpirV<'_>, + ) -> (Self::ShaderModuleId, Self::ShaderModuleData) { + todo!() + } + + fn device_create_bind_group_layout( + &self, + _device: &Self::DeviceId, + _device_data: &Self::DeviceData, + _desc: &BindGroupLayoutDescriptor<'_>, + ) -> (Self::BindGroupLayoutId, Self::BindGroupLayoutData) { + todo!() + } + + fn device_create_bind_group( + &self, + _device: &Self::DeviceId, + _device_data: &Self::DeviceData, + _desc: &BindGroupDescriptor<'_>, + ) -> (Self::BindGroupId, Self::BindGroupData) { + todo!() + } + + fn device_create_pipeline_layout( + &self, + _device: &Self::DeviceId, + _device_data: &Self::DeviceData, + _desc: &PipelineLayoutDescriptor<'_>, + ) -> (Self::PipelineLayoutId, Self::PipelineLayoutData) { + todo!() + } + + fn device_create_render_pipeline( + &self, + _device: &Self::DeviceId, + _device_data: &Self::DeviceData, + _desc: &RenderPipelineDescriptor<'_>, + ) -> (Self::RenderPipelineId, Self::RenderPipelineData) { + todo!() + } + + fn device_create_compute_pipeline( + &self, + _device: &Self::DeviceId, + _device_data: &Self::DeviceData, + _desc: &ComputePipelineDescriptor<'_>, + ) -> (Self::ComputePipelineId, Self::ComputePipelineData) { + todo!() + } + + fn device_create_buffer( + &self, + _device: &Self::DeviceId, + _device_data: &Self::DeviceData, + _desc: &BufferDescriptor<'_>, + ) -> (Self::BufferId, Self::BufferData) { + todo!() + } + + fn device_create_texture( + &self, + _device: &Self::DeviceId, + _device_data: &Self::DeviceData, + _desc: &TextureDescriptor<'_>, + ) -> (Self::TextureId, Self::TextureData) { + todo!() + } + + fn device_create_sampler( + &self, + _device: &Self::DeviceId, + _device_data: &Self::DeviceData, + _desc: &SamplerDescriptor<'_>, + ) -> (Self::SamplerId, Self::SamplerData) { + todo!() + } + + fn device_create_query_set( + &self, + _device: &Self::DeviceId, + _device_data: &Self::DeviceData, + _desc: &crate::QuerySetDescriptor<'_>, + ) -> (Self::QuerySetId, Self::QuerySetData) { + todo!() + } + + fn device_create_command_encoder( + &self, + _device: &Self::DeviceId, + _device_data: &Self::DeviceData, + _desc: &CommandEncoderDescriptor<'_>, + ) -> (Self::CommandEncoderId, Self::CommandEncoderData) { + todo!() + } + + fn device_create_render_bundle_encoder( + &self, + _device: &Self::DeviceId, + _device_data: &Self::DeviceData, + _desc: &RenderBundleEncoderDescriptor<'_>, + ) -> (Self::RenderBundleEncoderId, Self::RenderBundleEncoderData) { + todo!() + } + + fn device_drop(&self, _device: &Self::DeviceId, _device_data: &Self::DeviceData) { + todo!() + } + + fn device_set_device_lost_callback( + &self, + _device: &Self::DeviceId, + _device_data: &Self::DeviceData, + _device_lost_callback: crate::context::DeviceLostCallback, + ) { + todo!() + } + + fn device_destroy(&self, _device: &Self::DeviceId, _device_data: &Self::DeviceData) { + todo!() + } + + fn device_mark_lost( + &self, + _device: &Self::DeviceId, + _device_data: &Self::DeviceData, + _message: &str, + ) { + todo!() + } + + fn queue_drop(&self, _queue: &Self::QueueId, _queue_data: &Self::QueueData) { + todo!() + } + + fn device_poll( + &self, + _device: &Self::DeviceId, + _device_data: &Self::DeviceData, + _maintain: crate::Maintain, + ) -> wgt::MaintainResult { + todo!() + } + + fn device_on_uncaptured_error( + &self, + _device: &Self::DeviceId, + _device_data: &Self::DeviceData, + _handler: Box, + ) { + todo!() + } + + fn device_push_error_scope( + &self, + _device: &Self::DeviceId, + _device_data: &Self::DeviceData, + _filter: crate::ErrorFilter, + ) { + todo!() + } + + fn device_pop_error_scope( + &self, + _device: &Self::DeviceId, + _device_data: &Self::DeviceData, + ) -> Self::PopErrorScopeFuture { + todo!() + } + + fn buffer_map_async( + &self, + _buffer: &Self::BufferId, + _buffer_data: &Self::BufferData, + _mode: MapMode, + _range: Range, + _callback: crate::context::BufferMapCallback, + ) { + todo!() + } + + fn buffer_get_mapped_range( + &self, + _buffer: &Self::BufferId, + _buffer_data: &Self::BufferData, + _sub_range: Range, + ) -> Box { + todo!() + } + + fn buffer_unmap(&self, _buffer: &Self::BufferId, _buffer_data: &Self::BufferData) { + todo!() + } + + fn texture_create_view( + &self, + _texture: &Self::TextureId, + _texture_data: &Self::TextureData, + _desc: &TextureViewDescriptor<'_>, + ) -> (Self::TextureViewId, Self::TextureViewData) { + todo!() + } + + fn surface_drop(&self, _surface: &Self::SurfaceId, _surface_data: &Self::SurfaceData) { + todo!() + } + + fn adapter_drop(&self, _adapter: &Self::AdapterId, _adapter_data: &Self::AdapterData) { + todo!() + } + + fn buffer_destroy(&self, _buffer: &Self::BufferId, _buffer_data: &Self::BufferData) { + todo!() + } + + fn buffer_drop(&self, _buffer: &Self::BufferId, _buffer_data: &Self::BufferData) { + todo!() + } + + fn texture_destroy(&self, _texture: &Self::TextureId, _texture_data: &Self::TextureData) { + todo!() + } + + fn texture_drop(&self, _texture: &Self::TextureId, _texture_data: &Self::TextureData) { + todo!() + } + + fn texture_view_drop( + &self, + _texture_view: &Self::TextureViewId, + _texture_view_data: &Self::TextureViewData, + ) { + todo!() + } + + fn sampler_drop(&self, _sampler: &Self::SamplerId, _sampler_data: &Self::SamplerData) { + todo!() + } + + fn query_set_drop(&self, _query_set: &Self::QuerySetId, _query_set_data: &Self::QuerySetData) { + todo!() + } + + fn bind_group_drop( + &self, + _bind_group: &Self::BindGroupId, + _bind_group_data: &Self::BindGroupData, + ) { + todo!() + } + + fn bind_group_layout_drop( + &self, + _bind_group_layout: &Self::BindGroupLayoutId, + _bind_group_layout_data: &Self::BindGroupLayoutData, + ) { + todo!() + } + + fn pipeline_layout_drop( + &self, + _pipeline_layout: &Self::PipelineLayoutId, + _pipeline_layout_data: &Self::PipelineLayoutData, + ) { + todo!() + } + + fn shader_module_drop( + &self, + _shader_module: &Self::ShaderModuleId, + _shader_module_data: &Self::ShaderModuleData, + ) { + todo!() + } + + fn command_encoder_drop( + &self, + _command_encoder: &Self::CommandEncoderId, + _command_encoder_data: &Self::CommandEncoderData, + ) { + todo!() + } + + fn command_buffer_drop( + &self, + _command_buffer: &Self::CommandBufferId, + _command_buffer_data: &Self::CommandBufferData, + ) { + todo!() + } + + fn render_bundle_drop( + &self, + _render_bundle: &Self::RenderBundleId, + _render_bundle_data: &Self::RenderBundleData, + ) { + todo!() + } + + fn compute_pipeline_drop( + &self, + _pipeline: &Self::ComputePipelineId, + _pipeline_data: &Self::ComputePipelineData, + ) { + todo!() + } + + fn render_pipeline_drop( + &self, + _pipeline: &Self::RenderPipelineId, + _pipeline_data: &Self::RenderPipelineData, + ) { + todo!() + } + + fn compute_pipeline_get_bind_group_layout( + &self, + _pipeline: &Self::ComputePipelineId, + _pipeline_data: &Self::ComputePipelineData, + _index: u32, + ) -> (Self::BindGroupLayoutId, Self::BindGroupLayoutData) { + todo!() + } + + fn render_pipeline_get_bind_group_layout( + &self, + _pipeline: &Self::RenderPipelineId, + _pipeline_data: &Self::RenderPipelineData, + _index: u32, + ) -> (Self::BindGroupLayoutId, Self::BindGroupLayoutData) { + todo!() + } + + fn command_encoder_copy_buffer_to_buffer( + &self, + _encoder: &Self::CommandEncoderId, + _encoder_data: &Self::CommandEncoderData, + _source: &Self::BufferId, + _source_data: &Self::BufferData, + _source_offset: wgt::BufferAddress, + _destination: &Self::BufferId, + _destination_data: &Self::BufferData, + _destination_offset: wgt::BufferAddress, + _copy_size: wgt::BufferAddress, + ) { + todo!() + } + + fn command_encoder_copy_buffer_to_texture( + &self, + _encoder: &Self::CommandEncoderId, + _encoder_data: &Self::CommandEncoderData, + _source: crate::ImageCopyBuffer<'_>, + _destination: crate::ImageCopyTexture<'_>, + _copy_size: wgt::Extent3d, + ) { + todo!() + } + + fn command_encoder_copy_texture_to_buffer( + &self, + _encoder: &Self::CommandEncoderId, + _encoder_data: &Self::CommandEncoderData, + _source: crate::ImageCopyTexture<'_>, + _destination: crate::ImageCopyBuffer<'_>, + _copy_size: wgt::Extent3d, + ) { + todo!() + } + + fn command_encoder_copy_texture_to_texture( + &self, + _encoder: &Self::CommandEncoderId, + _encoder_data: &Self::CommandEncoderData, + _source: crate::ImageCopyTexture<'_>, + _destination: crate::ImageCopyTexture<'_>, + _copy_size: wgt::Extent3d, + ) { + todo!() + } + + fn command_encoder_begin_compute_pass( + &self, + _encoder: &Self::CommandEncoderId, + _encoder_data: &Self::CommandEncoderData, + _desc: &ComputePassDescriptor<'_>, + ) -> (Self::ComputePassId, Self::ComputePassData) { + todo!() + } + + fn command_encoder_end_compute_pass( + &self, + _encoder: &Self::CommandEncoderId, + _encoder_data: &Self::CommandEncoderData, + _pass: &mut Self::ComputePassId, + _pass_data: &mut Self::ComputePassData, + ) { + todo!() + } + + fn command_encoder_begin_render_pass( + &self, + _encoder: &Self::CommandEncoderId, + _encoder_data: &Self::CommandEncoderData, + _desc: &crate::RenderPassDescriptor<'_, '_>, + ) -> (Self::RenderPassId, Self::RenderPassData) { + todo!() + } + + fn command_encoder_end_render_pass( + &self, + _encoder: &Self::CommandEncoderId, + _encoder_data: &Self::CommandEncoderData, + _pass: &mut Self::RenderPassId, + _pass_data: &mut Self::RenderPassData, + ) { + todo!() + } + + fn command_encoder_finish( + &self, + _encoder: Self::CommandEncoderId, + _encoder_data: &mut Self::CommandEncoderData, + ) -> (Self::CommandBufferId, Self::CommandBufferData) { + todo!() + } + + fn command_encoder_clear_texture( + &self, + _encoder: &Self::CommandEncoderId, + _encoder_data: &Self::CommandEncoderData, + _texture: &crate::Texture, // TODO: Decompose? + _subresource_range: &wgt::ImageSubresourceRange, + ) { + todo!() + } + + fn command_encoder_clear_buffer( + &self, + _encoder: &Self::CommandEncoderId, + _encoder_data: &Self::CommandEncoderData, + _buffer: &crate::Buffer, + _offset: wgt::BufferAddress, + _size: Option, + ) { + todo!() + } + + fn command_encoder_insert_debug_marker( + &self, + _encoder: &Self::CommandEncoderId, + _encoder_data: &Self::CommandEncoderData, + _label: &str, + ) { + todo!() + } + + fn command_encoder_push_debug_group( + &self, + _encoder: &Self::CommandEncoderId, + _encoder_data: &Self::CommandEncoderData, + _label: &str, + ) { + todo!() + } + + fn command_encoder_pop_debug_group( + &self, + _encoder: &Self::CommandEncoderId, + _encoder_data: &Self::CommandEncoderData, + ) { + todo!() + } + + fn command_encoder_write_timestamp( + &self, + _encoder: &Self::CommandEncoderId, + _encoder_data: &Self::CommandEncoderData, + _query_set: &Self::QuerySetId, + _query_set_data: &Self::QuerySetData, + _query_index: u32, + ) { + todo!() + } + + fn command_encoder_resolve_query_set( + &self, + _encoder: &Self::CommandEncoderId, + _encoder_data: &Self::CommandEncoderData, + _query_set: &Self::QuerySetId, + _query_set_data: &Self::QuerySetData, + _first_query: u32, + _query_count: u32, + _destination: &Self::BufferId, + _destination_data: &Self::BufferData, + _destination_offset: wgt::BufferAddress, + ) { + todo!() + } + + fn render_bundle_encoder_finish( + &self, + _encoder: Self::RenderBundleEncoderId, + _encoder_data: Self::RenderBundleEncoderData, + _desc: &crate::RenderBundleDescriptor<'_>, + ) -> (Self::RenderBundleId, Self::RenderBundleData) { + todo!() + } + + fn queue_write_buffer( + &self, + _queue: &Self::QueueId, + _queue_data: &Self::QueueData, + _buffer: &Self::BufferId, + _buffer_data: &Self::BufferData, + _offset: wgt::BufferAddress, + _data: &[u8], + ) { + todo!() + } + + fn queue_validate_write_buffer( + &self, + _queue: &Self::QueueId, + _queue_data: &Self::QueueData, + _buffer: &Self::BufferId, + _buffer_data: &Self::BufferData, + _offset: wgt::BufferAddress, + _size: wgt::BufferSize, + ) -> Option<()> { + todo!() + } + + fn queue_create_staging_buffer( + &self, + _queue: &Self::QueueId, + _queue_data: &Self::QueueData, + _size: wgt::BufferSize, + ) -> Option> { + todo!() + } + + fn queue_write_staging_buffer( + &self, + _queue: &Self::QueueId, + _queue_data: &Self::QueueData, + _buffer: &Self::BufferId, + _buffer_data: &Self::BufferData, + _offset: wgt::BufferAddress, + _staging_buffer: &dyn crate::context::QueueWriteBuffer, + ) { + todo!() + } + + fn queue_write_texture( + &self, + _queue: &Self::QueueId, + _queue_data: &Self::QueueData, + _texture: crate::ImageCopyTexture<'_>, + _data: &[u8], + _data_layout: wgt::ImageDataLayout, + _size: wgt::Extent3d, + ) { + todo!() + } + + // TODO: do we need this? + fn queue_copy_external_image_to_texture( + &self, + _queue: &Self::QueueId, + _queue_data: &Self::QueueData, + _source: &wgt::ImageCopyExternalImage, + _dest: crate::ImageCopyTextureTagged<'_>, + _size: wgt::Extent3d, + ) { + todo!() + } + + fn queue_submit>( + &self, + _queue: &Self::QueueId, + _queue_data: &Self::QueueData, + _command_buffers: I, + ) -> (Self::SubmissionIndex, Self::SubmissionIndexData) { + todo!() + } + + fn queue_get_timestamp_period( + &self, + _queue: &Self::QueueId, + _queue_data: &Self::QueueData, + ) -> f32 { + todo!() + } + + fn queue_on_submitted_work_done( + &self, + _queue: &Self::QueueId, + _queue_data: &Self::QueueData, + _callback: crate::context::SubmittedWorkDoneCallback, + ) { + todo!() + } + + fn device_start_capture(&self, _device: &Self::DeviceId, _device_data: &Self::DeviceData) { + todo!() + } + + fn device_stop_capture(&self, _device: &Self::DeviceId, _device_data: &Self::DeviceData) { + todo!() + } + + fn compute_pass_set_pipeline( + &self, + _pass: &mut Self::ComputePassId, + _pass_data: &mut Self::ComputePassData, + _pipeline: &Self::ComputePipelineId, + _pipeline_data: &Self::ComputePipelineData, + ) { + todo!() + } + + fn compute_pass_set_bind_group( + &self, + _pass: &mut Self::ComputePassId, + _pass_data: &mut Self::ComputePassData, + _index: u32, + _bind_group: &Self::BindGroupId, + _bind_group_data: &Self::BindGroupData, + _offsets: &[wgt::DynamicOffset], + ) { + todo!() + } + + fn compute_pass_set_push_constants( + &self, + _pass: &mut Self::ComputePassId, + _pass_data: &mut Self::ComputePassData, + _offset: u32, + _data: &[u8], + ) { + todo!() + } + + fn compute_pass_insert_debug_marker( + &self, + _pass: &mut Self::ComputePassId, + _pass_data: &mut Self::ComputePassData, + _label: &str, + ) { + todo!() + } + + fn compute_pass_push_debug_group( + &self, + _pass: &mut Self::ComputePassId, + _pass_data: &mut Self::ComputePassData, + _group_label: &str, + ) { + todo!() + } + + fn compute_pass_pop_debug_group( + &self, + _pass: &mut Self::ComputePassId, + _pass_data: &mut Self::ComputePassData, + ) { + todo!() + } + + fn compute_pass_write_timestamp( + &self, + _pass: &mut Self::ComputePassId, + _pass_data: &mut Self::ComputePassData, + _query_set: &Self::QuerySetId, + _query_set_data: &Self::QuerySetData, + _query_index: u32, + ) { + todo!() + } + + fn compute_pass_begin_pipeline_statistics_query( + &self, + _pass: &mut Self::ComputePassId, + _pass_data: &mut Self::ComputePassData, + _query_set: &Self::QuerySetId, + _query_set_data: &Self::QuerySetData, + _query_index: u32, + ) { + todo!() + } + + fn compute_pass_end_pipeline_statistics_query( + &self, + _pass: &mut Self::ComputePassId, + _pass_data: &mut Self::ComputePassData, + ) { + todo!() + } + + fn compute_pass_dispatch_workgroups( + &self, + _pass: &mut Self::ComputePassId, + _pass_data: &mut Self::ComputePassData, + _x: u32, + _y: u32, + _z: u32, + ) { + todo!() + } + + fn compute_pass_dispatch_workgroups_indirect( + &self, + _pass: &mut Self::ComputePassId, + _pass_data: &mut Self::ComputePassData, + _indirect_buffer: &Self::BufferId, + _indirect_buffer_data: &Self::BufferData, + _indirect_offset: wgt::BufferAddress, + ) { + todo!() + } + + fn render_bundle_encoder_set_pipeline( + &self, + _encoder: &mut Self::RenderBundleEncoderId, + _encoder_data: &mut Self::RenderBundleEncoderData, + _pipeline: &Self::RenderPipelineId, + _pipeline_data: &Self::RenderPipelineData, + ) { + todo!() + } + + fn render_bundle_encoder_set_bind_group( + &self, + _encoder: &mut Self::RenderBundleEncoderId, + _encoder_data: &mut Self::RenderBundleEncoderData, + _index: u32, + _bind_group: &Self::BindGroupId, + _bind_group_data: &Self::BindGroupData, + _offsets: &[wgt::DynamicOffset], + ) { + todo!() + } + + fn render_bundle_encoder_set_index_buffer( + &self, + _encoder: &mut Self::RenderBundleEncoderId, + _encoder_data: &mut Self::RenderBundleEncoderData, + _buffer: &Self::BufferId, + _buffer_data: &Self::BufferData, + _index_format: wgt::IndexFormat, + _offset: wgt::BufferAddress, + _size: Option, + ) { + todo!() + } + + fn render_bundle_encoder_set_vertex_buffer( + &self, + _encoder: &mut Self::RenderBundleEncoderId, + _encoder_data: &mut Self::RenderBundleEncoderData, + _slot: u32, + _buffer: &Self::BufferId, + _buffer_data: &Self::BufferData, + _offset: wgt::BufferAddress, + _size: Option, + ) { + todo!() + } + + fn render_bundle_encoder_set_push_constants( + &self, + _encoder: &mut Self::RenderBundleEncoderId, + _encoder_data: &mut Self::RenderBundleEncoderData, + _stages: wgt::ShaderStages, + _offset: u32, + _data: &[u8], + ) { + todo!() + } + + fn render_bundle_encoder_draw( + &self, + _encoder: &mut Self::RenderBundleEncoderId, + _encoder_data: &mut Self::RenderBundleEncoderData, + _vertices: Range, + _instances: Range, + ) { + todo!() + } + + fn render_bundle_encoder_draw_indexed( + &self, + _encoder: &mut Self::RenderBundleEncoderId, + _encoder_data: &mut Self::RenderBundleEncoderData, + _indices: Range, + _base_vertex: i32, + _instances: Range, + ) { + todo!() + } + + fn render_bundle_encoder_draw_indirect( + &self, + _encoder: &mut Self::RenderBundleEncoderId, + _encoder_data: &mut Self::RenderBundleEncoderData, + _indirect_buffer: &Self::BufferId, + _indirect_buffer_data: &Self::BufferData, + _indirect_offset: wgt::BufferAddress, + ) { + todo!() + } + + fn render_bundle_encoder_draw_indexed_indirect( + &self, + _encoder: &mut Self::RenderBundleEncoderId, + _encoder_data: &mut Self::RenderBundleEncoderData, + _indirect_buffer: &Self::BufferId, + _indirect_buffer_data: &Self::BufferData, + _indirect_offset: wgt::BufferAddress, + ) { + todo!() + } + + fn render_bundle_encoder_multi_draw_indirect( + &self, + _encoder: &mut Self::RenderBundleEncoderId, + _encoder_data: &mut Self::RenderBundleEncoderData, + _indirect_buffer: &Self::BufferId, + _indirect_buffer_data: &Self::BufferData, + _indirect_offset: wgt::BufferAddress, + _count: u32, + ) { + todo!() + } + + fn render_bundle_encoder_multi_draw_indexed_indirect( + &self, + _encoder: &mut Self::RenderBundleEncoderId, + _encoder_data: &mut Self::RenderBundleEncoderData, + _indirect_buffer: &Self::BufferId, + _indirect_buffer_data: &Self::BufferData, + _indirect_offset: wgt::BufferAddress, + _count: u32, + ) { + todo!() + } + + fn render_bundle_encoder_multi_draw_indirect_count( + &self, + _encoder: &mut Self::RenderBundleEncoderId, + _encoder_data: &mut Self::RenderBundleEncoderData, + _indirect_buffer: &Self::BufferId, + _indirect_buffer_data: &Self::BufferData, + _indirect_offset: wgt::BufferAddress, + _count_buffer: &Self::BufferId, + _count_buffer_data: &Self::BufferData, + _count_buffer_offset: wgt::BufferAddress, + _max_count: u32, + ) { + todo!() + } + + fn render_bundle_encoder_multi_draw_indexed_indirect_count( + &self, + _encoder: &mut Self::RenderBundleEncoderId, + _encoder_data: &mut Self::RenderBundleEncoderData, + _indirect_buffer: &Self::BufferId, + _indirect_buffer_data: &Self::BufferData, + _indirect_offset: wgt::BufferAddress, + _count_buffer: &Self::BufferId, + _count_buffer_data: &Self::BufferData, + _count_buffer_offset: wgt::BufferAddress, + _max_count: u32, + ) { + todo!() + } + + fn render_pass_set_pipeline( + &self, + _pass: &mut Self::RenderPassId, + _pass_data: &mut Self::RenderPassData, + _pipeline: &Self::RenderPipelineId, + _pipeline_data: &Self::RenderPipelineData, + ) { + todo!() + } + + fn render_pass_set_bind_group( + &self, + _pass: &mut Self::RenderPassId, + _pass_data: &mut Self::RenderPassData, + _index: u32, + _bind_group: &Self::BindGroupId, + _bind_group_data: &Self::BindGroupData, + _offsets: &[wgt::DynamicOffset], + ) { + todo!() + } + + fn render_pass_set_index_buffer( + &self, + _pass: &mut Self::RenderPassId, + _pass_data: &mut Self::RenderPassData, + _buffer: &Self::BufferId, + _buffer_data: &Self::BufferData, + _index_format: wgt::IndexFormat, + _offset: wgt::BufferAddress, + _size: Option, + ) { + todo!() + } + + fn render_pass_set_vertex_buffer( + &self, + _pass: &mut Self::RenderPassId, + _pass_data: &mut Self::RenderPassData, + _slot: u32, + _buffer: &Self::BufferId, + _buffer_data: &Self::BufferData, + _offset: wgt::BufferAddress, + _size: Option, + ) { + todo!() + } + + fn render_pass_set_push_constants( + &self, + _pass: &mut Self::RenderPassId, + _pass_data: &mut Self::RenderPassData, + _stages: wgt::ShaderStages, + _offset: u32, + _data: &[u8], + ) { + todo!() + } + + fn render_pass_draw( + &self, + _pass: &mut Self::RenderPassId, + _pass_data: &mut Self::RenderPassData, + _vertices: Range, + _instances: Range, + ) { + todo!() + } + + fn render_pass_draw_indexed( + &self, + _pass: &mut Self::RenderPassId, + _pass_data: &mut Self::RenderPassData, + _indices: Range, + _base_vertex: i32, + _instances: Range, + ) { + todo!() + } + + fn render_pass_draw_indirect( + &self, + _pass: &mut Self::RenderPassId, + _pass_data: &mut Self::RenderPassData, + _indirect_buffer: &Self::BufferId, + _indirect_buffer_data: &Self::BufferData, + _indirect_offset: wgt::BufferAddress, + ) { + todo!() + } + + fn render_pass_draw_indexed_indirect( + &self, + _pass: &mut Self::RenderPassId, + _pass_data: &mut Self::RenderPassData, + _indirect_buffer: &Self::BufferId, + _indirect_buffer_data: &Self::BufferData, + _indirect_offset: wgt::BufferAddress, + ) { + todo!() + } + + fn render_pass_multi_draw_indirect( + &self, + _pass: &mut Self::RenderPassId, + _pass_data: &mut Self::RenderPassData, + _indirect_buffer: &Self::BufferId, + _indirect_buffer_data: &Self::BufferData, + _indirect_offset: wgt::BufferAddress, + _count: u32, + ) { + todo!() + } + + fn render_pass_multi_draw_indexed_indirect( + &self, + _pass: &mut Self::RenderPassId, + _pass_data: &mut Self::RenderPassData, + _indirect_buffer: &Self::BufferId, + _indirect_buffer_data: &Self::BufferData, + _indirect_offset: wgt::BufferAddress, + _count: u32, + ) { + todo!() + } + + fn render_pass_multi_draw_indirect_count( + &self, + _pass: &mut Self::RenderPassId, + _pass_data: &mut Self::RenderPassData, + _indirect_buffer: &Self::BufferId, + _indirect_buffer_data: &Self::BufferData, + _indirect_offset: wgt::BufferAddress, + _count_buffer: &Self::BufferId, + _count_buffer_data: &Self::BufferData, + _count_buffer_offset: wgt::BufferAddress, + _max_count: u32, + ) { + todo!() + } + + fn render_pass_multi_draw_indexed_indirect_count( + &self, + _pass: &mut Self::RenderPassId, + _pass_data: &mut Self::RenderPassData, + _indirect_buffer: &Self::BufferId, + _indirect_buffer_data: &Self::BufferData, + _indirect_offset: wgt::BufferAddress, + _count_buffer: &Self::BufferId, + _count_buffer_data: &Self::BufferData, + _count_buffer_offset: wgt::BufferAddress, + _max_count: u32, + ) { + todo!() + } + + fn render_pass_set_blend_constant( + &self, + _pass: &mut Self::RenderPassId, + _pass_data: &mut Self::RenderPassData, + _color: wgt::Color, + ) { + todo!() + } + + fn render_pass_set_scissor_rect( + &self, + _pass: &mut Self::RenderPassId, + _pass_data: &mut Self::RenderPassData, + _x: u32, + _y: u32, + _width: u32, + _height: u32, + ) { + todo!() + } + + fn render_pass_set_viewport( + &self, + _pass: &mut Self::RenderPassId, + _pass_data: &mut Self::RenderPassData, + _x: f32, + _y: f32, + _width: f32, + _height: f32, + _min_depth: f32, + _max_depth: f32, + ) { + todo!() + } + + fn render_pass_set_stencil_reference( + &self, + _pass: &mut Self::RenderPassId, + _pass_data: &mut Self::RenderPassData, + _reference: u32, + ) { + todo!() + } + + fn render_pass_insert_debug_marker( + &self, + _pass: &mut Self::RenderPassId, + _pass_data: &mut Self::RenderPassData, + _label: &str, + ) { + todo!() + } + + fn render_pass_push_debug_group( + &self, + _pass: &mut Self::RenderPassId, + _pass_data: &mut Self::RenderPassData, + _group_label: &str, + ) { + todo!() + } + + fn render_pass_pop_debug_group( + &self, + _pass: &mut Self::RenderPassId, + _pass_data: &mut Self::RenderPassData, + ) { + todo!() + } + + fn render_pass_write_timestamp( + &self, + _pass: &mut Self::RenderPassId, + _pass_data: &mut Self::RenderPassData, + _query_set: &Self::QuerySetId, + _query_set_data: &Self::QuerySetData, + _query_index: u32, + ) { + todo!() + } + + fn render_pass_begin_occlusion_query( + &self, + _pass: &mut Self::RenderPassId, + _pass_data: &mut Self::RenderPassData, + _query_index: u32, + ) { + todo!() + } + + fn render_pass_end_occlusion_query( + &self, + _pass: &mut Self::RenderPassId, + _pass_data: &mut Self::RenderPassData, + ) { + todo!() + } + + fn render_pass_begin_pipeline_statistics_query( + &self, + _pass: &mut Self::RenderPassId, + _pass_data: &mut Self::RenderPassData, + _query_set: &Self::QuerySetId, + _query_set_data: &Self::QuerySetData, + _query_index: u32, + ) { + todo!() + } + + fn render_pass_end_pipeline_statistics_query( + &self, + _pass: &mut Self::RenderPassId, + _pass_data: &mut Self::RenderPassData, + ) { + todo!() + } + + fn render_pass_execute_bundles( + &self, + _pass: &mut Self::RenderPassId, + _pass_data: &mut Self::RenderPassData, + _render_bundles: &mut dyn Iterator, + ) { + todo!() + } +} diff --git a/wgpu/src/lib.rs b/wgpu/src/lib.rs index e94d45561f..eea320be0f 100644 --- a/wgpu/src/lib.rs +++ b/wgpu/src/lib.rs @@ -1833,6 +1833,13 @@ impl Instance { }; } + #[cfg(wasi_webgpu)] + { + return Self { + context: Arc::from(crate::backend::ContextWasiWebgpu::init(_instance_desc)), + }; + } + unreachable!( "Earlier check of `any_backend_feature_enabled` should have prevented getting here!" ); diff --git a/wgpu/wit/.gitignore b/wgpu/wit/.gitignore new file mode 100644 index 0000000000..1aa6280363 --- /dev/null +++ b/wgpu/wit/.gitignore @@ -0,0 +1 @@ +deps \ No newline at end of file diff --git a/wgpu/wit/deps.lock b/wgpu/wit/deps.lock new file mode 100644 index 0000000000..c509b478e6 --- /dev/null +++ b/wgpu/wit/deps.lock @@ -0,0 +1,9 @@ +[io] +sha256 = "7210e5653539a15478f894d4da24cc69d61924cbcba21d2804d69314a88e5a4c" +sha512 = "49184a1b0945a889abd52d25271172ed3dc2db6968fcdddb1bab7ee0081f4a3eeee0977ad2291126a37631c0d86eeea75d822fa8af224c422134500bf9f0f2bb" + +[webgpu] +url = "https://github.com/MendyBerger/wasi-webgpu/archive/b20c0ec4eb20851dcd6c535af30757a45b8968af/main.tar.gz" +sha256 = "559e02a0d1165e35c0ff3ba78d37a110aa7b7f28d14c098f94711c644c61d496" +sha512 = "513fc06b5a98fef68b5ddb7d499836b3f3fc26c80c1532dd67760796af86c8d55a8a905780805b979c90e3618c304796374779bbb1ad58cfbcb1b702ded4af20" +deps = ["io"] diff --git a/wgpu/wit/deps.toml b/wgpu/wit/deps.toml new file mode 100644 index 0000000000..022567cbd9 --- /dev/null +++ b/wgpu/wit/deps.toml @@ -0,0 +1,2 @@ +[webgpu] +url = "https://github.com/MendyBerger/wasi-webgpu/archive/b20c0ec4eb20851dcd6c535af30757a45b8968af/main.tar.gz" diff --git a/wgpu/wit/main.wit b/wgpu/wit/main.wit new file mode 100644 index 0000000000..c378745ff2 --- /dev/null +++ b/wgpu/wit/main.wit @@ -0,0 +1,11 @@ +package wgpu:backend; + +world main { + import component:webgpu/webgpu; + import component:webgpu/graphics-context; + import component:webgpu/mini-canvas; + import component:webgpu/animation-frame; + import component:webgpu/pointer-events; + import component:webgpu/key-events; + import component:webgpu/frame-buffer; +} \ No newline at end of file