@@ -202,21 +202,21 @@ export class GPUQueueImpl implements GPUQueue {
202202 return ;
203203 }
204204
205- const dataPtr = ptr ( arrayBuffer , byteOffsetInData ) ;
206- const packedDestination = WGPUTexelCopyTextureInfoStruct . pack ( destination ) ;
205+ if ( ! dataLayout . bytesPerRow ) {
206+ fatalError ( "queueWriteTexture: dataLayout.bytesPerRow is required." ) ;
207+ }
208+
207209 const normalizedWriteSize = normalizeGPUExtent3DStrict ( writeSize ) ;
208-
209- // Ensure rowsPerImage is set, defaulting to copy height
210+ const packedDestination = WGPUTexelCopyTextureInfoStruct . pack ( destination ) ;
210211 const layoutForPacking : GPUTexelCopyBufferLayout = {
211- offset : dataLayout . offset ?? 0 ,
212- bytesPerRow : dataLayout . bytesPerRow ,
213- rowsPerImage : dataLayout . rowsPerImage ?? normalizedWriteSize . height ,
212+ offset : dataLayout . offset ?? 0 ,
213+ bytesPerRow : dataLayout . bytesPerRow ,
214+ rowsPerImage : dataLayout . rowsPerImage ?? normalizedWriteSize . height ,
214215 } ;
215- if ( ! layoutForPacking . bytesPerRow ) {
216- fatalError ( "queueWriteTexture: dataLayout.bytesPerRow is required." ) ;
217- }
216+
218217 const packedLayout = WGPUTexelCopyBufferLayoutStruct . pack ( layoutForPacking ) ;
219218 const packedWriteSize = WGPUExtent3DStruct . pack ( normalizedWriteSize ) ;
219+ const dataPtr = ptr ( arrayBuffer , byteOffsetInData ) ;
220220
221221 try {
222222 this . lib . wgpuQueueWriteTexture (
0 commit comments