Skip to content

Commit 48441c1

Browse files
committed
mention alignment in safety comments in render_geometry example
1 parent c0c18ca commit 48441c1

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

examples/render-geometry.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ fn main() {
107107
];
108108

109109
// A square is rendered as two triangles (see indices)
110-
// SAFETY: core::mem::offset_of makes sure the offsets are right.
110+
// SAFETY: core::mem::offset_of makes sure the offsets are right and alignment is respected.
111111
unsafe {
112112
canvas.render_geometry_raw(
113113
&vertices,
@@ -121,7 +121,7 @@ fn main() {
121121
.expect("render_geometry_raw failed (probably unsupported, see error message)");
122122

123123
// Parameters can be reused, here only the positions are swapped out for new ones.
124-
// SAFETY: core::mem::offset_of makes sure the offsets are right.
124+
// SAFETY: core::mem::offset_of makes sure the offsets are right and alignment is respected.
125125
// The offset 0 is correct because the element type of positions is `[f32; 2]`.
126126
unsafe {
127127
canvas.render_geometry_raw(

0 commit comments

Comments
 (0)