fix: align LayerUniformBuffer to 16 bytes for WebGL compat

This commit is contained in:
Maze Winther 2026-04-18 15:01:59 +02:00
parent 011f51051c
commit 794d4ae149
2 changed files with 3 additions and 1 deletions

View File

@ -52,7 +52,7 @@
"nanoid": "^5.1.5",
"next": "16.1.3",
"next-themes": "^0.4.4",
"opencut-wasm": "^0.2.5",
"opencut-wasm": "^0.2.6",
"pg": "^8.16.2",
"postgres": "^3.4.5",
"radix-ui": "^1.4.3",

View File

@ -57,6 +57,7 @@ struct LayerUniformBuffer {
opacity: f32,
flip_x: f32,
flip_y: f32,
_padding: [f32; 2], // WebGL requires uniform buffer sizes to be multiples of 16 bytes (40 → 48)
}
#[repr(C)]
@ -549,6 +550,7 @@ impl Compositor {
opacity: layer.opacity,
flip_x: if layer.transform.flip_x { 1.0 } else { 0.0 },
flip_y: if layer.transform.flip_y { 1.0 } else { 0.0 },
_padding: [0.0; 2],
}),
usage: wgpu::BufferUsages::UNIFORM | wgpu::BufferUsages::COPY_DST,
});