Fix missing _padding in color conversion pipeline

This commit is contained in:
Héctor Ramón Jiménez 2025-04-10 23:25:20 +02:00
parent 58e2d0cdcb
commit 482d54118a
No known key found for this signature in database
GPG key ID: 4C07CEC81AFA161F
2 changed files with 9 additions and 3 deletions

View file

@ -22,11 +22,18 @@ pub fn convert(
struct Ratio {
u: f32,
v: f32,
// Padding field for 16-byte alignment.
// See https://docs.rs/wgpu/latest/wgpu/struct.DownlevelFlags.html#associatedconstant.BUFFER_BINDINGS_NOT_16_BYTE_ALIGNED
_padding: [f32; 2],
}
let ratio = device.create_buffer_init(&wgpu::util::BufferInitDescriptor {
label: Some("iced-wgpu::triangle::msaa ratio"),
contents: bytemuck::bytes_of(&Ratio { u: 1.0, v: 1.0 }),
contents: bytemuck::bytes_of(&Ratio {
u: 1.0,
v: 1.0,
_padding: [0.0; 2],
}),
usage: wgpu::BufferUsages::COPY_DST | wgpu::BufferUsages::UNIFORM,
});

View file

@ -254,8 +254,7 @@ impl Targets {
struct Ratio {
u: f32,
v: f32,
// Padding field to make Ratio 16 byte aligned
//
// Padding field for 16-byte alignment.
// See https://docs.rs/wgpu/latest/wgpu/struct.DownlevelFlags.html#associatedconstant.BUFFER_BINDINGS_NOT_16_BYTE_ALIGNED
_padding: [f32; 2],
}