From a7d2d85d63531a4d025cc1b0d7450cd155f8ae75 Mon Sep 17 00:00:00 2001 From: asuessenbach Date: Mon, 4 Jul 2022 11:37:22 +0200 Subject: [PATCH] Add support for new attribute "validstructs"; ignore new possible values for attribute "limittype". --- VulkanHppGenerator.cpp | 19 +++++++++++++++++-- VulkanHppGenerator.hpp | 1 + 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/VulkanHppGenerator.cpp b/VulkanHppGenerator.cpp index 21e1f0a..08c59ed 100644 --- a/VulkanHppGenerator.cpp +++ b/VulkanHppGenerator.cpp @@ -1914,6 +1914,19 @@ void VulkanHppGenerator::checkStructMemberCorrectness( std::string const & } } +void VulkanHppGenerator::checkValidStructs( int line, std::map const & attributes ) const +{ + auto it = attributes.find( "validstructs" ); + if ( it != attributes.end() ) + { + std::vector validStructs = tokenize( it->second, "," ); + for ( auto const & vs : validStructs ) + { + check( m_structures.find( vs ) != m_structures.end(), line, "unknown struct <" + vs + "> listed in attribute " ); + } + } +} + std::string VulkanHppGenerator::combineDataTypes( std::map const & vectorParams, std::vector const & returnParams, bool singular, @@ -10622,7 +10635,9 @@ VulkanHppGenerator::ParamData VulkanHppGenerator::readCommandsCommandParam( tiny { "len", {} }, { "noautovalidity", { "true" } }, { "objecttype", { "objectType" } }, - { "optional", { "false", "true" } } } ); + { "optional", { "false", "true" } }, + { "validstructs", {} } } ); + checkValidStructs( line, attributes ); ParamData paramData( line ); for ( auto attribute : attributes ) @@ -12638,7 +12653,7 @@ void VulkanHppGenerator::readTypesTypeStructMember( tinyxml2::XMLElement const * { { "altlen", {} }, { "externsync", { "true" } }, { "len", {} }, - { "limittype", { "bitmask", "max", "min", "noauto", "range", "struct" } }, + { "limittype", { "bitmask", "bits", "exact", "max", "min", "mul", "noauto", "pot", "range", "struct" } }, { "noautovalidity", { "true" } }, { "objecttype", { "objectType" } }, { "optional", { "false", "true" } }, diff --git a/VulkanHppGenerator.hpp b/VulkanHppGenerator.hpp index aecadfa..5be6bf6 100644 --- a/VulkanHppGenerator.hpp +++ b/VulkanHppGenerator.hpp @@ -396,6 +396,7 @@ private: void checkHandleCorrectness() const; void checkStructCorrectness() const; void checkStructMemberCorrectness( std::string const & structureName, std::vector const & members, std::set & sTypeValues ) const; + void checkValidStructs( int line, std::map const & attributes ) const; std::string combineDataTypes( std::map const & vectorParams, std::vector const & returnParams, bool singular,