createDeviceBufferWithCopy method

DeviceBuffer? createDeviceBufferWithCopy(
  1. ByteData data
)

Allocates a new region of host-visible GPU-resident memory, initialized with the given data.

Given that the buffer will be immediately populated with data uploaded from the host, the StorageMode of the new DeviceBuffer is automatically set to StorageMode.hostVisible.

Returns null if the DeviceBuffer creation failed.

Implementation

DeviceBuffer? createDeviceBufferWithCopy(ByteData data) {
  DeviceBuffer result = DeviceBuffer._initializeWithHostData(this, data);
  return result.isValid ? result : null;
}