Add special handling for new VK_NV_acquire_winrt_display extension

This commit is contained in:
Markus Tavenrath 2020-12-04 16:18:52 +01:00 committed by Markus Tavenrath
parent 99d9ef9b7d
commit 301bbf08dd

View File

@ -4047,8 +4047,13 @@ std::string VulkanHppGenerator::constructCommandResultGetHandleUnique( std::stri
std::string objectDeleter, allocator; std::string objectDeleter, allocator;
if ( ( name.find( "Acquire" ) != std::string::npos ) || ( name.find( "Get" ) != std::string::npos ) ) if ( ( name.find( "Acquire" ) != std::string::npos ) || ( name.find( "Get" ) != std::string::npos ) )
{ {
assert( ( name == "vkAcquirePerformanceConfigurationINTEL" ) || ( name == "vkGetRandROutputDisplayEXT" ) ); if( ( name == "vkAcquirePerformanceConfigurationINTEL" ) || ( name == "vkGetRandROutputDisplayEXT" ) ) {
objectDeleter = "ObjectRelease"; objectDeleter = "ObjectRelease";
} else if ( (name == "vkAcquireWinrtDisplayNV") || (name == "vkGetWinrtDisplayNV") ) {
objectDeleter = "ObjectReleaseExt";
} else {
throw std::runtime_error( "Found " + name + " which requires special handling for the object deleter");
}
} }
else if ( name.find( "Allocate" ) != std::string::npos ) else if ( name.find( "Allocate" ) != std::string::npos )
{ {
@ -10422,6 +10427,36 @@ int main( int argc, char ** argv )
OwnerType m_owner = {}; OwnerType m_owner = {};
Dispatch const * m_dispatch = nullptr; Dispatch const * m_dispatch = nullptr;
}; };
template <typename OwnerType, typename Dispatch>
class ObjectReleaseExt
{
public:
ObjectReleaseExt() = default;
ObjectReleaseExt( OwnerType owner, Dispatch const & dispatch = VULKAN_HPP_DEFAULT_DISPATCHER ) VULKAN_HPP_NOEXCEPT
: m_owner( owner )
, m_dispatch( &dispatch )
{}
OwnerType getOwner() const VULKAN_HPP_NOEXCEPT
{
return m_owner;
}
protected:
template <typename T>
void destroy( T t ) VULKAN_HPP_NOEXCEPT
{
VULKAN_HPP_ASSERT( m_owner && m_dispatch );
m_owner.releaseExt( t, *m_dispatch );
}
private:
OwnerType m_owner = {};
Dispatch const * m_dispatch = nullptr;
};
)"; )";
static const std::string classOptional = R"( static const std::string classOptional = R"(