summaryrefslogtreecommitdiffstats
path: root/wgpu
diff options
context:
space:
mode:
authorLibravatar Dispersia <dispersias@gmail.com>2021-05-19 21:04:47 -0700
committerLibravatar Dispersia <dispersias@gmail.com>2021-05-19 21:04:47 -0700
commitb40c44164646e853239d1b76fd8e4768eb21d9ac (patch)
tree9822c5e8a0ad3e212f8f110cab21115c5bf0b5ba /wgpu
parentd91422e345d30f0d33d737a3be8ad1c90f5d14b9 (diff)
downloadiced-b40c44164646e853239d1b76fd8e4768eb21d9ac.tar.gz
iced-b40c44164646e853239d1b76fd8e4768eb21d9ac.tar.bz2
iced-b40c44164646e853239d1b76fd8e4768eb21d9ac.zip
Add padding to quad to fix alignment issue
Diffstat (limited to 'wgpu')
-rw-r--r--wgpu/src/quad.rs5
1 files changed, 5 insertions, 0 deletions
diff --git a/wgpu/src/quad.rs b/wgpu/src/quad.rs
index 9b87ef81..b91e3e89 100644
--- a/wgpu/src/quad.rs
+++ b/wgpu/src/quad.rs
@@ -305,6 +305,9 @@ const MAX_INSTANCES: usize = 100_000;
struct Uniforms {
transform: [f32; 16],
scale: f32,
+ // Uniforms must be aligned to their largest member,
+ // this uses a mat4x4<f32> which aligns to 16, so align to that
+ _padding: [f32; 3],
}
impl Uniforms {
@@ -312,6 +315,7 @@ impl Uniforms {
Self {
transform: *transformation.as_ref(),
scale,
+ _padding: [0.0; 3]
}
}
}
@@ -321,6 +325,7 @@ impl Default for Uniforms {
Self {
transform: *Transformation::identity().as_ref(),
scale: 1.0,
+ _padding: [0.0; 3]
}
}
}