diff --git a/traits.hpp b/traits.hpp index 30d13fd..d8490e1 100644 --- a/traits.hpp +++ b/traits.hpp @@ -118,6 +118,52 @@ namespace cruft::vk { using native_t = typename native_traits::type; + /////////////////////////////////////////////////////////////////////////// + /// defines whether a type is a native vulkan object. + /// + /// note that this only returns true for handle types, not parameter types. + /// eg, VkDevice will return true, but VkDeviceCreateInfo will not. + template + struct is_native : public std::false_type { }; + + + //------------------------------------------------------------------------- + #define DEFINE_IS_HANDLE(KLASS) \ + template <> \ + struct is_native> : \ + public std::true_type \ + { }; + + VK_TYPE_MAP (DEFINE_IS_HANDLE) + #undef DEFINE_IS_HANDLE + + + //------------------------------------------------------------------------- + template + static constexpr auto is_native_v = is_native::value; + + + /////////////////////////////////////////////////////////////////////////// + template + struct is_wrapper : public std::false_type { }; + + + //------------------------------------------------------------------------- + #define IS_WRAPPER(KLASS) \ + template <> \ + struct is_wrapper : \ + public std::true_type \ + { }; + + VK_TYPE_MAP(IS_WRAPPER) + #undef IS_WRAPPER + + + //------------------------------------------------------------------------- + template + static constexpr auto is_wrapper_v = is_wrapper::value; + + /////////////////////////////////////////////////////////////////////////// /// describes the native type that owns a given native type, and hence /// forms part of the create/destroy process.