Skip to content

Commit 8f53f75

Browse files
Merge branch 'mesh-shading/dx12-backend' of https://github.com/supamaggie70incorporated/wgpu into mesh-shading/dx12-backend
2 parents fafac8c + 5414538 commit 8f53f75

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

wgpu-hal/src/dx12/mod.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1590,17 +1590,17 @@ impl MeshShaderPipelineStateStream {
15901590
($subobject_type:expr, $data:expr) => {{
15911591
// Ensure 8-byte alignment for the subobject start
15921592
let alignment = 8;
1593-
let padding = (alignment - (bytes.len() % alignment)) % alignment;
1594-
bytes.extend(core::iter::repeat(0).take(padding));
1593+
let aligned_length = bytes.len().next_multiple_of(alignment);
1594+
bytes.resize(aligned_length, 0);
15951595

15961596
// Append the type tag (u32)
15971597
let tag: u32 = $subobject_type.0 as u32;
15981598
bytes.extend_from_slice(&tag.to_ne_bytes());
15991599

16001600
// Align the data
16011601
let obj_align = align_of_val(&$data);
1602-
let data_padding = (obj_align - (bytes.len() % obj_align)) % obj_align;
1603-
bytes.extend(core::iter::repeat(0).take(data_padding));
1602+
let data_start = bytes.len().next_multiple_of(obj_align);
1603+
bytes.resize(data_start, 0);
16041604

16051605
// Append the data itself
16061606
#[allow(clippy::ptr_as_ptr, trivial_casts)]

0 commit comments

Comments
 (0)