Skip to content

Commit

Permalink
Add special handling for call sequence in commands for vkGetDeviceFau…
Browse files Browse the repository at this point in the history
…ltInfoEXT (#1790)
  • Loading branch information
asuessenbach authored Feb 5, 2024
1 parent 6bdba3e commit 9fa4459
Show file tree
Hide file tree
Showing 3 changed files with 89 additions and 6 deletions.
33 changes: 33 additions & 0 deletions VulkanHppGenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down
30 changes: 28 additions & 2 deletions vulkan/vulkan_funcs.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 } );

Expand Down
32 changes: 28 additions & 4 deletions vulkan/vulkan_raii.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 } );
Expand Down

0 comments on commit 9fa4459

Please sign in to comment.