39 uint8_t *data =
nullptr;
56 auto *host_T_ptr =
reinterpret_cast<uint8_t *
>(host_ptr);
64 auto *host_T_ptr =
reinterpret_cast<uint8_t *
>(host_ptr);
72 auto *device_T_ptr_dst =
reinterpret_cast<uint8_t *
>(device_ptr_dst);
77 [[nodiscard]]
size_t bytes()
const override
Device memory abstraction layer with backend-specific storage and factory creation.
Reserved for template implementations of #DeviceStorage primitives.
#define DNDS_assert_info(expr, info)
Debug-only assertion with an extra std::string info message.
Abstract interface to a byte buffer owned by a specific backend.
virtual ~DeviceStorageBase()
how to resolve int-rowsize duplicate?
DeviceBackend backend() const override
Which backend the buffer lives on.
uint8_t * raw_ptr() override
Raw byte pointer to the underlying storage.
void copy_to_device(uint8_t *device_ptr_dst, size_t n_bytes) override
Device-to-device copy of n_bytes into device_ptr_dst.
size_t bytes() const override
Buffer size in bytes.
void copy_device_to_host(uint8_t *host_ptr, size_t n_bytes) override
Copy n_bytes from this device buffer into host_ptr.
void copy_host_to_device(uint8_t *host_ptr, size_t n_bytes) override
Copy n_bytes from host_ptr into this device buffer.
Compile-time-specialised storage class; one definition per DeviceBackend.
the host side operators are provided as implemented
void deviceStorageBase_deleter(DeviceStorageBase *p)
Stateless deleter for DeviceStorageBase that works across shared-library boundaries where the vtable ...
DeviceBackend
Enumerates the backends a DeviceStorage / Array can live on.
std::unique_ptr< DeviceStorageBase, std::function< void(DeviceStorageBase *)> > t_supDeviceStorageBase
Owning unique pointer to a DeviceStorageBase with cross-DLL-safe deleter.
std::shared_ptr< DeviceStorageBase > t_sspDeviceStorageBase
Shared pointer equivalent of t_supDeviceStorageBase.
static t_supDeviceStorageBase device_storage_create_unique(DeviceBackend backend, size_t n_bytes)
static t_sspDeviceStorageBase device_storage_create_shared(DeviceBackend backend, size_t n_bytes)
Eigen::Vector3d n(1.0, 0.0, 0.0)