From a9d1b4e44b708bd6caa4083bca1d2339472d3689 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aaro=20Per=C3=A4maa?= Date: Mon, 2 May 2022 18:38:55 +0300 Subject: [PATCH 1/2] Update push constant docs to reflect the API taking bytes instead of u32's --- wgpu/src/lib.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/wgpu/src/lib.rs b/wgpu/src/lib.rs index b39e412fc1..32abc7807f 100644 --- a/wgpu/src/lib.rs +++ b/wgpu/src/lib.rs @@ -2772,9 +2772,9 @@ impl<'a> RenderPass<'a> { /// /// Offset is measured in bytes, but must be a multiple of [`PUSH_CONSTANT_ALIGNMENT`]. /// - /// Data size must be a multiple of 4 and must be aligned to the 4s, so we take an array of u32. - /// For example, with an offset of 4 and an array of `[u32; 3]`, that will write to the range - /// of 4..16. + /// Data size must be a multiple of 4 and must have an alignment of 4. + /// For example, with an offset of 4 and an array of `[u8; 8]`, that will write to the range + /// of 4..12. /// /// For each byte in the range of push constant data written, the union of the stages of all push constant /// ranges that covers that byte must be exactly `stages`. There's no good way of explaining this simply, From 0ab52517344152aedfd93f03df5f34a630c2b198 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aaro=20Per=C3=A4maa?= Date: Tue, 3 May 2022 07:31:17 +0300 Subject: [PATCH 2/2] Update push constant docs for compute and bundles --- wgpu/src/lib.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/wgpu/src/lib.rs b/wgpu/src/lib.rs index 32abc7807f..afe3e7ac8a 100644 --- a/wgpu/src/lib.rs +++ b/wgpu/src/lib.rs @@ -2907,9 +2907,9 @@ impl<'a> ComputePass<'a> { /// /// Offset is measured in bytes, but must be a multiple of [`PUSH_CONSTANT_ALIGNMENT`]. /// - /// Data size must be a multiple of 4 and must be aligned to the 4s, so we take an array of u32. - /// For example, with an offset of 4 and an array of `[u32; 3]`, that will write to the range - /// of 4..16. + /// Data size must be a multiple of 4 and must have an alignment of 4. + /// For example, with an offset of 4 and an array of `[u8; 8]`, that will write to the range + /// of 4..12. pub fn set_push_constants(&mut self, offset: u32, data: &[u8]) { self.id.set_push_constants(offset, data); } @@ -3065,9 +3065,9 @@ impl<'a> RenderBundleEncoder<'a> { /// /// Offset is measured in bytes, but must be a multiple of [`PUSH_CONSTANT_ALIGNMENT`]. /// - /// Data size must be a multiple of 4 and must be aligned to the 4s, so we take an array of u32. - /// For example, with an offset of 4 and an array of `[u32; 3]`, that will write to the range - /// of 4..16. + /// Data size must be a multiple of 4 and must have an alignment of 4. + /// For example, with an offset of 4 and an array of `[u8; 8]`, that will write to the range + /// of 4..12. /// /// For each byte in the range of push constant data written, the union of the stages of all push constant /// ranges that covers that byte must be exactly `stages`. There's no good way of explaining this simply,