resource property
The resource data.
Implementation
@override
gpu.DeviceBuffer? get resource {
var resource = super.resource;
final sizeInBytes = _vertices.lengthInBytes + _indices.lengthInBytes;
if (resource?.sizeInBytes != sizeInBytes) {
// Store the device buffer in the resource parent.
resource = super.resource = gpu.gpuContext.createDeviceBuffer(
gpu.StorageMode.hostVisible,
sizeInBytes,
);
resource
?..overwrite(_vertices.asByteData())
..overwrite(
_indices.asByteData(),
destinationOffsetInBytes: _vertices.lengthInBytes,
);
}
return resource;
}
Implementation
@protected
set resource(R resource) => _resource = resource;