diff --git a/CMakeLists.txt b/CMakeLists.txt index e20af8b..1bfb333 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -152,6 +152,9 @@ list (APPEND sources swapchain.hpp traits.cpp traits.hpp + + meta/info.cpp + meta/info.hpp ) diff --git a/meta/info.cpp b/meta/info.cpp new file mode 100644 index 0000000..8f1f815 --- /dev/null +++ b/meta/info.cpp @@ -0,0 +1,41 @@ +/* + * 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/. + * + * Copyright: + * 2017-2018, Danny Robson + */ + +#include "info.hpp" + +#include "load/ostream.hpp" + +#include "instance.hpp" +#include "physical_device.hpp" +#include "ostream.hpp" + +#include "load/vendor.hpp" +#include "load/vtable.hpp" + +#include + +#include + + +/////////////////////////////////////////////////////////////////////////////// +std::ostream& +cruft::vk::meta::operator<< (std::ostream &os, info const &) +{ + cruft::vk::instance instance; + + os << "[ " + << "available_layers: [ " + << cruft::iterator::make_infix (cruft::vk::instance::available_layers ()) + << " ] }" + << ", instance: " << instance + << ", devices: [ " << cruft::iterator::make_infix (cruft::vk::physical_device::find (instance)) << " ], " + << " } ]\n"; + + return os; +} diff --git a/meta/info.hpp b/meta/info.hpp new file mode 100644 index 0000000..861f87a --- /dev/null +++ b/meta/info.hpp @@ -0,0 +1,19 @@ +/* + * 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/. + * + * Copyright: + * 2019, Danny Robson + */ + +#pragma once + +#include + + +namespace cruft::vk::meta { + struct info {}; + + std::ostream& operator<< (std::ostream &os, info const&); +}; diff --git a/tools/info.cpp b/tools/info.cpp index 6e63ccd..50cd55b 100644 --- a/tools/info.cpp +++ b/tools/info.cpp @@ -4,36 +4,17 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * Copyright: - * 2017-2018, Danny Robson + * 2019, Danny Robson */ -#include - -#include "load/ostream.hpp" -#include "load/vtable.hpp" - -#include "instance.hpp" -#include "physical_device.hpp" -#include "ostream.hpp" +#include "../meta/info.hpp" #include -#include "../load/vendor.hpp" -#include "load/vtable.hpp" - - /////////////////////////////////////////////////////////////////////////////// int main (int, char**) { - cruft::vk::instance instance; - - std::cout << "[ " - << "available_layers: [ " - << cruft::iterator::make_infix (cruft::vk::instance::available_layers ()) - << " ] }" - << ", instance: " << instance - << ", devices: [ " << cruft::iterator::make_infix (cruft::vk::physical_device::find (instance)) << " ], " - << " } ]\n"; + std::cout << cruft::vk::meta::info {} << '\n'; } \ No newline at end of file