0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-03 12:28:52 +01:00
construct/include/ircd/cl/data.h

41 lines
1.2 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<bool> use_host_ptr;
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;
};