libcruft-vk/instance.hpp

59 lines
1.5 KiB
C++
Raw Normal View History

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
*/
#ifndef CRUFT_VK_INSTANCE_HPP
#define CRUFT_VK_INSTANCE_HPP
2016-02-24 11:11:41 +11:00
#include "./object.hpp"
#include "./vk.hpp"
#include "./traits.hpp"
2017-09-05 17:20:17 +10:00
#include "./except.hpp"
#include <cruft/util/view.hpp>
2016-02-24 11:11:41 +11:00
#include <set>
#include <string>
namespace cruft::vk {
2017-09-05 17:20:17 +10:00
struct instance : public root<instance> {
struct create_info_t : public VkInstanceCreateInfo {
create_info_t ();
create_info_t (const VkInstanceCreateInfo&);
};
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);
instance (const create_info_t &info);
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
}
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
};
}
#endif