object: use more descriptive CRTP parameters
This commit is contained in:
parent
6e1ffd4d0e
commit
272e46ff8a
24
object.hpp
24
object.hpp
@ -27,9 +27,9 @@
|
|||||||
namespace cruft::vk {
|
namespace cruft::vk {
|
||||||
/// the base class for all non-trivial vulkan objects requiring lifetime
|
/// the base class for all non-trivial vulkan objects requiring lifetime
|
||||||
/// management.
|
/// management.
|
||||||
template <typename T>
|
template <typename SelfT>
|
||||||
struct object {
|
struct object {
|
||||||
object (native_t<T> _native):
|
object (native_t<SelfT> _native):
|
||||||
m_native (_native)
|
m_native (_native)
|
||||||
{
|
{
|
||||||
CHECK_NEQ (m_native, VK_NULL_HANDLE);
|
CHECK_NEQ (m_native, VK_NULL_HANDLE);
|
||||||
@ -45,7 +45,7 @@ namespace cruft::vk {
|
|||||||
auto& native (void)& { return m_native; }
|
auto& native (void)& { return m_native; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
native_t<T> m_native;
|
native_t<SelfT> m_native;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -71,13 +71,13 @@ namespace cruft::vk {
|
|||||||
/// a vulkan object that must be directly instantiated through
|
/// a vulkan object that must be directly instantiated through
|
||||||
/// constructor arguments, rather than being enumerated and owned by
|
/// constructor arguments, rather than being enumerated and owned by
|
||||||
/// another object.
|
/// another object.
|
||||||
template <typename T>
|
template <typename SelfT>
|
||||||
struct descendant : public object<T> {
|
struct descendant : public object<SelfT> {
|
||||||
template <typename ParentT, typename ...Args>
|
template <typename ParentT, typename ...Args>
|
||||||
descendant (ParentT &parent, Args &&...args):
|
descendant (ParentT &parent, Args &&...args):
|
||||||
object<T> (
|
object<SelfT> (
|
||||||
cruft::vk::error::try_query(
|
cruft::vk::error::try_query(
|
||||||
life_traits<native_t<T>>::create,
|
life_traits<native_t<SelfT>>::create,
|
||||||
parent.native (),
|
parent.native (),
|
||||||
std::forward<Args> (args)...
|
std::forward<Args> (args)...
|
||||||
)
|
)
|
||||||
@ -87,17 +87,17 @@ namespace cruft::vk {
|
|||||||
|
|
||||||
~descendant ()
|
~descendant ()
|
||||||
{
|
{
|
||||||
life_traits<native_t<T>>::destroy (this->native (), nullptr);
|
life_traits<native_t<SelfT>>::destroy (this->native (), nullptr);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/// a vulkan object that is obtained by listings from a parent object.
|
/// a vulkan object that is obtained by listings from a parent object.
|
||||||
template <typename T>
|
template <typename SelfT>
|
||||||
struct enumerated : public object<T> {
|
struct enumerated : public object<SelfT> {
|
||||||
using object<T>::object;
|
using object<SelfT>::object;
|
||||||
|
|
||||||
static std::vector<T>
|
static std::vector<SelfT>
|
||||||
find (const instance &parent);
|
find (const instance &parent);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user