Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add special handling for call sequence in commands for vkGetDeviceFaultInfoEXT #1790

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Add special handling for call sequence in commands for vkGetDeviceFau…
…ltInfoEXT
asuessenbach committed Feb 5, 2024
commit ba22b3b634fdde0c9c7924cd4d480bcf8326b9fd
33 changes: 33 additions & 0 deletions VulkanHppGenerator.cpp
Original file line number Diff line number Diff line change
@@ -3066,6 +3066,39 @@ std::string VulkanHppGenerator::generateCallSequence( std::string const &
bool raiiFactory ) const
{
std::string dispatcher = raii ? "getDispatcher()->" : "d.";

// first a special handling on vkGetDeviceFaultInfoEXT!!
if ( name == "vkGetDeviceFaultInfoEXT" )
{
const std::string callSequenceTemplate =
R"( VULKAN_HPP_NAMESPACE::Result result;
do
{
result = static_cast<VULKAN_HPP_NAMESPACE::Result>( ${dispatcher}vkGetDeviceFaultInfoEXT( m_device, reinterpret_cast<VkDeviceFaultCountsEXT *>( &faultCounts ), nullptr ) );
if ( result == VULKAN_HPP_NAMESPACE::Result::eSuccess )
{
std::free( faultInfo.pAddressInfos );
if ( faultCounts.addressInfoCount )
{
faultInfo.pAddressInfos = reinterpret_cast<VULKAN_HPP_NAMESPACE::DeviceFaultAddressInfoEXT *>( std::malloc( faultCounts.addressInfoCount * sizeof( VULKAN_HPP_NAMESPACE::DeviceFaultAddressInfoEXT ) ) );
}
std::free( faultInfo.pVendorInfos );
if ( faultCounts.vendorInfoCount )
{
faultInfo.pVendorInfos = reinterpret_cast<VULKAN_HPP_NAMESPACE::DeviceFaultVendorInfoEXT *>( std::malloc( faultCounts.vendorInfoCount * sizeof( VULKAN_HPP_NAMESPACE::DeviceFaultVendorInfoEXT ) ) );
}
std::free( faultInfo.pVendorBinaryData );
if ( faultCounts.vendorBinarySize )
{
faultInfo.pVendorBinaryData = std::malloc( faultCounts.vendorBinarySize );
}
result = static_cast<VULKAN_HPP_NAMESPACE::Result>( ${dispatcher}vkGetDeviceFaultInfoEXT( m_device, reinterpret_cast<VkDeviceFaultCountsEXT *>( &faultCounts ), reinterpret_cast<VkDeviceFaultInfoEXT *>( &faultInfo ) ) );
}
} while ( result == VULKAN_HPP_NAMESPACE::Result::eIncomplete );)";

return replaceWithMap( callSequenceTemplate, { { "dispatcher", dispatcher } } );
}

// if at least one returnParam is a size value of a vector param (and no singular params), we need two calls
if ( singularParams.empty() &&
std::any_of( returnParams.begin(),
30 changes: 28 additions & 2 deletions vulkan/vulkan_funcs.hpp
Original file line number Diff line number Diff line change
@@ -22589,8 +22589,34 @@ namespace VULKAN_HPP_NAMESPACE
std::pair<VULKAN_HPP_NAMESPACE::DeviceFaultCountsEXT, VULKAN_HPP_NAMESPACE::DeviceFaultInfoEXT> data_;
VULKAN_HPP_NAMESPACE::DeviceFaultCountsEXT & faultCounts = data_.first;
VULKAN_HPP_NAMESPACE::DeviceFaultInfoEXT & faultInfo = data_.second;
VULKAN_HPP_NAMESPACE::Result result = static_cast<VULKAN_HPP_NAMESPACE::Result>( d.vkGetDeviceFaultInfoEXT(
m_device, reinterpret_cast<VkDeviceFaultCountsEXT *>( &faultCounts ), reinterpret_cast<VkDeviceFaultInfoEXT *>( &faultInfo ) ) );
VULKAN_HPP_NAMESPACE::Result result;
do
{
result =
static_cast<VULKAN_HPP_NAMESPACE::Result>( d.vkGetDeviceFaultInfoEXT( m_device, reinterpret_cast<VkDeviceFaultCountsEXT *>( &faultCounts ), nullptr ) );
if ( result == VULKAN_HPP_NAMESPACE::Result::eSuccess )
{
std::free( faultInfo.pAddressInfos );
if ( faultCounts.addressInfoCount )
{
faultInfo.pAddressInfos = reinterpret_cast<VULKAN_HPP_NAMESPACE::DeviceFaultAddressInfoEXT *>(
std::malloc( faultCounts.addressInfoCount * sizeof( VULKAN_HPP_NAMESPACE::DeviceFaultAddressInfoEXT ) ) );
}
std::free( faultInfo.pVendorInfos );
if ( faultCounts.vendorInfoCount )
{
faultInfo.pVendorInfos = reinterpret_cast<VULKAN_HPP_NAMESPACE::DeviceFaultVendorInfoEXT *>(
std::malloc( faultCounts.vendorInfoCount * sizeof( VULKAN_HPP_NAMESPACE::DeviceFaultVendorInfoEXT ) ) );
}
std::free( faultInfo.pVendorBinaryData );
if ( faultCounts.vendorBinarySize )
{
faultInfo.pVendorBinaryData = std::malloc( faultCounts.vendorBinarySize );
}
result = static_cast<VULKAN_HPP_NAMESPACE::Result>( d.vkGetDeviceFaultInfoEXT(
m_device, reinterpret_cast<VkDeviceFaultCountsEXT *>( &faultCounts ), reinterpret_cast<VkDeviceFaultInfoEXT *>( &faultInfo ) ) );
}
} while ( result == VULKAN_HPP_NAMESPACE::Result::eIncomplete );
resultCheck(
result, VULKAN_HPP_NAMESPACE_STRING "::Device::getFaultInfoEXT", { VULKAN_HPP_NAMESPACE::Result::eSuccess, VULKAN_HPP_NAMESPACE::Result::eIncomplete } );

32 changes: 28 additions & 4 deletions vulkan/vulkan_raii.hpp
Original file line number Diff line number Diff line change
@@ -21056,10 +21056,34 @@ namespace VULKAN_HPP_NAMESPACE
std::pair<VULKAN_HPP_NAMESPACE::DeviceFaultCountsEXT, VULKAN_HPP_NAMESPACE::DeviceFaultInfoEXT> data_;
VULKAN_HPP_NAMESPACE::DeviceFaultCountsEXT & faultCounts = data_.first;
VULKAN_HPP_NAMESPACE::DeviceFaultInfoEXT & faultInfo = data_.second;
VULKAN_HPP_NAMESPACE::Result result =
static_cast<VULKAN_HPP_NAMESPACE::Result>( getDispatcher()->vkGetDeviceFaultInfoEXT( static_cast<VkDevice>( m_device ),
reinterpret_cast<VkDeviceFaultCountsEXT *>( &faultCounts ),
reinterpret_cast<VkDeviceFaultInfoEXT *>( &faultInfo ) ) );
VULKAN_HPP_NAMESPACE::Result result;
do
{
result = static_cast<VULKAN_HPP_NAMESPACE::Result>(
getDispatcher()->vkGetDeviceFaultInfoEXT( m_device, reinterpret_cast<VkDeviceFaultCountsEXT *>( &faultCounts ), nullptr ) );
if ( result == VULKAN_HPP_NAMESPACE::Result::eSuccess )
{
std::free( faultInfo.pAddressInfos );
if ( faultCounts.addressInfoCount )
{
faultInfo.pAddressInfos = reinterpret_cast<VULKAN_HPP_NAMESPACE::DeviceFaultAddressInfoEXT *>(
std::malloc( faultCounts.addressInfoCount * sizeof( VULKAN_HPP_NAMESPACE::DeviceFaultAddressInfoEXT ) ) );
}
std::free( faultInfo.pVendorInfos );
if ( faultCounts.vendorInfoCount )
{
faultInfo.pVendorInfos = reinterpret_cast<VULKAN_HPP_NAMESPACE::DeviceFaultVendorInfoEXT *>(
std::malloc( faultCounts.vendorInfoCount * sizeof( VULKAN_HPP_NAMESPACE::DeviceFaultVendorInfoEXT ) ) );
}
std::free( faultInfo.pVendorBinaryData );
if ( faultCounts.vendorBinarySize )
{
faultInfo.pVendorBinaryData = std::malloc( faultCounts.vendorBinarySize );
}
result = static_cast<VULKAN_HPP_NAMESPACE::Result>( getDispatcher()->vkGetDeviceFaultInfoEXT(
m_device, reinterpret_cast<VkDeviceFaultCountsEXT *>( &faultCounts ), reinterpret_cast<VkDeviceFaultInfoEXT *>( &faultInfo ) ) );
}
} while ( result == VULKAN_HPP_NAMESPACE::Result::eIncomplete );
resultCheck( result,
VULKAN_HPP_NAMESPACE_STRING "::Device::getFaultInfoEXT",
{ VULKAN_HPP_NAMESPACE::Result::eSuccess, VULKAN_HPP_NAMESPACE::Result::eIncomplete } );