gfx2d: align Uniforms struct on 16 bytes (#805)
This commit is contained in:
parent
867d111f6d
commit
eefe74fc06
1 changed files with 6 additions and 3 deletions
|
|
@ -44,12 +44,15 @@ pub const components = .{
|
||||||
.size = Vec2,
|
.size = Vec2,
|
||||||
};
|
};
|
||||||
|
|
||||||
const Uniforms = packed struct {
|
const Uniforms = extern struct {
|
||||||
|
// WebGPU requires that the size of struct fields are multiples of 16
|
||||||
|
// So we use align(16) and 'extern' to maintain field order
|
||||||
|
|
||||||
/// The view * orthographic projection matrix
|
/// The view * orthographic projection matrix
|
||||||
view_projection: Mat4x4,
|
view_projection: Mat4x4 align(16),
|
||||||
|
|
||||||
/// Total size of the sprite texture in pixels
|
/// Total size of the sprite texture in pixels
|
||||||
texture_size: Vec2,
|
texture_size: Vec2 align(16),
|
||||||
};
|
};
|
||||||
|
|
||||||
pub fn machSprite2DInit(adapter: anytype) !void {
|
pub fn machSprite2DInit(adapter: anytype) !void {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue