2016-02-26 13:39:01 +11:00
|
|
|
/*
|
2018-08-04 15:24:36 +10:00
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
2016-02-26 13:39:01 +11:00
|
|
|
*
|
|
|
|
* Copyright:
|
2017-09-01 12:34:09 +10:00
|
|
|
* 2016-2017, Danny Robson <danny@nerdcruft.net>
|
2016-02-26 13:39:01 +11:00
|
|
|
*/
|
|
|
|
|
2019-01-05 23:30:52 +11:00
|
|
|
#pragma once
|
2016-02-24 11:11:41 +11:00
|
|
|
|
2024-07-18 09:51:48 +10:00
|
|
|
#include <cruft/vk/object.hpp>
|
2016-02-24 11:11:41 +11:00
|
|
|
|
2024-07-18 09:51:48 +10:00
|
|
|
#include <cruft/vk/vk.hpp>
|
|
|
|
#include <cruft/vk/traits.hpp>
|
|
|
|
#include <cruft/vk/except.hpp>
|
2017-09-05 17:20:17 +10:00
|
|
|
|
|
|
|
#include <cruft/util/view.hpp>
|
2016-02-24 11:11:41 +11:00
|
|
|
|
2017-05-26 16:32:31 +10:00
|
|
|
#include <set>
|
|
|
|
#include <string>
|
|
|
|
|
2017-05-26 16:30:48 +10:00
|
|
|
namespace cruft::vk {
|
2017-09-05 17:20:17 +10:00
|
|
|
struct instance : public root<instance> {
|
2017-09-01 12:52:02 +10:00
|
|
|
struct create_info_t : public VkInstanceCreateInfo {
|
|
|
|
create_info_t ();
|
|
|
|
create_info_t (const VkInstanceCreateInfo&);
|
2017-05-26 16:32:31 +10:00
|
|
|
};
|
|
|
|
|
2017-09-01 13:11:54 +10:00
|
|
|
struct application_info_t : public VkApplicationInfo {
|
|
|
|
application_info_t ();
|
|
|
|
application_info_t (const VkApplicationInfo&);
|
|
|
|
};
|
|
|
|
|
2017-09-01 12:34:09 +10:00
|
|
|
instance ();
|
2018-08-05 14:51:18 +10:00
|
|
|
instance (cruft::view<const char**> layers,
|
|
|
|
cruft::view<const char**> extensions);
|
2017-09-01 12:52:02 +10:00
|
|
|
instance (const create_info_t &info);
|
2017-05-26 16:32:31 +10:00
|
|
|
|
2017-09-14 00:31:23 +10:00
|
|
|
template <typename FunctionT>
|
|
|
|
FunctionT
|
2017-09-05 17:20:17 +10:00
|
|
|
proc (const char *name)
|
|
|
|
{
|
2017-09-08 17:11:35 +10:00
|
|
|
auto ret = vkGetInstanceProcAddr (native (), name);
|
2017-09-05 17:20:17 +10:00
|
|
|
if (!ret)
|
|
|
|
throw vk::invalid_argument ("invalid procedure name");
|
|
|
|
|
2017-09-14 00:31:23 +10:00
|
|
|
return reinterpret_cast<FunctionT> (ret);
|
2017-09-05 17:20:17 +10:00
|
|
|
}
|
|
|
|
|
2017-05-26 16:32:31 +10:00
|
|
|
std::set<std::string> extensions (void) const;
|
2017-09-05 17:20:17 +10:00
|
|
|
|
|
|
|
static std::vector<VkLayerProperties> available_layers (void);
|
2016-02-24 11:11:41 +11:00
|
|
|
};
|
|
|
|
}
|