Fix error on platforms that require 16 byte aligned uniforms such as WebGL.

This commit is contained in:
Robin KAY 2022-08-23 21:44:02 +01:00
parent f0d5a92fbd
commit 2ac918d63a
2 changed files with 5 additions and 0 deletions

View File

@ -6,14 +6,17 @@ struct VertexInput {
}; };
struct OutlineViewUniform { struct OutlineViewUniform {
@align(16)
scale: vec2<f32>, scale: vec2<f32>,
}; };
struct OutlineVertexUniform { struct OutlineVertexUniform {
@align(16)
width: f32, width: f32,
}; };
struct OutlineFragmentUniform { struct OutlineFragmentUniform {
@align(16)
colour: vec4<f32>, colour: vec4<f32>,
}; };

View File

@ -17,11 +17,13 @@ use crate::{pipeline::OutlinePipeline, Outline};
#[derive(Clone, Component, ShaderType)] #[derive(Clone, Component, ShaderType)]
pub struct OutlineVertexUniform { pub struct OutlineVertexUniform {
#[align(16)]
pub width: f32, pub width: f32,
} }
#[derive(Clone, Component, ShaderType)] #[derive(Clone, Component, ShaderType)]
pub struct OutlineFragmentUniform { pub struct OutlineFragmentUniform {
#[align(16)]
pub colour: Vec4, pub colour: Vec4,
} }