diff --git a/rs/assets/shaders/dither_fade.wgsl b/rs/assets/shaders/dither_fade.wgsl index 70780e2..66b3007 100644 --- a/rs/assets/shaders/dither_fade.wgsl +++ b/rs/assets/shaders/dither_fade.wgsl @@ -17,6 +17,11 @@ struct DitherFade { fade: f32, +#ifdef SIXTEEN_BYTE_ALIGNMENT + _wasm_padding_8b: u32, + _wasm_padding_12b: u32, + _wasm_padding_16b: u32, +#endif } @group(2) @binding(200) diff --git a/rs/engine/src/mats/fade.rs b/rs/engine/src/mats/fade.rs index c6bb6ed..12891e9 100644 --- a/rs/engine/src/mats/fade.rs +++ b/rs/engine/src/mats/fade.rs @@ -10,17 +10,42 @@ use serde::{Deserialize, Serialize}; pub struct DitherFade { #[uniform(200)] pub fade: f32, + #[cfg(target_arch = "wasm32")] + #[uniform(200)] + pub _wasm_padding_8b: u32, + #[cfg(target_arch = "wasm32")] + #[uniform(200)] + pub _wasm_padding_12b: u32, + #[cfg(target_arch = "wasm32")] + #[uniform(200)] + pub _wasm_padding_16b: u32, } impl Default for DitherFade { fn default() -> Self { - Self { fade: 1.0 } + Self { + fade: 1.0, + #[cfg(target_arch = "wasm32")] + _wasm_padding_8b: 0, + #[cfg(target_arch = "wasm32")] + _wasm_padding_12b: 0, + #[cfg(target_arch = "wasm32")] + _wasm_padding_16b: 0, + } } } impl DitherFade { pub fn new(fade: f32) -> Self { - Self { fade } + Self { + fade, + #[cfg(target_arch = "wasm32")] + _wasm_padding_8b: 0, + #[cfg(target_arch = "wasm32")] + _wasm_padding_12b: 0, + #[cfg(target_arch = "wasm32")] + _wasm_padding_16b: 0, + } } } diff --git a/rs/engine/src/ui.rs b/rs/engine/src/ui.rs index fa27e23..581c2a2 100644 --- a/rs/engine/src/ui.rs +++ b/rs/engine/src/ui.rs @@ -936,7 +936,7 @@ impl UiMatBuilder { ..default() }, }, - extension: DitherFade { fade: self.fade }, + extension: DitherFade::new(self.fade), } } }