File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -318,10 +318,10 @@ pub(crate) fn validate_linear_texture_data(
318318 bytes_in_copy,
319319 } = layout. get_buffer_texture_copy_info ( format, aspect, copy_size) ?;
320320
321- if copy_width % block_width_texels != 0 {
321+ if ! copy_width. is_multiple_of ( block_width_texels) {
322322 return Err ( TransferError :: UnalignedCopyWidth ) ;
323323 }
324- if copy_height % block_height_texels != 0 {
324+ if ! copy_height. is_multiple_of ( block_height_texels) {
325325 return Err ( TransferError :: UnalignedCopyHeight ) ;
326326 }
327327
@@ -986,7 +986,7 @@ pub(super) fn copy_buffer_to_buffer(
986986 None => ( src_buffer. size - source_offset, src_buffer. size ) ,
987987 } ;
988988
989- if size % wgt:: COPY_BUFFER_ALIGNMENT != 0 {
989+ if ! size. is_multiple_of ( wgt:: COPY_BUFFER_ALIGNMENT ) {
990990 return Err ( TransferError :: UnalignedCopySize ( size) . into ( ) ) ;
991991 }
992992 if !source_offset. is_multiple_of ( wgt:: COPY_BUFFER_ALIGNMENT ) {
Original file line number Diff line number Diff line change @@ -588,13 +588,15 @@ impl Buffer {
588588 if !offset. is_multiple_of ( wgt:: MAP_ALIGNMENT ) {
589589 return Err ( ( op, BufferAccessError :: UnalignedOffset { offset } ) ) ;
590590 }
591- if range_size % wgt:: COPY_BUFFER_ALIGNMENT != 0 {
591+ if ! range_size. is_multiple_of ( wgt:: COPY_BUFFER_ALIGNMENT ) {
592592 return Err ( ( op, BufferAccessError :: UnalignedRangeSize { range_size } ) ) ;
593593 }
594594
595595 let range = offset..( offset + range_size) ;
596596
597- if range. start % wgt:: MAP_ALIGNMENT != 0 || range. end % wgt:: COPY_BUFFER_ALIGNMENT != 0 {
597+ if !range. start . is_multiple_of ( wgt:: MAP_ALIGNMENT )
598+ || !range. end . is_multiple_of ( wgt:: COPY_BUFFER_ALIGNMENT )
599+ {
598600 return Err ( ( op, BufferAccessError :: UnalignedRange ) ) ;
599601 }
600602
@@ -696,7 +698,7 @@ impl Buffer {
696698 if !offset. is_multiple_of ( wgt:: MAP_ALIGNMENT ) {
697699 return Err ( BufferAccessError :: UnalignedOffset { offset } ) ;
698700 }
699- if range_size % wgt:: COPY_BUFFER_ALIGNMENT != 0 {
701+ if range_size. is_multiple_of ( wgt:: COPY_BUFFER_ALIGNMENT ) {
700702 return Err ( BufferAccessError :: UnalignedRangeSize { range_size } ) ;
701703 }
702704 let map_state = & * self . map_state . lock ( ) ;
You can’t perform that action at this time.
0 commit comments