@@ -173,6 +173,9 @@ pub struct ExternalTextureParams {
173173
174174const _: ( ) =
175175 assert ! ( size_of:: <ExternalTextureParams >( ) == wgpu_hal:: EXTERNAL_TEXTURE_PARAMS_SIZE as usize ) ;
176+ const EXTERNAL_TEXTURE_PARAMS_BUFFER_SIZE : usize = {
177+ size_of :: < ExternalTextureParams > ( ) . next_multiple_of ( wgpu_hal:: UNIVERSAL_BUFFER_SIZE_ALIGNMENT as usize )
178+ } ;
176179
177180impl ExternalTextureParams {
178181 pub fn from_desc < L > ( desc : & wgt:: ExternalTextureDescriptor < L > ) -> Self {
@@ -587,7 +590,7 @@ impl Device {
587590 Some ( "(wgpu internal) default external texture params buffer" ) ,
588591 instance_flags,
589592 ) ,
590- size : align_to ( size_of :: < ExternalTextureParams > ( ) as _ , 256 ) ,
593+ size : EXTERNAL_TEXTURE_PARAMS_BUFFER_SIZE as _ ,
591594 usage : wgt:: BufferUses :: COPY_DST | wgt:: BufferUses :: UNIFORM ,
592595 memory_flags : hal:: MemoryFlags :: empty ( ) ,
593596 } )
@@ -718,7 +721,8 @@ impl Device {
718721 _padding : Default :: default ( ) ,
719722 } ;
720723 let mut staging_buffer =
721- StagingBuffer :: new ( self , wgt:: BufferSize :: new ( size_of_val ( & data) as _ ) . unwrap ( ) ) ?;
724+ StagingBuffer :: new ( self , wgt:: BufferSize :: new ( EXTERNAL_TEXTURE_PARAMS_BUFFER_SIZE as _ ) . unwrap ( ) ) ?;
725+ staging_buffer. write_zeros ( ) ;
722726 staging_buffer. write ( bytemuck:: bytes_of ( & data) ) ;
723727 let staging_buffer = staging_buffer. flush ( ) ;
724728
0 commit comments