From 00dac1bd2182c003d8f9ed1e5370726d743ea270 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20S=C3=BC=C3=9Fenbach?= Date: Tue, 8 Oct 2024 13:25:37 +0200 Subject: [PATCH] Add check on "queues" being specified with at least one command. (#1968) --- VulkanHppGenerator.cpp | 17 ++++++++++++++--- VulkanHppGenerator.hpp | 4 ++-- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/VulkanHppGenerator.cpp b/VulkanHppGenerator.cpp index 4664fb0..c425b06 100644 --- a/VulkanHppGenerator.cpp +++ b/VulkanHppGenerator.cpp @@ -13340,7 +13340,7 @@ void VulkanHppGenerator::readCommand( tinyxml2::XMLElement const * element ) { "cmdbufferlevel", { "primary", "secondary" } }, { "comment", {} }, { "errorcodes", {} }, - { "queues", { "compute", "decode", "encode", "graphics", "opticalflow", "sparse_binding", "transfer" } }, + { "queues", {} }, { "renderpass", { "both", "inside", "outside" } }, { "successcodes", {} }, { "tasks", { "action", "indirection", "state", "synchronization" } }, @@ -13363,6 +13363,10 @@ void VulkanHppGenerator::readCommand( tinyxml2::XMLElement const * element ) commandData.errorCodes = tokenize( attribute.second, "," ); // errorCodes are checked in checkCorrectness after complete reading } + else if ( attribute.first == "queues" ) + { + m_commandQueues.insert( attribute.second ); + } else if ( attribute.first == "successcodes" ) { commandData.successCodes = tokenize( attribute.second, "," ); @@ -15267,9 +15271,16 @@ void VulkanHppGenerator::readSyncStageEquivalent( tinyxml2::XMLElement const * e void VulkanHppGenerator::readSyncStageSupport( tinyxml2::XMLElement const * element ) { - const int line = element->GetLineNum(); - checkAttributes( line, getAttributes( element ), { { "queues", { "compute", "decode", "encode", "graphics", "opticalflow", "transfer" } } }, {} ); + const int line = element->GetLineNum(); + std::map attributes = getAttributes( element ); + checkAttributes( line, attributes, { { "queues", {} } }, {} ); checkElements( line, getChildElements( element ), {}, {} ); + + for ( auto const & attribute : attributes ) + { + assert( attribute.first == "queues" ); + checkForError( m_commandQueues.contains( attribute.second ), line, "syncsupport queues uses unknown value <" + attribute.second + ">" ); + } } void VulkanHppGenerator::readTag( tinyxml2::XMLElement const * element ) diff --git a/VulkanHppGenerator.hpp b/VulkanHppGenerator.hpp index 3c4d984..f55586e 100644 --- a/VulkanHppGenerator.hpp +++ b/VulkanHppGenerator.hpp @@ -1102,8 +1102,7 @@ private: void readSPIRVExtensions( tinyxml2::XMLElement const * element ); void readStructMember( tinyxml2::XMLElement const * element, std::vector & members, bool isUnion ); void readSync( tinyxml2::XMLElement const * element ); - void readSyncAccess( tinyxml2::XMLElement const * element, - std::map::const_iterator accessFlagBits2It ); + void readSyncAccess( tinyxml2::XMLElement const * element, std::map::const_iterator accessFlagBits2It ); void readSyncAccessEquivalent( tinyxml2::XMLElement const * element, std::map::const_iterator accessFlagBits2It ); void readSyncAccessSupport( tinyxml2::XMLElement const * element ); void readSyncPipeline( tinyxml2::XMLElement const * element ); @@ -1151,6 +1150,7 @@ private: std::string m_api; std::map m_baseTypes; std::map m_bitmasks; + std::set m_commandQueues; std::map m_commands; std::map m_constants; std::map m_defines;