create static method

Future<GpuTexture> create({
  1. required int width,
  2. required int height,
})

Implementation

static Future<GpuTexture> create(
    {required int width, required int height}) async {
  final sw = WebgpuRend.instance;
  final handle = sw.createTextureInternal(width, height);
  if (handle == nullptr) throw "Failed to create texture";

  final id = sw.getTextureIdInternal(handle);
  final rawTexPtr = sw.getWgpuTextureInternal(handle);
  final rawViewPtr = sw.getWgpuViewInternal(handle);

  return GpuTexture._(
      handle, id, rawTexPtr.cast(), rawViewPtr.cast(), width, height, true);
}