Replies: 2 comments
-
I have tried changing the time f32 to vec4, so theoretically it would be a multiple of 16, but it didn't help. |
Beta Was this translation helpful? Give feedback.
0 replies
-
Try setting 4 separate f32 fields instead of a Vec4. You just won't use the 3 other fields of padding. See #18812 for an example. Kinda like this, in rust: struct CustomMaterial {
#[uniform(0)]
your_data: f32,
// Web examples WebGL2 support: structs must be 16 byte aligned.
#[cfg(feature = "webgl2")]
#[uniform(0)]
_webgl2_padding_8b: u32,
#[cfg(feature = "webgl2")]
#[uniform(0)]
_webgl2_padding_12b: u32,
#[cfg(feature = "webgl2")]
#[uniform(0)]
_webgl2_padding_16b: u32,
} in WGSL: struct CustomMaterial {
your_data: f32,
#ifdef SIXTEEN_BYTE_ALIGNMENT
// Web examples WebGL2 support: structs must be 16 byte aligned.
_webgl2_padding_8b: u32,
_webgl2_padding_12b: u32,
_webgl2_padding_16b: u32,
#endif
}
@group(2) @binding(0)
var<uniform> custom_mat: CustomMaterial; |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
What I'm trying to achieve mostly lies within this shader:
And here's the code that uses it:
When I compile and run targeting WASM, nothing happens on the canvas. And the console says:
I have seen similar issues reported, but I still don't get how to overcome this. Is this a bug or a known thing which requires certain workaround?
Beta Was this translation helpful? Give feedback.
All reactions