meta/info: split the system info printing into a unit
This commit is contained in:
parent
2ab194cdc0
commit
91cc9ea3fe
@ -152,6 +152,9 @@ list (APPEND sources
|
|||||||
swapchain.hpp
|
swapchain.hpp
|
||||||
traits.cpp
|
traits.cpp
|
||||||
traits.hpp
|
traits.hpp
|
||||||
|
|
||||||
|
meta/info.cpp
|
||||||
|
meta/info.hpp
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
41
meta/info.cpp
Normal file
41
meta/info.cpp
Normal file
@ -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 <danny@nerdcruft.net>
|
||||||
|
*/
|
||||||
|
|
||||||
|
#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 <cruft/util/iterator/infix.hpp>
|
||||||
|
|
||||||
|
#include <ostream>
|
||||||
|
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
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;
|
||||||
|
}
|
19
meta/info.hpp
Normal file
19
meta/info.hpp
Normal file
@ -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 <danny@nerdcruft.net>
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <iosfwd>
|
||||||
|
|
||||||
|
|
||||||
|
namespace cruft::vk::meta {
|
||||||
|
struct info {};
|
||||||
|
|
||||||
|
std::ostream& operator<< (std::ostream &os, info const&);
|
||||||
|
};
|
@ -4,36 +4,17 @@
|
|||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||||
*
|
*
|
||||||
* Copyright:
|
* Copyright:
|
||||||
* 2017-2018, Danny Robson <danny@nerdcruft.net>
|
* 2019, Danny Robson <danny@nerdcruft.net>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <cruft/util/iterator/infix.hpp>
|
#include "../meta/info.hpp"
|
||||||
|
|
||||||
#include "load/ostream.hpp"
|
|
||||||
#include "load/vtable.hpp"
|
|
||||||
|
|
||||||
#include "instance.hpp"
|
|
||||||
#include "physical_device.hpp"
|
|
||||||
#include "ostream.hpp"
|
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
|
|
||||||
#include "../load/vendor.hpp"
|
|
||||||
#include "load/vtable.hpp"
|
|
||||||
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
int
|
int
|
||||||
main (int, char**)
|
main (int, char**)
|
||||||
{
|
{
|
||||||
cruft::vk::instance instance;
|
std::cout << cruft::vk::meta::info {} << '\n';
|
||||||
|
|
||||||
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";
|
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user