diff --git a/README.md b/README.md index c1c3346d7..1aff3aaed 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ [![Dev Matrix ](https://img.shields.io/static/v1?label=devs&message=%23wgpu&color=blueviolet&logo=matrix)](https://matrix.to/#/#wgpu:matrix.org) [![User Matrix ](https://img.shields.io/static/v1?label=users&message=%23wgpu-users&color=blueviolet&logo=matrix)](https://matrix.to/#/#wgpu-users:matrix.org) [![Build Status](https://github.com/gfx-rs/wgpu/workflows/CI/badge.svg)](https://github.com/gfx-rs/wgpu/actions) -[![codecov.io](https://codecov.io/gh/gfx-rs/wgpu/branch/master/graph/badge.svg?token=84qJTesmeS)](https://codecov.io/gh/gfx-rs/wgpu) +[![codecov.io](https://codecov.io/gh/gfx-rs/wgpu/branch/trunk/graph/badge.svg?token=84qJTesmeS)](https://codecov.io/gh/gfx-rs/wgpu) `wgpu` is a cross-platform, safe, pure-rust graphics api. It runs natively on Vulkan, Metal, D3D12, and OpenGL; and on top of WebGL2 and WebGPU on wasm. @@ -17,16 +17,18 @@ The api is based on the [WebGPU standard](https://gpuweb.github.io/gpuweb/). It The repository hosts the following libraries: - [![Crates.io](https://img.shields.io/crates/v/wgpu.svg?label=wgpu)](https://crates.io/crates/wgpu) [![docs.rs](https://docs.rs/wgpu/badge.svg)](https://docs.rs/wgpu/) - User facing Rust API. -- [![Crates.io](https://img.shields.io/crates/v/wgpu-core.svg?label=wgpu-core)](https://crates.io/crates/wgpu-core) [![docs.rs](https://docs.rs/wgpu-core/badge.svg)](https://docs.rs/wgpu-core/) - Internal WebGPU implementation. +- [![Crates.io](https://img.shields.io/crates/v/wgpu-core.svg?label=wgpu-core)](https://crates.io/crates/wgpu-core) [![docs.rs](https://docs.rs/wgpu-core/badge.svg)](https://docs.rs/wgpu-core/) - Internal safe implementation. - [![Crates.io](https://img.shields.io/crates/v/wgpu-hal.svg?label=wgpu-hal)](https://crates.io/crates/wgpu-hal) [![docs.rs](https://docs.rs/wgpu-hal/badge.svg)](https://docs.rs/wgpu-hal/) - Internal unsafe GPU API abstraction layer. - [![Crates.io](https://img.shields.io/crates/v/wgpu-types.svg?label=wgpu-types)](https://crates.io/crates/wgpu-types) [![docs.rs](https://docs.rs/wgpu-types/badge.svg)](https://docs.rs/wgpu-types/) - Rust types shared between all crates. +- [![Crates.io](https://img.shields.io/crates/v/naga.svg?label=naga)](https://crates.io/crates/naga) [![docs.rs](https://docs.rs/naga/badge.svg)](https://docs.rs/naga/) - Stand-alone shader translation library. - [![Crates.io](https://img.shields.io/crates/v/deno_webgpu.svg?label=deno_webgpu)](https://crates.io/crates/deno_webgpu) - WebGPU implementation for the Deno JavaScript/TypeScript runtime The following binaries: +- [![Crates.io](https://img.shields.io/crates/v/naga-cli.svg?label=naga-cli)](https://crates.io/crates/naga-cli) - Tool for translating shaders between different languages using naga. +- [![Crates.io](https://img.shields.io/crates/v/wgpu-info.svg?label=wgpu-info)](https://crates.io/crates/wgpu-info) - Tool for getting information on GPUs in the system. - `cts_runner` - WebGPU Conformance Test Suite runner using `deno_webgpu`. - `player` - standalone application for replaying the API traces. -- `wgpu-info` - program that prints out information about all the adapters on the system or invokes a command for every adapter. For an overview of all the components in the gfx-rs ecosystem, see [the big picture](./etc/big-picture.png). @@ -34,7 +36,7 @@ For an overview of all the components in the gfx-rs ecosystem, see [the big pict ### Rust -Rust examples can be found at `wgpu/examples`. You can run the examples on native with `cargo run --bin `. See the [list of examples](examples). +Rust examples can be found at [wgpu/examples](examples). You can run the examples on native with `cargo run --bin `. See the [list of examples](examples). To run the examples on WebGPU on wasm, run `cargo xtask run-wasm --bin `. Then connect to `http://localhost:8000` in your WebGPU enabled browser. @@ -60,8 +62,9 @@ If you want to use wgpu in other languages, there are many bindings to wgpu-nati We have the Matrix space [![Matrix Space](https://img.shields.io/static/v1?label=Space&message=%23Wgpu&color=blue&logo=matrix)](https://matrix.to/#/#Wgpu:matrix.org) with a few different rooms that form the wgpu community: -- [![Dev Matrix](https://img.shields.io/static/v1?label=devs&message=%23wgpu&color=blueviolet&logo=matrix)](https://matrix.to/#/#wgpu:matrix.org) - discussion of the library's development. -- [![User Matrix](https://img.shields.io/static/v1?label=users&message=%23wgpu-users&color=blueviolet&logo=matrix)](https://matrix.to/#/#wgpu-users:matrix.org) - discussion of using the library and the surrounding ecosystem. +- [![Wgpu Matrix](https://img.shields.io/static/v1?label=wgpu-devs&message=%23wgpu&color=blueviolet&logo=matrix)](https://matrix.to/#/#wgpu:matrix.org) - discussion of the wgpu's development. +- [![Naga Matrix](https://img.shields.io/static/v1?label=naga-devs&message=%23naga&color=blueviolet&logo=matrix)](https://matrix.to/#/#naga:matrix.org) - discussion of the naga's development. +- [![User Matrix](https://img.shields.io/static/v1?label=wgpu-users&message=%23wgpu-users&color=blueviolet&logo=matrix)](https://matrix.to/#/#wgpu-users:matrix.org) - discussion of using the library and the surrounding ecosystem. - [![Random Matrix](https://img.shields.io/static/v1?label=random&message=%23wgpu-random&color=blueviolet&logo=matrix)](https://matrix.to/#/#wgpu-random:matrix.org) - discussion of everything else. ## Wiki @@ -117,13 +120,13 @@ On Linux, you can point to them using `LD_LIBRARY_PATH` environment. ### MSRV policy Due to complex dependants, we have two MSRV policies: - - `wgpu-core`, `wgpu-hal`, and `wgpu-types`'s MSRV is **1.65**. + - `naga`, `wgpu-core`, `wgpu-hal`, and `wgpu-types`'s MSRV is **1.65**. - The rest of the workspace has the MSRV of **1.70**. It is enforced on CI (in "/.github/workflows/ci.yml") with `CORE_MSRV` and `REPO_MSRV` variable. This version can only be upgraded in breaking releases, though we release a breaking version every 3 months. -The `wgpu-core`, `wgpu-hal`, and `wgpu-types` crates should never +The `naga`, `wgpu-core`, `wgpu-hal`, and `wgpu-types` crates should never require an MSRV ahead of Firefox's MSRV for nightly builds, as determined by the value of `MINIMUM_RUST_VERSION` in [`python/mozboot/mozboot/util.py`][util]. @@ -195,7 +198,7 @@ To run a given set of tests: ``` # Must be inside the cts folder we just checked out, else this will fail -cargo run --manifest-path ../cts_runner/Cargo.toml -- ./tools/run_deno --verbose "" +cargo run --manifest-path ../Cargo.toml --bin cts_runner -- ./tools/run_deno --verbose "" ``` To find the full list of tests, go to the [online cts viewer](https://gpuweb.github.io/cts/standalone/?runnow=0&worker=0&debug=0&q=webgpu:*). diff --git a/codecov.yml b/codecov.yml index 959972a69..1e26550a2 100644 --- a/codecov.yml +++ b/codecov.yml @@ -1 +1,3 @@ -comment: false \ No newline at end of file +codecov: + branch: trunk +comment: false diff --git a/logo.png b/logo.png index 63f222a43..1b18a0b11 100644 Binary files a/logo.png and b/logo.png differ diff --git a/wgpu/Cargo.toml b/wgpu/Cargo.toml index 343ed2b05..02c03b09e 100644 --- a/wgpu/Cargo.toml +++ b/wgpu/Cargo.toml @@ -8,9 +8,8 @@ homepage.workspace = true repository.workspace = true keywords.workspace = true license.workspace = true -exclude = [ - "Cargo.lock", -] +readme = "../README.md" +exclude = ["Cargo.lock"] [package.metadata.docs.rs] all-features = true @@ -41,7 +40,11 @@ webgl = ["hal", "wgc/gles"] vulkan-portability = ["wgc/vulkan"] expose-ids = [] # Implement `Send` and `Sync` on Wasm. -fragile-send-sync-non-atomic-wasm = ["hal/fragile-send-sync-non-atomic-wasm", "wgc/fragile-send-sync-non-atomic-wasm", "wgt/fragile-send-sync-non-atomic-wasm"] +fragile-send-sync-non-atomic-wasm = [ + "hal/fragile-send-sync-non-atomic-wasm", + "wgc/fragile-send-sync-non-atomic-wasm", + "wgt/fragile-send-sync-non-atomic-wasm", +] # wgpu-core is always available as an optional dependency, "wgc". # Whenever wgpu-core is selected, we want raw window handle support. @@ -87,7 +90,11 @@ hal = { workspace = true } hal = { workspace = true, features = ["renderdoc"] } [target.'cfg(windows)'.dependencies] -hal = { workspace = true, features = ["dxc_shader_compiler", "renderdoc", "windows_rs"] } +hal = { workspace = true, features = [ + "dxc_shader_compiler", + "renderdoc", + "windows_rs", +] } [target.'cfg(target_arch = "wasm32")'.dependencies.hal] workspace = true @@ -249,9 +256,9 @@ web-sys = { workspace = true, features = [ "ImageBitmapRenderingContext", "Window", "WorkerGlobalScope", - "WorkerNavigator" + "WorkerNavigator", ] } wasm-bindgen.workspace = true js-sys.workspace = true wasm-bindgen-futures.workspace = true -parking_lot.workspace = true \ No newline at end of file +parking_lot.workspace = true diff --git a/wgpu/Makefile b/wgpu/Makefile deleted file mode 100644 index 73d1d3b15..000000000 --- a/wgpu/Makefile +++ /dev/null @@ -1,20 +0,0 @@ -# This Makefile generates SPIR-V shaders from GLSL shaders in the examples. - -shader_compiler = glslangValidator - -# All input shaders. -glsls = $(wildcard examples/*/*.vert examples/*/*.frag examples/*/*.comp) - -# All SPIR-V targets. -spirvs = $(addsuffix .spv,$(glsls)) - -.PHONY: default -default: $(spirvs) - -# Rule for making a SPIR-V target. -$(spirvs): %.spv: % - $(shader_compiler) -V $< -o $@ - -.PHONY: clean -clean: - rm -f $(spirvs) diff --git a/wgpu/README.md b/wgpu/README.md deleted file mode 100644 index 4f4f85a1e..000000000 --- a/wgpu/README.md +++ /dev/null @@ -1,60 +0,0 @@ - - -wgpu-rs is an idiomatic Rust wrapper over [wgpu-core](https://github.com/gfx-rs/wgpu). It's designed to be suitable for general purpose graphics and computation needs of Rust community. - -wgpu-rs can target both the natively supported backends and Wasm directly. - -See our [gallery](https://wgpu.rs/#showcase) and the [wiki page](https://github.com/gfx-rs/wgpu/wiki/Users) for the list of libraries and applications using `wgpu-rs`. - -## Usage - -### How to Run Examples - -All examples are located under the [examples](examples) directory. - -These examples use the default syntax for running examples, as found in the [Cargo](https://doc.rust-lang.org/cargo/reference/manifest.html#examples) documentation. For example, to run the `cube` example: - -```bash -cargo run --bin cube -``` - -The `hello*` examples show bare-bones setup without any helper code. For `hello-compute`, pass 4 numbers separated by spaces as arguments: - -```bash -cargo run --bin hello-compute 1 2 3 4 -``` - -The following environment variables can be used to configure how the framework examples run: - -- `WGPU_BACKEND` - - Options: `vulkan`, `metal`, `dx11`, `dx12`, `gl`, `webgpu` - - If unset a default backend is chosen based on what is supported - by your system. - -- `WGPU_POWER_PREF` - - Options: `low`, `high`, `none` - - If unset power usage is not considered when choosing an adapter. - -- `WGPU_ADAPTER_NAME` - - Select a specific adapter by specifying a substring of the adapter name. - -#### Run Examples on the Web (`wasm32-unknown-unknown`) - -See [wiki article](https://github.com/gfx-rs/wgpu/wiki/Running-on-the-Web-with-WebGPU-and-WebGL). - -## Shaders - -[WGSL](https://gpuweb.github.io/gpuweb/wgsl/) is the main shading language of WebGPU. - -Users can run the [naga](https://github.com/gfx-rs/naga) binary in the following way to convert their SPIR-V shaders to WGSL: - -```bash -cargo run -- -``` - -In addition, SPIR-V can be used by enabling the `spirv` feature and GLSL can be enabled by enabling the `glsl` feature at the cost of slightly increased build times. diff --git a/wgpu/src/lib.rs b/wgpu/src/lib.rs index 4c499254d..d557c05af 100644 --- a/wgpu/src/lib.rs +++ b/wgpu/src/lib.rs @@ -3,7 +3,7 @@ //! To start using the API, create an [`Instance`]. #![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))] -#![doc(html_logo_url = "https://raw.githubusercontent.com/gfx-rs/wgpu/master/logo.png")] +#![doc(html_logo_url = "https://raw.githubusercontent.com/gfx-rs/wgpu/trunk/logo.png")] #![warn(missing_docs, unsafe_op_in_unsafe_fn)] mod backend;