Update Readme

This commit is contained in:
Connor Fitzgerald 2023-10-26 01:28:27 -04:00
parent b8b93042c2
commit e54289b08b
No known key found for this signature in database
GPG Key ID: 7D3FA445BAD3008D
7 changed files with 30 additions and 98 deletions

View File

@ -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) [![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) [![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) [![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. `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: 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.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-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/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 - [![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: 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`. - `cts_runner` - WebGPU Conformance Test Suite runner using `deno_webgpu`.
- `player` - standalone application for replaying the API traces. - `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). 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
Rust examples can be found at `wgpu/examples`. You can run the examples on native with `cargo run --bin <name>`. 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 <name>`. See the [list of examples](examples).
To run the examples on WebGPU on wasm, run `cargo xtask run-wasm --bin <name>`. Then connect to `http://localhost:8000` in your WebGPU enabled browser. To run the examples on WebGPU on wasm, run `cargo xtask run-wasm --bin <name>`. 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: 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. - [![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.
- [![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. - [![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. - [![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 ## Wiki
@ -117,13 +120,13 @@ On Linux, you can point to them using `LD_LIBRARY_PATH` environment.
### MSRV policy ### MSRV policy
Due to complex dependants, we have two MSRV policies: 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**. - 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. 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. 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 require an MSRV ahead of Firefox's MSRV for nightly builds, as
determined by the value of `MINIMUM_RUST_VERSION` in determined by the value of `MINIMUM_RUST_VERSION` in
[`python/mozboot/mozboot/util.py`][util]. [`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 # 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 "<test string>" cargo run --manifest-path ../Cargo.toml --bin cts_runner -- ./tools/run_deno --verbose "<test string>"
``` ```
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:*). 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:*).

View File

@ -1 +1,3 @@
codecov:
branch: trunk
comment: false comment: false

BIN
logo.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 50 KiB

After

Width:  |  Height:  |  Size: 182 KiB

View File

@ -8,9 +8,8 @@ homepage.workspace = true
repository.workspace = true repository.workspace = true
keywords.workspace = true keywords.workspace = true
license.workspace = true license.workspace = true
exclude = [ readme = "../README.md"
"Cargo.lock", exclude = ["Cargo.lock"]
]
[package.metadata.docs.rs] [package.metadata.docs.rs]
all-features = true all-features = true
@ -41,7 +40,11 @@ webgl = ["hal", "wgc/gles"]
vulkan-portability = ["wgc/vulkan"] vulkan-portability = ["wgc/vulkan"]
expose-ids = [] expose-ids = []
# Implement `Send` and `Sync` on Wasm. # 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". # wgpu-core is always available as an optional dependency, "wgc".
# Whenever wgpu-core is selected, we want raw window handle support. # Whenever wgpu-core is selected, we want raw window handle support.
@ -87,7 +90,11 @@ hal = { workspace = true }
hal = { workspace = true, features = ["renderdoc"] } hal = { workspace = true, features = ["renderdoc"] }
[target.'cfg(windows)'.dependencies] [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] [target.'cfg(target_arch = "wasm32")'.dependencies.hal]
workspace = true workspace = true
@ -249,7 +256,7 @@ web-sys = { workspace = true, features = [
"ImageBitmapRenderingContext", "ImageBitmapRenderingContext",
"Window", "Window",
"WorkerGlobalScope", "WorkerGlobalScope",
"WorkerNavigator" "WorkerNavigator",
] } ] }
wasm-bindgen.workspace = true wasm-bindgen.workspace = true
js-sys.workspace = true js-sys.workspace = true

View File

@ -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)

View File

@ -1,60 +0,0 @@
<img align="right" width="25%" src="https://raw.githubusercontent.com/gfx-rs/wgpu/master/logo.png">
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 -- <input.spv> <output.wgsl>
```
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.

View File

@ -3,7 +3,7 @@
//! To start using the API, create an [`Instance`]. //! To start using the API, create an [`Instance`].
#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))] #![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)] #![warn(missing_docs, unsafe_op_in_unsafe_fn)]
mod backend; mod backend;