Changed functions that could return eIncomplete to loop while incomplete and return the final result.

This commit is contained in:
Andreas Süßenbach 2016-03-30 12:18:19 +02:00
parent 6163c6e8ca
commit 3e8964e181
2 changed files with 292 additions and 205 deletions

View File

@ -510,7 +510,13 @@ std::string determineFunctionName(std::string const& name, CommandData const& co
std::string determineReturnType(CommandData const& commandData, size_t returnIndex, bool isVector) std::string determineReturnType(CommandData const& commandData, size_t returnIndex, bool isVector)
{ {
std::string returnType; std::string returnType;
if ((returnIndex != ~0) && ((commandData.returnType == "void") || ((commandData.returnType == "Result") && (commandData.successCodes.size() < 2)))) if ( (returnIndex != ~0)
&& ( (commandData.returnType == "void")
|| ( (commandData.returnType == "Result")
&& ( (commandData.successCodes.size() == 1)
|| ( (commandData.successCodes.size() == 2)
&& (commandData.successCodes[1] == "eIncomplete")
&& commandData.twoStep)))))
{ {
if (isVector) if (isVector)
{ {
@ -1735,7 +1741,7 @@ void writeFunctionBody(std::ofstream & ofs, std::string const& indentation, std:
} }
// write the local variable to hold a returned value // write the local variable to hold a returned value
if ((returnIndex != ~0) && (((commandData.returnType == "Result") && (commandData.successCodes.size() < 2)) || (commandData.returnType == "void"))) if ((returnIndex != ~0) && (commandData.returnType != returnType))
{ {
ofs << indentation << " " << returnType << " " << reduceName(commandData.arguments[returnIndex].name); ofs << indentation << " " << returnType << " " << reduceName(commandData.arguments[returnIndex].name);
@ -1782,12 +1788,23 @@ void writeFunctionBody(std::ofstream & ofs, std::string const& indentation, std:
// write the function call // write the function call
ofs << indentation << " "; ofs << indentation << " ";
std::string localIndentation = " ";
if (commandData.returnType == "Result") if (commandData.returnType == "Result")
{ {
ofs << "Result result = static_cast<Result>( "; ofs << "Result result";
if (commandData.twoStep && (1 < commandData.successCodes.size()))
{
ofs << ";" << std::endl
<< indentation << " do" << std::endl
<< indentation << " {" << std::endl
<< indentation << " result";
localIndentation += " ";
}
ofs << " = static_cast<Result>( ";
} }
else if (commandData.returnType != "void") else if (commandData.returnType != "void")
{ {
assert(!commandData.twoStep);
ofs << "return "; ofs << "return ";
} }
writeCall(ofs, dependencyData.name, templateIndex, commandData, vkTypes, vectorParameters, returnIndex, true); writeCall(ofs, dependencyData.name, templateIndex, commandData, vkTypes, vectorParameters, returnIndex, true);
@ -1797,24 +1814,32 @@ void writeFunctionBody(std::ofstream & ofs, std::string const& indentation, std:
} }
ofs << ";" << std::endl; ofs << ";" << std::endl;
// add an exception check
if ((commandData.returnType == "Result") || !commandData.successCodes.empty())
{
writeExceptionCheck(ofs, indentation, className, functionName, commandData.successCodes);
}
if (commandData.twoStep) if (commandData.twoStep)
{ {
std::map<size_t, size_t>::const_iterator returnit = vectorParameters.find(returnIndex); std::map<size_t, size_t>::const_iterator returnit = vectorParameters.find(returnIndex);
// resize the vector to hold the data according to the result from the first call
ofs << indentation << " " << reduceName(commandData.arguments[returnit->first].name) << ".resize( " << reduceName(commandData.arguments[returnit->second].name) << " );" << std::endl;
// write the function call a second time
ofs << indentation << " ";
if (commandData.returnType == "Result") if (commandData.returnType == "Result")
{ {
ofs << "result = static_cast<Result>( "; ofs << indentation << localIndentation << "if ( ( result == Result::eSuccess ) && " << reduceName(commandData.arguments[returnit->second].name) << " )" << std::endl
<< indentation << localIndentation << "{" << std::endl
<< indentation << localIndentation << " ";
}
else
{
ofs << indentation << " ";
}
// resize the vector to hold the data according to the result from the first call
ofs << reduceName(commandData.arguments[returnit->first].name) << ".resize( " << reduceName(commandData.arguments[returnit->second].name) << " );" << std::endl;
// write the function call a second time
if (commandData.returnType == "Result")
{
ofs << indentation << localIndentation << " result = static_cast<Result>( ";
}
else
{
ofs << indentation << " ";
} }
writeCall(ofs, dependencyData.name, templateIndex, commandData, vkTypes, vectorParameters, returnIndex, false); writeCall(ofs, dependencyData.name, templateIndex, commandData, vkTypes, vectorParameters, returnIndex, false);
if (commandData.returnType == "Result") if (commandData.returnType == "Result")
@ -1822,16 +1847,23 @@ void writeFunctionBody(std::ofstream & ofs, std::string const& indentation, std:
ofs << " )"; ofs << " )";
} }
ofs << ";" << std::endl; ofs << ";" << std::endl;
if (commandData.returnType == "Result")
// add a second exception check {
if ((commandData.returnType == "Result") || !commandData.successCodes.empty()) ofs << indentation << localIndentation << "}" << std::endl;
if (1 < commandData.successCodes.size())
{
ofs << indentation << " } while ( result == Result::eIncomplete );" << std::endl;
}
writeExceptionCheck(ofs, indentation, className, functionName, {"eSuccess"});
}
}
else if ((commandData.returnType == "Result") || !commandData.successCodes.empty())
{ {
writeExceptionCheck(ofs, indentation, className, functionName, commandData.successCodes); writeExceptionCheck(ofs, indentation, className, functionName, commandData.successCodes);
} }
}
// return the returned value // return the returned value
if ((returnIndex != ~0) && (((commandData.returnType == "Result") && (commandData.successCodes.size() < 2)) || (commandData.returnType == "void"))) if ((returnIndex != ~0) && (commandData.returnType != returnType))
{ {
ofs << indentation << " return " << reduceName(commandData.arguments[returnIndex].name) << ";" << std::endl; ofs << indentation << " return " << reduceName(commandData.arguments[returnIndex].name) << ";" << std::endl;
} }
@ -1847,16 +1879,19 @@ void writeFunctionHeader(std::ofstream & ofs, std::string const& indentation, st
{ {
std::set<size_t> skippedArguments; std::set<size_t> skippedArguments;
for (std::map<size_t, size_t>::const_iterator it = vectorParameters.begin(); it != vectorParameters.end(); ++it) for (std::map<size_t, size_t>::const_iterator it = vectorParameters.begin(); it != vectorParameters.end(); ++it)
{
if (it->second != ~0)
{ {
skippedArguments.insert(it->second); skippedArguments.insert(it->second);
} }
}
if ((vectorParameters.size() == 1) if ((vectorParameters.size() == 1)
&& ((commandData.arguments[vectorParameters.begin()->first].len == "dataSize/4") || (commandData.arguments[vectorParameters.begin()->first].len == "latexmath:[$dataSize \\over 4$]"))) && ((commandData.arguments[vectorParameters.begin()->first].len == "dataSize/4") || (commandData.arguments[vectorParameters.begin()->first].len == "latexmath:[$dataSize \\over 4$]")))
{ {
assert(commandData.arguments[3].name == "dataSize"); assert(commandData.arguments[3].name == "dataSize");
skippedArguments.insert(3); skippedArguments.insert(3);
} }
if ((returnIndex != ~0) && (((commandData.returnType == "Result") && (commandData.successCodes.size() < 2)) || (commandData.returnType == "void"))) if ((returnIndex != ~0) && (commandData.returnType != returnType))
{ {
skippedArguments.insert(returnIndex); skippedArguments.insert(returnIndex);
} }
@ -1872,6 +1907,9 @@ void writeFunctionHeader(std::ofstream & ofs, std::string const& indentation, st
ofs << "inline "; ofs << "inline ";
} }
ofs << returnType << " " << name << "("; ofs << returnType << " " << name << "(";
if (skippedArguments.size() + (commandData.handleCommand ? 1 : 0) < commandData.arguments.size())
{
ofs << " ";
bool argEncountered = false; bool argEncountered = false;
for (size_t i = commandData.handleCommand ? 1 : 0; i < commandData.arguments.size(); i++) for (size_t i = commandData.handleCommand ? 1 : 0; i < commandData.arguments.size(); i++)
{ {
@ -1944,6 +1982,8 @@ void writeFunctionHeader(std::ofstream & ofs, std::string const& indentation, st
argEncountered = true; argEncountered = true;
} }
} }
ofs << " ";
}
ofs << ")"; ofs << ")";
if (commandData.handleCommand) if (commandData.handleCommand)
{ {

View File

@ -20790,12 +20790,11 @@ namespace vk
std::vector<uint8_t> data; std::vector<uint8_t> data;
size_t dataSize; size_t dataSize;
Result result = static_cast<Result>( vkGetPipelineCacheData( m_device, static_cast<VkPipelineCache>( pipelineCache ), &dataSize, nullptr ) ); Result result = static_cast<Result>( vkGetPipelineCacheData( m_device, static_cast<VkPipelineCache>( pipelineCache ), &dataSize, nullptr ) );
if ( result != Result::eSuccess ) if ( ( result == Result::eSuccess ) && dataSize )
{ {
throw std::system_error( result, "vk::Device::getPipelineCacheData" );
}
data.resize( dataSize ); data.resize( dataSize );
result = static_cast<Result>( vkGetPipelineCacheData( m_device, static_cast<VkPipelineCache>( pipelineCache ), &dataSize, reinterpret_cast<void*>( data.data() ) ) ); result = static_cast<Result>( vkGetPipelineCacheData( m_device, static_cast<VkPipelineCache>( pipelineCache ), &dataSize, reinterpret_cast<void*>( data.data() ) ) );
}
if ( result != Result::eSuccess ) if ( result != Result::eSuccess )
{ {
throw std::system_error( result, "vk::Device::getPipelineCacheData" ); throw std::system_error( result, "vk::Device::getPipelineCacheData" );
@ -21258,21 +21257,25 @@ namespace vk
} }
#ifdef VKCPP_ENHANCED_MODE #ifdef VKCPP_ENHANCED_MODE
Result getSwapchainImagesKHR( SwapchainKHR swapchain, std::vector<Image> & swapchainImages ) const std::vector<Image> getSwapchainImagesKHR( SwapchainKHR swapchain ) const
{ {
std::vector<Image> swapchainImages;
uint32_t swapchainImageCount; uint32_t swapchainImageCount;
Result result = static_cast<Result>( vkGetSwapchainImagesKHR( m_device, static_cast<VkSwapchainKHR>( swapchain ), &swapchainImageCount, nullptr ) ); Result result;
if ( ( result != Result::eSuccess ) && ( result != Result::eIncomplete ) ) do
{
result = static_cast<Result>( vkGetSwapchainImagesKHR( m_device, static_cast<VkSwapchainKHR>( swapchain ), &swapchainImageCount, nullptr ) );
if ( ( result == Result::eSuccess ) && swapchainImageCount )
{ {
throw std::system_error( result, "vk::Device::getSwapchainImagesKHR" );
}
swapchainImages.resize( swapchainImageCount ); swapchainImages.resize( swapchainImageCount );
result = static_cast<Result>( vkGetSwapchainImagesKHR( m_device, static_cast<VkSwapchainKHR>( swapchain ), &swapchainImageCount, reinterpret_cast<VkImage*>( swapchainImages.data() ) ) ); result = static_cast<Result>( vkGetSwapchainImagesKHR( m_device, static_cast<VkSwapchainKHR>( swapchain ), &swapchainImageCount, reinterpret_cast<VkImage*>( swapchainImages.data() ) ) );
if ( ( result != Result::eSuccess ) && ( result != Result::eIncomplete ) ) }
} while ( result == Result::eIncomplete );
if ( result != Result::eSuccess )
{ {
throw std::system_error( result, "vk::Device::getSwapchainImagesKHR" ); throw std::system_error( result, "vk::Device::getSwapchainImagesKHR" );
} }
return result; return swapchainImages;
} }
#endif /*VKCPP_ENHANCED_MODE*/ #endif /*VKCPP_ENHANCED_MODE*/
@ -21450,21 +21453,25 @@ namespace vk
} }
#ifdef VKCPP_ENHANCED_MODE #ifdef VKCPP_ENHANCED_MODE
Result enumerateDeviceLayerProperties( std::vector<LayerProperties> & properties ) const std::vector<LayerProperties> enumerateDeviceLayerProperties() const
{ {
std::vector<LayerProperties> properties;
uint32_t propertyCount; uint32_t propertyCount;
Result result = static_cast<Result>( vkEnumerateDeviceLayerProperties( m_physicalDevice, &propertyCount, nullptr ) ); Result result;
if ( ( result != Result::eSuccess ) && ( result != Result::eIncomplete ) ) do
{
result = static_cast<Result>( vkEnumerateDeviceLayerProperties( m_physicalDevice, &propertyCount, nullptr ) );
if ( ( result == Result::eSuccess ) && propertyCount )
{ {
throw std::system_error( result, "vk::PhysicalDevice::enumerateDeviceLayerProperties" );
}
properties.resize( propertyCount ); properties.resize( propertyCount );
result = static_cast<Result>( vkEnumerateDeviceLayerProperties( m_physicalDevice, &propertyCount, reinterpret_cast<VkLayerProperties*>( properties.data() ) ) ); result = static_cast<Result>( vkEnumerateDeviceLayerProperties( m_physicalDevice, &propertyCount, reinterpret_cast<VkLayerProperties*>( properties.data() ) ) );
if ( ( result != Result::eSuccess ) && ( result != Result::eIncomplete ) ) }
} while ( result == Result::eIncomplete );
if ( result != Result::eSuccess )
{ {
throw std::system_error( result, "vk::PhysicalDevice::enumerateDeviceLayerProperties" ); throw std::system_error( result, "vk::PhysicalDevice::enumerateDeviceLayerProperties" );
} }
return result; return properties;
} }
#endif /*VKCPP_ENHANCED_MODE*/ #endif /*VKCPP_ENHANCED_MODE*/
@ -21474,21 +21481,25 @@ namespace vk
} }
#ifdef VKCPP_ENHANCED_MODE #ifdef VKCPP_ENHANCED_MODE
Result enumerateDeviceExtensionProperties( vk::Optional<std::string const> const & layerName, std::vector<ExtensionProperties> & properties ) const std::vector<ExtensionProperties> enumerateDeviceExtensionProperties( vk::Optional<std::string const> const & layerName ) const
{ {
std::vector<ExtensionProperties> properties;
uint32_t propertyCount; uint32_t propertyCount;
Result result = static_cast<Result>( vkEnumerateDeviceExtensionProperties( m_physicalDevice, layerName ? layerName->c_str() : nullptr, &propertyCount, nullptr ) ); Result result;
if ( ( result != Result::eSuccess ) && ( result != Result::eIncomplete ) ) do
{
result = static_cast<Result>( vkEnumerateDeviceExtensionProperties( m_physicalDevice, layerName ? layerName->c_str() : nullptr, &propertyCount, nullptr ) );
if ( ( result == Result::eSuccess ) && propertyCount )
{ {
throw std::system_error( result, "vk::PhysicalDevice::enumerateDeviceExtensionProperties" );
}
properties.resize( propertyCount ); properties.resize( propertyCount );
result = static_cast<Result>( vkEnumerateDeviceExtensionProperties( m_physicalDevice, layerName ? layerName->c_str() : nullptr, &propertyCount, reinterpret_cast<VkExtensionProperties*>( properties.data() ) ) ); result = static_cast<Result>( vkEnumerateDeviceExtensionProperties( m_physicalDevice, layerName ? layerName->c_str() : nullptr, &propertyCount, reinterpret_cast<VkExtensionProperties*>( properties.data() ) ) );
if ( ( result != Result::eSuccess ) && ( result != Result::eIncomplete ) ) }
} while ( result == Result::eIncomplete );
if ( result != Result::eSuccess )
{ {
throw std::system_error( result, "vk::PhysicalDevice::enumerateDeviceExtensionProperties" ); throw std::system_error( result, "vk::PhysicalDevice::enumerateDeviceExtensionProperties" );
} }
return result; return properties;
} }
#endif /*VKCPP_ENHANCED_MODE*/ #endif /*VKCPP_ENHANCED_MODE*/
@ -21515,21 +21526,25 @@ namespace vk
} }
#ifdef VKCPP_ENHANCED_MODE #ifdef VKCPP_ENHANCED_MODE
Result getDisplayPropertiesKHR( std::vector<DisplayPropertiesKHR> & properties ) const std::vector<DisplayPropertiesKHR> getDisplayPropertiesKHR() const
{ {
std::vector<DisplayPropertiesKHR> properties;
uint32_t propertyCount; uint32_t propertyCount;
Result result = static_cast<Result>( vkGetPhysicalDeviceDisplayPropertiesKHR( m_physicalDevice, &propertyCount, nullptr ) ); Result result;
if ( ( result != Result::eSuccess ) && ( result != Result::eIncomplete ) ) do
{
result = static_cast<Result>( vkGetPhysicalDeviceDisplayPropertiesKHR( m_physicalDevice, &propertyCount, nullptr ) );
if ( ( result == Result::eSuccess ) && propertyCount )
{ {
throw std::system_error( result, "vk::PhysicalDevice::getDisplayPropertiesKHR" );
}
properties.resize( propertyCount ); properties.resize( propertyCount );
result = static_cast<Result>( vkGetPhysicalDeviceDisplayPropertiesKHR( m_physicalDevice, &propertyCount, reinterpret_cast<VkDisplayPropertiesKHR*>( properties.data() ) ) ); result = static_cast<Result>( vkGetPhysicalDeviceDisplayPropertiesKHR( m_physicalDevice, &propertyCount, reinterpret_cast<VkDisplayPropertiesKHR*>( properties.data() ) ) );
if ( ( result != Result::eSuccess ) && ( result != Result::eIncomplete ) ) }
} while ( result == Result::eIncomplete );
if ( result != Result::eSuccess )
{ {
throw std::system_error( result, "vk::PhysicalDevice::getDisplayPropertiesKHR" ); throw std::system_error( result, "vk::PhysicalDevice::getDisplayPropertiesKHR" );
} }
return result; return properties;
} }
#endif /*VKCPP_ENHANCED_MODE*/ #endif /*VKCPP_ENHANCED_MODE*/
@ -21539,21 +21554,25 @@ namespace vk
} }
#ifdef VKCPP_ENHANCED_MODE #ifdef VKCPP_ENHANCED_MODE
Result getDisplayPlanePropertiesKHR( std::vector<DisplayPlanePropertiesKHR> & properties ) const std::vector<DisplayPlanePropertiesKHR> getDisplayPlanePropertiesKHR() const
{ {
std::vector<DisplayPlanePropertiesKHR> properties;
uint32_t propertyCount; uint32_t propertyCount;
Result result = static_cast<Result>( vkGetPhysicalDeviceDisplayPlanePropertiesKHR( m_physicalDevice, &propertyCount, nullptr ) ); Result result;
if ( ( result != Result::eSuccess ) && ( result != Result::eIncomplete ) ) do
{
result = static_cast<Result>( vkGetPhysicalDeviceDisplayPlanePropertiesKHR( m_physicalDevice, &propertyCount, nullptr ) );
if ( ( result == Result::eSuccess ) && propertyCount )
{ {
throw std::system_error( result, "vk::PhysicalDevice::getDisplayPlanePropertiesKHR" );
}
properties.resize( propertyCount ); properties.resize( propertyCount );
result = static_cast<Result>( vkGetPhysicalDeviceDisplayPlanePropertiesKHR( m_physicalDevice, &propertyCount, reinterpret_cast<VkDisplayPlanePropertiesKHR*>( properties.data() ) ) ); result = static_cast<Result>( vkGetPhysicalDeviceDisplayPlanePropertiesKHR( m_physicalDevice, &propertyCount, reinterpret_cast<VkDisplayPlanePropertiesKHR*>( properties.data() ) ) );
if ( ( result != Result::eSuccess ) && ( result != Result::eIncomplete ) ) }
} while ( result == Result::eIncomplete );
if ( result != Result::eSuccess )
{ {
throw std::system_error( result, "vk::PhysicalDevice::getDisplayPlanePropertiesKHR" ); throw std::system_error( result, "vk::PhysicalDevice::getDisplayPlanePropertiesKHR" );
} }
return result; return properties;
} }
#endif /*VKCPP_ENHANCED_MODE*/ #endif /*VKCPP_ENHANCED_MODE*/
@ -21563,21 +21582,25 @@ namespace vk
} }
#ifdef VKCPP_ENHANCED_MODE #ifdef VKCPP_ENHANCED_MODE
Result getDisplayPlaneSupportedDisplaysKHR( uint32_t planeIndex, std::vector<DisplayKHR> & displays ) const std::vector<DisplayKHR> getDisplayPlaneSupportedDisplaysKHR( uint32_t planeIndex ) const
{ {
std::vector<DisplayKHR> displays;
uint32_t displayCount; uint32_t displayCount;
Result result = static_cast<Result>( vkGetDisplayPlaneSupportedDisplaysKHR( m_physicalDevice, planeIndex, &displayCount, nullptr ) ); Result result;
if ( ( result != Result::eSuccess ) && ( result != Result::eIncomplete ) ) do
{
result = static_cast<Result>( vkGetDisplayPlaneSupportedDisplaysKHR( m_physicalDevice, planeIndex, &displayCount, nullptr ) );
if ( ( result == Result::eSuccess ) && displayCount )
{ {
throw std::system_error( result, "vk::PhysicalDevice::getDisplayPlaneSupportedDisplaysKHR" );
}
displays.resize( displayCount ); displays.resize( displayCount );
result = static_cast<Result>( vkGetDisplayPlaneSupportedDisplaysKHR( m_physicalDevice, planeIndex, &displayCount, reinterpret_cast<VkDisplayKHR*>( displays.data() ) ) ); result = static_cast<Result>( vkGetDisplayPlaneSupportedDisplaysKHR( m_physicalDevice, planeIndex, &displayCount, reinterpret_cast<VkDisplayKHR*>( displays.data() ) ) );
if ( ( result != Result::eSuccess ) && ( result != Result::eIncomplete ) ) }
} while ( result == Result::eIncomplete );
if ( result != Result::eSuccess )
{ {
throw std::system_error( result, "vk::PhysicalDevice::getDisplayPlaneSupportedDisplaysKHR" ); throw std::system_error( result, "vk::PhysicalDevice::getDisplayPlaneSupportedDisplaysKHR" );
} }
return result; return displays;
} }
#endif /*VKCPP_ENHANCED_MODE*/ #endif /*VKCPP_ENHANCED_MODE*/
@ -21587,21 +21610,25 @@ namespace vk
} }
#ifdef VKCPP_ENHANCED_MODE #ifdef VKCPP_ENHANCED_MODE
Result getDisplayModePropertiesKHR( DisplayKHR display, std::vector<DisplayModePropertiesKHR> & properties ) const std::vector<DisplayModePropertiesKHR> getDisplayModePropertiesKHR( DisplayKHR display ) const
{ {
std::vector<DisplayModePropertiesKHR> properties;
uint32_t propertyCount; uint32_t propertyCount;
Result result = static_cast<Result>( vkGetDisplayModePropertiesKHR( m_physicalDevice, static_cast<VkDisplayKHR>( display ), &propertyCount, nullptr ) ); Result result;
if ( ( result != Result::eSuccess ) && ( result != Result::eIncomplete ) ) do
{
result = static_cast<Result>( vkGetDisplayModePropertiesKHR( m_physicalDevice, static_cast<VkDisplayKHR>( display ), &propertyCount, nullptr ) );
if ( ( result == Result::eSuccess ) && propertyCount )
{ {
throw std::system_error( result, "vk::PhysicalDevice::getDisplayModePropertiesKHR" );
}
properties.resize( propertyCount ); properties.resize( propertyCount );
result = static_cast<Result>( vkGetDisplayModePropertiesKHR( m_physicalDevice, static_cast<VkDisplayKHR>( display ), &propertyCount, reinterpret_cast<VkDisplayModePropertiesKHR*>( properties.data() ) ) ); result = static_cast<Result>( vkGetDisplayModePropertiesKHR( m_physicalDevice, static_cast<VkDisplayKHR>( display ), &propertyCount, reinterpret_cast<VkDisplayModePropertiesKHR*>( properties.data() ) ) );
if ( ( result != Result::eSuccess ) && ( result != Result::eIncomplete ) ) }
} while ( result == Result::eIncomplete );
if ( result != Result::eSuccess )
{ {
throw std::system_error( result, "vk::PhysicalDevice::getDisplayModePropertiesKHR" ); throw std::system_error( result, "vk::PhysicalDevice::getDisplayModePropertiesKHR" );
} }
return result; return properties;
} }
#endif /*VKCPP_ENHANCED_MODE*/ #endif /*VKCPP_ENHANCED_MODE*/
@ -21698,21 +21725,25 @@ namespace vk
} }
#ifdef VKCPP_ENHANCED_MODE #ifdef VKCPP_ENHANCED_MODE
Result getSurfaceFormatsKHR( SurfaceKHR surface, std::vector<SurfaceFormatKHR> & surfaceFormats ) const std::vector<SurfaceFormatKHR> getSurfaceFormatsKHR( SurfaceKHR surface ) const
{ {
std::vector<SurfaceFormatKHR> surfaceFormats;
uint32_t surfaceFormatCount; uint32_t surfaceFormatCount;
Result result = static_cast<Result>( vkGetPhysicalDeviceSurfaceFormatsKHR( m_physicalDevice, static_cast<VkSurfaceKHR>( surface ), &surfaceFormatCount, nullptr ) ); Result result;
if ( ( result != Result::eSuccess ) && ( result != Result::eIncomplete ) ) do
{
result = static_cast<Result>( vkGetPhysicalDeviceSurfaceFormatsKHR( m_physicalDevice, static_cast<VkSurfaceKHR>( surface ), &surfaceFormatCount, nullptr ) );
if ( ( result == Result::eSuccess ) && surfaceFormatCount )
{ {
throw std::system_error( result, "vk::PhysicalDevice::getSurfaceFormatsKHR" );
}
surfaceFormats.resize( surfaceFormatCount ); surfaceFormats.resize( surfaceFormatCount );
result = static_cast<Result>( vkGetPhysicalDeviceSurfaceFormatsKHR( m_physicalDevice, static_cast<VkSurfaceKHR>( surface ), &surfaceFormatCount, reinterpret_cast<VkSurfaceFormatKHR*>( surfaceFormats.data() ) ) ); result = static_cast<Result>( vkGetPhysicalDeviceSurfaceFormatsKHR( m_physicalDevice, static_cast<VkSurfaceKHR>( surface ), &surfaceFormatCount, reinterpret_cast<VkSurfaceFormatKHR*>( surfaceFormats.data() ) ) );
if ( ( result != Result::eSuccess ) && ( result != Result::eIncomplete ) ) }
} while ( result == Result::eIncomplete );
if ( result != Result::eSuccess )
{ {
throw std::system_error( result, "vk::PhysicalDevice::getSurfaceFormatsKHR" ); throw std::system_error( result, "vk::PhysicalDevice::getSurfaceFormatsKHR" );
} }
return result; return surfaceFormats;
} }
#endif /*VKCPP_ENHANCED_MODE*/ #endif /*VKCPP_ENHANCED_MODE*/
@ -21722,21 +21753,25 @@ namespace vk
} }
#ifdef VKCPP_ENHANCED_MODE #ifdef VKCPP_ENHANCED_MODE
Result getSurfacePresentModesKHR( SurfaceKHR surface, std::vector<PresentModeKHR> & presentModes ) const std::vector<PresentModeKHR> getSurfacePresentModesKHR( SurfaceKHR surface ) const
{ {
std::vector<PresentModeKHR> presentModes;
uint32_t presentModeCount; uint32_t presentModeCount;
Result result = static_cast<Result>( vkGetPhysicalDeviceSurfacePresentModesKHR( m_physicalDevice, static_cast<VkSurfaceKHR>( surface ), &presentModeCount, nullptr ) ); Result result;
if ( ( result != Result::eSuccess ) && ( result != Result::eIncomplete ) ) do
{
result = static_cast<Result>( vkGetPhysicalDeviceSurfacePresentModesKHR( m_physicalDevice, static_cast<VkSurfaceKHR>( surface ), &presentModeCount, nullptr ) );
if ( ( result == Result::eSuccess ) && presentModeCount )
{ {
throw std::system_error( result, "vk::PhysicalDevice::getSurfacePresentModesKHR" );
}
presentModes.resize( presentModeCount ); presentModes.resize( presentModeCount );
result = static_cast<Result>( vkGetPhysicalDeviceSurfacePresentModesKHR( m_physicalDevice, static_cast<VkSurfaceKHR>( surface ), &presentModeCount, reinterpret_cast<VkPresentModeKHR*>( presentModes.data() ) ) ); result = static_cast<Result>( vkGetPhysicalDeviceSurfacePresentModesKHR( m_physicalDevice, static_cast<VkSurfaceKHR>( surface ), &presentModeCount, reinterpret_cast<VkPresentModeKHR*>( presentModes.data() ) ) );
if ( ( result != Result::eSuccess ) && ( result != Result::eIncomplete ) ) }
} while ( result == Result::eIncomplete );
if ( result != Result::eSuccess )
{ {
throw std::system_error( result, "vk::PhysicalDevice::getSurfacePresentModesKHR" ); throw std::system_error( result, "vk::PhysicalDevice::getSurfacePresentModesKHR" );
} }
return result; return presentModes;
} }
#endif /*VKCPP_ENHANCED_MODE*/ #endif /*VKCPP_ENHANCED_MODE*/
@ -22028,21 +22063,25 @@ namespace vk
} }
#ifdef VKCPP_ENHANCED_MODE #ifdef VKCPP_ENHANCED_MODE
Result enumeratePhysicalDevices( std::vector<PhysicalDevice> & physicalDevices ) const std::vector<PhysicalDevice> enumeratePhysicalDevices() const
{ {
std::vector<PhysicalDevice> physicalDevices;
uint32_t physicalDeviceCount; uint32_t physicalDeviceCount;
Result result = static_cast<Result>( vkEnumeratePhysicalDevices( m_instance, &physicalDeviceCount, nullptr ) ); Result result;
if ( ( result != Result::eSuccess ) && ( result != Result::eIncomplete ) ) do
{
result = static_cast<Result>( vkEnumeratePhysicalDevices( m_instance, &physicalDeviceCount, nullptr ) );
if ( ( result == Result::eSuccess ) && physicalDeviceCount )
{ {
throw std::system_error( result, "vk::Instance::enumeratePhysicalDevices" );
}
physicalDevices.resize( physicalDeviceCount ); physicalDevices.resize( physicalDeviceCount );
result = static_cast<Result>( vkEnumeratePhysicalDevices( m_instance, &physicalDeviceCount, reinterpret_cast<VkPhysicalDevice*>( physicalDevices.data() ) ) ); result = static_cast<Result>( vkEnumeratePhysicalDevices( m_instance, &physicalDeviceCount, reinterpret_cast<VkPhysicalDevice*>( physicalDevices.data() ) ) );
if ( ( result != Result::eSuccess ) && ( result != Result::eIncomplete ) ) }
} while ( result == Result::eIncomplete );
if ( result != Result::eSuccess )
{ {
throw std::system_error( result, "vk::Instance::enumeratePhysicalDevices" ); throw std::system_error( result, "vk::Instance::enumeratePhysicalDevices" );
} }
return result; return physicalDevices;
} }
#endif /*VKCPP_ENHANCED_MODE*/ #endif /*VKCPP_ENHANCED_MODE*/
@ -22315,21 +22354,25 @@ namespace vk
} }
#ifdef VKCPP_ENHANCED_MODE #ifdef VKCPP_ENHANCED_MODE
inline Result enumerateInstanceLayerProperties( std::vector<LayerProperties> & properties ) inline std::vector<LayerProperties> enumerateInstanceLayerProperties()
{ {
std::vector<LayerProperties> properties;
uint32_t propertyCount; uint32_t propertyCount;
Result result = static_cast<Result>( vkEnumerateInstanceLayerProperties( &propertyCount, nullptr ) ); Result result;
if ( ( result != Result::eSuccess ) && ( result != Result::eIncomplete ) ) do
{
result = static_cast<Result>( vkEnumerateInstanceLayerProperties( &propertyCount, nullptr ) );
if ( ( result == Result::eSuccess ) && propertyCount )
{ {
throw std::system_error( result, "vk::enumerateInstanceLayerProperties" );
}
properties.resize( propertyCount ); properties.resize( propertyCount );
result = static_cast<Result>( vkEnumerateInstanceLayerProperties( &propertyCount, reinterpret_cast<VkLayerProperties*>( properties.data() ) ) ); result = static_cast<Result>( vkEnumerateInstanceLayerProperties( &propertyCount, reinterpret_cast<VkLayerProperties*>( properties.data() ) ) );
if ( ( result != Result::eSuccess ) && ( result != Result::eIncomplete ) ) }
} while ( result == Result::eIncomplete );
if ( result != Result::eSuccess )
{ {
throw std::system_error( result, "vk::enumerateInstanceLayerProperties" ); throw std::system_error( result, "vk::enumerateInstanceLayerProperties" );
} }
return result; return properties;
} }
#endif /*VKCPP_ENHANCED_MODE*/ #endif /*VKCPP_ENHANCED_MODE*/
@ -22339,21 +22382,25 @@ namespace vk
} }
#ifdef VKCPP_ENHANCED_MODE #ifdef VKCPP_ENHANCED_MODE
inline Result enumerateInstanceExtensionProperties( vk::Optional<std::string const> const & layerName, std::vector<ExtensionProperties> & properties ) inline std::vector<ExtensionProperties> enumerateInstanceExtensionProperties( vk::Optional<std::string const> const & layerName )
{ {
std::vector<ExtensionProperties> properties;
uint32_t propertyCount; uint32_t propertyCount;
Result result = static_cast<Result>( vkEnumerateInstanceExtensionProperties( layerName ? layerName->c_str() : nullptr, &propertyCount, nullptr ) ); Result result;
if ( ( result != Result::eSuccess ) && ( result != Result::eIncomplete ) ) do
{
result = static_cast<Result>( vkEnumerateInstanceExtensionProperties( layerName ? layerName->c_str() : nullptr, &propertyCount, nullptr ) );
if ( ( result == Result::eSuccess ) && propertyCount )
{ {
throw std::system_error( result, "vk::enumerateInstanceExtensionProperties" );
}
properties.resize( propertyCount ); properties.resize( propertyCount );
result = static_cast<Result>( vkEnumerateInstanceExtensionProperties( layerName ? layerName->c_str() : nullptr, &propertyCount, reinterpret_cast<VkExtensionProperties*>( properties.data() ) ) ); result = static_cast<Result>( vkEnumerateInstanceExtensionProperties( layerName ? layerName->c_str() : nullptr, &propertyCount, reinterpret_cast<VkExtensionProperties*>( properties.data() ) ) );
if ( ( result != Result::eSuccess ) && ( result != Result::eIncomplete ) ) }
} while ( result == Result::eIncomplete );
if ( result != Result::eSuccess )
{ {
throw std::system_error( result, "vk::enumerateInstanceExtensionProperties" ); throw std::system_error( result, "vk::enumerateInstanceExtensionProperties" );
} }
return result; return properties;
} }
#endif /*VKCPP_ENHANCED_MODE*/ #endif /*VKCPP_ENHANCED_MODE*/