mirror of
https://github.com/gfx-rs/wgpu.git
synced 2024-11-22 06:44:14 +00:00
Improve shader support documentation
This commit is contained in:
parent
1bd85a835a
commit
87102ccdf5
15
README.md
15
README.md
@ -77,6 +77,21 @@ We have a [wiki](https://github.com/gfx-rs/wgpu/wiki) that serves as a knowledge
|
|||||||
|
|
||||||
:white_check_mark: = First Class Support — :ok: = Best Effort Support — :hammer_and_wrench: = Unsupported, but support in progress
|
:white_check_mark: = First Class Support — :ok: = Best Effort Support — :hammer_and_wrench: = Unsupported, but support in progress
|
||||||
|
|
||||||
|
### Shader Support
|
||||||
|
|
||||||
|
wgpu supports 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, we
|
||||||
|
will handle all of the conversion. Additionally, support for these shader inputs is not going away.
|
||||||
|
|
||||||
|
While WebGPU does not support any shader 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 SPIR-V shaders, enable the `spirv` feature of wgpu.
|
||||||
|
To enable GLSL shaders, enable the `glsl` feature of wgpu.
|
||||||
|
|
||||||
### Angle
|
### Angle
|
||||||
|
|
||||||
[Angle](http://angleproject.org) is a translation layer from GLES to other backends, developed by Google.
|
[Angle](http://angleproject.org) is a translation layer from GLES to other backends, developed by Google.
|
||||||
|
@ -23,6 +23,7 @@ autotests = false
|
|||||||
|
|
||||||
[package.metadata.docs.rs]
|
[package.metadata.docs.rs]
|
||||||
all-features = true
|
all-features = true
|
||||||
|
rustdoc-args = ["--cfg", "docsrs"]
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
|
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
//!
|
//!
|
||||||
//! To start using the API, create an [`Instance`].
|
//! To start using the API, create an [`Instance`].
|
||||||
|
|
||||||
|
#![cfg_attr(docsrs, feature(doc_cfg))] // Allow doc(cfg(feature = "")) for showing in docs that something is feature gated.
|
||||||
#![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/master/logo.png")]
|
||||||
#![warn(missing_docs)]
|
#![warn(missing_docs)]
|
||||||
|
|
||||||
@ -762,11 +763,13 @@ impl Drop for ShaderModule {
|
|||||||
pub enum ShaderSource<'a> {
|
pub enum ShaderSource<'a> {
|
||||||
/// SPIR-V module represented as a slice of words.
|
/// SPIR-V module represented as a slice of words.
|
||||||
#[cfg(feature = "spirv")]
|
#[cfg(feature = "spirv")]
|
||||||
|
#[cfg_attr(docsrs, doc(cfg(feature = "spirv")))]
|
||||||
SpirV(Cow<'a, [u32]>),
|
SpirV(Cow<'a, [u32]>),
|
||||||
/// GLSL module as a string slice.
|
/// GLSL module as a string slice.
|
||||||
///
|
///
|
||||||
/// Note: GLSL is not yet fully supported and must be a specific ShaderStage.
|
/// Note: GLSL is not yet fully supported and must be a specific ShaderStage.
|
||||||
#[cfg(feature = "glsl")]
|
#[cfg(feature = "glsl")]
|
||||||
|
#[cfg_attr(docsrs, doc(cfg(feature = "glsl")))]
|
||||||
Glsl {
|
Glsl {
|
||||||
/// The source code of the shader.
|
/// The source code of the shader.
|
||||||
shader: Cow<'a, str>,
|
shader: Cow<'a, str>,
|
||||||
|
Loading…
Reference in New Issue
Block a user