examples/custom-renderer: correct packed struct -> extern struct

Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
Stephen Gutekanst 2024-04-06 13:25:12 -07:00 committed by Stephen Gutekanst
parent 8bd822c35d
commit a7a6ecdd45
2 changed files with 4 additions and 5 deletions

View file

@ -33,9 +33,8 @@ pub const global_events = .{
.tick = .{ .handler = tick }, .tick = .{ .handler = tick },
}; };
// TODO(important): this shouldn't be a packed struct, it should be extern. const UniformBufferObject = extern struct {
const UniformBufferObject = packed struct { offset: Vec3,
offset: Vec3.Vector,
scale: f32, scale: f32,
}; };
@ -146,7 +145,7 @@ fn tick(
_ = id; _ = id;
const ubo = UniformBufferObject{ const ubo = UniformBufferObject{
.offset = position.v, .offset = position,
.scale = scale, .scale = scale,
}; };
encoder.writeBuffer(renderer.state().uniform_buffer, uniform_offset * num_entities, &[_]UniformBufferObject{ubo}); encoder.writeBuffer(renderer.state().uniform_buffer, uniform_offset * num_entities, &[_]UniformBufferObject{ubo});

View file

@ -1,6 +1,6 @@
// TODO(important): docs // TODO(important): docs
struct Uniform { struct Uniform {
pos: vec3<f32>, pos: vec4<f32>,
scale: f32, scale: f32,
}; };