From 51cf303585d1e56f612e74087e93d7f4bc494faf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Sun, 13 Dec 2020 19:23:45 +0100 Subject: [PATCH] Vk: list device features in magnum-vk-info. It's reusing an internal file to make them display nicely, I hope that doesn't make it too ugly / too sad that library users can't do the same thing in their code. --- src/Magnum/Vk/vk-info.cpp | 43 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/src/Magnum/Vk/vk-info.cpp b/src/Magnum/Vk/vk-info.cpp index 92d44509d..590e572dc 100644 --- a/src/Magnum/Vk/vk-info.cpp +++ b/src/Magnum/Vk/vk-info.cpp @@ -25,6 +25,7 @@ #include +#include "Magnum/Vk/DeviceFeatures.h" #include "Magnum/Vk/Extensions.h" #include "Magnum/Vk/ExtensionProperties.h" #include "Magnum/Vk/InstanceCreateInfo.h" @@ -307,6 +308,48 @@ int main(int argc, char** argv) { /* If we wanted only extension strings, exit now */ if(args.isSet("extension-strings")) return 0; + Debug{} << "Feature support:"; + { + #ifndef DOXYGEN_GENERATING_OUTPUT /* It gets really confused */ + const Vk::DeviceFeatures features = device.features(); + #define _c(value, field) \ + { \ + Debug d; \ + d << " " << #value << sixtyfourSpaces.prefix(63 - sizeof(#value)); \ + if(features & Vk::DeviceFeature::value) \ + d << "SUPPORTED"; \ + else \ + d << " - "; \ + } + #define _cver(value, field, suffix, version) \ + { \ + Debug d; \ + d << " " << #value << sixtyfourSpaces.prefix(63 - sizeof(#value)); \ + if(features & Vk::DeviceFeature::value) \ + d << "SUPPORTED"; \ + else if(device.isVersionSupported(Vk::Version::version)) \ + d << " - "; \ + else \ + d << " n/a "; \ + } + #define _cext(value, field, suffix, extension) \ + { \ + Debug d; \ + d << " " << #value << sixtyfourSpaces.prefix(63 - sizeof(#value)); \ + if(features & Vk::DeviceFeature::value) \ + d << "SUPPORTED"; \ + else if(device.isVersionSupported(Vk::Extensions::extension::coreVersion()) || extensionProperties.isSupported()) \ + d << " - "; \ + else \ + d << " n/a "; \ + } + #include "Magnum/Vk/Implementation/deviceFeatureMapping.hpp" + #undef _c + #undef _cver + #undef _cext + #endif + } + Debug{} << "Queue families:"; for(UnsignedInt i = 0; i != device.queueFamilyCount(); ++i) { Debug{} << " " << i << Debug::nospace << ":" << device.queueFamilyFlags(i);