Closed brendan-duncan closed 3 years ago
Hmm, this is annoying. If it doesn't accept an array, it looks like an implementation bug:
In https://www.w3.org/TR/webgpu/#dom-gpuqueue-writetexture
size is a GPUExtent3D
, and in
https://www.w3.org/TR/webgpu/#typedefdef-gpuextent3d
it is defined as
typedef (sequence<GPUIntegerCoordinate> or GPUExtent3DDict) GPUExtent3D;
and a three-long array should definitely fall into a "sequence
Pushed above commit to work around that.
Oh actually, maybe the root bug was the extra 'data' field. Removed that and restored the array form, let me know if Chrome still doesn't accept it.
Also fixed Closure compiler escaping in the function.
Oh, you're right, the data field had thrown off the GPUExtent3D; I had originally modified the size when the error message was that it couldn't decode the GPUExtent3D parameter. GPUExtent3D is fine as an array.
One more quick fix since it's in the same wgpu_queue_write_texture function,
wgpu[queue]['writeTexture'](wgpuReadGpuImageCopyTexture(destination), HEAPU8, { offset: data, bytesPerRow: bytesPerBlockRow, rowsPerImage: blockRowsPerImage }, data, [writeWidth, writeHeight, writeDepthOrArrayLayers]);
should be
wgpu[queue]['writeTexture'](wgpuReadGpuImageCopyTexture(destination), HEAPU8, { offset: data, bytesPerRow: bytesPerBlockRow, rowsPerImage: blockRowsPerImage }, {width: writeWidth, height: writeHeight, depthOrArrayLayers: writeDepthOrArrayLayers});
There's an extra data arg, and the GPUExtent3D size doesn't like being an array.