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 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)
{
@ -1735,7 +1741,7 @@ void writeFunctionBody(std::ofstream & ofs, std::string const& indentation, std:
}
// 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);
@ -1782,12 +1788,23 @@ void writeFunctionBody(std::ofstream & ofs, std::string const& indentation, std:
// write the function call
ofs << indentation << " ";
std::string localIndentation = " ";
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")
{
assert(!commandData.twoStep);
ofs << "return ";
}
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;
// add an exception check
if ((commandData.returnType == "Result") || !commandData.successCodes.empty())
{
writeExceptionCheck(ofs, indentation, className, functionName, commandData.successCodes);
}
if (commandData.twoStep)
{
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")
{
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);
if (commandData.returnType == "Result")
@ -1822,16 +1847,23 @@ void writeFunctionBody(std::ofstream & ofs, std::string const& indentation, std:
ofs << " )";
}
ofs << ";" << std::endl;
// add a second exception check
if ((commandData.returnType == "Result") || !commandData.successCodes.empty())
if (commandData.returnType == "Result")
{
writeExceptionCheck(ofs, indentation, className, functionName, commandData.successCodes);
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);
}
// 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;
}
@ -1848,7 +1880,10 @@ void writeFunctionHeader(std::ofstream & ofs, std::string const& indentation, st
std::set<size_t> skippedArguments;
for (std::map<size_t, size_t>::const_iterator it = vectorParameters.begin(); it != vectorParameters.end(); ++it)
{
skippedArguments.insert(it->second);
if (it->second != ~0)
{
skippedArguments.insert(it->second);
}
}
if ((vectorParameters.size() == 1)
&& ((commandData.arguments[vectorParameters.begin()->first].len == "dataSize/4") || (commandData.arguments[vectorParameters.begin()->first].len == "latexmath:[$dataSize \\over 4$]")))
@ -1856,7 +1891,7 @@ void writeFunctionHeader(std::ofstream & ofs, std::string const& indentation, st
assert(commandData.arguments[3].name == "dataSize");
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);
}
@ -1871,80 +1906,85 @@ void writeFunctionHeader(std::ofstream & ofs, std::string const& indentation, st
{
ofs << "inline ";
}
ofs << returnType << " " << name << "( ";
bool argEncountered = false;
for (size_t i = commandData.handleCommand ? 1 : 0; i < commandData.arguments.size(); i++)
ofs << returnType << " " << name << "(";
if (skippedArguments.size() + (commandData.handleCommand ? 1 : 0) < commandData.arguments.size())
{
if (skippedArguments.find(i) == skippedArguments.end())
ofs << " ";
bool argEncountered = false;
for (size_t i = commandData.handleCommand ? 1 : 0; i < commandData.arguments.size(); i++)
{
if (argEncountered)
if (skippedArguments.find(i) == skippedArguments.end())
{
ofs << ", ";
}
if (argEncountered)
{
ofs << ", ";
}
std::map<size_t,size_t>::const_iterator it = vectorParameters.find(i);
size_t pos = commandData.arguments[i].type.find('*');
if ((it == vectorParameters.end()) && (pos == std::string::npos))
{
ofs << commandData.arguments[i].type << " " << commandData.arguments[i].name;
if (!commandData.arguments[i].arraySize.empty())
std::map<size_t, size_t>::const_iterator it = vectorParameters.find(i);
size_t pos = commandData.arguments[i].type.find('*');
if ((it == vectorParameters.end()) && (pos == std::string::npos))
{
ofs << "[" << commandData.arguments[i].arraySize << "]";
}
}
else
{
bool optional = commandData.arguments[i].optional && ((it == vectorParameters.end()) || (it->second == ~0));
if (optional)
{
ofs << "vk::Optional<";
}
if (vectorParameters.find(i) == vectorParameters.end())
{
assert(pos != std::string::npos);
if (commandData.arguments[i].type.find("char") != std::string::npos)
ofs << commandData.arguments[i].type << " " << commandData.arguments[i].name;
if (!commandData.arguments[i].arraySize.empty())
{
ofs << "std::string const";
}
else
{
assert(commandData.arguments[i].type[pos] == '*');
ofs << trimEnd(commandData.arguments[i].type.substr(0, pos));
ofs << "[" << commandData.arguments[i].arraySize << "]";
}
}
else
{
if (templateIndex == i)
bool optional = commandData.arguments[i].optional && ((it == vectorParameters.end()) || (it->second == ~0));
if (optional)
{
ofs << "std::vector<T>";
ofs << "vk::Optional<";
}
else if (commandData.arguments[i].pureType == "char")
if (vectorParameters.find(i) == vectorParameters.end())
{
ofs << "std::string";
}
else if (commandData.arguments[i].pureType == "void")
{
ofs << "std::vector<uint8_t>";
assert(pos != std::string::npos);
if (commandData.arguments[i].type.find("char") != std::string::npos)
{
ofs << "std::string const";
}
else
{
assert(commandData.arguments[i].type[pos] == '*');
ofs << trimEnd(commandData.arguments[i].type.substr(0, pos));
}
}
else
{
ofs << "std::vector<" << commandData.arguments[i].pureType << ">";
if (templateIndex == i)
{
ofs << "std::vector<T>";
}
else if (commandData.arguments[i].pureType == "char")
{
ofs << "std::string";
}
else if (commandData.arguments[i].pureType == "void")
{
ofs << "std::vector<uint8_t>";
}
else
{
ofs << "std::vector<" << commandData.arguments[i].pureType << ">";
}
if (commandData.arguments[i].type.find("const") != std::string::npos)
{
ofs << " const";
}
}
if (commandData.arguments[i].type.find("const") != std::string::npos)
if (optional)
{
ofs << " const";
ofs << "> const";
}
ofs << " & " << reduceName(commandData.arguments[i].name);
}
if (optional)
{
ofs << "> const";
}
ofs << " & " << reduceName(commandData.arguments[i].name);
argEncountered = true;
}
argEncountered = true;
}
ofs << " ";
}
ofs << " )";
ofs << ")";
if (commandData.handleCommand)
{
ofs << " const";

View File

@ -17602,7 +17602,7 @@ namespace vk
#endif /*!VKCPP_ENHANCED_MODE*/
#ifdef VKCPP_ENHANCED_MODE
void end( ) const
void end() const
{
Result result = static_cast<Result>( vkEndCommandBuffer( m_commandBuffer ) );
if ( result != Result::eSuccess )
@ -18196,7 +18196,7 @@ namespace vk
#endif /*!VKCPP_ENHANCED_MODE*/
#ifdef VKCPP_ENHANCED_MODE
void endRenderPass( ) const
void endRenderPass() const
{
vkCmdEndRenderPass( m_commandBuffer );
}
@ -18801,7 +18801,7 @@ namespace vk
#endif /*!VKCPP_ENHANCED_MODE*/
#ifdef VKCPP_ENHANCED_MODE
void waitIdle( ) const
void waitIdle() const
{
Result result = static_cast<Result>( vkQueueWaitIdle( m_queue ) );
if ( result != Result::eSuccess )
@ -20139,7 +20139,7 @@ namespace vk
#endif /*!VKCPP_ENHANCED_MODE*/
#ifdef VKCPP_ENHANCED_MODE
void waitIdle( ) const
void waitIdle() const
{
Result result = static_cast<Result>( vkDeviceWaitIdle( m_device ) );
if ( result != Result::eSuccess )
@ -20790,12 +20790,11 @@ namespace vk
std::vector<uint8_t> data;
size_t dataSize;
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 );
result = static_cast<Result>( vkGetPipelineCacheData( m_device, static_cast<VkPipelineCache>( pipelineCache ), &dataSize, reinterpret_cast<void*>( data.data() ) ) );
}
data.resize( dataSize );
result = static_cast<Result>( vkGetPipelineCacheData( m_device, static_cast<VkPipelineCache>( pipelineCache ), &dataSize, reinterpret_cast<void*>( data.data() ) ) );
if ( result != Result::eSuccess )
{
throw std::system_error( result, "vk::Device::getPipelineCacheData" );
@ -21258,21 +21257,25 @@ namespace vk
}
#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;
Result result = static_cast<Result>( vkGetSwapchainImagesKHR( m_device, static_cast<VkSwapchainKHR>( swapchain ), &swapchainImageCount, nullptr ) );
if ( ( result != Result::eSuccess ) && ( result != Result::eIncomplete ) )
Result result;
do
{
result = static_cast<Result>( vkGetSwapchainImagesKHR( m_device, static_cast<VkSwapchainKHR>( swapchain ), &swapchainImageCount, nullptr ) );
if ( ( result == Result::eSuccess ) && swapchainImageCount )
{
swapchainImages.resize( swapchainImageCount );
result = static_cast<Result>( vkGetSwapchainImagesKHR( m_device, static_cast<VkSwapchainKHR>( swapchain ), &swapchainImageCount, reinterpret_cast<VkImage*>( swapchainImages.data() ) ) );
}
} while ( result == Result::eIncomplete );
if ( result != Result::eSuccess )
{
throw std::system_error( result, "vk::Device::getSwapchainImagesKHR" );
}
swapchainImages.resize( swapchainImageCount );
result = static_cast<Result>( vkGetSwapchainImagesKHR( m_device, static_cast<VkSwapchainKHR>( swapchain ), &swapchainImageCount, reinterpret_cast<VkImage*>( swapchainImages.data() ) ) );
if ( ( result != Result::eSuccess ) && ( result != Result::eIncomplete ) )
{
throw std::system_error( result, "vk::Device::getSwapchainImagesKHR" );
}
return result;
return swapchainImages;
}
#endif /*VKCPP_ENHANCED_MODE*/
@ -21341,7 +21344,7 @@ namespace vk
}
#ifdef VKCPP_ENHANCED_MODE
PhysicalDeviceProperties getProperties( ) const
PhysicalDeviceProperties getProperties() const
{
PhysicalDeviceProperties properties;
vkGetPhysicalDeviceProperties( m_physicalDevice, reinterpret_cast<VkPhysicalDeviceProperties*>( &properties ) );
@ -21355,7 +21358,7 @@ namespace vk
}
#ifdef VKCPP_ENHANCED_MODE
std::vector<QueueFamilyProperties> getQueueFamilyProperties( ) const
std::vector<QueueFamilyProperties> getQueueFamilyProperties() const
{
std::vector<QueueFamilyProperties> queueFamilyProperties;
uint32_t queueFamilyPropertyCount;
@ -21372,7 +21375,7 @@ namespace vk
}
#ifdef VKCPP_ENHANCED_MODE
PhysicalDeviceMemoryProperties getMemoryProperties( ) const
PhysicalDeviceMemoryProperties getMemoryProperties() const
{
PhysicalDeviceMemoryProperties memoryProperties;
vkGetPhysicalDeviceMemoryProperties( m_physicalDevice, reinterpret_cast<VkPhysicalDeviceMemoryProperties*>( &memoryProperties ) );
@ -21386,7 +21389,7 @@ namespace vk
}
#ifdef VKCPP_ENHANCED_MODE
PhysicalDeviceFeatures getFeatures( ) const
PhysicalDeviceFeatures getFeatures() const
{
PhysicalDeviceFeatures features;
vkGetPhysicalDeviceFeatures( m_physicalDevice, reinterpret_cast<VkPhysicalDeviceFeatures*>( &features ) );
@ -21450,21 +21453,25 @@ namespace vk
}
#ifdef VKCPP_ENHANCED_MODE
Result enumerateDeviceLayerProperties( std::vector<LayerProperties> & properties ) const
std::vector<LayerProperties> enumerateDeviceLayerProperties() const
{
std::vector<LayerProperties> properties;
uint32_t propertyCount;
Result result = static_cast<Result>( vkEnumerateDeviceLayerProperties( m_physicalDevice, &propertyCount, nullptr ) );
if ( ( result != Result::eSuccess ) && ( result != Result::eIncomplete ) )
Result result;
do
{
result = static_cast<Result>( vkEnumerateDeviceLayerProperties( m_physicalDevice, &propertyCount, nullptr ) );
if ( ( result == Result::eSuccess ) && propertyCount )
{
properties.resize( propertyCount );
result = static_cast<Result>( vkEnumerateDeviceLayerProperties( m_physicalDevice, &propertyCount, reinterpret_cast<VkLayerProperties*>( properties.data() ) ) );
}
} while ( result == Result::eIncomplete );
if ( result != Result::eSuccess )
{
throw std::system_error( result, "vk::PhysicalDevice::enumerateDeviceLayerProperties" );
}
properties.resize( propertyCount );
result = static_cast<Result>( vkEnumerateDeviceLayerProperties( m_physicalDevice, &propertyCount, reinterpret_cast<VkLayerProperties*>( properties.data() ) ) );
if ( ( result != Result::eSuccess ) && ( result != Result::eIncomplete ) )
{
throw std::system_error( result, "vk::PhysicalDevice::enumerateDeviceLayerProperties" );
}
return result;
return properties;
}
#endif /*VKCPP_ENHANCED_MODE*/
@ -21474,21 +21481,25 @@ namespace vk
}
#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;
Result result = static_cast<Result>( vkEnumerateDeviceExtensionProperties( m_physicalDevice, layerName ? layerName->c_str() : nullptr, &propertyCount, nullptr ) );
if ( ( result != Result::eSuccess ) && ( result != Result::eIncomplete ) )
Result result;
do
{
result = static_cast<Result>( vkEnumerateDeviceExtensionProperties( m_physicalDevice, layerName ? layerName->c_str() : nullptr, &propertyCount, nullptr ) );
if ( ( result == Result::eSuccess ) && propertyCount )
{
properties.resize( propertyCount );
result = static_cast<Result>( vkEnumerateDeviceExtensionProperties( m_physicalDevice, layerName ? layerName->c_str() : nullptr, &propertyCount, reinterpret_cast<VkExtensionProperties*>( properties.data() ) ) );
}
} while ( result == Result::eIncomplete );
if ( result != Result::eSuccess )
{
throw std::system_error( result, "vk::PhysicalDevice::enumerateDeviceExtensionProperties" );
}
properties.resize( propertyCount );
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 ) )
{
throw std::system_error( result, "vk::PhysicalDevice::enumerateDeviceExtensionProperties" );
}
return result;
return properties;
}
#endif /*VKCPP_ENHANCED_MODE*/
@ -21515,21 +21526,25 @@ namespace vk
}
#ifdef VKCPP_ENHANCED_MODE
Result getDisplayPropertiesKHR( std::vector<DisplayPropertiesKHR> & properties ) const
std::vector<DisplayPropertiesKHR> getDisplayPropertiesKHR() const
{
std::vector<DisplayPropertiesKHR> properties;
uint32_t propertyCount;
Result result = static_cast<Result>( vkGetPhysicalDeviceDisplayPropertiesKHR( m_physicalDevice, &propertyCount, nullptr ) );
if ( ( result != Result::eSuccess ) && ( result != Result::eIncomplete ) )
Result result;
do
{
result = static_cast<Result>( vkGetPhysicalDeviceDisplayPropertiesKHR( m_physicalDevice, &propertyCount, nullptr ) );
if ( ( result == Result::eSuccess ) && propertyCount )
{
properties.resize( propertyCount );
result = static_cast<Result>( vkGetPhysicalDeviceDisplayPropertiesKHR( m_physicalDevice, &propertyCount, reinterpret_cast<VkDisplayPropertiesKHR*>( properties.data() ) ) );
}
} while ( result == Result::eIncomplete );
if ( result != Result::eSuccess )
{
throw std::system_error( result, "vk::PhysicalDevice::getDisplayPropertiesKHR" );
}
properties.resize( propertyCount );
result = static_cast<Result>( vkGetPhysicalDeviceDisplayPropertiesKHR( m_physicalDevice, &propertyCount, reinterpret_cast<VkDisplayPropertiesKHR*>( properties.data() ) ) );
if ( ( result != Result::eSuccess ) && ( result != Result::eIncomplete ) )
{
throw std::system_error( result, "vk::PhysicalDevice::getDisplayPropertiesKHR" );
}
return result;
return properties;
}
#endif /*VKCPP_ENHANCED_MODE*/
@ -21539,21 +21554,25 @@ namespace vk
}
#ifdef VKCPP_ENHANCED_MODE
Result getDisplayPlanePropertiesKHR( std::vector<DisplayPlanePropertiesKHR> & properties ) const
std::vector<DisplayPlanePropertiesKHR> getDisplayPlanePropertiesKHR() const
{
std::vector<DisplayPlanePropertiesKHR> properties;
uint32_t propertyCount;
Result result = static_cast<Result>( vkGetPhysicalDeviceDisplayPlanePropertiesKHR( m_physicalDevice, &propertyCount, nullptr ) );
if ( ( result != Result::eSuccess ) && ( result != Result::eIncomplete ) )
Result result;
do
{
result = static_cast<Result>( vkGetPhysicalDeviceDisplayPlanePropertiesKHR( m_physicalDevice, &propertyCount, nullptr ) );
if ( ( result == Result::eSuccess ) && propertyCount )
{
properties.resize( propertyCount );
result = static_cast<Result>( vkGetPhysicalDeviceDisplayPlanePropertiesKHR( m_physicalDevice, &propertyCount, reinterpret_cast<VkDisplayPlanePropertiesKHR*>( properties.data() ) ) );
}
} while ( result == Result::eIncomplete );
if ( result != Result::eSuccess )
{
throw std::system_error( result, "vk::PhysicalDevice::getDisplayPlanePropertiesKHR" );
}
properties.resize( propertyCount );
result = static_cast<Result>( vkGetPhysicalDeviceDisplayPlanePropertiesKHR( m_physicalDevice, &propertyCount, reinterpret_cast<VkDisplayPlanePropertiesKHR*>( properties.data() ) ) );
if ( ( result != Result::eSuccess ) && ( result != Result::eIncomplete ) )
{
throw std::system_error( result, "vk::PhysicalDevice::getDisplayPlanePropertiesKHR" );
}
return result;
return properties;
}
#endif /*VKCPP_ENHANCED_MODE*/
@ -21563,21 +21582,25 @@ namespace vk
}
#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;
Result result = static_cast<Result>( vkGetDisplayPlaneSupportedDisplaysKHR( m_physicalDevice, planeIndex, &displayCount, nullptr ) );
if ( ( result != Result::eSuccess ) && ( result != Result::eIncomplete ) )
Result result;
do
{
result = static_cast<Result>( vkGetDisplayPlaneSupportedDisplaysKHR( m_physicalDevice, planeIndex, &displayCount, nullptr ) );
if ( ( result == Result::eSuccess ) && displayCount )
{
displays.resize( displayCount );
result = static_cast<Result>( vkGetDisplayPlaneSupportedDisplaysKHR( m_physicalDevice, planeIndex, &displayCount, reinterpret_cast<VkDisplayKHR*>( displays.data() ) ) );
}
} while ( result == Result::eIncomplete );
if ( result != Result::eSuccess )
{
throw std::system_error( result, "vk::PhysicalDevice::getDisplayPlaneSupportedDisplaysKHR" );
}
displays.resize( displayCount );
result = static_cast<Result>( vkGetDisplayPlaneSupportedDisplaysKHR( m_physicalDevice, planeIndex, &displayCount, reinterpret_cast<VkDisplayKHR*>( displays.data() ) ) );
if ( ( result != Result::eSuccess ) && ( result != Result::eIncomplete ) )
{
throw std::system_error( result, "vk::PhysicalDevice::getDisplayPlaneSupportedDisplaysKHR" );
}
return result;
return displays;
}
#endif /*VKCPP_ENHANCED_MODE*/
@ -21587,21 +21610,25 @@ namespace vk
}
#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;
Result result = static_cast<Result>( vkGetDisplayModePropertiesKHR( m_physicalDevice, static_cast<VkDisplayKHR>( display ), &propertyCount, nullptr ) );
if ( ( result != Result::eSuccess ) && ( result != Result::eIncomplete ) )
Result result;
do
{
result = static_cast<Result>( vkGetDisplayModePropertiesKHR( m_physicalDevice, static_cast<VkDisplayKHR>( display ), &propertyCount, nullptr ) );
if ( ( result == Result::eSuccess ) && propertyCount )
{
properties.resize( propertyCount );
result = static_cast<Result>( vkGetDisplayModePropertiesKHR( m_physicalDevice, static_cast<VkDisplayKHR>( display ), &propertyCount, reinterpret_cast<VkDisplayModePropertiesKHR*>( properties.data() ) ) );
}
} while ( result == Result::eIncomplete );
if ( result != Result::eSuccess )
{
throw std::system_error( result, "vk::PhysicalDevice::getDisplayModePropertiesKHR" );
}
properties.resize( propertyCount );
result = static_cast<Result>( vkGetDisplayModePropertiesKHR( m_physicalDevice, static_cast<VkDisplayKHR>( display ), &propertyCount, reinterpret_cast<VkDisplayModePropertiesKHR*>( properties.data() ) ) );
if ( ( result != Result::eSuccess ) && ( result != Result::eIncomplete ) )
{
throw std::system_error( result, "vk::PhysicalDevice::getDisplayModePropertiesKHR" );
}
return result;
return properties;
}
#endif /*VKCPP_ENHANCED_MODE*/
@ -21698,21 +21725,25 @@ namespace vk
}
#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;
Result result = static_cast<Result>( vkGetPhysicalDeviceSurfaceFormatsKHR( m_physicalDevice, static_cast<VkSurfaceKHR>( surface ), &surfaceFormatCount, nullptr ) );
if ( ( result != Result::eSuccess ) && ( result != Result::eIncomplete ) )
Result result;
do
{
result = static_cast<Result>( vkGetPhysicalDeviceSurfaceFormatsKHR( m_physicalDevice, static_cast<VkSurfaceKHR>( surface ), &surfaceFormatCount, nullptr ) );
if ( ( result == Result::eSuccess ) && surfaceFormatCount )
{
surfaceFormats.resize( surfaceFormatCount );
result = static_cast<Result>( vkGetPhysicalDeviceSurfaceFormatsKHR( m_physicalDevice, static_cast<VkSurfaceKHR>( surface ), &surfaceFormatCount, reinterpret_cast<VkSurfaceFormatKHR*>( surfaceFormats.data() ) ) );
}
} while ( result == Result::eIncomplete );
if ( result != Result::eSuccess )
{
throw std::system_error( result, "vk::PhysicalDevice::getSurfaceFormatsKHR" );
}
surfaceFormats.resize( surfaceFormatCount );
result = static_cast<Result>( vkGetPhysicalDeviceSurfaceFormatsKHR( m_physicalDevice, static_cast<VkSurfaceKHR>( surface ), &surfaceFormatCount, reinterpret_cast<VkSurfaceFormatKHR*>( surfaceFormats.data() ) ) );
if ( ( result != Result::eSuccess ) && ( result != Result::eIncomplete ) )
{
throw std::system_error( result, "vk::PhysicalDevice::getSurfaceFormatsKHR" );
}
return result;
return surfaceFormats;
}
#endif /*VKCPP_ENHANCED_MODE*/
@ -21722,21 +21753,25 @@ namespace vk
}
#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;
Result result = static_cast<Result>( vkGetPhysicalDeviceSurfacePresentModesKHR( m_physicalDevice, static_cast<VkSurfaceKHR>( surface ), &presentModeCount, nullptr ) );
if ( ( result != Result::eSuccess ) && ( result != Result::eIncomplete ) )
Result result;
do
{
result = static_cast<Result>( vkGetPhysicalDeviceSurfacePresentModesKHR( m_physicalDevice, static_cast<VkSurfaceKHR>( surface ), &presentModeCount, nullptr ) );
if ( ( result == Result::eSuccess ) && presentModeCount )
{
presentModes.resize( presentModeCount );
result = static_cast<Result>( vkGetPhysicalDeviceSurfacePresentModesKHR( m_physicalDevice, static_cast<VkSurfaceKHR>( surface ), &presentModeCount, reinterpret_cast<VkPresentModeKHR*>( presentModes.data() ) ) );
}
} while ( result == Result::eIncomplete );
if ( result != Result::eSuccess )
{
throw std::system_error( result, "vk::PhysicalDevice::getSurfacePresentModesKHR" );
}
presentModes.resize( presentModeCount );
result = static_cast<Result>( vkGetPhysicalDeviceSurfacePresentModesKHR( m_physicalDevice, static_cast<VkSurfaceKHR>( surface ), &presentModeCount, reinterpret_cast<VkPresentModeKHR*>( presentModes.data() ) ) );
if ( ( result != Result::eSuccess ) && ( result != Result::eIncomplete ) )
{
throw std::system_error( result, "vk::PhysicalDevice::getSurfacePresentModesKHR" );
}
return result;
return presentModes;
}
#endif /*VKCPP_ENHANCED_MODE*/
@ -22028,21 +22063,25 @@ namespace vk
}
#ifdef VKCPP_ENHANCED_MODE
Result enumeratePhysicalDevices( std::vector<PhysicalDevice> & physicalDevices ) const
std::vector<PhysicalDevice> enumeratePhysicalDevices() const
{
std::vector<PhysicalDevice> physicalDevices;
uint32_t physicalDeviceCount;
Result result = static_cast<Result>( vkEnumeratePhysicalDevices( m_instance, &physicalDeviceCount, nullptr ) );
if ( ( result != Result::eSuccess ) && ( result != Result::eIncomplete ) )
Result result;
do
{
result = static_cast<Result>( vkEnumeratePhysicalDevices( m_instance, &physicalDeviceCount, nullptr ) );
if ( ( result == Result::eSuccess ) && physicalDeviceCount )
{
physicalDevices.resize( physicalDeviceCount );
result = static_cast<Result>( vkEnumeratePhysicalDevices( m_instance, &physicalDeviceCount, reinterpret_cast<VkPhysicalDevice*>( physicalDevices.data() ) ) );
}
} while ( result == Result::eIncomplete );
if ( result != Result::eSuccess )
{
throw std::system_error( result, "vk::Instance::enumeratePhysicalDevices" );
}
physicalDevices.resize( physicalDeviceCount );
result = static_cast<Result>( vkEnumeratePhysicalDevices( m_instance, &physicalDeviceCount, reinterpret_cast<VkPhysicalDevice*>( physicalDevices.data() ) ) );
if ( ( result != Result::eSuccess ) && ( result != Result::eIncomplete ) )
{
throw std::system_error( result, "vk::Instance::enumeratePhysicalDevices" );
}
return result;
return physicalDevices;
}
#endif /*VKCPP_ENHANCED_MODE*/
@ -22315,21 +22354,25 @@ namespace vk
}
#ifdef VKCPP_ENHANCED_MODE
inline Result enumerateInstanceLayerProperties( std::vector<LayerProperties> & properties )
inline std::vector<LayerProperties> enumerateInstanceLayerProperties()
{
std::vector<LayerProperties> properties;
uint32_t propertyCount;
Result result = static_cast<Result>( vkEnumerateInstanceLayerProperties( &propertyCount, nullptr ) );
if ( ( result != Result::eSuccess ) && ( result != Result::eIncomplete ) )
Result result;
do
{
result = static_cast<Result>( vkEnumerateInstanceLayerProperties( &propertyCount, nullptr ) );
if ( ( result == Result::eSuccess ) && propertyCount )
{
properties.resize( propertyCount );
result = static_cast<Result>( vkEnumerateInstanceLayerProperties( &propertyCount, reinterpret_cast<VkLayerProperties*>( properties.data() ) ) );
}
} while ( result == Result::eIncomplete );
if ( result != Result::eSuccess )
{
throw std::system_error( result, "vk::enumerateInstanceLayerProperties" );
}
properties.resize( propertyCount );
result = static_cast<Result>( vkEnumerateInstanceLayerProperties( &propertyCount, reinterpret_cast<VkLayerProperties*>( properties.data() ) ) );
if ( ( result != Result::eSuccess ) && ( result != Result::eIncomplete ) )
{
throw std::system_error( result, "vk::enumerateInstanceLayerProperties" );
}
return result;
return properties;
}
#endif /*VKCPP_ENHANCED_MODE*/
@ -22339,21 +22382,25 @@ namespace vk
}
#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;
Result result = static_cast<Result>( vkEnumerateInstanceExtensionProperties( layerName ? layerName->c_str() : nullptr, &propertyCount, nullptr ) );
if ( ( result != Result::eSuccess ) && ( result != Result::eIncomplete ) )
Result result;
do
{
result = static_cast<Result>( vkEnumerateInstanceExtensionProperties( layerName ? layerName->c_str() : nullptr, &propertyCount, nullptr ) );
if ( ( result == Result::eSuccess ) && propertyCount )
{
properties.resize( propertyCount );
result = static_cast<Result>( vkEnumerateInstanceExtensionProperties( layerName ? layerName->c_str() : nullptr, &propertyCount, reinterpret_cast<VkExtensionProperties*>( properties.data() ) ) );
}
} while ( result == Result::eIncomplete );
if ( result != Result::eSuccess )
{
throw std::system_error( result, "vk::enumerateInstanceExtensionProperties" );
}
properties.resize( propertyCount );
result = static_cast<Result>( vkEnumerateInstanceExtensionProperties( layerName ? layerName->c_str() : nullptr, &propertyCount, reinterpret_cast<VkExtensionProperties*>( properties.data() ) ) );
if ( ( result != Result::eSuccess ) && ( result != Result::eIncomplete ) )
{
throw std::system_error( result, "vk::enumerateInstanceExtensionProperties" );
}
return result;
return properties;
}
#endif /*VKCPP_ENHANCED_MODE*/