copyTextureToTexture method

void copyTextureToTexture({
  1. required GpuTexture from,
  2. required GpuTexture to,
})

Implementation

void copyTextureToTexture(
    {required GpuTexture from, required GpuTexture to}) {
  using((arena) {
    final srcInfo = arena<WGPUTexelCopyTextureInfo>();
    srcInfo.ref.texture = from.texture;
    srcInfo.ref.mipLevel = 0;
    srcInfo.ref.origin = (arena<WGPUOrigin3D>()
          ..ref.x = 0
          ..ref.y = 0
          ..ref.z = 0)
        .ref;
    srcInfo.ref.aspect = WGPUTextureAspect.WGPUTextureAspect_All;
    final dstInfo = arena<WGPUTexelCopyTextureInfo>();
    dstInfo.ref.texture = to.texture;
    dstInfo.ref.mipLevel = 0;
    dstInfo.ref.origin = (arena<WGPUOrigin3D>()
          ..ref.x = 0
          ..ref.y = 0
          ..ref.z = 0)
        .ref;
    dstInfo.ref.aspect = WGPUTextureAspect.WGPUTextureAspect_All;
    final extent = arena<WGPUExtent3D>();
    extent.ref.width = from.width;
    extent.ref.height = from.height;
    extent.ref.depthOrArrayLayers = 1;
    _wgpu.wgpuCommandEncoderCopyTextureToTexture(
        _handle, srcInfo, dstInfo, extent);
  });
}