Revert "Remove padding from triangle"

This reverts commit 2d549d806c.
This commit is contained in:
Héctor Ramón 2021-05-21 20:29:17 +07:00
parent 0772310c4f
commit ebec84ea7c
1 changed files with 8 additions and 0 deletions

View File

@ -425,12 +425,18 @@ impl Pipeline {
#[derive(Debug, Clone, Copy, Zeroable, Pod)] #[derive(Debug, Clone, Copy, Zeroable, Pod)]
struct Uniforms { struct Uniforms {
transform: [f32; 16], 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 { impl Default for Uniforms {
fn default() -> Self { fn default() -> Self {
Self { Self {
transform: *Transformation::identity().as_ref(), transform: *Transformation::identity().as_ref(),
_padding_a: [0.0; 32],
_padding_b: [0.0; 16],
} }
} }
} }
@ -439,6 +445,8 @@ impl From<Transformation> for Uniforms {
fn from(transformation: Transformation) -> Uniforms { fn from(transformation: Transformation) -> Uniforms {
Self { Self {
transform: transformation.into(), transform: transformation.into(),
_padding_a: [0.0; 32],
_padding_b: [0.0; 16],
} }
} }
} }