From ebec84ea7c54fffb5bc9645326782d84a30a8197 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A9ctor=20Ram=C3=B3n?= Date: Fri, 21 May 2021 20:29:17 +0700 Subject: [PATCH] Revert "Remove padding from triangle" This reverts commit 2d549d806cd9ff1d7b7b237d818cd24c84957c83. --- wgpu/src/triangle.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/wgpu/src/triangle.rs b/wgpu/src/triangle.rs index 141fc9af..8636b331 100644 --- a/wgpu/src/triangle.rs +++ b/wgpu/src/triangle.rs @@ -425,12 +425,18 @@ impl Pipeline { #[derive(Debug, Clone, Copy, Zeroable, Pod)] struct Uniforms { transform: [f32; 16], + // We need to align this to 256 bytes to please `wgpu`... + // TODO: Be smarter and stop wasting memory! + _padding_a: [f32; 32], + _padding_b: [f32; 16], } impl Default for Uniforms { fn default() -> Self { Self { transform: *Transformation::identity().as_ref(), + _padding_a: [0.0; 32], + _padding_b: [0.0; 16], } } } @@ -439,6 +445,8 @@ impl From for Uniforms { fn from(transformation: Transformation) -> Uniforms { Self { transform: transformation.into(), + _padding_a: [0.0; 32], + _padding_b: [0.0; 16], } } }