Skip to content

Commit

Permalink
Give short example of WGSL push_constant syntax.
Browse files Browse the repository at this point in the history
The existing comment referred to the GLSL syntax but didn't give
an indication of how to use it within WGSL.
  • Loading branch information
waywardmonkeys committed Mar 15, 2024
1 parent e04a9f4 commit a6fccef
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ By @cwfitzgerald in [#5325](https://github.com/gfx-rs/wgpu/pull/5325).
- Document Wayland specific behavior related to `SurfaceTexture::present`. By @i509VCB in [#5092](https://github.com/gfx-rs/wgpu/pull/5092).
- Add mention of primitive restart in the description of `PrimitiveState::strip_index_format`. By @cpsdqs in [#5350](https://github.com/gfx-rs/wgpu/pull/5350)
- Document precise behaviour of `SourceLocation`. By @stefnotch in [#5386](https://github.com/gfx-rs/wgpu/pull/5386)
- Give short example of WGSL `push_constant` syntax. By @waywardmonkeys in [#5393](https://github.com/gfx-rs/wgpu/pull/5393)

### New features

Expand Down
9 changes: 8 additions & 1 deletion wgpu-types/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -682,7 +682,14 @@ bitflags::bitflags! {
/// Allows the user to call [`RenderPass::set_push_constants`], provide a non-empty array
/// to [`PipelineLayoutDescriptor`], and provide a non-zero limit to [`Limits::max_push_constant_size`].
///
/// A block of push constants can be declared with `layout(push_constant) uniform Name {..}` in shaders.
/// A block of push constants can be declared in WGSL with `var<push_constant>`:
///
/// ```rust,ignore
/// struct PushConstants { example: f32, }
/// var<push_constant> c: PushConstants;
/// ```
///
/// In GLSL, this corresponds to `layout(push_constant) uniform Name {..}`.
///
/// Supported platforms:
/// - DX12
Expand Down

0 comments on commit a6fccef

Please sign in to comment.