@@ -1253,7 +1253,8 @@ impl Device {
12531253 . map_err ( |e| self . handle_hal_error_with_nonfatal_oom ( e) ) ?;
12541254
12551255 let timestamp_normalization_bind_group = Snatchable :: new ( unsafe {
1256- // SAFETY: The size passed here must not overflow the buffer.
1256+ // SAFETY: The size passed here must be 4B aligned, >= the application size, and
1257+ // <= the buffer size.
12571258 self . timestamp_normalizer
12581259 . get ( )
12591260 . unwrap ( )
@@ -1592,7 +1593,8 @@ impl Device {
15921593 /// # Safety
15931594 ///
15941595 /// - `hal_buffer` must have been created on this device.
1595- /// - `hal_buffer` must have been created respecting `desc` (in particular, the size).
1596+ /// - `hal_buffer` must have been created respecting `desc` (in particular, the size,
1597+ /// which must always be a multiple of 4, and may be subject to other requirements).
15961598 /// - `hal_buffer` must be initialized.
15971599 /// - `hal_buffer` must not have zero size.
15981600 pub ( crate ) unsafe fn create_buffer_from_hal_inner (
@@ -1601,6 +1603,8 @@ impl Device {
16011603 desc : & resource:: BufferDescriptor ,
16021604 ) -> Result < Arc < Buffer > , resource:: CreateBufferError > {
16031605 let timestamp_normalization_bind_group = Snatchable :: new ( unsafe {
1606+ // SAFETY: The size passed here must be 4B aligned, >= the application size, and
1607+ // <= the buffer size.
16041608 self . timestamp_normalizer
16051609 . get ( )
16061610 . unwrap ( )
@@ -1650,6 +1654,10 @@ impl Device {
16501654 Ok ( buffer)
16511655 }
16521656
1657+ /// If needed, creates the bind groups for indirect validation shaders to read
1658+ /// from `raw_buffer`.
1659+ ///
1660+ /// `buffer_size` is the user-requested size of the buffer.
16531661 fn create_indirect_validation_bind_groups (
16541662 & self ,
16551663 raw_buffer : & dyn hal:: DynBuffer ,
0 commit comments