createResource method

  1. @override
DeviceBuffer? createResource()
override

Implementation

@override
gpu.DeviceBuffer? createResource() {
  final sizeInBytes = _vertices.lengthInBytes + _indices.lengthInBytes;
  resourceSizeInByes = sizeInBytes;
  return GpuContextWrapper(gpu.gpuContext).createDeviceBuffer(
      gpu.StorageMode.hostVisible,
      sizeInBytes,
    )
    ..overwrite(_vertices.asByteData())
    ..overwrite(
      _indices.asByteData(),
      destinationOffsetInBytes: _vertices.lengthInBytes,
    );
}