From d79ebc4db3e41dbde60fd0745142f00d0d325389 Mon Sep 17 00:00:00 2001 From: Johann Muszynski Date: Sun, 15 Sep 2024 10:07:39 +0300 Subject: [PATCH] Update some docs containing OpenGL or GLSL references (#6271) --- CHANGELOG.md | 4 ++++ wgpu-types/src/lib.rs | 37 +++++++++++++++++---------------- wgpu/src/api/pipeline_layout.rs | 4 ++-- 3 files changed, 25 insertions(+), 20 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2a463c89b..35355b178 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -126,6 +126,10 @@ By @bradwerth [#6216](https://github.com/gfx-rs/wgpu/pull/6216). - Change the inconsistent `DropGuard` based API on Vulkan and GLES to a consistent, callback-based one. By @jerzywilczek in [#6164](https://github.com/gfx-rs/wgpu/pull/6164) +### Documentation + +- Removed some OpenGL and Vulkan references from `wgpu-types` documentation. Fixed Storage texel types in examples. By @Nelarius in [#6271](https://github.com/gfx-rs/wgpu/pull/6271) + ### Dependency Updates #### GLES diff --git a/wgpu-types/src/lib.rs b/wgpu-types/src/lib.rs index e3cab5605..c7167f826 100644 --- a/wgpu-types/src/lib.rs +++ b/wgpu-types/src/lib.rs @@ -568,7 +568,7 @@ bitflags::bitflags! { /// may also create uniform arrays of storage textures. /// /// ex. - /// - `var textures: array, 10>` (WGSL) + /// - `var textures: array, 10>` (WGSL) /// - `uniform image2D textures[10]` (GLSL) /// /// This capability allows them to exist and to be indexed by dynamically uniform @@ -1959,12 +1959,13 @@ impl TextureViewDimension { /// Alpha blend factor. /// -/// Alpha blending is very complicated: see the OpenGL or Vulkan spec for more information. -/// /// Corresponds to [WebGPU `GPUBlendFactor`]( -/// https://gpuweb.github.io/gpuweb/#enumdef-gpublendfactor). -/// Values using S1 requires [`Features::DUAL_SOURCE_BLENDING`] and can only be -/// used with the first render target. +/// https://gpuweb.github.io/gpuweb/#enumdef-gpublendfactor). Values using `Src1` +/// require [`Features::DUAL_SOURCE_BLENDING`] and can only be used with the first +/// render target. +/// +/// For further details on how the blend factors are applied, see the analogous +/// functionality in OpenGL: . #[repr(C)] #[derive(Copy, Clone, Debug, Hash, Eq, PartialEq)] #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] @@ -2024,10 +2025,11 @@ impl BlendFactor { /// Alpha blend operation. /// -/// Alpha blending is very complicated: see the OpenGL or Vulkan spec for more information. -/// /// Corresponds to [WebGPU `GPUBlendOperation`]( /// https://gpuweb.github.io/gpuweb/#enumdef-gpublendoperation). +/// +/// For further details on how the blend operations are applied, see +/// the analogous functionality in OpenGL: . #[repr(C)] #[derive(Copy, Clone, Debug, Default, Hash, Eq, PartialEq)] #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] @@ -2102,8 +2104,6 @@ impl Default for BlendComponent { /// Describe the blend state of a render pipeline, /// within [`ColorTargetState`]. /// -/// See the OpenGL or Vulkan spec for more information. -/// /// Corresponds to [WebGPU `GPUBlendState`]( /// https://gpuweb.github.io/gpuweb/#dictdef-gpublendstate). #[repr(C)] @@ -6543,7 +6543,7 @@ pub enum StorageTextureAccess { /// Example WGSL syntax: /// ```rust,ignore /// @group(0) @binding(0) - /// var my_storage_image: texture_storage_2d; + /// var my_storage_image: texture_storage_2d; /// ``` /// /// Example GLSL syntax: @@ -6560,7 +6560,7 @@ pub enum StorageTextureAccess { /// Example WGSL syntax: /// ```rust,ignore /// @group(0) @binding(0) - /// var my_storage_image: texture_storage_2d; + /// var my_storage_image: texture_storage_2d; /// ``` /// /// Example GLSL syntax: @@ -6577,7 +6577,7 @@ pub enum StorageTextureAccess { /// Example WGSL syntax: /// ```rust,ignore /// @group(0) @binding(0) - /// var my_storage_image: texture_storage_2d; + /// var my_storage_image: texture_storage_2d; /// ``` /// /// Example GLSL syntax: @@ -6701,8 +6701,8 @@ pub enum BindingType { /// Dimension of the texture view that is going to be sampled. view_dimension: TextureViewDimension, /// True if the texture has a sample count greater than 1. If this is true, - /// the texture must be read from shaders with `texture1DMS`, `texture2DMS`, or `texture3DMS`, - /// depending on `dimension`. + /// the texture must be declared as `texture_multisampled_2d` or + /// `texture_depth_multisampled_2d` in the shader, and read using `textureLoad`. multisampled: bool, }, /// A storage texture. @@ -6710,15 +6710,16 @@ pub enum BindingType { /// Example WGSL syntax: /// ```rust,ignore /// @group(0) @binding(0) - /// var my_storage_image: texture_storage_2d; + /// var my_storage_image: texture_storage_2d; /// ``` /// /// Example GLSL syntax: /// ```cpp,ignore /// layout(set=0, binding=0, r32f) writeonly uniform image2D myStorageImage; /// ``` - /// Note that the texture format must be specified in the shader as well. - /// A list of valid formats can be found in the specification here: + /// Note that the texture format must be specified in the shader, along with the + /// access mode. For WGSL, the format must be one of the enumerants in the list + /// of [storage texel formats](https://gpuweb.github.io/gpuweb/wgsl/#storage-texel-formats). /// /// Corresponds to [WebGPU `GPUStorageTextureBindingLayout`]( /// https://gpuweb.github.io/gpuweb/#dictdef-gpustoragetexturebindinglayout). diff --git a/wgpu/src/api/pipeline_layout.rs b/wgpu/src/api/pipeline_layout.rs index 2b89d2b7a..20538dd9e 100644 --- a/wgpu/src/api/pipeline_layout.rs +++ b/wgpu/src/api/pipeline_layout.rs @@ -40,8 +40,8 @@ pub struct PipelineLayoutDescriptor<'a> { /// "set = 0", second entry will provide all the bindings for "set = 1" etc. pub bind_group_layouts: &'a [&'a BindGroupLayout], /// Set of push constant ranges this pipeline uses. Each shader stage that uses push constants - /// must define the range in push constant memory that corresponds to its single `layout(push_constant)` - /// uniform block. + /// must define the range in push constant memory that corresponds to its single `var` + /// buffer. /// /// If this array is non-empty, the [`Features::PUSH_CONSTANTS`] must be enabled. pub push_constant_ranges: &'a [PushConstantRange],