0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-09-07 01:06:37 +02:00
construct/include/ircd/cl/data.h

40 lines
1.1 KiB
C
Raw Normal View History

// The Construct
//
// Copyright (C) The Construct Developers, Authors & Contributors
// Copyright (C) 2016-2022 Jason Volk <jason@zemos.net>
//
// Permission to use, copy, modify, and/or distribute this software for any
// purpose with or without fee is hereby granted, provided that the above
// copyright notice and this permission notice is present in all copies. The
// full license for this software is available in the LICENSE file.
#pragma once
#define HAVE_IRCD_CL_DATA_H
/// cl_mem wrapping
struct ircd::cl::data
{
static conf::item<size_t> gart_page_size;
void *handle {nullptr};
public:
uint flags() const;
size_t size() const;
off_t offset() const;
char *ptr() const; // host only
size_t maps() const;
size_t refs() const;
data(const size_t, const bool host_rd = false, const bool host_wr = false);
data(const mutable_buffer &, const bool dev_wonly = false); // host rw
data(const const_buffer &); // host ro
data(data &, const pair<size_t, off_t> &); // subbuffer
data(const data &) = delete;
data() = default;
data(data &&) noexcept;
data &operator=(const data &) = delete;
data &operator=(data &&) noexcept;
~data() noexcept;
};