mirror of
https://github.com/gfx-rs/wgpu.git
synced 2025-12-08 21:26:17 +00:00
Refactor readme to get to the point (#8488)
This commit is contained in:
parent
6e06ec99ee
commit
c0607b53f5
232
README.md
232
README.md
@ -1,16 +1,45 @@
|
|||||||
# wgpu
|
# wgpu
|
||||||
<img align="right" width="20%" src="logo.png">
|
<img align="right" width="20%" src="logo.png">
|
||||||
|
|
||||||
[](https://matrix.to/#/#Wgpu:matrix.org)
|
|
||||||
[](https://matrix.to/#/#wgpu:matrix.org)
|
|
||||||
[](https://matrix.to/#/#wgpu-users:matrix.org)
|
|
||||||
[](https://github.com/gfx-rs/wgpu/actions)
|
[](https://github.com/gfx-rs/wgpu/actions)
|
||||||
[](https://codecov.io/gh/gfx-rs/wgpu)
|
[](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.
|
||||||
|
|
||||||
The API is based on the [WebGPU standard][webgpu]. It serves as the core of the WebGPU integration in Firefox, Servo, and Deno.
|
The API is based on the [WebGPU standard][webgpu], but is a fully native Rust library. It serves as the core of the WebGPU integration in Firefox, Servo, and Deno.
|
||||||
|
|
||||||
|
## Getting Started
|
||||||
|
|
||||||
|
See our examples online at <https://wgpu.rs/examples/>. You can see the Rust sources at [examples](examples) and run them directly with `cargo run --bin wgpu-examples <example>`.
|
||||||
|
|
||||||
|
### Learning `wgpu`
|
||||||
|
|
||||||
|
If you are new to `wgpu` and graphics programming, we recommend starting with [Learn Wgpu].
|
||||||
|
<!-- Note, "Learn Wgpu" is using the capitalization style in their header, NOT our styling -->
|
||||||
|
|
||||||
|
Additionally, [WebGPU Fundamentals] is a tutorial for WebGPU which is very similar to our API, minus differences between Rust and Javascript.
|
||||||
|
|
||||||
|
[Learn Wgpu]: https://sotrh.github.io/learn-wgpu/
|
||||||
|
[WebGPU Fundamentals]: https://webgpufundamentals.org/
|
||||||
|
|
||||||
|
### Wiki
|
||||||
|
|
||||||
|
We have a [wiki](https://github.com/gfx-rs/wgpu/wiki) which has information on useful architecture patterns, debugging tips, and more getting started information.
|
||||||
|
|
||||||
|
### Need Help? Want to Contribute?
|
||||||
|
|
||||||
|
The wgpu community uses Matrix to discuss.
|
||||||
|
|
||||||
|
- [](https://matrix.to/#/#wgpu:matrix.org) - discussion of wgpu's development.
|
||||||
|
- [](https://matrix.to/#/#wgpu-users:matrix.org) - discussion of using the library and the surrounding ecosystem.
|
||||||
|
|
||||||
|
### Other Languages
|
||||||
|
|
||||||
|
To use wgpu in C or dozens of other languages, look at [wgpu-native](https://github.com/gfx-rs/wgpu-native). These are C bindings to wgpu and has an up-to-date list of libraries bringing support to other languages.
|
||||||
|
|
||||||
|
[Learn WebGPU (for C++)] is a good resource for learning how to use wgpu-native from C++.
|
||||||
|
|
||||||
|
[Learn WebGPU (for C++)]: https://eliemichel.github.io/LearnWebGPU/
|
||||||
[webgpu]: https://gpuweb.github.io/gpuweb/
|
[webgpu]: https://gpuweb.github.io/gpuweb/
|
||||||
|
|
||||||
## Quick Links
|
## Quick Links
|
||||||
@ -30,77 +59,6 @@ Contributors are welcome! See [CONTRIBUTING.md][contrib] for more information.
|
|||||||
[trunk-change]: https://github.com/gfx-rs/wgpu/blob/trunk/CHANGELOG.md#unreleased
|
[trunk-change]: https://github.com/gfx-rs/wgpu/blob/trunk/CHANGELOG.md#unreleased
|
||||||
[contrib]: CONTRIBUTING.md
|
[contrib]: CONTRIBUTING.md
|
||||||
|
|
||||||
## Repo Overview
|
|
||||||
|
|
||||||
The repository hosts the following libraries:
|
|
||||||
|
|
||||||
- [](https://crates.io/crates/wgpu) [](https://docs.rs/wgpu/) - User facing Rust API.
|
|
||||||
- [](https://crates.io/crates/wgpu-core) [](https://docs.rs/wgpu-core/) - Internal safe implementation.
|
|
||||||
- [](https://crates.io/crates/wgpu-hal) [](https://docs.rs/wgpu-hal/) - Internal unsafe GPU API abstraction layer.
|
|
||||||
- [](https://crates.io/crates/wgpu-types) [](https://docs.rs/wgpu-types/) - Rust types shared between all crates.
|
|
||||||
- [](https://crates.io/crates/naga) [](https://docs.rs/naga/) - Stand-alone shader translation library.
|
|
||||||
- [](https://crates.io/crates/deno_webgpu) - WebGPU implementation for the Deno JavaScript/TypeScript runtime
|
|
||||||
|
|
||||||
The following binaries:
|
|
||||||
|
|
||||||
- [](https://crates.io/crates/naga-cli) - Tool for translating shaders between different languages using `naga`.
|
|
||||||
- [](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.
|
|
||||||
|
|
||||||
For an overview of all the components in the gfx-rs ecosystem, see [the big picture](./docs/big-picture.png).
|
|
||||||
|
|
||||||
## Getting Started
|
|
||||||
|
|
||||||
### Play with our Examples
|
|
||||||
|
|
||||||
Go to <https://wgpu.rs/examples/> to play with our examples in your browser. Requires a browser supporting WebGPU for the WebGPU examples.
|
|
||||||
|
|
||||||
### Rust
|
|
||||||
|
|
||||||
Rust examples can be found at [examples](examples). You can run the examples natively with `cargo run --bin wgpu-examples <example>`.
|
|
||||||
|
|
||||||
If you are new to wgpu and graphics programming, we recommend starting with https://sotrh.github.io/learn-wgpu/.
|
|
||||||
|
|
||||||
To run the examples in a browser, run `cargo xtask run-wasm`.
|
|
||||||
Then open `http://localhost:8000` in your browser, and you can choose an example to run.
|
|
||||||
Naturally, in order to display any of the WebGPU based examples, you need to make sure your browser supports it.
|
|
||||||
|
|
||||||
### C/C++
|
|
||||||
|
|
||||||
To use wgpu in C/C++, you need [wgpu-native](https://github.com/gfx-rs/wgpu-native).
|
|
||||||
|
|
||||||
If you are looking for a wgpu C++ tutorial, look at the following:
|
|
||||||
|
|
||||||
- https://eliemichel.github.io/LearnWebGPU/
|
|
||||||
|
|
||||||
### Others
|
|
||||||
|
|
||||||
If you want to use wgpu in other languages, there are many bindings to wgpu-native from languages such as Python, D, Julia, Kotlin, and more. See [the list](https://github.com/gfx-rs/wgpu-native#bindings).
|
|
||||||
|
|
||||||
## Community
|
|
||||||
|
|
||||||
We have the Matrix space [](https://matrix.to/#/#Wgpu:matrix.org) with a few different rooms that form the wgpu community:
|
|
||||||
|
|
||||||
- [](https://matrix.to/#/#wgpu:matrix.org) - discussion of the wgpu's development.
|
|
||||||
- [](https://matrix.to/#/#naga:matrix.org) - discussion of the naga's development.
|
|
||||||
- [](https://matrix.to/#/#wgpu-users:matrix.org) - discussion of using the library and the surrounding ecosystem.
|
|
||||||
- [](https://matrix.to/#/#wgpu-random:matrix.org) - discussion of everything else.
|
|
||||||
|
|
||||||
## Wiki
|
|
||||||
|
|
||||||
We have a [wiki](https://github.com/gfx-rs/wgpu/wiki) that serves as a knowledge base.
|
|
||||||
|
|
||||||
## Extension Specifications
|
|
||||||
|
|
||||||
While the core of wgpu is based on the WebGPU standard, we also support extensions that allow for features that the standard does not have yet.
|
|
||||||
For high-level documentation on how to use these extensions, see the individual specifications:
|
|
||||||
|
|
||||||
🧪EXPERIMENTAL🧪 APIs are subject to change and may allow undefined behavior if used incorrectly.
|
|
||||||
|
|
||||||
- 🧪EXPERIMENTAL🧪 [Ray Tracing](./docs/api-specs/ray_tracing.md).
|
|
||||||
- 🧪EXPERIMENTAL🧪 [Mesh Shading](./docs/api-specs/mesh_shading.md).
|
|
||||||
|
|
||||||
## Supported Platforms
|
## Supported Platforms
|
||||||
|
|
||||||
| API | Windows | Linux/Android | macOS/iOS | Web (wasm) |
|
| API | Windows | Linux/Android | macOS/iOS | Web (wasm) |
|
||||||
@ -113,39 +71,32 @@ For high-level documentation on how to use these extensions, see the individual
|
|||||||
|
|
||||||
✅ = First Class Support
|
✅ = First Class Support
|
||||||
🆗 = Downlevel/Best Effort Support
|
🆗 = Downlevel/Best Effort Support
|
||||||
📐 = Requires the [ANGLE](#angle) translation layer (GL ES 3.0 only)
|
📐 = Requires the [ANGLE](https://github.com/gfx-rs/wgpu/wiki/Running-on-ANGLE) translation layer (GL ES 3.0 only)
|
||||||
🌋 = Requires the [MoltenVK](https://vulkan.lunarg.com/sdk/home#mac) translation layer
|
🌋 = Requires the [MoltenVK](https://vulkan.lunarg.com/sdk/home#mac) translation layer
|
||||||
🛠️ = Unsupported, though open to contributions
|
🛠️ = Unsupported, though open to contributions
|
||||||
|
|
||||||
### Shader Support
|
## Environment Variables
|
||||||
|
|
||||||
wgpu supports shaders in [WGSL](https://gpuweb.github.io/gpuweb/wgsl/), SPIR-V, and GLSL.
|
Testing, examples, and `::from_env()` methods use a standardized set of environment variables to control wgpu's behavior.
|
||||||
Both [HLSL](https://github.com/Microsoft/DirectXShaderCompiler) and [GLSL](https://github.com/KhronosGroup/glslang)
|
|
||||||
have compilers to target SPIR-V. All of these shader languages can be used with any backend as we handle all of the conversions. Additionally, support for these shader inputs is not going away.
|
|
||||||
|
|
||||||
While WebGPU does not support any shading language other than WGSL, we will automatically convert your
|
- `WGPU_BACKEND` with a comma-separated list of the backends you want to use (`vulkan`, `metal`, `dx12`, or `gl`).
|
||||||
non-WGSL shaders if you're running on WebGPU.
|
- `WGPU_ADAPTER_NAME` with a case-insensitive substring of the name of the adapter you want to use (ex. `1080` will match `NVIDIA GeForce 1080ti`).
|
||||||
|
- `WGPU_DX12_COMPILER` with the DX12 shader compiler you wish to use (`dxc`, `static-dxc`, or `fxc`). Note that `dxc` requires `dxcompiler.dll` (min v1.8.2502) to be in the working directory, and `static-dxc` requires the `static-dxc` crate feature to be enabled. Otherwise, it will fall back to `fxc`.
|
||||||
|
|
||||||
WGSL is always supported by default, but GLSL and SPIR-V need features enabled to compile in support.
|
See the [documentation](https://docs.rs/wgpu/latest/wgpu/index.html?search=env) for more environment variables.
|
||||||
|
|
||||||
Note that the WGSL specification is still under development,
|
When running the CTS, use the variables `DENO_WEBGPU_ADAPTER_NAME`, `DENO_WEBGPU_BACKEND`, `DENO_WEBGPU_POWER_PREFERENCE`.
|
||||||
so the [draft specification][wgsl spec] does not exactly describe what `wgpu` supports.
|
|
||||||
See [below](#tracking-the-webgpu-and-wgsl-draft-specifications) for details.
|
|
||||||
|
|
||||||
To enable SPIR-V shaders, enable the `spirv` feature of wgpu.
|
## Repo Overview
|
||||||
To enable GLSL shaders, enable the `glsl` feature of wgpu.
|
|
||||||
|
|
||||||
### Angle
|
For an overview of all the components in the gfx-rs ecosystem, see [the big picture](./docs/big-picture.png).
|
||||||
|
|
||||||
[Angle](http://angleproject.org) is a translation layer from GLES to other backends developed by Google.
|
## MSRV policy
|
||||||
We support running our GLES3 backend over it in order to reach platforms DX11 support, which aren't accessible otherwise.
|
|
||||||
In order to run with Angle, the "angle" feature has to be enabled, and Angle libraries placed in a location visible to the application.
|
|
||||||
These binaries can be downloaded from [gfbuild-angle](https://github.com/DileSoft/gfbuild-angle) artifacts, [manual compilation](https://github.com/google/angle/blob/main/doc/DevSetup.md) may be required on Macs with Apple silicon.
|
|
||||||
|
|
||||||
On Windows, you generally need to copy them into the working directory, in the same directory as the executable, or somewhere in your path.
|
TL;DR: If you're using `wgpu`, our MSRV is **1.88**.
|
||||||
On Linux, you can point to them using `LD_LIBRARY_PATH` environment.
|
|
||||||
|
|
||||||
### MSRV policy
|
<details>
|
||||||
|
<summary> Specific Details </summary>
|
||||||
|
|
||||||
Due to complex dependants, we have two MSRV policies:
|
Due to complex dependants, we have two MSRV policies:
|
||||||
|
|
||||||
@ -162,85 +113,11 @@ determined by the value of `MINIMUM_RUST_VERSION` in
|
|||||||
|
|
||||||
[util]: https://searchfox.org/mozilla-central/source/python/mozboot/mozboot/util.py
|
[util]: https://searchfox.org/mozilla-central/source/python/mozboot/mozboot/util.py
|
||||||
|
|
||||||
## Environment Variables
|
</details>
|
||||||
|
|
||||||
All testing and example infrastructure share the same set of environment variables that determine which Backend/GPU it will run on.
|
## Testing and Environment Variables
|
||||||
|
|
||||||
- `WGPU_ADAPTER_NAME` with a substring of the name of the adapter you want to use (ex. `1080` will match `NVIDIA GeForce 1080ti`).
|
[Information about testing](./docs/testing.md), including where tests of various kinds live, and how to run the tests.
|
||||||
- `WGPU_BACKEND` with a comma-separated list of the backends you want to use (`vulkan`, `metal`, `dx12`, or `gl`).
|
|
||||||
- `WGPU_POWER_PREF` with the power preference to choose when a specific adapter name isn't specified (`high`, `low` or `none`)
|
|
||||||
- `WGPU_DX12_COMPILER` with the DX12 shader compiler you wish to use (`dxc`, `static-dxc`, or `fxc`). Note that `dxc` requires `dxcompiler.dll` (min v1.8.2502) to be in the working directory, and `static-dxc` requires the `static-dxc` crate feature to be enabled. Otherwise, it will fall back to `fxc`.
|
|
||||||
- `WGPU_GLES_MINOR_VERSION` with the minor OpenGL ES 3 version number to request (`0`, `1`, `2` or `automatic`).
|
|
||||||
- `WGPU_ALLOW_UNDERLYING_NONCOMPLIANT_ADAPTER` with a boolean whether non-compliant drivers are enumerated (`0` for false, `1` for true).
|
|
||||||
|
|
||||||
When running the CTS, use the variables `DENO_WEBGPU_ADAPTER_NAME`, `DENO_WEBGPU_BACKEND`, `DENO_WEBGPU_POWER_PREFERENCE`.
|
|
||||||
|
|
||||||
## Testing
|
|
||||||
|
|
||||||
We have multiple methods of testing, each of which tests different qualities about wgpu. We automatically run our tests on CI. The current state of CI testing:
|
|
||||||
|
|
||||||
| Platform/Backend | Tests | Notes |
|
|
||||||
| ---------------- | ------------------ | --------------------- |
|
|
||||||
| Windows/DX12 | :heavy_check_mark: | using WARP |
|
|
||||||
| Windows/OpenGL | :heavy_check_mark: | using llvmpipe |
|
|
||||||
| MacOS/Metal | :heavy_check_mark: | using hardware runner |
|
|
||||||
| Linux/Vulkan | :heavy_check_mark: | using lavapipe |
|
|
||||||
| Linux/OpenGL ES | :heavy_check_mark: | using llvmpipe |
|
|
||||||
| Chrome/WebGL | :heavy_check_mark: | using swiftshader |
|
|
||||||
| Chrome/WebGPU | :x: | not set up |
|
|
||||||
|
|
||||||
### Core Test Infrastructure
|
|
||||||
|
|
||||||
We use a tool called [`cargo nextest`](https://github.com/nextest-rs/nextest) to run our tests.
|
|
||||||
To install it, run `cargo install cargo-nextest`.
|
|
||||||
|
|
||||||
To run the test suite:
|
|
||||||
|
|
||||||
```
|
|
||||||
cargo xtask test
|
|
||||||
```
|
|
||||||
|
|
||||||
To run the test suite on WebGL (currently incomplete):
|
|
||||||
|
|
||||||
```
|
|
||||||
cd wgpu
|
|
||||||
wasm-pack test --headless --chrome --no-default-features --features webgl --workspace
|
|
||||||
```
|
|
||||||
|
|
||||||
This will automatically run the tests using a packaged browser. Remove `--headless` to run the tests with whatever browser you wish at `http://localhost:8000`.
|
|
||||||
|
|
||||||
If you are a user and want a way to help contribute to wgpu, we always need more help writing test cases.
|
|
||||||
|
|
||||||
### WebGPU Conformance Test Suite
|
|
||||||
|
|
||||||
WebGPU includes a Conformance Test Suite to validate that implementations are
|
|
||||||
working correctly. We run cases from the CTS against wgpu using
|
|
||||||
[Deno](https://deno.com/). A [default list of enabled
|
|
||||||
tests](./cts_runner/test.lst) is automatically run on pull requests in CI.
|
|
||||||
|
|
||||||
To run the default set of CTS tests locally, run:
|
|
||||||
|
|
||||||
```
|
|
||||||
cargo xtask cts
|
|
||||||
```
|
|
||||||
|
|
||||||
You can also specify a test selector on the command line:
|
|
||||||
|
|
||||||
```
|
|
||||||
cargo xtask cts 'webgpu:api,operation,command_buffer,basic:*'
|
|
||||||
```
|
|
||||||
|
|
||||||
Or supply your own test list in a file:
|
|
||||||
|
|
||||||
```
|
|
||||||
cargo xtask cts -f your_tests.lst
|
|
||||||
```
|
|
||||||
|
|
||||||
To find the full list of tests, go to the
|
|
||||||
[web version of the CTS](https://gpuweb.github.io/cts/standalone/?runnow=0&worker=0&debug=0&q=webgpu:*).
|
|
||||||
|
|
||||||
The version of the CTS used by `cargo xtask cts` is specified in
|
|
||||||
[`cts_runner/revision.txt`](./cts_runner/revision.txt).
|
|
||||||
|
|
||||||
## Tracking the WebGPU and WGSL draft specifications
|
## Tracking the WebGPU and WGSL draft specifications
|
||||||
|
|
||||||
@ -276,10 +153,3 @@ Exactly which WGSL features `wgpu` supports depends on how you are using it:
|
|||||||
[naga]: https://github.com/gfx-rs/wgpu/tree/trunk/naga/
|
[naga]: https://github.com/gfx-rs/wgpu/tree/trunk/naga/
|
||||||
[naga bugs]: https://github.com/gfx-rs/wgpu/issues?q=is%3Aissue%20state%3Aopen%20label%3A%22naga%22
|
[naga bugs]: https://github.com/gfx-rs/wgpu/issues?q=is%3Aissue%20state%3Aopen%20label%3A%22naga%22
|
||||||
|
|
||||||
## Coordinate Systems
|
|
||||||
|
|
||||||
wgpu uses the coordinate systems of D3D and Metal:
|
|
||||||
|
|
||||||
| Render | Texture |
|
|
||||||
| --------------------------------------------------- | ----------------------------------------------------- |
|
|
||||||
|  |  |
|
|
||||||
|
|||||||
@ -24,6 +24,7 @@ This is a table of contents, in the form of the repository's directory structure
|
|||||||
|
|
||||||
- benches
|
- benches
|
||||||
- [benches](#benchmark-tests)
|
- [benches](#benchmark-tests)
|
||||||
|
- [cts_runner](#webgpu-cts)
|
||||||
- examples
|
- examples
|
||||||
- [features](#example-tests)
|
- [features](#example-tests)
|
||||||
- naga
|
- naga
|
||||||
@ -231,3 +232,33 @@ does not support those features.
|
|||||||
Throughout the codebase we have standard `#[test]`s that test individual
|
Throughout the codebase we have standard `#[test]`s that test individual
|
||||||
functions or small parts of the codebase. These don't run on the gpu.
|
functions or small parts of the codebase. These don't run on the gpu.
|
||||||
|
|
||||||
|
## WebGPU CTS
|
||||||
|
|
||||||
|
WebGPU includes a Conformance Test Suite to validate that implementations are
|
||||||
|
working correctly. We run cases from the CTS against wgpu using
|
||||||
|
[Deno](https://deno.com/). A [default list of enabled
|
||||||
|
tests](../cts_runner/test.lst) is automatically run on pull requests in CI.
|
||||||
|
|
||||||
|
To run the default set of CTS tests locally, run:
|
||||||
|
|
||||||
|
```
|
||||||
|
cargo xtask cts
|
||||||
|
```
|
||||||
|
|
||||||
|
You can also specify a test selector on the command line:
|
||||||
|
|
||||||
|
```
|
||||||
|
cargo xtask cts 'webgpu:api,operation,command_buffer,basic:*'
|
||||||
|
```
|
||||||
|
|
||||||
|
Or supply your own test list in a file:
|
||||||
|
|
||||||
|
```
|
||||||
|
cargo xtask cts -f your_tests.lst
|
||||||
|
```
|
||||||
|
|
||||||
|
To find the full list of tests, go to the
|
||||||
|
[web-based standalone CTS runner](https://gpuweb.github.io/cts/standalone/?runnow=0&worker=0&debug=0&q=webgpu:*).
|
||||||
|
|
||||||
|
The version of the CTS used by `cargo xtask cts` is specified in
|
||||||
|
[`cts_runner/revision.txt`](../cts_runner/revision.txt).
|
||||||
|
|||||||
@ -1,8 +1,8 @@
|
|||||||
//! `wgpu` is a cross-platform, safe, pure-Rust graphics API. It runs natively on
|
//! `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.
|
//! Vulkan, Metal, D3D12, and OpenGL; and on top of WebGL2 and WebGPU on wasm.
|
||||||
//!
|
//!
|
||||||
//! The API is based on the [WebGPU standard][webgpu]. It serves as the core of the
|
//! The API is based on the [WebGPU standard][webgpu], but is a fully native Rust library.
|
||||||
//! WebGPU integration in Firefox, Servo, and Deno.
|
//! It serves as the core of the WebGPU integration in Firefox, Servo, and Deno.
|
||||||
//!
|
//!
|
||||||
//! [webgpu]: https://gpuweb.github.io/gpuweb/
|
//! [webgpu]: https://gpuweb.github.io/gpuweb/
|
||||||
//!
|
//!
|
||||||
@ -10,15 +10,56 @@
|
|||||||
//!
|
//!
|
||||||
//! The main entry point to the API is the [`Instance`] type, from which you can create [`Adapter`], [`Device`], and [`Surface`].
|
//! The main entry point to the API is the [`Instance`] type, from which you can create [`Adapter`], [`Device`], and [`Surface`].
|
||||||
//!
|
//!
|
||||||
//! If you are new to `wgpu` and graphics programming, we recommend reading
|
//! If you are new to `wgpu` and graphics programming, we recommend starting with [Learn Wgpu].
|
||||||
//! <https://sotrh.github.io/learn-wgpu/> and <https://webgpufundamentals.org/>. The latter is a WebGPU
|
//! <!-- Note, "Learn Wgpu" is using the capitalization style in their header, NOT our styling -->
|
||||||
//! tutorial, but the concepts are nearly identical to `wgpu`.
|
//!
|
||||||
|
//! Additionally, [WebGPU Fundamentals] is a tutorial for WebGPU which is very similar to our API, minus differences between Rust and Javascript.
|
||||||
|
//!
|
||||||
|
//! We have a [wiki](https://github.com/gfx-rs/wgpu/wiki) which has information on useful architecture patterns, debugging tips, and more getting started information.
|
||||||
//!
|
//!
|
||||||
//! There are examples for this version [available on GitHub](https://github.com/gfx-rs/wgpu/tree/v27/examples#readme).
|
//! There are examples for this version [available on GitHub](https://github.com/gfx-rs/wgpu/tree/v27/examples#readme).
|
||||||
//!
|
//!
|
||||||
//! The API is refcounted, so all handles are cloneable, and if you create a resource which references another,
|
//! The API is refcounted, so all handles are cloneable, and if you create a resource which references another,
|
||||||
//! it will automatically keep dependent resources alive.
|
//! it will automatically keep dependent resources alive.
|
||||||
//!
|
//!
|
||||||
|
//! `wgpu` uses the coordinate systems of D3D and Metal. Depth ranges from [0, 1].
|
||||||
|
//!
|
||||||
|
//! | Render | Texture |
|
||||||
|
//! | --------------------- | ---------------------- |
|
||||||
|
//! | ![render_coordinates] | ![texture_coordinates] |
|
||||||
|
//!
|
||||||
|
//! `wgpu`'s MSRV is **1.88**.
|
||||||
|
//!
|
||||||
|
//! [Learn Wgpu]: https://sotrh.github.io/learn-wgpu/
|
||||||
|
//! [WebGPU Fundamentals]: https://webgpufundamentals.org/
|
||||||
|
//! [render_coordinates]: https://raw.githubusercontent.com/gfx-rs/wgpu/refs/heads/v27/docs/render_coordinates.png
|
||||||
|
//! [texture_coordinates]: https://raw.githubusercontent.com/gfx-rs/wgpu/refs/heads/v27/docs/texture_coordinates.png
|
||||||
|
//!
|
||||||
|
//! ## Extension Specifications
|
||||||
|
//!
|
||||||
|
//! While the core of `wgpu` is based on the WebGPU standard, we also support extensions that allow for features that the standard does not have yet.
|
||||||
|
//! For high-level documentation on how to use these extensions, see documentation on [`Features`] or the relevant specification:
|
||||||
|
//!
|
||||||
|
//! 🧪EXPERIMENTAL🧪 APIs are subject to change and may allow undefined behavior if used incorrectly.
|
||||||
|
//!
|
||||||
|
//! - 🧪EXPERIMENTAL🧪 [Ray Tracing](https://github.com/gfx-rs/wgpu/blob/v27/docs/api-specs/ray_tracing.md).
|
||||||
|
//! - 🧪EXPERIMENTAL🧪 [Mesh Shading](https://github.com/gfx-rs/wgpu/blob/v27/docs/api-specs/mesh_shading.md).
|
||||||
|
//!
|
||||||
|
//! ## Shader Support
|
||||||
|
//!
|
||||||
|
//! `wgpu` can consume shaders in [WGSL](https://gpuweb.github.io/gpuweb/wgsl/), SPIR-V, and GLSL.
|
||||||
|
//! Both [HLSL](https://github.com/Microsoft/DirectXShaderCompiler) and [GLSL](https://github.com/KhronosGroup/glslang)
|
||||||
|
//! have compilers to target SPIR-V. All of these shader languages can be used with any backend as we handle all of the conversions. Additionally, support for these shader inputs is not going away.
|
||||||
|
//!
|
||||||
|
//! While WebGPU does not support any shading language other than WGSL, we will automatically convert your
|
||||||
|
//! non-WGSL shaders if you're running on WebGPU.
|
||||||
|
//!
|
||||||
|
//! WGSL is always supported by default, but GLSL and SPIR-V need features enabled to compile in support.
|
||||||
|
//!
|
||||||
|
//! To enable WGSL shaders, enable the `wgsl` feature of `wgpu` (enabled by default).
|
||||||
|
//! To enable SPIR-V shaders, enable the `spirv` feature of `wgpu`.
|
||||||
|
//! To enable GLSL shaders, enable the `glsl` feature of `wgpu`.
|
||||||
|
//!
|
||||||
//! ## Feature flags
|
//! ## Feature flags
|
||||||
#![doc = document_features::document_features!()]
|
#![doc = document_features::document_features!()]
|
||||||
//!
|
//!
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user