Merge pull request #1113 from asuessenbach/parent2

Refactor parent member of the vk::raii classes.
This commit is contained in:
Andreas Süßenbach 2021-10-25 16:03:09 +02:00 committed by GitHub
commit 07129f07c7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 1296 additions and 1236 deletions

View File

@ -48,8 +48,8 @@ int main( int /*argc*/, char ** /*argv*/ )
<< "physicalDevices:\n"; << "physicalDevices:\n";
for ( size_t j = 0; j < groupProperties[i].physicalDeviceCount; j++ ) for ( size_t j = 0; j < groupProperties[i].physicalDeviceCount; j++ )
{ {
vk::raii::PhysicalDevice physicalDevice( static_cast<VkPhysicalDevice>( groupProperties[i].physicalDevices[j] ), vk::raii::PhysicalDevice physicalDevice(
instance.getDispatcher() ); instance, static_cast<VkPhysicalDevice>( groupProperties[i].physicalDevices[j] ) );
std::cout << "\t\t" << j << " : " << physicalDevice.getProperties().deviceName << "\n"; std::cout << "\t\t" << j << " : " << physicalDevice.getProperties().deviceName << "\n";
} }
std::cout << "\t" std::cout << "\t"
@ -58,8 +58,8 @@ int main( int /*argc*/, char ** /*argv*/ )
if ( 1 < groupProperties[i].physicalDeviceCount ) if ( 1 < groupProperties[i].physicalDeviceCount )
{ {
vk::raii::PhysicalDevice physicalDevice( static_cast<VkPhysicalDevice>( groupProperties[i].physicalDevices[0] ), vk::raii::PhysicalDevice physicalDevice(
instance.getDispatcher() ); instance, static_cast<VkPhysicalDevice>( groupProperties[i].physicalDevices[0] ) );
// get the QueueFamilyProperties of the first PhysicalDevice // get the QueueFamilyProperties of the first PhysicalDevice
std::vector<vk::QueueFamilyProperties> queueFamilyProperties = physicalDevice.getQueueFamilyProperties(); std::vector<vk::QueueFamilyProperties> queueFamilyProperties = physicalDevice.getQueueFamilyProperties();

File diff suppressed because it is too large Load Diff

View File

@ -409,11 +409,11 @@ private:
std::string generateBitmasks( std::vector<RequireData> const & requireData, std::string generateBitmasks( std::vector<RequireData> const & requireData,
std::set<std::string> & listedBitmasks, std::set<std::string> & listedBitmasks,
std::string const & title ) const; std::string const & title ) const;
std::string generateCallArgumentsEnhanced( std::vector<ParamData> const & params, std::string generateCallArgumentsEnhanced( CommandData const & commandData,
size_t initialSkipCount, size_t initialSkipCount,
bool nonConstPointerAsNullptr, bool nonConstPointerAsNullptr,
std::set<size_t> const & singularParams, std::set<size_t> const & singularParams,
bool raiiHandleMemberFunction ) const; bool raiiHandleMemberFunction ) const;
std::string generateCallArgumentsRAIIFactory( std::vector<ParamData> const & params, std::string generateCallArgumentsRAIIFactory( std::vector<ParamData> const & params,
size_t initialSkipCount, size_t initialSkipCount,
std::set<size_t> const & skippedParameters, std::set<size_t> const & skippedParameters,
@ -1090,18 +1090,21 @@ private:
std::map<size_t, size_t> const & vectorParamIndices ) const; std::map<size_t, size_t> const & vectorParamIndices ) const;
std::pair<std::string, std::string> std::pair<std::string, std::string>
generateRAIIHandleConstructors( std::pair<std::string, HandleData> const & handle ) const; generateRAIIHandleConstructors( std::pair<std::string, HandleData> const & handle ) const;
std::string generateRAIIHandleConstructorArgument( ParamData const & param, bool definition, bool singular ) const; std::string generateRAIIHandleConstructorArgument( ParamData const & param,
std::string generateRAIIHandleConstructorArguments( std::pair<std::string, HandleData> const & handle, bool definition,
std::vector<ParamData> const & params, bool singular,
bool singular, bool takesOwnership ) const;
bool skipLeadingGrandParent, std::string generateRAIIHandleConstructorArguments(
bool encounteredArgument ) const; std::pair<std::string, HandleData> const & handle,
std::string generateRAIIHandleConstructorCallArguments( std::string const & handleType, std::map<std::string, VulkanHppGenerator::CommandData>::const_iterator constructorIt,
std::vector<ParamData> const & params, bool singular,
bool nonConstPointerAsNullptr, bool takesOwnership ) const;
std::set<size_t> const & singularParams, std::string generateRAIIHandleConstructorCallArguments(
bool allocatorIsMemberVariable, std::pair<std::string, HandleData> const & handle,
bool skipLeadingGrandParent ) const; std::map<std::string, VulkanHppGenerator::CommandData>::const_iterator constructorIt,
bool nonConstPointerAsNullptr,
std::set<size_t> const & singularParams,
bool allocatorIsMemberVariable ) const;
std::string generateRAIIHandleConstructorEnumerate( std::pair<std::string, HandleData> const & handle, std::string generateRAIIHandleConstructorEnumerate( std::pair<std::string, HandleData> const & handle,
std::map<std::string, CommandData>::const_iterator constructorIt, std::map<std::string, CommandData>::const_iterator constructorIt,
std::vector<ParamData>::const_iterator handleParamIt, std::vector<ParamData>::const_iterator handleParamIt,
@ -1109,10 +1112,10 @@ private:
std::string const & enter, std::string const & enter,
std::string const & leave ) const; std::string const & leave ) const;
std::string std::string
generateRAIIHandleConstructorInitializationList( std::string const & handleType, generateRAIIHandleConstructorInitializationList( std::pair<std::string, HandleData> const & handle,
std::map<std::string, CommandData>::const_iterator constructorIt, std::map<std::string, CommandData>::const_iterator constructorIt,
std::map<std::string, CommandData>::const_iterator destructorIt, std::map<std::string, CommandData>::const_iterator destructorIt,
bool hasSecondLevelCommands ) const; bool takesOwnership ) const;
std::string generateRAIIHandleConstructorResult( std::pair<std::string, HandleData> const & handle, std::string generateRAIIHandleConstructorResult( std::pair<std::string, HandleData> const & handle,
std::map<std::string, CommandData>::const_iterator constructorIt, std::map<std::string, CommandData>::const_iterator constructorIt,
std::string const & enter, std::string const & enter,
@ -1136,10 +1139,12 @@ private:
std::string generateRAIIHandleContext( std::pair<std::string, HandleData> const & handle, std::string generateRAIIHandleContext( std::pair<std::string, HandleData> const & handle,
std::set<std::string> const & specialFunctions ) const; std::set<std::string> const & specialFunctions ) const;
std::pair<std::string, std::string> std::pair<std::string, std::string>
generateRAIIHandleDestructor( std::string const & handleType, generateRAIIHandleDestructor( std::string const & parentType,
std::string const & handleType,
std::map<std::string, CommandData>::const_iterator destructorIt, std::map<std::string, CommandData>::const_iterator destructorIt,
std::string const & enter ) const; std::string const & enter ) const;
std::string generateRAIIHandleDestructorCallArguments( std::string const & handleType, std::string generateRAIIHandleDestructorCallArguments( std::string const & parentType,
std::string const & handleType,
std::vector<ParamData> const & params ) const; std::vector<ParamData> const & params ) const;
std::tuple<std::string, std::string, std::string, std::string> std::tuple<std::string, std::string, std::string, std::string>
generateRAIIHandleDetails( std::pair<std::string, HandleData> const & handle, generateRAIIHandleDetails( std::pair<std::string, HandleData> const & handle,
@ -1149,7 +1154,6 @@ private:
std::string generateRAIIHandleSingularConstructorArguments( std::string generateRAIIHandleSingularConstructorArguments(
std::pair<std::string, HandleData> const & handle, std::pair<std::string, HandleData> const & handle,
std::map<std::string, CommandData>::const_iterator constructorIt ) const; std::map<std::string, CommandData>::const_iterator constructorIt ) const;
std::string generateRAIIHandleUpgradeConstructor( std::pair<std::string, HandleData> const & handle ) const;
std::string generateRAIIHandleVectorSizeCheck( std::string const & name, std::string generateRAIIHandleVectorSizeCheck( std::string const & name,
CommandData const & commandData, CommandData const & commandData,
size_t initialSkipCount, size_t initialSkipCount,
@ -1188,7 +1192,8 @@ private:
size_t initialSkipCount, size_t initialSkipCount,
std::map<size_t, std::vector<size_t>> const & countToVectorMap, std::map<size_t, std::vector<size_t>> const & countToVectorMap,
std::set<size_t> const & skippedParams ) const; std::set<size_t> const & skippedParams ) const;
std::string getPlatform( std::string const & title ) const; std::pair<std::string, std::string> getParentTypeAndName( std::pair<std::string, HandleData> const & handle ) const;
std::string getPlatform( std::string const & title ) const;
std::pair<std::string, std::string> getPoolTypeAndName( std::string const & type ) const; std::pair<std::string, std::string> getPoolTypeAndName( std::string const & type ) const;
std::string getVectorSize( std::vector<ParamData> const & params, std::string getVectorSize( std::vector<ParamData> const & params,
std::map<size_t, size_t> const & vectorParamIndices, std::map<size_t, size_t> const & vectorParamIndices,
@ -1292,6 +1297,7 @@ private:
std::set<std::string> const & handleCommands, std::set<std::string> const & handleCommands,
std::set<std::string> & listedCommands ) const; std::set<std::string> & listedCommands ) const;
void setVulkanLicenseHeader( int line, std::string const & comment ); void setVulkanLicenseHeader( int line, std::string const & comment );
bool skipLeadingGrandParent( std::pair<std::string, HandleData> const & handle ) const;
std::string toString( TypeCategory category ); std::string toString( TypeCategory category );
private: private:

File diff suppressed because it is too large Load Diff