diff --git a/CMakeLists.txt b/CMakeLists.txt index 9ce43c4..680cd52 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -28,6 +28,14 @@ cmake_minimum_required(VERSION 3.2) project(VkCppGenerator) +file(TO_NATIVE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/Vulkan-Docs/src/spec/vk.xml vk_spec) +string(REPLACE "\\" "\\\\" vk_spec ${vk_spec}) +add_definitions(-DVK_SPEC="${vk_spec}") + +file(TO_NATIVE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/vulkan/vk_cpp.hpp vk_cpp) +string(REPLACE "\\" "\\\\" vk_cpp ${vk_cpp}) +add_definitions(-DVK_CPP="${vk_cpp}") + set(HEADERS ) diff --git a/README.md b/README.md index c704334..f9eb8dd 100644 --- a/README.md +++ b/README.md @@ -136,7 +136,7 @@ device.createImage(&ci, allocator, &image); # Enhancements beyond native Vulkan To provide a more object oriented feeling we're providing classes for each handle which include all Vulkan functions where the first parameter matches the handle. In addition to this we made a few changes to the signatures of the member functions -* To enable the enhanced mode put ```#define VKCPP_ENHANCED_MODE``` before including ```vk_cpp.h``` +* To disable the enhanced mode put ```#define VKCPP_DISABLE_ENHANCED_MODE``` before including ```vk_cpp.h``` * ```(count, T*)``` has been replaced by ```std::vector``` * ```const char *``` has been replaced by ```std::string ``` * ```T const*``` has been replaced by ```T const &``` to allow temporary objects. This is useful to pass small structures like ```vk::ClearColorValue``` or ```vk::Extent*``` diff --git a/VkCppGenerator.cpp b/VkCppGenerator.cpp index 90b7e8e..e4df018 100644 --- a/VkCppGenerator.cpp +++ b/VkCppGenerator.cpp @@ -1,2909 +1,2924 @@ -// Copyright(c) 2015-2016, NVIDIA CORPORATION. All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// * Neither the name of NVIDIA CORPORATION nor the names of its -// contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY -// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -const std::string nvidiaLicenseHeader( -"// Copyright(c) 2015-2016, NVIDIA CORPORATION. All rights reserved.\n" -"//\n" -"// Redistribution and use in source and binary forms, with or without\n" -"// modification, are permitted provided that the following conditions\n" -"// are met:\n" -"// * Redistributions of source code must retain the above copyright\n" -"// notice, this list of conditions and the following disclaimer.\n" -"// * Redistributions in binary form must reproduce the above copyright\n" -"// notice, this list of conditions and the following disclaimer in the\n" -"// documentation and/or other materials provided with the distribution.\n" -"// * Neither the name of NVIDIA CORPORATION nor the names of its\n" -"// contributors may be used to endorse or promote products derived\n" -"// from this software without specific prior written permission.\n" -"//\n" -"// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY\n" -"// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n" -"// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\n" -"// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR\n" -"// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,\n" -"// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,\n" -"// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n" -"// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY\n" -"// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n" -"// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n" -"// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n" -); - -const std::string exceptionHeader( - "#if defined(_MSC_VER) && (_MSC_VER == 1800)\n" - "# define noexcept _NOEXCEPT\n" - "#endif\n" - "\n" - " class ErrorCategoryImpl : public std::error_category\n" - " {\n" - " public:\n" - " virtual const char* name() const noexcept override { return \"vk::Result\"; }\n" - " virtual std::string message(int ev) const override { return to_string(static_cast(ev)); }\n" - " };\n" - "\n" - "#if defined(_MSC_VER) && (_MSC_VER == 1800)\n" - "# undef noexcept\n" - "#endif\n" - "\n" - " inline const std::error_category& errorCategory()\n" - " {\n" - " static ErrorCategoryImpl instance;\n" - " return instance;\n" - " }\n" - "\n" - " inline std::error_code make_error_code(Result e)\n" - " {\n" - " return std::error_code(static_cast(e), errorCategory());\n" - " }\n" - "\n" - " inline std::error_condition make_error_condition(Result e)\n" - " {\n" - " return std::error_condition(static_cast(e), errorCategory());\n" - " }\n" - "\n" - ); - -const std::string flagsHeader( -" template \n" -" class Flags\n" -" {\n" -" public:\n" -" Flags()\n" -" : m_mask(0)\n" -" {\n" -" }\n" -"\n" -" Flags(BitType bit)\n" -" : m_mask(static_cast(bit))\n" -" {\n" -" }\n" -"\n" -" Flags(Flags const& rhs)\n" -" : m_mask(rhs.m_mask)\n" -" {\n" -" }\n" -"\n" -" Flags & operator=(Flags const& rhs)\n" -" {\n" -" m_mask = rhs.m_mask;\n" -" return *this;\n" -" }\n" -"\n" -" Flags & operator|=(Flags const& rhs)\n" -" {\n" -" m_mask |= rhs.m_mask;\n" -" return *this;\n" -" }\n" -"\n" -" Flags & operator&=(Flags const& rhs)\n" -" {\n" -" m_mask &= rhs.m_mask;\n" -" return *this;\n" -" }\n" -"\n" -" Flags & operator^=(Flags const& rhs)\n" -" {\n" -" m_mask ^= rhs.m_mask;\n" -" return *this;\n" -" }\n" -"\n" -" Flags operator|(Flags const& rhs) const\n" -" {\n" -" Flags result(*this);\n" -" result |= rhs;\n" -" return result;\n" -" }\n" -"\n" -" Flags operator&(Flags const& rhs) const\n" -" {\n" -" Flags result(*this);\n" -" result &= rhs;\n" -" return result;\n" -" }\n" -"\n" -" Flags operator^(Flags const& rhs) const\n" -" {\n" -" Flags result(*this);\n" -" result ^= rhs;\n" -" return result;\n" -" }\n" -"\n" -" bool operator!() const\n" -" {\n" -" return !m_mask;\n" -" }\n" -"\n" -" bool operator==(Flags const& rhs) const\n" -" {\n" -" return m_mask == rhs.m_mask;\n" -" }\n" -"\n" -" bool operator!=(Flags const& rhs) const\n" -" {\n" -" return m_mask != rhs.m_mask;\n" -" }\n" -"\n" -" explicit operator bool() const\n" -" {\n" -" return !!m_mask;\n" -" }\n" -"\n" -" explicit operator MaskType() const\n" -" {\n" -" return m_mask;\n" -" }\n" -"\n" -" private:\n" -" MaskType m_mask;\n" -" };\n" -" \n" -" template \n" -" Flags operator|(BitType bit, Flags const& flags)\n" -" {\n" -" return flags | bit;\n" -" }\n" -" \n" -" template \n" -" Flags operator&(BitType bit, Flags const& flags)\n" -" {\n" -" return flags & bit;\n" -" }\n" -" \n" -" template \n" -" Flags operator^(BitType bit, Flags const& flags)\n" -" {\n" -" return flags ^ bit;\n" -" }\n" -"\n" -); - -std::string const optionalClassHeader = ( - " template \n" - " class Optional\n" - " {\n" - " public:\n" - " Optional(RefType & reference) { m_ptr = &reference; }\n" - " Optional(std::nullptr_t) { m_ptr = nullptr; }\n" - "\n" - " operator RefType*() const { return m_ptr; }\n" - " RefType const* operator->() const { return m_ptr; }\n" - " explicit operator bool() const { return !!m_ptr; }\n" - "\n" - " private:\n" - " RefType *m_ptr;\n" - " };\n" - "\n" -); - -// trim from end -std::string trimEnd(std::string const& input) -{ - std::string result = input; - result.erase(std::find_if(result.rbegin(), result.rend(), std::not1(std::ptr_fun(std::isspace))).base(), result.end()); - return result; -} - -struct MemberData -{ - std::string type; - std::string name; - std::string arraySize; - std::string pureType; - std::string len; - bool optional; -}; - -struct CommandData -{ - CommandData() - : handleCommand(false) - , twoStep(false) - {} - - std::string returnType; - std::vector arguments; - std::vector successCodes; - std::string protect; - bool handleCommand; - bool twoStep; -}; - -struct DependencyData -{ - enum class Category - { - COMMAND, - ENUM, - FLAGS, - FUNC_POINTER, - HANDLE, - REQUIRED, - SCALAR, - STRUCT, - UNION - }; - - DependencyData(Category c, std::string const& n) - : category(c) - , name(n) - {} - - Category category; - std::string name; - std::set dependencies; -}; - -struct NameValue -{ - std::string name; - std::string value; -}; - -struct EnumData -{ - bool bitmask; - std::string prefix; - std::string postfix; - std::vector members; - std::string protect; - - void addEnum(std::string const & name, std::string const& tag, bool appendTag); -}; - -struct FlagData -{ - std::string protect; -}; - -struct HandleData -{ - std::vector commands; -}; - -struct ScalarData -{ - std::string protect; -}; - -struct StructData -{ - StructData() - : returnedOnly(false) - {} - - bool returnedOnly; - std::vector members; - std::string protect; -}; - -struct VkData -{ - std::map commands; - std::list dependencies; - std::map enums; - std::map flags; - std::map handles; - std::map scalars; - std::map structs; - std::set tags; - std::string typesafeCheck; - std::string version; - std::set vkTypes; - std::string vulkanLicenseHeader; -}; - -void createDefaults( VkData const& vkData, std::map & defaultValues ); -std::string determineFunctionName(std::string const& name, CommandData const& commandData); -std::string determineReturnType(CommandData const& commandData, size_t returnIndex, bool isVector = false); -void enterProtect(std::ofstream &ofs, std::string const& protect); -std::string extractTag(std::string const& name); -size_t findReturnIndex(CommandData const& commandData, std::map const& vectorParameters); -std::string findTag(std::string const& name, std::set const& tags); -size_t findTemplateIndex(CommandData const& commandData, std::map const& vectorParameters); -std::string generateEnumNameForFlags(std::string const& name); -std::map getVectorParameters(CommandData const& commandData); -bool hasPointerArguments(CommandData const& commandData); -bool isVectorSizeParameter(std::map const& vectorParameters, size_t idx); -void leaveProtect(std::ofstream &ofs, std::string const& protect); -bool noDependencies(std::set const& dependencies, std::map & listedTypes); -bool readCommandParam( tinyxml2::XMLElement * element, DependencyData & typeData, std::vector & arguments ); -std::map::iterator readCommandProto(tinyxml2::XMLElement * element, VkData & vkData); -void readCommands( tinyxml2::XMLElement * element, VkData & vkData ); -void readCommandsCommand(tinyxml2::XMLElement * element, VkData & vkData); -void readComment(tinyxml2::XMLElement * element, std::string & header); -void readEnums( tinyxml2::XMLElement * element, VkData & vkData ); -void readEnumsEnum( tinyxml2::XMLElement * element, EnumData & enumData, std::string const& tag ); -void readExtensionRequire(tinyxml2::XMLElement * element, VkData & vkData, std::string const& protect, std::string const& tag); -void readExtensions( tinyxml2::XMLElement * element, VkData & vkData ); -void readExtensionsExtension(tinyxml2::XMLElement * element, VkData & vkData); -void readTypeBasetype( tinyxml2::XMLElement * element, std::list & dependencies ); -void readTypeBitmask( tinyxml2::XMLElement * element, VkData & vkData); -void readTypeDefine( tinyxml2::XMLElement * element, VkData & vkData ); -void readTypeFuncpointer( tinyxml2::XMLElement * element, std::list & dependencies ); -void readTypeHandle(tinyxml2::XMLElement * element, VkData & vkData); -void readTypeStruct( tinyxml2::XMLElement * element, VkData & vkData ); -void readTypeStructMember( tinyxml2::XMLElement * element, std::vector & members, std::set & dependencies ); -void readTypeUnion( tinyxml2::XMLElement * element, VkData & vkData ); -void readTypeUnionMember( tinyxml2::XMLElement * element, std::vector & members, std::set & dependencies ); -void readTags(tinyxml2::XMLElement * element, std::set & tags); -void readTypes(tinyxml2::XMLElement * element, VkData & vkData); -void sortDependencies( std::list & dependencies ); -std::string reduceName(std::string const& name, bool stripTrailingS = false); -std::string strip(std::string const& value, std::string const& prefix, std::string const& tag = std::string()); -std::string stripCommand(std::string const& value); -std::string toCamelCase(std::string const& value); -std::string toUpperCase(std::string const& name); -void writeCall(std::ofstream & ofs, std::string const& name, size_t templateIndex, CommandData const& commandData, std::set const& vkTypes, std::map const& vectorParameters, size_t returnIndex, bool firstCall, bool singular); -void writeEnumsToString(std::ofstream & ofs, VkData const& vkData); -void writeExceptionCheck(std::ofstream & ofs, std::string const& indentation, std::string const& className, std::string const& functionName, std::vector const& successCodes); -void writeFunctionBody(std::ofstream & ofs, std::string const& indentation, std::string const& className, std::string const& functionName, std::string const& returnType, size_t templateIndex, DependencyData const& dependencyData, CommandData const& commandData, std::set const& vkTypes, size_t returnIndex, std::map const& vectorParameters, bool singular); -void writeFunctionHeader(std::ofstream & ofs, std::string const& indentation, std::string const& returnType, std::string const& name, CommandData const& commandData, size_t returnIndex, size_t templateIndex, std::map const& vectorParameters, bool singular); -void writeMemberData(std::ofstream & ofs, MemberData const& memberData, std::set const& vkTypes); -void writeStructConstructor( std::ofstream & ofs, std::string const& name, std::string const& memberName, StructData const& structData, std::set const& vkTypes, std::map const& defaultValues ); -void writeStructGetter( std::ofstream & ofs, MemberData const& memberData, std::string const& memberName, std::set const& vkTypes, bool constVersion ); -void writeStructSetter( std::ofstream & ofs, std::string const& name, MemberData const& memberData, std::string const& memberName, std::set const& vkTypes, std::map const& structs ); -void writeTypeCommand( std::ofstream & ofs, DependencyData const& dependencyData, CommandData const& commandData, std::set const& vkTypes ); -void writeTypeCommandEnhanced(std::ofstream & ofs, std::string const& indentation, std::string const& className, std::string const& functionName, DependencyData const& dependencyData, CommandData const& commandData, std::set const& vkTypes); -void writeTypeCommandStandard(std::ofstream & ofs, std::string const& indentation, std::string const& functionName, DependencyData const& dependencyData, CommandData const& commandData, std::set const& vkTypes); -void writeTypeEnum(std::ofstream & ofs, DependencyData const& dependencyData, EnumData const& enumData); -void writeTypeFlags( std::ofstream & ofs, DependencyData const& dependencyData, FlagData const& flagData ); -void writeTypeHandle(std::ofstream & ofs, VkData const& vkData, DependencyData const& dependencyData, HandleData const& handle, std::list const& dependencies); -void writeTypeScalar( std::ofstream & ofs, DependencyData const& dependencyData ); -void writeTypeStruct( std::ofstream & ofs, VkData const& vkData, DependencyData const& dependencyData, std::map const& defaultValues ); -void writeTypeUnion( std::ofstream & ofs, VkData const& vkData, DependencyData const& dependencyData, StructData const& unionData, std::map const& defaultValues ); -void writeTypes(std::ofstream & ofs, VkData const& vkData, std::map const& defaultValues); -void writeVersionCheck(std::ofstream & ofs, std::string const& version); -void writeTypesafeCheck(std::ofstream & ofs, std::string const& typesafeCheck); - -void EnumData::addEnum(std::string const & name, std::string const& tag, bool appendTag) -{ - assert(tag.empty() || (name.find(tag) != std::string::npos)); - members.push_back(NameValue()); - members.back().name = "e" + toCamelCase(strip(name, prefix, tag)); - members.back().value = name; - if (!postfix.empty()) - { - size_t pos = members.back().name.find(postfix); - if (pos != std::string::npos) - { - members.back().name.erase(pos); - } - } - if (appendTag && !tag.empty()) - { - members.back().name += tag; - } -} - -void createDefaults( VkData const& vkData, std::map & defaultValues ) -{ - for ( std::list::const_iterator it = vkData.dependencies.begin() ; it != vkData.dependencies.end() ; ++it ) - { - assert( defaultValues.find( it->name ) == defaultValues.end() ); - switch( it->category ) - { - case DependencyData::Category::COMMAND : // commands should never be asked for defaults - break; - case DependencyData::Category::ENUM : - { - assert(vkData.enums.find(it->name) != vkData.enums.end()); - EnumData const & enumData = vkData.enums.find(it->name)->second; - if (!enumData.members.empty()) - { - defaultValues[it->name] = it->name + "::" + vkData.enums.find(it->name)->second.members.front().name; - } - else - { - defaultValues[it->name] = it->name + "()"; - } - } - break; - case DependencyData::Category::FLAGS : - case DependencyData::Category::HANDLE: - case DependencyData::Category::STRUCT: - case DependencyData::Category::UNION : // just call the default constructor for flags, structs, and structs (which are mapped to classes) - defaultValues[it->name] = it->name + "()"; - break; - case DependencyData::Category::FUNC_POINTER : // func_pointers explicitly have no default! - defaultValues[it->name]; - break; - case DependencyData::Category::REQUIRED : // all required default to "0" - case DependencyData::Category::SCALAR : // all scalars default to "0" - defaultValues[it->name] = "0"; - break; - default : - assert( false ); - break; - } - } -} - -std::string determineFunctionName(std::string const& name, CommandData const& commandData) -{ - if (commandData.handleCommand) - { - std::string strippedName = name; - std::string searchName = commandData.arguments[0].pureType; - size_t pos = name.find(searchName); - if (pos == std::string::npos) - { - assert(isupper(searchName[0])); - searchName[0] = tolower(searchName[0]); - pos = name.find(searchName); - } - if (pos != std::string::npos) - { - strippedName.erase(pos, commandData.arguments[0].pureType.length()); - } - else if ((commandData.arguments[0].pureType == "CommandBuffer") && (name.find("cmd") == 0)) - { - strippedName.erase(0, 3); - pos = 0; - } - if (pos == 0) - { - assert(isupper(strippedName[0])); - strippedName[0] = tolower(strippedName[0]); - } - return strippedName; - } - return name; -} - -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() == 1) - || ( (commandData.successCodes.size() == 2) - && (commandData.successCodes[1] == "eIncomplete") - && commandData.twoStep))))) - { - if (isVector) - { - if (commandData.arguments[returnIndex].pureType == "void") - { - returnType = "std::vector"; - } - else - { - returnType = "std::vector<" + commandData.arguments[returnIndex].pureType + ">"; - } - } - else - { - assert(commandData.arguments[returnIndex].type.back() == '*'); - assert(commandData.arguments[returnIndex].type.find("const") == std::string::npos); - returnType = commandData.arguments[returnIndex].type; - returnType.pop_back(); - } - } - else if ((commandData.returnType == "Result") && (commandData.successCodes.size() == 1)) - { - // an original return of type "Result" with less just one successCode is changed to void, errors throw an exception - returnType = "void"; - } - else - { - // the return type just stays the original return type - returnType = commandData.returnType; - } - return returnType; -} - -void enterProtect(std::ofstream &ofs, std::string const& protect) -{ - if (!protect.empty()) - { - ofs << "#ifdef " << protect << std::endl; - } -} - -std::string extractTag(std::string const& name) -{ - // the name is supposed to look like: VK__ - size_t start = name.find('_'); - assert(start != std::string::npos); - size_t end = name.find('_', start + 1); - assert(end != std::string::npos); - return name.substr(start + 1, end - start - 1); -} - -size_t findReturnIndex(CommandData const& commandData, std::map const& vectorParameters) -{ - for (size_t i = 0; i < commandData.arguments.size(); i++) - { - if ((commandData.arguments[i].type.find('*') != std::string::npos) && (commandData.arguments[i].type.find("const") == std::string::npos) && !isVectorSizeParameter(vectorParameters, i)) - { -#if !defined(NDEBUG) - for (size_t j = i + 1; j < commandData.arguments.size(); j++) - { - assert((commandData.arguments[j].type.find('*') == std::string::npos) || (commandData.arguments[j].type.find("const") != std::string::npos)); - } -#endif - return i; - } - } - return ~0; -} - -std::string findTag(std::string const& name, std::set const& tags) -{ - for (std::set::const_iterator it = tags.begin(); it != tags.end(); ++it) - { - size_t pos = name.find(*it); - if ((pos != std::string::npos) && (pos == name.length() - it->length())) - { - return *it; - } - } - return ""; -} - -size_t findTemplateIndex(CommandData const& commandData, std::map const& vectorParameters) -{ - for (size_t i = 0; i < commandData.arguments.size(); i++) - { - if ((commandData.arguments[i].name == "pData") || (commandData.arguments[i].name == "pValues")) - { - assert(vectorParameters.find(i) != vectorParameters.end()); - return i; - } - } - return ~0; -} - -std::string getEnumName(std::string const& name) // get vkcpp enum name from vk enum name -{ - return strip(name, "Vk"); -} - -std::string generateEnumNameForFlags(std::string const& name) -{ - std::string generatedName = name; - size_t pos = generatedName.rfind("Flags"); - assert(pos != std::string::npos); - generatedName.replace(pos, 5, "FlagBits"); - return generatedName; -} - -std::map getVectorParameters(CommandData const& commandData) -{ - std::map lenParameters; - for (size_t i = 0; i < commandData.arguments.size(); i++) - { - if (!commandData.arguments[i].len.empty()) - { - lenParameters.insert(std::make_pair(i, ~0)); - for (size_t j = 0; j < commandData.arguments.size(); j++) - { - if (commandData.arguments[i].len == commandData.arguments[j].name) - { - lenParameters[i] = j; - } - } - assert( (lenParameters[i] != ~0) - || (commandData.arguments[i].len == "dataSize/4") - || (commandData.arguments[i].len == "latexmath:[$dataSize \\over 4$]") - || (commandData.arguments[i].len == "null-terminated") - || (commandData.arguments[i].len == "pAllocateInfo->descriptorSetCount") - || (commandData.arguments[i].len == "pAllocateInfo->commandBufferCount")); - assert((lenParameters[i] == ~0) || (lenParameters[i] < i)); - } - } - return lenParameters; -} - -bool hasPointerArguments(CommandData const& commandData) -{ - for (size_t i = 0; i < commandData.arguments.size(); i++) - { - size_t pos = commandData.arguments[i].type.find('*'); - if ((pos != std::string::npos) && (commandData.arguments[i].type.find('*', pos + 1) == std::string::npos)) - { - return true; - } - } - return false; -} - -bool isVectorSizeParameter(std::map const& vectorParameters, size_t idx) -{ - for (std::map::const_iterator it = vectorParameters.begin(); it != vectorParameters.end(); ++it) - { - if (it->second == idx) - { - return true; - } - } - return false; -} - -void leaveProtect(std::ofstream &ofs, std::string const& protect) -{ - if (!protect.empty()) - { - ofs << "#endif /*" << protect << "*/" << std::endl; - } -} - -bool noDependencies(std::set const& dependencies, std::set & listedTypes) -{ - bool ok = true; - for ( std::set::const_iterator it = dependencies.begin() ; it != dependencies.end() && ok ; ++it ) - { - ok = ( listedTypes.find( *it ) != listedTypes.end() ); - } - return( ok ); -} - -bool readCommandParam( tinyxml2::XMLElement * element, DependencyData & typeData, std::vector & arguments ) -{ - arguments.push_back( MemberData() ); - MemberData & arg = arguments.back(); - - if (element->Attribute("len")) - { - arg.len = element->Attribute("len"); - } - - tinyxml2::XMLNode * child = element->FirstChild(); - assert( child ); - if ( child->ToText() ) - { - std::string value = trimEnd(child->Value()); - assert( (value == "const") || (value == "struct") ); - arg.type = value + " "; - child = child->NextSibling(); - assert( child ); - } - - assert( child->ToElement() ); - assert( ( strcmp( child->Value(), "type" ) == 0 ) && child->ToElement() && child->ToElement()->GetText() ); - std::string type = strip( child->ToElement()->GetText(), "Vk" ); - typeData.dependencies.insert( type ); - arg.type += type; - arg.pureType = type; - - child = child->NextSibling(); - assert( child ); - if ( child->ToText() ) - { - std::string value = trimEnd(child->Value()); - assert( ( value == "*" ) || ( value == "**" ) || ( value == "* const*" ) ); - arg.type += value; - child = child->NextSibling(); - } - - assert( child->ToElement() && ( strcmp( child->Value(), "name" ) == 0 ) ); - arg.name = child->ToElement()->GetText(); - - if ( arg.name.back() == ']' ) - { - assert( !child->NextSibling() ); - size_t pos = arg.name.find( '[' ); - assert( pos != std::string::npos ); - arg.arraySize = arg.name.substr( pos + 1, arg.name.length() - 2 - pos ); - arg.name.erase( pos ); - } - - child = child->NextSibling(); - if ( child ) - { - if ( child->ToText() ) - { - std::string value = child->Value(); - if ( value == "[" ) - { - child = child->NextSibling(); - assert( child ); - assert( child->ToElement() && ( strcmp( child->Value(), "enum" ) == 0 ) ); - arg.arraySize = child->ToElement()->GetText(); - child = child->NextSibling(); - assert( child ); - assert( child->ToText() ); - assert( strcmp( child->Value(), "]" ) == 0 ); - assert( !child->NextSibling() ); - } - else - { - assert( ( value.front() == '[' ) && ( value.back() == ']' ) ); - arg.arraySize = value.substr( 1, value.length() - 2 ); - assert( !child->NextSibling() ); - } - } - } - - arg.optional = element->Attribute("optional") && (strcmp(element->Attribute("optional"), "true") == 0); - - return element->Attribute("optional") && (strcmp(element->Attribute("optional"), "false,true") == 0); -} - -std::map::iterator readCommandProto(tinyxml2::XMLElement * element, VkData & vkData) -{ - tinyxml2::XMLElement * typeElement = element->FirstChildElement(); - assert( typeElement && ( strcmp( typeElement->Value(), "type" ) == 0 ) ); - tinyxml2::XMLElement * nameElement = typeElement->NextSiblingElement(); - assert( nameElement && ( strcmp( nameElement->Value(), "name" ) == 0 ) ); - assert( !nameElement->NextSiblingElement() ); - - std::string type = strip( typeElement->GetText(), "Vk" ); - std::string name = stripCommand( nameElement->GetText() ); - - vkData.dependencies.push_back( DependencyData( DependencyData::Category::COMMAND, name ) ); - assert( vkData.commands.find( name ) == vkData.commands.end() ); - std::map::iterator it = vkData.commands.insert( std::make_pair( name, CommandData() ) ).first; - it->second.returnType = type; - - return it; -} - -void readCommands(tinyxml2::XMLElement * element, VkData & vkData) -{ - tinyxml2::XMLElement * child = element->FirstChildElement(); - assert( child ); - do - { - assert( strcmp( child->Value(), "command" ) == 0 ); - readCommandsCommand( child, vkData ); - } while ( child = child->NextSiblingElement() ); -} - -void readCommandsCommand(tinyxml2::XMLElement * element, VkData & vkData) -{ - tinyxml2::XMLElement * child = element->FirstChildElement(); - assert( child && ( strcmp( child->Value(), "proto" ) == 0 ) ); - - std::map::iterator it = readCommandProto(child, vkData); - - if (element->Attribute("successcodes")) - { - std::string successCodes = element->Attribute("successcodes"); - size_t start = 0, end; - do - { - end = successCodes.find(',', start); - std::string code = successCodes.substr(start, end - start); - std::string tag = findTag(code, vkData.tags); - it->second.successCodes.push_back("e" + toCamelCase(strip(code, "VK_", tag)) + tag); - start = end + 1; - } while (end != std::string::npos); - } - - // HACK: the current vk.xml misses to specify successcodes on command vkCreateDebugReportCallbackEXT! - if (it->first == "createDebugReportCallbackEXT") - { - it->second.successCodes.clear(); - it->second.successCodes.push_back("eSuccess"); - } - - while ( child = child->NextSiblingElement() ) - { - std::string value = child->Value(); - if ( value == "param" ) - { - it->second.twoStep |= readCommandParam(child, vkData.dependencies.back(), it->second.arguments); - } - else - { - assert( ( value == "implicitexternsyncparams" ) || ( value == "validity" ) ); - } - } - - // HACK: the current vk.xml misses to specify on param pSparseMemoryRequirementCount on command vkGetImageSparseMemoryRequirements! - if (it->first == "getImageSparseMemoryRequirements") - { - it->second.twoStep = true; - } - - assert(!it->second.arguments.empty()); - std::map::iterator hit = vkData.handles.find(it->second.arguments[0].pureType); - if (hit != vkData.handles.end()) - { - hit->second.commands.push_back(it->first); - it->second.handleCommand = true; - DependencyData const& dep = vkData.dependencies.back(); - std::list::iterator dit = std::find_if(vkData.dependencies.begin(), vkData.dependencies.end(), [hit](DependencyData const& dd) { return dd.name == hit->first; }); - for (std::set::const_iterator depit = dep.dependencies.begin(); depit != dep.dependencies.end(); ++depit) - { - if (*depit != hit->first) - { - dit->dependencies.insert(*depit); - } - } - } -} - -void readComment(tinyxml2::XMLElement * element, std::string & header) -{ - assert(element->GetText()); - assert(header.empty()); - header = element->GetText(); - assert(header.find("\nCopyright") == 0); - - size_t pos = header.find("\n\n-----"); - assert(pos != std::string::npos); - header.erase(pos); - - for (size_t pos = header.find('\n'); pos != std::string::npos; pos = header.find('\n', pos + 1)) - { - header.replace(pos, 1, "\n// "); - } - - header += "\n\n// This header is generated from the Khronos Vulkan XML API Registry."; -} - -void readEnums( tinyxml2::XMLElement * element, VkData & vkData ) -{ - assert( element->Attribute( "name" ) ); - std::string name = getEnumName(element->Attribute("name")); - if ( name != "API Constants" ) - { - vkData.dependencies.push_back( DependencyData( DependencyData::Category::ENUM, name ) ); - std::map::iterator it = vkData.enums.insert( std::make_pair( name, EnumData() ) ).first; - std::string tag; - - if (name == "Result") - { - // special handling for VKResult, as its enums just have VK_ in common - it->second.prefix = "VK_"; - } - else - { - assert(element->Attribute("type")); - std::string type = element->Attribute("type"); - assert((type == "bitmask") || (type == "enum")); - it->second.bitmask = (type == "bitmask"); - std::string prefix, postfix; - if (it->second.bitmask) - { - size_t pos = name.find("FlagBits"); - assert(pos != std::string::npos); - it->second.prefix = "VK" + toUpperCase(name.substr(0, pos)) + "_"; - it->second.postfix = "Bit"; - } - else - { - it->second.prefix = "VK" + toUpperCase(name) + "_"; - } - - // if the enum name contains a tag remove it from the prefix to generate correct enum value names. - for (std::set::const_iterator tit = vkData.tags.begin(); tit != vkData.tags.end(); ++tit) - { - size_t pos = it->second.prefix.find(*tit); - if ((pos != std::string::npos) && (pos == it->second.prefix.length() - tit->length() - 1)) - { - it->second.prefix.erase(pos); - tag = *tit; - break; - } - } - } - - readEnumsEnum( element, it->second, tag ); - - assert( vkData.vkTypes.find( name ) == vkData.vkTypes.end() ); - vkData.vkTypes.insert( name ); - } -} - -void readEnumsEnum( tinyxml2::XMLElement * element, EnumData & enumData, std::string const& tag ) -{ - tinyxml2::XMLElement * child = element->FirstChildElement(); - do - { - if ( child->Attribute( "name" ) ) - { - enumData.addEnum(child->Attribute("name"), tag, false); - } - } while ( child = child->NextSiblingElement() ); -} - -void readExtensionRequire(tinyxml2::XMLElement * element, VkData & vkData, std::string const& protect, std::string const& tag) -{ - tinyxml2::XMLElement * child = element->FirstChildElement(); - do - { - std::string value = child->Value(); - - if ( value == "command" ) - { - assert(child->Attribute("name")); - std::string name = stripCommand(child->Attribute("name")); - std::map::iterator cit = vkData.commands.find(name); - assert(cit != vkData.commands.end()); - cit->second.protect = protect; - } - else if (value == "type") - { - assert(child->Attribute("name")); - std::string name = strip(child->Attribute("name"), "Vk"); - std::map::iterator eit = vkData.enums.find(name); - if (eit != vkData.enums.end()) - { - eit->second.protect = protect; - } - else - { - std::map::iterator fit = vkData.flags.find(name); - if (fit != vkData.flags.end()) - { - fit->second.protect = protect; - - // if the enum of this flags is auto-generated, protect it as well - std::string enumName = generateEnumNameForFlags(name); - std::map::iterator eit = vkData.enums.find(enumName); - assert(eit != vkData.enums.end()); - if (eit->second.members.empty()) - { - eit->second.protect = protect; - } - } - else - { - std::map::iterator scit = vkData.scalars.find(name); - if (scit != vkData.scalars.end()) - { - scit->second.protect = protect; - } - else - { - std::map::iterator stit = vkData.structs.find(name); - assert(stit != vkData.structs.end() && stit->second.protect.empty()); - stit->second.protect = protect; - } - } - } - } - else if ( value == "enum") - { - // TODO process enums which don't extend existing enums - if (child->Attribute("extends")) - { - assert(child->Attribute("name")); - assert(vkData.enums.find(getEnumName(child->Attribute("extends"))) != vkData.enums.end()); - assert(!!child->Attribute("bitpos") + !!child->Attribute("offset") + !!child->Attribute("value") == 1); - vkData.enums[getEnumName(child->Attribute("extends"))].addEnum(child->Attribute("name"), child->Attribute("value") ? "" : tag, true ); - } - } - else - { - assert(value=="usage"); - } - } while ( child = child->NextSiblingElement() ); -} - -void readExtensions(tinyxml2::XMLElement * element, VkData & vkData) -{ - tinyxml2::XMLElement * child = element->FirstChildElement(); - assert( child ); - do - { - assert( strcmp( child->Value(), "extension" ) == 0 ); - readExtensionsExtension( child, vkData ); - } while ( child = child->NextSiblingElement() ); -} - -void readExtensionsExtension(tinyxml2::XMLElement * element, VkData & vkData) -{ - assert( element->Attribute( "name" ) ); - std::string tag = extractTag(element->Attribute("name")); - assert(vkData.tags.find(tag) != vkData.tags.end()); - - // don't parse disabled extensions - if (strcmp(element->Attribute("supported"), "disabled") == 0) - { - return; - } - - std::string protect; - if (element->Attribute("protect")) - { - protect = element->Attribute( "protect" ); - } - - tinyxml2::XMLElement * child = element->FirstChildElement(); - assert( child && ( strcmp( child->Value(), "require" ) == 0 ) && !child->NextSiblingElement() ); - readExtensionRequire( child, vkData, protect, tag ); -} - -void readTypeBasetype( tinyxml2::XMLElement * element, std::list & dependencies ) -{ - tinyxml2::XMLElement * typeElement = element->FirstChildElement(); - assert( typeElement && ( strcmp( typeElement->Value(), "type" ) == 0 ) && typeElement->GetText() ); - std::string type = typeElement->GetText(); - assert( ( type == "uint32_t" ) || ( type == "uint64_t" ) ); - - tinyxml2::XMLElement * nameElement = typeElement->NextSiblingElement(); - assert( nameElement && ( strcmp( nameElement->Value(), "name" ) == 0 ) && nameElement->GetText() ); - std::string name = strip( nameElement->GetText(), "Vk" ); - - // skip "Flags", - if ( name != "Flags" ) - { - dependencies.push_back( DependencyData( DependencyData::Category::SCALAR, name ) ); - dependencies.back().dependencies.insert( type ); - } - else - { - assert( type == "uint32_t" ); - } -} - -void readTypeBitmask(tinyxml2::XMLElement * element, VkData & vkData) -{ - tinyxml2::XMLElement * typeElement = element->FirstChildElement(); - assert( typeElement && ( strcmp( typeElement->Value(), "type" ) == 0 ) && typeElement->GetText() && ( strcmp( typeElement->GetText(), "VkFlags" ) == 0 ) ); - std::string type = typeElement->GetText(); - - tinyxml2::XMLElement * nameElement = typeElement->NextSiblingElement(); - assert( nameElement && ( strcmp( nameElement->Value(), "name" ) == 0 ) && nameElement->GetText() ); - std::string name = strip( nameElement->GetText(), "Vk" ); - - assert( !nameElement->NextSiblingElement() ); - - std::string requires; - if (element->Attribute("requires")) - { - requires = strip(element->Attribute("requires"), "Vk"); - } - else { - // Generate FlagBits name - requires = generateEnumNameForFlags(name); - vkData.dependencies.push_back(DependencyData(DependencyData::Category::ENUM, requires)); - std::map::iterator it = vkData.enums.insert(std::make_pair(requires, EnumData())).first; - it->second.bitmask = true; - vkData.vkTypes.insert(requires); - } - - vkData.dependencies.push_back( DependencyData( DependencyData::Category::FLAGS, name ) ); - vkData.dependencies.back().dependencies.insert( requires ); - vkData.flags.insert(std::make_pair(name, FlagData())); - - assert( vkData.vkTypes.find( name ) == vkData.vkTypes.end() ); - vkData.vkTypes.insert( name ); -} - -void readTypeDefine( tinyxml2::XMLElement * element, VkData & vkData ) -{ - tinyxml2::XMLElement * child = element->FirstChildElement(); - if (child && (strcmp(child->GetText(), "VK_HEADER_VERSION") == 0)) - { - vkData.version = element->LastChild()->ToText()->Value(); - } - else if (element->Attribute("name") && strcmp(element->Attribute("name"), "VK_DEFINE_NON_DISPATCHABLE_HANDLE") == 0) - { - std::string text = element->LastChild()->ToText()->Value(); - size_t start = text.find('#'); - size_t end = text.find_first_of("\r\n", start + 1); - vkData.typesafeCheck = text.substr(start, end - start); - } -} - -void readTypeFuncpointer( tinyxml2::XMLElement * element, std::list & dependencies ) -{ - tinyxml2::XMLElement * child = element->FirstChildElement(); - assert( child && ( strcmp( child->Value(), "name" ) == 0 ) && child->GetText() ); - dependencies.push_back( DependencyData( DependencyData::Category::FUNC_POINTER, child->GetText() ) ); -} - -void readTypeHandle(tinyxml2::XMLElement * element, VkData & vkData) -{ - tinyxml2::XMLElement * typeElement = element->FirstChildElement(); - assert( typeElement && ( strcmp( typeElement->Value(), "type" ) == 0 ) && typeElement->GetText() ); -#if !defined(NDEBUG) - std::string type = typeElement->GetText(); - assert( type.find( "VK_DEFINE" ) == 0 ); -#endif - - tinyxml2::XMLElement * nameElement = typeElement->NextSiblingElement(); - assert( nameElement && ( strcmp( nameElement->Value(), "name" ) == 0 ) && nameElement->GetText() ); - std::string name = strip( nameElement->GetText(), "Vk" ); - - vkData.dependencies.push_back( DependencyData( DependencyData::Category::HANDLE, name ) ); - - assert(vkData.vkTypes.find(name) == vkData.vkTypes.end()); - vkData.vkTypes.insert(name); - assert(vkData.handles.find(name) == vkData.handles.end()); - vkData.handles[name]; // add this to the handles map -} - -void readTypeStructMember( tinyxml2::XMLElement * element, std::vector & members, std::set & dependencies ) -{ - members.push_back( MemberData() ); - MemberData & member = members.back(); - - tinyxml2::XMLNode * child = element->FirstChild(); - assert( child ); - if ( child->ToText()) - { - std::string value = trimEnd(child->Value()); - assert( (value == "const") || (value == "struct") ); - member.type = value + " "; - child = child->NextSibling(); - assert( child ); - } - - assert( child->ToElement() ); - assert( ( strcmp( child->Value(), "type" ) == 0 ) && child->ToElement() && child->ToElement()->GetText() ); - std::string type = strip( child->ToElement()->GetText(), "Vk" ); - dependencies.insert( type ); - member.type += type; - member.pureType = type; - - child = child->NextSibling(); - assert( child ); - if ( child->ToText()) - { - std::string value = trimEnd(child->Value()); - assert( ( value == "*" ) || ( value == "**" ) || ( value == "* const*" ) ); - member.type += value; - child = child->NextSibling(); - } - - assert( ( child->ToElement() && strcmp( child->Value(), "name" ) == 0 )); - member.name = child->ToElement()->GetText(); - - if ( member.name.back() == ']' ) - { - assert( !child->NextSibling() ); - size_t pos = member.name.find( '[' ); - assert( pos != std::string::npos ); - member.arraySize = member.name.substr( pos + 1, member.name.length() - 2 - pos ); - member.name.erase( pos ); - } - - child = child->NextSibling(); - if ( child ) - { - assert( member.arraySize.empty() ); - if ( child->ToText() ) - { - std::string value = child->Value(); - if ( value == "[" ) - { - child = child->NextSibling(); - assert( child ); - assert( child->ToElement() && ( strcmp( child->Value(), "enum" ) == 0 ) ); - member.arraySize = child->ToElement()->GetText(); - child = child->NextSibling(); - assert( child ); - assert( child->ToText() ); - assert( strcmp( child->Value(), "]" ) == 0 ); - assert( !child->NextSibling() ); - } - else - { - assert( ( value.front() == '[' ) && ( value.back() == ']' ) ); - member.arraySize = value.substr( 1, value.length() - 2 ); - assert( !child->NextSibling() ); - } - } - } -} - -void readTypeStruct( tinyxml2::XMLElement * element, VkData & vkData ) -{ - assert( !element->Attribute( "returnedonly" ) || ( strcmp( element->Attribute( "returnedonly" ), "true" ) == 0 ) ); - - assert( element->Attribute( "name" ) ); - std::string name = strip( element->Attribute( "name" ), "Vk" ); - - if ( name == "Rect3D" ) - { - return; - } - - vkData.dependencies.push_back( DependencyData( DependencyData::Category::STRUCT, name ) ); - - assert( vkData.structs.find( name ) == vkData.structs.end() ); - std::map::iterator it = vkData.structs.insert( std::make_pair( name, StructData() ) ).first; - it->second.returnedOnly = !!element->Attribute( "returnedonly" ); - - tinyxml2::XMLElement * child = element->FirstChildElement(); - do - { - assert( child->Value() ); - std::string value = child->Value(); - if ( value == "member" ) - { - readTypeStructMember( child, it->second.members, vkData.dependencies.back().dependencies ); - } - else - { - assert( value == "validity" ); - } - } while ( child = child->NextSiblingElement() ); - - assert( vkData.vkTypes.find( name ) == vkData.vkTypes.end() ); - vkData.vkTypes.insert( name ); -} - -void readTypeUnionMember( tinyxml2::XMLElement * element, std::vector & members, std::set & dependencies ) -{ - members.push_back( MemberData() ); - MemberData & member = members.back(); - - tinyxml2::XMLNode * child = element->FirstChild(); - assert( child ); - if ( child->ToText() ) - { - assert( ( strcmp( child->Value(), "const" ) == 0 ) || ( strcmp( child->Value(), "struct" ) == 0 ) ); - member.type = std::string( child->Value() ) + " "; - child = child->NextSibling(); - assert( child ); - } - - assert( child->ToElement() ); - assert( ( strcmp( child->Value(), "type" ) == 0 ) && child->ToElement() && child->ToElement()->GetText() ); - std::string type = strip( child->ToElement()->GetText(), "Vk" ); - dependencies.insert( type ); - member.type += type; - member.pureType = type; - - child = child->NextSibling(); - assert( child ); - if ( child->ToText() ) - { - std::string value = child->Value(); - assert( ( value == "*" ) || ( value == "**" ) || ( value == "* const*" ) ); - member.type += value; - child = child->NextSibling(); - } - - assert( child->ToElement() && ( strcmp( child->Value(), "name" ) == 0 ) ); - member.name = child->ToElement()->GetText(); - - if ( member.name.back() == ']' ) - { - assert( !child->NextSibling() ); - size_t pos = member.name.find( '[' ); - assert( pos != std::string::npos ); - member.arraySize = member.name.substr( pos + 1, member.name.length() - 2 - pos ); - member.name.erase( pos ); - } - - child = child->NextSibling(); - if ( child ) - { - if ( child->ToText() ) - { - std::string value = child->Value(); - if ( value == "[" ) - { - child = child->NextSibling(); - assert( child ); - assert( child->ToElement() && ( strcmp( child->Value(), "enum" ) == 0 ) ); - member.arraySize = child->ToElement()->GetText(); - child = child->NextSibling(); - assert( child ); - assert( child->ToText() ); - assert( strcmp( child->Value(), "]" ) == 0 ); - assert( !child->NextSibling() ); - } - else - { - assert( ( value.front() == '[' ) && ( value.back() == ']' ) ); - member.arraySize = value.substr( 1, value.length() - 2 ); - assert( !child->NextSibling() ); - } - } - } -} - -void readTypeUnion( tinyxml2::XMLElement * element, VkData & vkData ) -{ - assert( element->Attribute( "name" ) ); - std::string name = strip( element->Attribute( "name" ), "Vk" ); - - vkData.dependencies.push_back( DependencyData( DependencyData::Category::UNION, name ) ); - - assert( vkData.structs.find( name ) == vkData.structs.end() ); - std::map::iterator it = vkData.structs.insert( std::make_pair( name, StructData() ) ).first; - - tinyxml2::XMLElement * child = element->FirstChildElement(); - do - { - assert( strcmp( child->Value(), "member" ) == 0 ); - readTypeUnionMember( child, it->second.members, vkData.dependencies.back().dependencies ); - } while ( child = child->NextSiblingElement() ); - - assert( vkData.vkTypes.find( name ) == vkData.vkTypes.end() ); - vkData.vkTypes.insert( name ); -} - -void readTags(tinyxml2::XMLElement * element, std::set & tags) -{ - tags.insert("EXT"); - tags.insert("KHR"); - tinyxml2::XMLElement * child = element->FirstChildElement(); - do - { - assert(child->Attribute("name")); - tags.insert(child->Attribute("name")); - } while (child = child->NextSiblingElement()); -} - -void readTypes(tinyxml2::XMLElement * element, VkData & vkData) -{ - tinyxml2::XMLElement * child = element->FirstChildElement(); - do - { - assert( strcmp( child->Value(), "type" ) == 0 ); - std::string type = child->Value(); - assert( type == "type" ); - if ( child->Attribute( "category" ) ) - { - std::string category = child->Attribute( "category" ); - if ( category == "basetype" ) - { - readTypeBasetype( child, vkData.dependencies ); - } - else if ( category == "bitmask" ) - { - readTypeBitmask( child, vkData); - } - else if ( category == "define" ) - { - readTypeDefine( child, vkData ); - } - else if ( category == "funcpointer" ) - { - readTypeFuncpointer( child, vkData.dependencies ); - } - else if ( category == "handle" ) - { - readTypeHandle( child, vkData ); - } - else if ( category == "struct" ) - { - readTypeStruct( child, vkData ); - } - else if ( category == "union" ) - { - readTypeUnion( child, vkData ); - } - else - { - assert( ( category == "enum" ) || ( category == "include" ) ); - } - } - else - { - assert( child->Attribute( "requires" ) && child->Attribute( "name" ) ); - vkData.dependencies.push_back( DependencyData( DependencyData::Category::REQUIRED, child->Attribute( "name" ) ) ); - } - } while ( child = child->NextSiblingElement() ); -} - -void sortDependencies( std::list & dependencies ) -{ - std::set listedTypes = { "VkFlags" }; - std::list sortedDependencies; - - while ( !dependencies.empty() ) - { -#if !defined(NDEBUG) - bool ok = false; -#endif - for ( std::list::iterator it = dependencies.begin() ; it != dependencies.end() ; ++it ) - { - if ( noDependencies( it->dependencies, listedTypes ) ) - { - sortedDependencies.push_back( *it ); - listedTypes.insert( it->name ); - dependencies.erase( it ); -#if !defined(NDEBUG) - ok = true; -#endif - break; - } - } - assert( ok ); - } - - dependencies.swap(sortedDependencies); -} - -std::string reduceName(std::string const& name, bool stripTrailingS) -{ - assert(1 < name.length()); - std::string reducedName; - if ((name[0] == 'p') && (isupper(name[1]) || name[1] == 'p')) - { - reducedName = strip(name, "p"); - reducedName[0] = tolower(reducedName[0]); - } - else - { - reducedName = name; - } - - if (stripTrailingS && (reducedName.back() == 's')) - { - reducedName.pop_back(); - } - - return reducedName; -} - -std::string strip(std::string const& value, std::string const& prefix, std::string const& postfix) -{ - std::string strippedValue = value; - if (strippedValue.find(prefix) == 0) - { - strippedValue.erase(0, prefix.length()); - } - if (!postfix.empty()) - { - size_t pos = strippedValue.rfind(postfix); - assert(pos != std::string::npos); - strippedValue.erase(pos); - } - return strippedValue; -} - -std::string stripCommand(std::string const& value) -{ - std::string stripped = strip(value, "vk"); - assert(isupper(stripped[0])); - stripped[0] = tolower(stripped[0]); - return stripped; -} - -std::string toCamelCase(std::string const& value) -{ - assert(!value.empty() && (isupper(value[0]) || isdigit(value[0]))); - std::string result; - result.reserve(value.size()); - result.push_back(value[0]); - for (size_t i = 1; i < value.size(); i++) - { - if (value[i] != '_') - { - if ((value[i - 1] == '_') || isdigit(value[i-1])) - { - result.push_back(value[i]); - } - else - { - result.push_back(tolower(value[i])); - } - } - } - return result; -} - -std::string toUpperCase(std::string const& name) -{ - assert(isupper(name.front())); - std::string convertedName; - - for (size_t i = 0; i const& vkTypes, std::map const& vectorParameters, size_t returnIndex, bool firstCall, bool singular) -{ - std::map countIndices; - for (std::map::const_iterator it = vectorParameters.begin(); it != vectorParameters.end(); ++it) - { - countIndices.insert(std::make_pair(it->second, it->first)); - } - if ((vectorParameters.size() == 1) - && ((commandData.arguments[vectorParameters.begin()->first].len == "dataSize/4") || (commandData.arguments[vectorParameters.begin()->first].len == "latexmath:[$dataSize \\over 4$]"))) - { - assert(commandData.arguments[3].name == "dataSize"); - countIndices.insert(std::make_pair(3, vectorParameters.begin()->first)); - } - - assert(islower(name[0])); - ofs << "vk" << static_cast(toupper(name[0])) << name.substr(1) << "( "; - size_t i = 0; - if (commandData.handleCommand) - { - ofs << "m_" << commandData.arguments[0].name; - i++; - } - for (; i < commandData.arguments.size(); i++) - { - if (0 < i) - { - ofs << ", "; - } - std::map::const_iterator it = countIndices.find(i); - if (it != countIndices.end()) - { - if ((returnIndex == it->second) && commandData.twoStep) - { - ofs << "&" << reduceName(commandData.arguments[it->first].name); - } - else - { - if (singular) - { - if (templateIndex == it->second) - { - ofs << "static_cast<" << commandData.arguments[it->first].pureType << ">( sizeof( T ) )"; - } - else - { - ofs << "1"; - } - } - else - { - ofs << "static_cast<" << commandData.arguments[it->first].pureType << ">( " << reduceName(commandData.arguments[it->second].name) << ".size() "; - if (templateIndex == it->second) - { - ofs << "* sizeof( T ) "; - } - ofs << ")"; - } - } - } - else - { - it = vectorParameters.find(i); - if (it != vectorParameters.end()) - { - assert(commandData.arguments[it->first].type.back() == '*'); - if ((returnIndex == it->first) && commandData.twoStep && firstCall) - { - ofs << "nullptr"; - } - else - { - std::set::const_iterator vkit = vkTypes.find(commandData.arguments[it->first].pureType); - if ((vkit != vkTypes.end()) || (it->first == templateIndex)) - { - ofs << "reinterpret_cast<"; - if (commandData.arguments[it->first].type.find("const") != std::string::npos) - { - ofs << "const "; - } - if (vkit != vkTypes.end()) - { - ofs << "Vk"; - } - ofs << commandData.arguments[it->first].pureType << "*>( "; - if (singular) - { - ofs << "&"; - } - ofs << reduceName(commandData.arguments[it->first].name, singular); - if (!singular) - { - ofs << ".data()"; - } - ofs << " )"; - } - else if (commandData.arguments[it->first].pureType == "char") - { - ofs << reduceName(commandData.arguments[it->first].name); - if (commandData.arguments[it->first].optional) - { - ofs << " ? " << reduceName(commandData.arguments[it->first].name) << "->c_str() : nullptr"; - } - else - { - ofs << ".c_str()"; - } - } - else - { - if (singular) - { - ofs << "&"; - } - ofs << reduceName(commandData.arguments[it->first].name, singular); - if (!singular) - { - ofs << ".data()"; - } - } - } - } - else if (vkTypes.find(commandData.arguments[i].pureType) != vkTypes.end()) - { - if (commandData.arguments[i].type.back() == '*') - { - if (commandData.arguments[i].type.find("const") != std::string::npos) - { - ofs << "reinterpret_cast( "; - if (commandData.arguments[i].optional) - { - ofs << "static_cast( "; - } - else - { - ofs << "&"; - } - ofs << reduceName(commandData.arguments[i].name) << (commandData.arguments[i].optional ? "))" : " )"); - } - else - { - assert(!commandData.arguments[i].optional); - ofs << "reinterpret_cast( &" << reduceName(commandData.arguments[i].name) << " )"; - } - } - else - { - ofs << "static_cast( " << commandData.arguments[i].name << " )"; - } - } - else - { - if (commandData.arguments[i].type.back() == '*') - { - if (commandData.arguments[i].type.find("const") != std::string::npos) - { - assert(commandData.arguments[i].type.find("char") != std::string::npos); - ofs << reduceName(commandData.arguments[i].name); - if (commandData.arguments[i].optional) - { - ofs << " ? " << reduceName(commandData.arguments[i].name) << "->c_str() : nullptr"; - } - else - { - ofs << ".c_str()"; - } - } - else - { - assert(commandData.arguments[i].type.find("char") == std::string::npos); - ofs << "&" << reduceName(commandData.arguments[i].name); - } - } - else - { - ofs << commandData.arguments[i].name; - } - } - } - } - ofs << " )"; -} - -void writeExceptionCheck(std::ofstream & ofs, std::string const& indentation, std::string const& className, std::string const& functionName, std::vector const& successCodes) -{ - if (successCodes.size() == 1) - { - assert(successCodes.front() == "eSuccess"); - ofs << indentation << " if ( result != Result::eSuccess )" << std::endl; - } - else - { - assert(successCodes.size() == 2); - ofs << indentation << " if ( ( result != Result::" << successCodes[0] << " ) && ( result != Result::" << successCodes[1] << " ) )" << std::endl; - } - ofs << indentation << " {" << std::endl - << indentation << " throw std::system_error( result, \"vk::"; - if (!className.empty()) - { - ofs << className << "::"; - } - ofs << functionName << "\" );" << std::endl - << indentation << " }" << std::endl; -} - -void writeFunctionBody(std::ofstream & ofs, std::string const& indentation, std::string const& className, std::string const& functionName, std::string const& returnType, size_t templateIndex, DependencyData const& dependencyData, CommandData const& commandData, std::set const& vkTypes, size_t returnIndex, std::map const& vectorParameters, bool singular) -{ - ofs << indentation << "{" << std::endl; - - // add a static_assert if a type is templated and its size needs to be some multiple of the original size - if ((templateIndex != ~0) && (commandData.arguments[templateIndex].pureType != "void")) - { - ofs << indentation << " static_assert( sizeof( T ) % sizeof( " << commandData.arguments[templateIndex].pureType << " ) == 0, \"wrong size of template type T\" );" << std::endl; - } - - // add some error checks if multiple vectors need to have the same size - if (!singular && (1 < vectorParameters.size())) - { - for (std::map::const_iterator it0 = vectorParameters.begin(); it0 != vectorParameters.end(); ++it0) - { - if (it0->first != returnIndex) - { - for (std::map::const_iterator it1 = std::next(it0); it1 != vectorParameters.end(); ++it1) - { - if ((it1->first != returnIndex) && (it0->second == it1->second)) - { - ofs << indentation << " if ( " << reduceName(commandData.arguments[it0->first].name) << ".size() != " << reduceName(commandData.arguments[it1->first].name) << ".size() )" << std::endl - << indentation << " {" << std::endl - << indentation << " throw std::logic_error( \"vk::" << className << "::" << functionName << ": " << reduceName(commandData.arguments[it0->first].name) << ".size() != " << reduceName(commandData.arguments[it1->first].name) << ".size()\" );" << std::endl - << indentation << " }" << std::endl; - } - } - } - } - } - - // write the local variable to hold a returned value - if ((returnIndex != ~0) && (commandData.returnType != returnType)) - { - ofs << indentation << " " << (singular ? commandData.arguments[returnIndex].pureType : returnType) << " " << reduceName(commandData.arguments[returnIndex].name, singular); - - if (!singular) - { - std::map::const_iterator it = vectorParameters.find(returnIndex); - if (it != vectorParameters.end() && !commandData.twoStep) - { - std::string size; - if ((it->second == ~0) && !commandData.arguments[returnIndex].len.empty()) - { - size = reduceName(commandData.arguments[returnIndex].len); - size_t pos = size.find("->"); - assert(pos != std::string::npos); - size.replace(pos, 2, "."); - size += "()"; - } - else - { - for (std::map::const_iterator sit = vectorParameters.begin(); sit != vectorParameters.end(); ++sit) - { - if ((sit->first != returnIndex) && (sit->second == it->second)) - { - size = reduceName(commandData.arguments[sit->first].name) + ".size()"; - break; - } - } - } - assert(!size.empty()); - ofs << "( " << size << " )"; - } - } - ofs << ";" << std::endl; - } - - // local count variable to hold the size of the vector to fill - if (commandData.twoStep) - { - assert(returnIndex != ~0); - - std::map::const_iterator returnit = vectorParameters.find(returnIndex); - assert(returnit != vectorParameters.end() && (returnit->second != ~0)); - assert((commandData.returnType == "Result") || (commandData.returnType == "void")); - - ofs << indentation << " " << commandData.arguments[returnit->second].pureType << " " << reduceName(commandData.arguments[returnit->second].name) << ";" << std::endl; - } - - // write the function call - ofs << indentation << " "; - std::string localIndentation = " "; - if (commandData.returnType == "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( "; - } - else if (commandData.returnType != "void") - { - assert(!commandData.twoStep); - ofs << "return "; - } - writeCall(ofs, dependencyData.name, templateIndex, commandData, vkTypes, vectorParameters, returnIndex, true, singular); - if (commandData.returnType == "Result") - { - ofs << " )"; - } - ofs << ";" << std::endl; - - if (commandData.twoStep) - { - std::map::const_iterator returnit = vectorParameters.find(returnIndex); - - if (commandData.returnType == "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( "; - } - else - { - ofs << indentation << " "; - } - writeCall(ofs, dependencyData.name, templateIndex, commandData, vkTypes, vectorParameters, returnIndex, false, singular); - if (commandData.returnType == "Result") - { - ofs << " )"; - } - ofs << ";" << std::endl; - if (commandData.returnType == "Result") - { - 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 != returnType)) - { - ofs << indentation << " return " << reduceName(commandData.arguments[returnIndex].name, singular) << ";" << std::endl; - } - else if (returnType == "Result") - { - ofs << indentation << " return result;" << std::endl; - } - - ofs << indentation << "}" << std::endl; -} - -void writeFunctionHeader(std::ofstream & ofs, std::string const& indentation, std::string const& returnType, std::string const& name, CommandData const& commandData, size_t returnIndex, size_t templateIndex, std::map const& vectorParameters, bool singular) -{ - std::set skippedArguments; - for (std::map::const_iterator it = vectorParameters.begin(); it != vectorParameters.end(); ++it) - { - 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$]"))) - { - assert(commandData.arguments[3].name == "dataSize"); - skippedArguments.insert(3); - } - if ((returnIndex != ~0) && (commandData.returnType != returnType)) - { - skippedArguments.insert(returnIndex); - } - - ofs << indentation; - if ((templateIndex != ~0) && ((templateIndex != returnIndex) || (returnType == "Result"))) - { - ofs << "template " << std::endl - << indentation; - } - else if (!commandData.handleCommand) - { - ofs << "inline "; - } - ofs << ((singular && (returnIndex != ~0)) ? commandData.arguments[returnIndex].pureType : returnType) << " " << reduceName(name, singular) << "("; - if (skippedArguments.size() + (commandData.handleCommand ? 1 : 0) < commandData.arguments.size()) - { - size_t lastArgument = ~0; - for (size_t i = commandData.arguments.size() - 1; i < commandData.arguments.size(); i--) - { - if (skippedArguments.find(i) == skippedArguments.end()) - { - lastArgument = i; - break; - } - } - - ofs << " "; - bool argEncountered = false; - for (size_t i = commandData.handleCommand ? 1 : 0; i < commandData.arguments.size(); i++) - { - if (skippedArguments.find(i) == skippedArguments.end()) - { - if (argEncountered) - { - ofs << ", "; - } - - std::map::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()) - { - ofs << "[" << commandData.arguments[i].arraySize << "]"; - } - } - else - { - bool optional = commandData.arguments[i].optional && ((it == vectorParameters.end()) || (it->second == ~0)); - if (optional) - { - ofs << "Optional<"; - } - if (vectorParameters.find(i) == vectorParameters.end()) - { - 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 - { - if (templateIndex == i) - { - ofs << (singular ? "T" : "std::vector"); - } - else if (commandData.arguments[i].pureType == "char") - { - ofs << "std::string"; - } - else if (commandData.arguments[i].pureType == "void") - { - ofs << "std::vector"; - } - else if (singular) - { - ofs << commandData.arguments[i].pureType; - } - else - { - ofs << "std::vector<" << commandData.arguments[i].pureType << ">"; - } - if (commandData.arguments[i].type.find("const") != std::string::npos) - { - ofs << " const"; - } - } - if (optional) - { - ofs << "> const"; - } - ofs << " & " << reduceName(commandData.arguments[i].name, singular); - if (optional && (i == lastArgument)) - { - ofs << " = nullptr"; - } - } - argEncountered = true; - } - } - ofs << " "; - } - ofs << ")"; - if (commandData.handleCommand) - { - ofs << " const"; - } - ofs << std::endl; -} - -void writeMemberData(std::ofstream & ofs, MemberData const& memberData, std::set const& vkTypes) -{ - if ( vkTypes.find( memberData.pureType ) != vkTypes.end() ) - { - if ( memberData.type.back() == '*' ) - { - ofs << "reinterpret_cast<"; - if ( memberData.type.find( "const" ) == 0 ) - { - ofs << "const "; - } - ofs << "Vk" << memberData.pureType << '*'; - } - else - { - ofs << "static_cast( " << memberData.name << " )"; - } - else - { - ofs << memberData.name; - } -} - -void writeStructConstructor( std::ofstream & ofs, std::string const& name, std::string const& memberName, StructData const& structData, std::set const& vkTypes, std::map const& defaultValues ) -{ - // check if there is a member element with no default available - bool noDefault = false; - for (size_t i = 0; i < structData.members.size() && !noDefault; i++) - { - std::map::const_iterator it = defaultValues.find(structData.members[i].pureType); - assert(it != defaultValues.end()); - noDefault = it->second.empty(); - } - - if (!noDefault) - { - // if there's a default for all memeber, provide a default constructor - ofs << " " << name << "()" << std::endl - << " : " << name << "( "; - bool listedArgument = false; - for (size_t i = 0; i < structData.members.size(); i++) - { - if (listedArgument) - { - ofs << ", "; - } - if ((structData.members[i].name != "pNext") && (structData.members[i].name != "sType")) - { - if (structData.members[i].type.back() == '*') - { - ofs << "nullptr"; - } - else - { - std::map::const_iterator it = defaultValues.find(structData.members[i].pureType); - assert((it != defaultValues.end()) && !it->second.empty()); - - if (structData.members[i].arraySize.empty()) - { - ofs << it->second; - } - else - { - ofs << "{ " << it->second << " }"; - } - } - listedArgument = true; - } - } - ofs << " )" << std::endl - << " {}" << std::endl - << std::endl; - } - - // the constructor with all the elements as arguments - ofs << " " << name << "( "; - std::vector noDefaultArgs, defaultArgs; - bool listedArgument = false; - for (size_t i = 0; i const& " + structData.members[i].name; - } - listedArgument = true; - } - } - ofs << ")" << std::endl; - - // now the body of the constructor, copying over data from argument list into wrapped struct - ofs << " {" << std::endl; - for ( size_t i=0 ; i here for the correct name. In this case the 'generic' rule to create the enums doesn't work - if (name == "DebugReportCallbackCreateInfoEXT") - { - ofs << "VK_STRUCTURE_TYPE_DEBUG_REPORT_CREATE_INFO_EXT"; - } - else - { - ofs << "VK_STRUCTURE_TYPE" << toUpperCase(name); - } - } - else - { - writeMemberData( ofs, structData.members[i], vkTypes ); - } - } - ofs << ";" << std::endl; - } - ofs << " }" << std::endl - << std::endl; - - // now write the copy constructor - ofs << " " << name << "(Vk" << name << " const & rhs)" << std::endl - << " : " << memberName << "(rhs)" << std::endl - << " {" << std::endl - << " }" << std::endl - << std::endl; - - // now write the assignment operator - ofs << " " << name << "& operator=(Vk" << name << " const & rhs)" << std::endl - << " {" << std::endl - << " " << memberName << " = rhs;" << std::endl - << " return *this;" << std::endl - << " }" << std::endl - << std::endl; - -} - -void writeStructGetter( std::ofstream & ofs, MemberData const& memberData, std::string const& memberName, std::set const& vkTypes, bool constVersion ) -{ - ofs << " "; - if ( memberData.type.back() == '*' ) - { - if ( constVersion && ( memberData.type.find( "const" ) != 0 ) ) - { - ofs << "const "; - } - ofs << memberData.type; - } - else - { - if (constVersion) - { - ofs << "const "; - } - ofs << memberData.type << ( memberData.arraySize.empty() ? '&' : '*' ); - } - - ofs << " " << memberData.name << "()"; - if (constVersion) - { - ofs << " const"; - } - ofs << std::endl - << " {" << std::endl - << " return "; - if ( ! memberData.arraySize.empty() ) - { - ofs << "reinterpret_cast<"; - if (constVersion) - { - ofs << "const "; - } - ofs << memberData.type << "*>( " << memberName << "." << memberData.name << " )"; - } - else if ( memberData.type.back() == '*' ) - { - ofs << "reinterpret_cast<"; - if (constVersion && (memberData.type.find("const") != 0)) - { - ofs << "const "; - } - ofs << memberData.type << ">( " << memberName << "." << memberData.name << " )"; - } - else if ( vkTypes.find( memberData.pureType ) != vkTypes.end() ) - { - ofs << "reinterpret_cast<"; - if (constVersion) - { - ofs << "const "; - } - ofs << memberData.pureType << "&>( " << memberName << "." << memberData.name << " )"; - } - else - { - ofs << memberName << "." << memberData.name; - } - ofs << ";" << std::endl - << " }" << std::endl - << std::endl; -} - -void writeStructSetter( std::ofstream & ofs, std::string const& name, MemberData const& memberData, std::string const& memberName, std::set const& vkTypes ) -{ - ofs << " " << name << "& " << memberData.name << "( "; - if ( memberData.arraySize.empty() ) - { - ofs << memberData.type << " "; - } - else - { - ofs << "std::array<" << memberData.type << "," << memberData.arraySize << "> "; - } - ofs << memberData.name << " )" << std::endl - << " {" << std::endl; - if ( !memberData.arraySize.empty() ) - { - ofs << " memcpy( &" << memberName << "." << memberData.name << ", " << memberData.name << ".data(), " << memberData.arraySize << " * sizeof( " << memberData.type << " ) )"; - } - else - { - ofs << " " << memberName << "." << memberData.name << " = "; - writeMemberData( ofs, memberData, vkTypes ); - } - ofs << ";" << std::endl - << " return *this;" << std::endl - << " }" << std::endl - << std::endl; -} - -void writeTypeCommand( std::ofstream & ofs, DependencyData const& dependencyData, CommandData const& commandData, std::set const& vkTypes ) -{ - if (!commandData.handleCommand) - { - writeTypeCommandStandard(ofs, " ", dependencyData.name, dependencyData, commandData, vkTypes); - - ofs << std::endl - << "#ifdef VKCPP_ENHANCED_MODE" << std::endl; - writeTypeCommandEnhanced(ofs, " ", "", dependencyData.name, dependencyData, commandData, vkTypes); - ofs << "#endif /*VKCPP_ENHANCED_MODE*/" << std::endl - << std::endl; - } -} - -bool hasSizedVectorParameter(std::map const& vectorParameters, size_t returnIndex) -{ - for (auto it = vectorParameters.begin(); it != vectorParameters.end(); ++it) - { - if ((it->first != returnIndex) && (it->second != ~0)) - { - return true; - } - } - return false; -} - -void writeTypeCommandEnhanced(std::ofstream & ofs, std::string const& indentation, std::string const& className, std::string const& functionName, DependencyData const& dependencyData, CommandData const& commandData, std::set const& vkTypes) -{ - enterProtect(ofs, commandData.protect); - std::map vectorParameters = getVectorParameters(commandData); - size_t returnIndex = findReturnIndex(commandData, vectorParameters); - size_t templateIndex = findTemplateIndex(commandData, vectorParameters); - std::map::const_iterator returnVector = vectorParameters.find(returnIndex); - std::string returnType = determineReturnType(commandData, returnIndex, returnVector != vectorParameters.end()); - - writeFunctionHeader(ofs, indentation, returnType, functionName, commandData, returnIndex, templateIndex, vectorParameters, false); - writeFunctionBody(ofs, indentation, className, functionName, returnType, templateIndex, dependencyData, commandData, vkTypes, returnIndex, vectorParameters, false); - if (hasSizedVectorParameter(vectorParameters, returnIndex)) - { - ofs << std::endl; - writeFunctionHeader(ofs, indentation, returnType, functionName, commandData, returnIndex, templateIndex, vectorParameters, true); - writeFunctionBody(ofs, indentation, className, functionName, returnType, templateIndex, dependencyData, commandData, vkTypes, returnIndex, vectorParameters, true); - } - leaveProtect(ofs, commandData.protect); -} - -void writeTypeCommandStandard(std::ofstream & ofs, std::string const& indentation, std::string const& functionName, DependencyData const& dependencyData, CommandData const& commandData, std::set const& vkTypes) -{ - enterProtect(ofs, commandData.protect); - ofs << indentation; - if (!commandData.handleCommand) - { - ofs << "inline "; - } - ofs << commandData.returnType << " " << functionName << "( "; - bool argEncountered = false; - for (size_t i = commandData.handleCommand ? 1 : 0; i < commandData.arguments.size(); i++) - { - if (argEncountered) - { - ofs << ", "; - } - ofs << commandData.arguments[i].type << " " << commandData.arguments[i].name; - if (!commandData.arguments[i].arraySize.empty()) - { - ofs << "[" << commandData.arguments[i].arraySize << "]"; - } - argEncountered = true; - } - ofs << " )"; - if (commandData.handleCommand) - { - ofs << " const"; - } - ofs << std::endl - << indentation << "{" << std::endl - << indentation << " "; - bool castReturn = false; - if (commandData.returnType != "void") - { - ofs << "return "; - castReturn = (vkTypes.find(commandData.returnType) != vkTypes.end()); - if (castReturn) - { - ofs << "static_cast<" << commandData.returnType << ">( "; - } - } - - std::string callName(dependencyData.name); - assert(islower(callName[0])); - callName[0] = toupper(callName[0]); - - ofs << "vk" << callName << "( "; - if (commandData.handleCommand) - { - ofs << "m_" << commandData.arguments[0].name; - } - argEncountered = false; - for (size_t i = commandData.handleCommand ? 1 : 0; i < commandData.arguments.size(); i++) - { - if (0 < i) - { - ofs << ", "; - } - writeMemberData(ofs, commandData.arguments[i], vkTypes); - } - ofs << " )"; - if (castReturn) - { - ofs << " )"; - } - ofs << ";" << std::endl - << indentation << "}" << std::endl; - leaveProtect(ofs, commandData.protect); -} - -void writeTypeEnum( std::ofstream & ofs, DependencyData const& dependencyData, EnumData const& enumData ) -{ - enterProtect(ofs, enumData.protect); - ofs << " enum class " << dependencyData.name << std::endl - << " {" << std::endl; - for ( size_t i=0 ; iname << ": return \"" << itMember->name.substr(1) << "\";" << std::endl; - } - ofs << " default: return \"unknown\";" << std::endl - << " }" << std::endl; - } - ofs << " }" << std::endl; - leaveProtect(ofs, enumData.protect); - ofs << std::endl; -} - -void writeFlagsToString(std::ofstream & ofs, DependencyData const& dependencyData, EnumData const &enumData) -{ - enterProtect(ofs, enumData.protect); - std::string enumPrefix = *dependencyData.dependencies.begin() + "::"; - ofs << " inline std::string to_string(" << dependencyData.name << (enumData.members.empty() ? ")" : " value)") << std::endl - << " {" << std::endl; - if (enumData.members.empty()) - { - ofs << " return std::string();" << std::endl; - } - else - { - ofs << " if (!value) return std::string();" << std::endl - << " std::string result;" << std::endl; - - for (auto itMember = enumData.members.begin(); itMember != enumData.members.end(); ++itMember) - { - ofs << " if (value & " << enumPrefix + itMember->name << ") result += \"" << itMember->name.substr(1) << " | \";" << std::endl; - } - ofs << " return result.substr(0, result.size() - 3);" << std::endl; - } - ofs << " }" << std::endl; - leaveProtect(ofs, enumData.protect); - ofs << std::endl; -} - -void writeEnumsToString(std::ofstream & ofs, VkData const& vkData) -{ - for (auto it = vkData.dependencies.begin(); it != vkData.dependencies.end(); ++it) - { - switch (it->category) - { - case DependencyData::Category::ENUM: - assert(vkData.enums.find(it->name) != vkData.enums.end()); - writeEnumsToString(ofs, *it, vkData.enums.find(it->name)->second); - break; - case DependencyData::Category::FLAGS: - writeFlagsToString(ofs, *it, vkData.enums.find(*it->dependencies.begin())->second); - break; - } - } -} - -void writeTypeFlags( std::ofstream & ofs, DependencyData const& dependencyData, FlagData const& flagData ) -{ - assert( dependencyData.dependencies.size() == 1 ); - enterProtect(ofs, flagData.protect); - ofs << " typedef Flags<" << *dependencyData.dependencies.begin() << ", Vk" << dependencyData.name << "> " << dependencyData.name << ";" << std::endl - << std::endl - << " inline " << dependencyData.name << " operator|( " << *dependencyData.dependencies.begin() << " bit0, " << *dependencyData.dependencies.begin() << " bit1 )" << std::endl - << " {" << std::endl - << " return " << dependencyData.name << "( bit0 ) | bit1;" << std::endl - << " }" << std::endl; - leaveProtect(ofs, flagData.protect); - ofs << std::endl; -} - -void writeTypeHandle(std::ofstream & ofs, VkData const& vkData, DependencyData const& dependencyData, HandleData const& handle, std::list const& dependencies) -{ - std::string memberName = dependencyData.name; - assert(isupper(memberName[0])); - memberName[0] = tolower(memberName[0]); - - ofs << " class " << dependencyData.name << std::endl - << " {" << std::endl - << " public:" << std::endl - << " " << dependencyData.name << "()" << std::endl - << " : m_" << memberName << "(VK_NULL_HANDLE)" << std::endl - << " {}" << std::endl - << std::endl - << "#if defined(VK_CPP_TYPESAFE_CONVERSION)" << std::endl - // construct from native handle - << " " << dependencyData.name << "(Vk" << dependencyData.name << " " << memberName << ")" << std::endl - << " : m_" << memberName << "(" << memberName << ")" << std::endl - << " {}" << std::endl - << std::endl - << " " << dependencyData.name << "& operator=(Vk" << dependencyData.name << " " << memberName << ")" << std::endl - << " {" << std::endl - << " m_" << memberName << " = " << memberName << ";" << std::endl - << " return *this;" << std::endl - << " }" << std::endl - << "#endif\n" - << std::endl; - - if (!handle.commands.empty()) - { - for (size_t i = 0; i < handle.commands.size(); i++) - { - std::string commandName = handle.commands[i]; - std::map::const_iterator cit = vkData.commands.find(commandName); - assert((cit != vkData.commands.end()) && cit->second.handleCommand); - std::list::const_iterator dep = std::find_if(dependencies.begin(), dependencies.end(), [commandName](DependencyData const& dd) { return dd.name == commandName; }); - assert(dep != dependencies.end()); - std::string className = dependencyData.name; - std::string functionName = determineFunctionName(dep->name, cit->second); - - bool hasPointers = hasPointerArguments(cit->second); - if (!hasPointers) - { - ofs << "#ifndef VKCPP_ENHANCED_MODE" << std::endl; - } - writeTypeCommandStandard(ofs, " ", functionName, *dep, cit->second, vkData.vkTypes); - if (!hasPointers) - { - ofs << "#endif /*!VKCPP_ENHANCED_MODE*/" << std::endl; - } - - ofs << std::endl - << "#ifdef VKCPP_ENHANCED_MODE" << std::endl; - writeTypeCommandEnhanced(ofs, " ", className, functionName, *dep, cit->second, vkData.vkTypes); - ofs << "#endif /*VKCPP_ENHANCED_MODE*/" << std::endl; - - if (i < handle.commands.size() - 1) - { - ofs << std::endl; - } - } - ofs << std::endl; - } - ofs << "#if !defined(VK_CPP_TYPESAFE_CONVERSION)" << std::endl - << " explicit" << std::endl - << "#endif" << std::endl - << " operator Vk" << dependencyData.name << "() const" << std::endl - << " {" << std::endl - << " return m_" << memberName << ";" << std::endl - << " }" << std::endl - << std::endl - << " explicit operator bool() const" << std::endl - << " {" << std::endl - << " return m_" << memberName << " != VK_NULL_HANDLE;" << std::endl - << " }" << std::endl - << std::endl - << " bool operator!() const" << std::endl - << " {" << std::endl - << " return m_" << memberName << " == VK_NULL_HANDLE;" << std::endl - << " }" << std::endl - << std::endl - << " private:" << std::endl - << " Vk" << dependencyData.name << " m_" << memberName << ";" << std::endl - << " };" << std::endl -#if 1 - << " static_assert( sizeof( " << dependencyData.name << " ) == sizeof( Vk" << dependencyData.name << " ), \"handle and wrapper have different size!\" );" << std::endl -#endif - << std::endl; -} - -void writeTypeScalar( std::ofstream & ofs, DependencyData const& dependencyData ) -{ - assert( dependencyData.dependencies.size() == 1 ); - ofs << " typedef " << *dependencyData.dependencies.begin() << " " << dependencyData.name << ";" << std::endl; -} - -void writeTypeStruct( std::ofstream & ofs, VkData const& vkData, DependencyData const& dependencyData, std::map const& defaultValues ) -{ - std::map::const_iterator it = vkData.structs.find( dependencyData.name ); - assert( it != vkData.structs.end() ); - - enterProtect(ofs, it->second.protect); - ofs << " class " << dependencyData.name << std::endl - << " {" << std::endl - << " public:" << std::endl; - - std::string memberName( dependencyData.name ); - assert( isupper( memberName[0] ) ); - memberName[0] = tolower( memberName[0] ); - memberName = "m_" + memberName; - - // only structs that are not returnedOnly get a constructor! - if ( !it->second.returnedOnly ) - { - writeStructConstructor( ofs, dependencyData.name, memberName, it->second, vkData.vkTypes, defaultValues ); - } - - // create the getters and setters - for ( size_t i=0 ; isecond.members.size() ; i++ ) - { - writeStructGetter(ofs, it->second.members[i], memberName, vkData.vkTypes, true); - if (!it->second.returnedOnly) - { - writeStructGetter(ofs, it->second.members[i], memberName, vkData.vkTypes, false); - writeStructSetter( ofs, dependencyData.name, it->second.members[i], memberName, vkData.vkTypes ); - } - } - - // the cast-operator to the wrapped struct, and the struct itself as a private member variable - ofs << " operator const Vk" << dependencyData.name << "&() const" << std::endl - << " {" << std::endl - << " return " << memberName << ";" << std::endl - << " }" << std::endl - << std::endl - << " private:" << std::endl - << " Vk" << dependencyData.name << " " << memberName << ";" << std::endl - << " };" << std::endl; -#if 1 - ofs << " static_assert( sizeof( " << dependencyData.name << " ) == sizeof( Vk" << dependencyData.name << " ), \"struct and wrapper have different size!\" );" << std::endl; -#endif - leaveProtect(ofs, it->second.protect); - ofs << std::endl; -} - -void writeTypeUnion( std::ofstream & ofs, VkData const& vkData, DependencyData const& dependencyData, StructData const& unionData, std::map const& defaultValues ) -{ - std::ostringstream oss; - ofs << " class " << dependencyData.name << std::endl - << " {" << std::endl - << " public:" << std::endl; - - std::string memberName( dependencyData.name ); - assert( isupper( memberName[0] ) ); - memberName[0] = tolower( memberName[0] ); - memberName = "m_" + memberName; - - for ( size_t i=0 ; i& "; - } - ofs << unionData.members[i].name; - - // just the very first constructor gets default arguments - if ( i == 0 ) - { - std::map::const_iterator it = defaultValues.find( unionData.members[i].pureType ); - assert( it != defaultValues.end() ); - if ( unionData.members[i].arraySize.empty() ) - { - ofs << " = " << it->second; - } - else - { - ofs << " = { " << it->second << " }"; - } - } - ofs << " )" << std::endl - << " {" << std::endl - << " "; - if ( unionData.members[i].arraySize.empty() ) - { - ofs << memberName << "." << unionData.members[i].name << " = " << unionData.members[i].name; - } - else - { - ofs << "memcpy( &" << memberName << "." << unionData.members[i].name << ", " << unionData.members[i].name << ".data(), " << unionData.members[i].arraySize << " * sizeof( " << unionData.members[i].type << " ) )"; - } - ofs << ";" << std::endl - << " }" << std::endl - << std::endl; - - // one getter/setter per union element - writeStructGetter(ofs, unionData.members[i], memberName, vkData.vkTypes, true); - - assert(!unionData.returnedOnly); - writeStructGetter(ofs, unionData.members[i], memberName, vkData.vkTypes, false); - writeStructSetter(ofs, dependencyData.name, unionData.members[i], memberName, vkData.vkTypes); - } - ofs << " operator Vk" << dependencyData.name << " const& () const" << std::endl - << " {" << std::endl - << " return " << memberName << ";" << std::endl - << " }" << std::endl - << std::endl - << " private:" << std::endl - << " Vk" << dependencyData.name << " " << memberName << ";" << std::endl - << " };" << std::endl - << std::endl; -} - -void writeTypes(std::ofstream & ofs, VkData const& vkData, std::map const& defaultValues) -{ - for ( std::list::const_iterator it = vkData.dependencies.begin() ; it != vkData.dependencies.end() ; ++it ) - { - switch( it->category ) - { - case DependencyData::Category::COMMAND : - assert( vkData.commands.find( it->name ) != vkData.commands.end() ); - writeTypeCommand( ofs, *it, vkData.commands.find( it->name )->second, vkData.vkTypes ); - break; - case DependencyData::Category::ENUM : - assert( vkData.enums.find( it->name ) != vkData.enums.end() ); - writeTypeEnum( ofs, *it, vkData.enums.find( it->name )->second ); - break; - case DependencyData::Category::FLAGS : - assert(vkData.flags.find(it->name) != vkData.flags.end()); - writeTypeFlags( ofs, *it, vkData.flags.find( it->name)->second ); - break; - case DependencyData::Category::FUNC_POINTER : - case DependencyData::Category::REQUIRED : - // skip FUNC_POINTER and REQUIRED, they just needed to be in the dependencies list to resolve dependencies - break; - case DependencyData::Category::HANDLE : - assert(vkData.handles.find(it->name) != vkData.handles.end()); - writeTypeHandle(ofs, vkData, *it, vkData.handles.find(it->name)->second, vkData.dependencies); - break; - case DependencyData::Category::SCALAR : - writeTypeScalar( ofs, *it ); - break; - case DependencyData::Category::STRUCT : - writeTypeStruct( ofs, vkData, *it, defaultValues ); - break; - case DependencyData::Category::UNION : - assert( vkData.structs.find( it->name ) != vkData.structs.end() ); - writeTypeUnion( ofs, vkData, *it, vkData.structs.find( it->name )->second, defaultValues ); - break; - default : - assert( false ); - break; - } - } -} - -void writeVersionCheck(std::ofstream & ofs, std::string const& version) -{ - ofs << "static_assert( VK_HEADER_VERSION == " << version << " , \"Wrong VK_HEADER_VERSION!\" );" << std::endl - << std::endl; -} - -void writeTypesafeCheck(std::ofstream & ofs, std::string const& typesafeCheck) -{ - ofs << "// 32-bit vulkan is not typesafe for handles, so don't allow copy constructors on this platform by default." << std::endl - << "// To enable this feature on 32-bit platforms please define VK_CPP_TYPESAFE_CONVERSION" << std::endl - << typesafeCheck << std::endl - << "#define VK_CPP_TYPESAFE_CONVERSION 1" << std::endl - << "#endif" << std::endl - << std::endl; -} - -int main( int argc, char **argv ) -{ - tinyxml2::XMLDocument doc; - - tinyxml2::XMLError error = doc.LoadFile( argv[1] ); - if (error != tinyxml2::XML_SUCCESS) - { - std::cout << "VkGenerate: failed to load file " << argv[1] << " . Error code: " << error << std::endl; - return -1; - } - - tinyxml2::XMLElement * registryElement = doc.FirstChildElement(); - assert( strcmp( registryElement->Value(), "registry" ) == 0 ); - assert( !registryElement->NextSiblingElement() ); - - VkData vkData; - - tinyxml2::XMLElement * child = registryElement->FirstChildElement(); - do - { - assert( child->Value() ); - const std::string value = child->Value(); - if ( value == "commands" ) - { - readCommands( child, vkData ); - } - else if (value == "comment") - { - readComment(child, vkData.vulkanLicenseHeader); - } - else if ( value == "enums" ) - { - readEnums( child, vkData ); - } - else if ( value == "extensions" ) - { - readExtensions( child, vkData ); - } - else if (value == "tags") - { - readTags(child, vkData.tags); - } - else if ( value == "types" ) - { - readTypes( child, vkData ); - } - else - { - assert( ( value == "feature" ) || ( value == "vendorids" ) ); - } - } while ( child = child->NextSiblingElement() ); - - sortDependencies( vkData.dependencies ); - - std::map defaultValues; - createDefaults( vkData, defaultValues ); - - std::ofstream ofs( "vk_cpp.h" ); - ofs << nvidiaLicenseHeader << std::endl - << vkData.vulkanLicenseHeader << std::endl - << std::endl - << std::endl - << "#ifndef VK_CPP_H_" << std::endl - << "#define VK_CPP_H_" << std::endl - << std::endl - << "#include " << std::endl - << "#include " << std::endl - << "#include " << std::endl - << "#include " << std::endl - << "#include " << std::endl - << "#include " << std::endl - << "#include " << std::endl - << "#ifdef VKCPP_ENHANCED_MODE" << std::endl - << "# include " << std::endl - << "#endif /*VKCPP_ENHANCED_MODE*/" << std::endl - << std::endl; - - writeVersionCheck( ofs, vkData.version ); - writeTypesafeCheck(ofs, vkData.typesafeCheck ); - ofs << "namespace vk" << std::endl - << "{" << std::endl - << flagsHeader - << optionalClassHeader; - - // first of all, write out vk::Result and the exception handling stuff - std::list::const_iterator it = std::find_if(vkData.dependencies.begin(), vkData.dependencies.end(), [](DependencyData const& dp) { return dp.name == "Result"; }); - assert(it != vkData.dependencies.end()); - writeTypeEnum(ofs, *it, vkData.enums.find(it->name)->second); - writeEnumsToString(ofs, *it, vkData.enums.find(it->name)->second); - vkData.dependencies.erase(it); - ofs << exceptionHeader; - - ofs << "} // namespace vk" << std::endl - << std::endl - << "namespace std" << std::endl - << "{" << std::endl - << " template <>" << std::endl - << " struct is_error_code_enum : public true_type" << std::endl - << " {};" << std::endl - << "}" << std::endl - << std::endl - << "namespace vk" << std::endl - << "{" << std::endl; - - writeTypes( ofs, vkData, defaultValues ); - writeEnumsToString(ofs, vkData); - - ofs << "} // namespace vk" << std::endl - << std::endl - << "#endif" << std::endl; -} +// Copyright(c) 2015-2016, NVIDIA CORPORATION. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +const std::string nvidiaLicenseHeader( +"// Copyright(c) 2015-2016, NVIDIA CORPORATION. All rights reserved.\n" +"//\n" +"// Redistribution and use in source and binary forms, with or without\n" +"// modification, are permitted provided that the following conditions\n" +"// are met:\n" +"// * Redistributions of source code must retain the above copyright\n" +"// notice, this list of conditions and the following disclaimer.\n" +"// * Redistributions in binary form must reproduce the above copyright\n" +"// notice, this list of conditions and the following disclaimer in the\n" +"// documentation and/or other materials provided with the distribution.\n" +"// * Neither the name of NVIDIA CORPORATION nor the names of its\n" +"// contributors may be used to endorse or promote products derived\n" +"// from this software without specific prior written permission.\n" +"//\n" +"// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY\n" +"// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n" +"// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\n" +"// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR\n" +"// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,\n" +"// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,\n" +"// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n" +"// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY\n" +"// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n" +"// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n" +"// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n" +); + +const std::string exceptionHeader( + "#if defined(_MSC_VER) && (_MSC_VER == 1800)\n" + "# define noexcept _NOEXCEPT\n" + "#endif\n" + "\n" + " class ErrorCategoryImpl : public std::error_category\n" + " {\n" + " public:\n" + " virtual const char* name() const noexcept override { return \"vk::Result\"; }\n" + " virtual std::string message(int ev) const override { return to_string(static_cast(ev)); }\n" + " };\n" + "\n" + "#if defined(_MSC_VER) && (_MSC_VER == 1800)\n" + "# undef noexcept\n" + "#endif\n" + "\n" + " inline const std::error_category& errorCategory()\n" + " {\n" + " static ErrorCategoryImpl instance;\n" + " return instance;\n" + " }\n" + "\n" + " inline std::error_code make_error_code(Result e)\n" + " {\n" + " return std::error_code(static_cast(e), errorCategory());\n" + " }\n" + "\n" + " inline std::error_condition make_error_condition(Result e)\n" + " {\n" + " return std::error_condition(static_cast(e), errorCategory());\n" + " }\n" + "\n" + ); + +const std::string flagsHeader( +" template \n" +" class Flags\n" +" {\n" +" public:\n" +" Flags()\n" +" : m_mask(0)\n" +" {\n" +" }\n" +"\n" +" Flags(BitType bit)\n" +" : m_mask(static_cast(bit))\n" +" {\n" +" }\n" +"\n" +" Flags(Flags const& rhs)\n" +" : m_mask(rhs.m_mask)\n" +" {\n" +" }\n" +"\n" +" Flags & operator=(Flags const& rhs)\n" +" {\n" +" m_mask = rhs.m_mask;\n" +" return *this;\n" +" }\n" +"\n" +" Flags & operator|=(Flags const& rhs)\n" +" {\n" +" m_mask |= rhs.m_mask;\n" +" return *this;\n" +" }\n" +"\n" +" Flags & operator&=(Flags const& rhs)\n" +" {\n" +" m_mask &= rhs.m_mask;\n" +" return *this;\n" +" }\n" +"\n" +" Flags & operator^=(Flags const& rhs)\n" +" {\n" +" m_mask ^= rhs.m_mask;\n" +" return *this;\n" +" }\n" +"\n" +" Flags operator|(Flags const& rhs) const\n" +" {\n" +" Flags result(*this);\n" +" result |= rhs;\n" +" return result;\n" +" }\n" +"\n" +" Flags operator&(Flags const& rhs) const\n" +" {\n" +" Flags result(*this);\n" +" result &= rhs;\n" +" return result;\n" +" }\n" +"\n" +" Flags operator^(Flags const& rhs) const\n" +" {\n" +" Flags result(*this);\n" +" result ^= rhs;\n" +" return result;\n" +" }\n" +"\n" +" bool operator!() const\n" +" {\n" +" return !m_mask;\n" +" }\n" +"\n" +" bool operator==(Flags const& rhs) const\n" +" {\n" +" return m_mask == rhs.m_mask;\n" +" }\n" +"\n" +" bool operator!=(Flags const& rhs) const\n" +" {\n" +" return m_mask != rhs.m_mask;\n" +" }\n" +"\n" +" explicit operator bool() const\n" +" {\n" +" return !!m_mask;\n" +" }\n" +"\n" +" explicit operator MaskType() const\n" +" {\n" +" return m_mask;\n" +" }\n" +"\n" +" private:\n" +" MaskType m_mask;\n" +" };\n" +" \n" +" template \n" +" Flags operator|(BitType bit, Flags const& flags)\n" +" {\n" +" return flags | bit;\n" +" }\n" +" \n" +" template \n" +" Flags operator&(BitType bit, Flags const& flags)\n" +" {\n" +" return flags & bit;\n" +" }\n" +" \n" +" template \n" +" Flags operator^(BitType bit, Flags const& flags)\n" +" {\n" +" return flags ^ bit;\n" +" }\n" +"\n" +); + +std::string const optionalClassHeader = ( + " template \n" + " class Optional\n" + " {\n" + " public:\n" + " Optional(RefType & reference) { m_ptr = &reference; }\n" + " Optional(std::nullptr_t) { m_ptr = nullptr; }\n" + "\n" + " operator RefType*() const { return m_ptr; }\n" + " RefType const* operator->() const { return m_ptr; }\n" + " explicit operator bool() const { return !!m_ptr; }\n" + "\n" + " private:\n" + " RefType *m_ptr;\n" + " };\n" + "\n" +); + +// trim from end +std::string trimEnd(std::string const& input) +{ + std::string result = input; + result.erase(std::find_if(result.rbegin(), result.rend(), std::not1(std::ptr_fun(std::isspace))).base(), result.end()); + return result; +} + +struct MemberData +{ + std::string type; + std::string name; + std::string arraySize; + std::string pureType; + std::string len; + bool optional; +}; + +struct CommandData +{ + CommandData() + : handleCommand(false) + , twoStep(false) + {} + + std::string returnType; + std::vector arguments; + std::vector successCodes; + std::string protect; + bool handleCommand; + bool twoStep; +}; + +struct DependencyData +{ + enum class Category + { + COMMAND, + ENUM, + FLAGS, + FUNC_POINTER, + HANDLE, + REQUIRED, + SCALAR, + STRUCT, + UNION + }; + + DependencyData(Category c, std::string const& n) + : category(c) + , name(n) + {} + + Category category; + std::string name; + std::set dependencies; +}; + +struct NameValue +{ + std::string name; + std::string value; +}; + +struct EnumData +{ + bool bitmask; + std::string prefix; + std::string postfix; + std::vector members; + std::string protect; + + void addEnum(std::string const & name, std::string const& tag, bool appendTag); +}; + +struct FlagData +{ + std::string protect; +}; + +struct HandleData +{ + std::vector commands; +}; + +struct ScalarData +{ + std::string protect; +}; + +struct StructData +{ + StructData() + : returnedOnly(false) + {} + + bool returnedOnly; + std::vector members; + std::string protect; +}; + +struct VkData +{ + std::map commands; + std::list dependencies; + std::map enums; + std::map flags; + std::map handles; + std::map scalars; + std::map structs; + std::set tags; + std::string typesafeCheck; + std::string version; + std::set vkTypes; + std::string vulkanLicenseHeader; +}; + +void createDefaults( VkData const& vkData, std::map & defaultValues ); +std::string determineFunctionName(std::string const& name, CommandData const& commandData); +std::string determineReturnType(CommandData const& commandData, size_t returnIndex, bool isVector = false); +void enterProtect(std::ofstream &ofs, std::string const& protect); +std::string extractTag(std::string const& name); +size_t findReturnIndex(CommandData const& commandData, std::map const& vectorParameters); +std::string findTag(std::string const& name, std::set const& tags); +size_t findTemplateIndex(CommandData const& commandData, std::map const& vectorParameters); +std::string generateEnumNameForFlags(std::string const& name); +std::map getVectorParameters(CommandData const& commandData); +bool hasPointerArguments(CommandData const& commandData); +bool isVectorSizeParameter(std::map const& vectorParameters, size_t idx); +void leaveProtect(std::ofstream &ofs, std::string const& protect); +bool noDependencies(std::set const& dependencies, std::map & listedTypes); +bool readCommandParam( tinyxml2::XMLElement * element, DependencyData & typeData, std::vector & arguments ); +std::map::iterator readCommandProto(tinyxml2::XMLElement * element, VkData & vkData); +void readCommands( tinyxml2::XMLElement * element, VkData & vkData ); +void readCommandsCommand(tinyxml2::XMLElement * element, VkData & vkData); +void readComment(tinyxml2::XMLElement * element, std::string & header); +void readEnums( tinyxml2::XMLElement * element, VkData & vkData ); +void readEnumsEnum( tinyxml2::XMLElement * element, EnumData & enumData, std::string const& tag ); +void readExtensionRequire(tinyxml2::XMLElement * element, VkData & vkData, std::string const& protect, std::string const& tag); +void readExtensions( tinyxml2::XMLElement * element, VkData & vkData ); +void readExtensionsExtension(tinyxml2::XMLElement * element, VkData & vkData); +void readTypeBasetype( tinyxml2::XMLElement * element, std::list & dependencies ); +void readTypeBitmask( tinyxml2::XMLElement * element, VkData & vkData); +void readTypeDefine( tinyxml2::XMLElement * element, VkData & vkData ); +void readTypeFuncpointer( tinyxml2::XMLElement * element, std::list & dependencies ); +void readTypeHandle(tinyxml2::XMLElement * element, VkData & vkData); +void readTypeStruct( tinyxml2::XMLElement * element, VkData & vkData ); +void readTypeStructMember( tinyxml2::XMLElement * element, std::vector & members, std::set & dependencies ); +void readTypeUnion( tinyxml2::XMLElement * element, VkData & vkData ); +void readTypeUnionMember( tinyxml2::XMLElement * element, std::vector & members, std::set & dependencies ); +void readTags(tinyxml2::XMLElement * element, std::set & tags); +void readTypes(tinyxml2::XMLElement * element, VkData & vkData); +void sortDependencies( std::list & dependencies ); +std::string reduceName(std::string const& name, bool stripTrailingS = false); +std::string strip(std::string const& value, std::string const& prefix, std::string const& tag = std::string()); +std::string stripCommand(std::string const& value); +std::string toCamelCase(std::string const& value); +std::string toUpperCase(std::string const& name); +void writeCall(std::ofstream & ofs, std::string const& name, size_t templateIndex, CommandData const& commandData, std::set const& vkTypes, std::map const& vectorParameters, size_t returnIndex, bool firstCall, bool singular); +void writeEnumsToString(std::ofstream & ofs, VkData const& vkData); +void writeExceptionCheck(std::ofstream & ofs, std::string const& indentation, std::string const& className, std::string const& functionName, std::vector const& successCodes); +void writeFunctionBody(std::ofstream & ofs, std::string const& indentation, std::string const& className, std::string const& functionName, std::string const& returnType, size_t templateIndex, DependencyData const& dependencyData, CommandData const& commandData, std::set const& vkTypes, size_t returnIndex, std::map const& vectorParameters, bool singular); +void writeFunctionHeader(std::ofstream & ofs, std::string const& indentation, std::string const& returnType, std::string const& name, CommandData const& commandData, size_t returnIndex, size_t templateIndex, std::map const& vectorParameters, bool singular); +void writeMemberData(std::ofstream & ofs, MemberData const& memberData, std::set const& vkTypes); +void writeStructConstructor( std::ofstream & ofs, std::string const& name, std::string const& memberName, StructData const& structData, std::set const& vkTypes, std::map const& defaultValues ); +void writeStructGetter( std::ofstream & ofs, MemberData const& memberData, std::string const& memberName, std::set const& vkTypes, bool constVersion ); +void writeStructSetter( std::ofstream & ofs, std::string const& name, MemberData const& memberData, std::string const& memberName, std::set const& vkTypes, std::map const& structs ); +void writeTypeCommand( std::ofstream & ofs, DependencyData const& dependencyData, CommandData const& commandData, std::set const& vkTypes ); +void writeTypeCommandEnhanced(std::ofstream & ofs, std::string const& indentation, std::string const& className, std::string const& functionName, DependencyData const& dependencyData, CommandData const& commandData, std::set const& vkTypes); +void writeTypeCommandStandard(std::ofstream & ofs, std::string const& indentation, std::string const& functionName, DependencyData const& dependencyData, CommandData const& commandData, std::set const& vkTypes); +void writeTypeEnum(std::ofstream & ofs, DependencyData const& dependencyData, EnumData const& enumData); +void writeTypeFlags( std::ofstream & ofs, DependencyData const& dependencyData, FlagData const& flagData ); +void writeTypeHandle(std::ofstream & ofs, VkData const& vkData, DependencyData const& dependencyData, HandleData const& handle, std::list const& dependencies); +void writeTypeScalar( std::ofstream & ofs, DependencyData const& dependencyData ); +void writeTypeStruct( std::ofstream & ofs, VkData const& vkData, DependencyData const& dependencyData, std::map const& defaultValues ); +void writeTypeUnion( std::ofstream & ofs, VkData const& vkData, DependencyData const& dependencyData, StructData const& unionData, std::map const& defaultValues ); +void writeTypes(std::ofstream & ofs, VkData const& vkData, std::map const& defaultValues); +void writeVersionCheck(std::ofstream & ofs, std::string const& version); +void writeTypesafeCheck(std::ofstream & ofs, std::string const& typesafeCheck); + +void EnumData::addEnum(std::string const & name, std::string const& tag, bool appendTag) +{ + assert(tag.empty() || (name.find(tag) != std::string::npos)); + members.push_back(NameValue()); + members.back().name = "e" + toCamelCase(strip(name, prefix, tag)); + members.back().value = name; + if (!postfix.empty()) + { + size_t pos = members.back().name.find(postfix); + if (pos != std::string::npos) + { + members.back().name.erase(pos); + } + } + if (appendTag && !tag.empty()) + { + members.back().name += tag; + } +} + +void createDefaults( VkData const& vkData, std::map & defaultValues ) +{ + for ( std::list::const_iterator it = vkData.dependencies.begin() ; it != vkData.dependencies.end() ; ++it ) + { + assert( defaultValues.find( it->name ) == defaultValues.end() ); + switch( it->category ) + { + case DependencyData::Category::COMMAND : // commands should never be asked for defaults + break; + case DependencyData::Category::ENUM : + { + assert(vkData.enums.find(it->name) != vkData.enums.end()); + EnumData const & enumData = vkData.enums.find(it->name)->second; + if (!enumData.members.empty()) + { + defaultValues[it->name] = it->name + "::" + vkData.enums.find(it->name)->second.members.front().name; + } + else + { + defaultValues[it->name] = it->name + "()"; + } + } + break; + case DependencyData::Category::FLAGS : + case DependencyData::Category::HANDLE: + case DependencyData::Category::STRUCT: + case DependencyData::Category::UNION : // just call the default constructor for flags, structs, and structs (which are mapped to classes) + defaultValues[it->name] = it->name + "()"; + break; + case DependencyData::Category::FUNC_POINTER : // func_pointers explicitly have no default! + defaultValues[it->name]; + break; + case DependencyData::Category::REQUIRED : // all required default to "0" + case DependencyData::Category::SCALAR : // all scalars default to "0" + defaultValues[it->name] = "0"; + break; + default : + assert( false ); + break; + } + } +} + +std::string determineFunctionName(std::string const& name, CommandData const& commandData) +{ + if (commandData.handleCommand) + { + std::string strippedName = name; + std::string searchName = commandData.arguments[0].pureType; + size_t pos = name.find(searchName); + if (pos == std::string::npos) + { + assert(isupper(searchName[0])); + searchName[0] = tolower(searchName[0]); + pos = name.find(searchName); + } + if (pos != std::string::npos) + { + strippedName.erase(pos, commandData.arguments[0].pureType.length()); + } + else if ((commandData.arguments[0].pureType == "CommandBuffer") && (name.find("cmd") == 0)) + { + strippedName.erase(0, 3); + pos = 0; + } + if (pos == 0) + { + assert(isupper(strippedName[0])); + strippedName[0] = tolower(strippedName[0]); + } + return strippedName; + } + return name; +} + +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() == 1) + || ( (commandData.successCodes.size() == 2) + && (commandData.successCodes[1] == "eIncomplete") + && commandData.twoStep))))) + { + if (isVector) + { + if (commandData.arguments[returnIndex].pureType == "void") + { + returnType = "std::vector"; + } + else + { + returnType = "std::vector<" + commandData.arguments[returnIndex].pureType + ">"; + } + } + else + { + assert(commandData.arguments[returnIndex].type.back() == '*'); + assert(commandData.arguments[returnIndex].type.find("const") == std::string::npos); + returnType = commandData.arguments[returnIndex].type; + returnType.pop_back(); + } + } + else if ((commandData.returnType == "Result") && (commandData.successCodes.size() == 1)) + { + // an original return of type "Result" with less just one successCode is changed to void, errors throw an exception + returnType = "void"; + } + else + { + // the return type just stays the original return type + returnType = commandData.returnType; + } + return returnType; +} + +void enterProtect(std::ofstream &ofs, std::string const& protect) +{ + if (!protect.empty()) + { + ofs << "#ifdef " << protect << std::endl; + } +} + +std::string extractTag(std::string const& name) +{ + // the name is supposed to look like: VK__ + size_t start = name.find('_'); + assert(start != std::string::npos); + size_t end = name.find('_', start + 1); + assert(end != std::string::npos); + return name.substr(start + 1, end - start - 1); +} + +size_t findReturnIndex(CommandData const& commandData, std::map const& vectorParameters) +{ + for (size_t i = 0; i < commandData.arguments.size(); i++) + { + if ((commandData.arguments[i].type.find('*') != std::string::npos) && (commandData.arguments[i].type.find("const") == std::string::npos) && !isVectorSizeParameter(vectorParameters, i)) + { +#if !defined(NDEBUG) + for (size_t j = i + 1; j < commandData.arguments.size(); j++) + { + assert((commandData.arguments[j].type.find('*') == std::string::npos) || (commandData.arguments[j].type.find("const") != std::string::npos)); + } +#endif + return i; + } + } + return ~0; +} + +std::string findTag(std::string const& name, std::set const& tags) +{ + for (std::set::const_iterator it = tags.begin(); it != tags.end(); ++it) + { + size_t pos = name.find(*it); + if ((pos != std::string::npos) && (pos == name.length() - it->length())) + { + return *it; + } + } + return ""; +} + +size_t findTemplateIndex(CommandData const& commandData, std::map const& vectorParameters) +{ + for (size_t i = 0; i < commandData.arguments.size(); i++) + { + if ((commandData.arguments[i].name == "pData") || (commandData.arguments[i].name == "pValues")) + { + assert(vectorParameters.find(i) != vectorParameters.end()); + return i; + } + } + return ~0; +} + +std::string getEnumName(std::string const& name) // get vkcpp enum name from vk enum name +{ + return strip(name, "Vk"); +} + +std::string generateEnumNameForFlags(std::string const& name) +{ + std::string generatedName = name; + size_t pos = generatedName.rfind("Flags"); + assert(pos != std::string::npos); + generatedName.replace(pos, 5, "FlagBits"); + return generatedName; +} + +std::map getVectorParameters(CommandData const& commandData) +{ + std::map lenParameters; + for (size_t i = 0; i < commandData.arguments.size(); i++) + { + if (!commandData.arguments[i].len.empty()) + { + lenParameters.insert(std::make_pair(i, ~0)); + for (size_t j = 0; j < commandData.arguments.size(); j++) + { + if (commandData.arguments[i].len == commandData.arguments[j].name) + { + lenParameters[i] = j; + } + } + assert( (lenParameters[i] != ~0) + || (commandData.arguments[i].len == "dataSize/4") + || (commandData.arguments[i].len == "latexmath:[$dataSize \\over 4$]") + || (commandData.arguments[i].len == "null-terminated") + || (commandData.arguments[i].len == "pAllocateInfo->descriptorSetCount") + || (commandData.arguments[i].len == "pAllocateInfo->commandBufferCount")); + assert((lenParameters[i] == ~0) || (lenParameters[i] < i)); + } + } + return lenParameters; +} + +bool hasPointerArguments(CommandData const& commandData) +{ + for (size_t i = 0; i < commandData.arguments.size(); i++) + { + size_t pos = commandData.arguments[i].type.find('*'); + if ((pos != std::string::npos) && (commandData.arguments[i].type.find('*', pos + 1) == std::string::npos)) + { + return true; + } + } + return false; +} + +bool isVectorSizeParameter(std::map const& vectorParameters, size_t idx) +{ + for (std::map::const_iterator it = vectorParameters.begin(); it != vectorParameters.end(); ++it) + { + if (it->second == idx) + { + return true; + } + } + return false; +} + +void leaveProtect(std::ofstream &ofs, std::string const& protect) +{ + if (!protect.empty()) + { + ofs << "#endif /*" << protect << "*/" << std::endl; + } +} + +bool noDependencies(std::set const& dependencies, std::set & listedTypes) +{ + bool ok = true; + for ( std::set::const_iterator it = dependencies.begin() ; it != dependencies.end() && ok ; ++it ) + { + ok = ( listedTypes.find( *it ) != listedTypes.end() ); + } + return( ok ); +} + +bool readCommandParam( tinyxml2::XMLElement * element, DependencyData & typeData, std::vector & arguments ) +{ + arguments.push_back( MemberData() ); + MemberData & arg = arguments.back(); + + if (element->Attribute("len")) + { + arg.len = element->Attribute("len"); + } + + tinyxml2::XMLNode * child = element->FirstChild(); + assert( child ); + if ( child->ToText() ) + { + std::string value = trimEnd(child->Value()); + assert( (value == "const") || (value == "struct") ); + arg.type = value + " "; + child = child->NextSibling(); + assert( child ); + } + + assert( child->ToElement() ); + assert( ( strcmp( child->Value(), "type" ) == 0 ) && child->ToElement() && child->ToElement()->GetText() ); + std::string type = strip( child->ToElement()->GetText(), "Vk" ); + typeData.dependencies.insert( type ); + arg.type += type; + arg.pureType = type; + + child = child->NextSibling(); + assert( child ); + if ( child->ToText() ) + { + std::string value = trimEnd(child->Value()); + assert( ( value == "*" ) || ( value == "**" ) || ( value == "* const*" ) ); + arg.type += value; + child = child->NextSibling(); + } + + assert( child->ToElement() && ( strcmp( child->Value(), "name" ) == 0 ) ); + arg.name = child->ToElement()->GetText(); + + if ( arg.name.back() == ']' ) + { + assert( !child->NextSibling() ); + size_t pos = arg.name.find( '[' ); + assert( pos != std::string::npos ); + arg.arraySize = arg.name.substr( pos + 1, arg.name.length() - 2 - pos ); + arg.name.erase( pos ); + } + + child = child->NextSibling(); + if ( child ) + { + if ( child->ToText() ) + { + std::string value = child->Value(); + if ( value == "[" ) + { + child = child->NextSibling(); + assert( child ); + assert( child->ToElement() && ( strcmp( child->Value(), "enum" ) == 0 ) ); + arg.arraySize = child->ToElement()->GetText(); + child = child->NextSibling(); + assert( child ); + assert( child->ToText() ); + assert( strcmp( child->Value(), "]" ) == 0 ); + assert( !child->NextSibling() ); + } + else + { + assert( ( value.front() == '[' ) && ( value.back() == ']' ) ); + arg.arraySize = value.substr( 1, value.length() - 2 ); + assert( !child->NextSibling() ); + } + } + } + + arg.optional = element->Attribute("optional") && (strcmp(element->Attribute("optional"), "true") == 0); + + return element->Attribute("optional") && (strcmp(element->Attribute("optional"), "false,true") == 0); +} + +std::map::iterator readCommandProto(tinyxml2::XMLElement * element, VkData & vkData) +{ + tinyxml2::XMLElement * typeElement = element->FirstChildElement(); + assert( typeElement && ( strcmp( typeElement->Value(), "type" ) == 0 ) ); + tinyxml2::XMLElement * nameElement = typeElement->NextSiblingElement(); + assert( nameElement && ( strcmp( nameElement->Value(), "name" ) == 0 ) ); + assert( !nameElement->NextSiblingElement() ); + + std::string type = strip( typeElement->GetText(), "Vk" ); + std::string name = stripCommand( nameElement->GetText() ); + + vkData.dependencies.push_back( DependencyData( DependencyData::Category::COMMAND, name ) ); + assert( vkData.commands.find( name ) == vkData.commands.end() ); + std::map::iterator it = vkData.commands.insert( std::make_pair( name, CommandData() ) ).first; + it->second.returnType = type; + + return it; +} + +void readCommands(tinyxml2::XMLElement * element, VkData & vkData) +{ + tinyxml2::XMLElement * child = element->FirstChildElement(); + assert( child ); + do + { + assert( strcmp( child->Value(), "command" ) == 0 ); + readCommandsCommand( child, vkData ); + } while ( child = child->NextSiblingElement() ); +} + +void readCommandsCommand(tinyxml2::XMLElement * element, VkData & vkData) +{ + tinyxml2::XMLElement * child = element->FirstChildElement(); + assert( child && ( strcmp( child->Value(), "proto" ) == 0 ) ); + + std::map::iterator it = readCommandProto(child, vkData); + + if (element->Attribute("successcodes")) + { + std::string successCodes = element->Attribute("successcodes"); + size_t start = 0, end; + do + { + end = successCodes.find(',', start); + std::string code = successCodes.substr(start, end - start); + std::string tag = findTag(code, vkData.tags); + it->second.successCodes.push_back("e" + toCamelCase(strip(code, "VK_", tag)) + tag); + start = end + 1; + } while (end != std::string::npos); + } + + // HACK: the current vk.xml misses to specify successcodes on command vkCreateDebugReportCallbackEXT! + if (it->first == "createDebugReportCallbackEXT") + { + it->second.successCodes.clear(); + it->second.successCodes.push_back("eSuccess"); + } + + while ( child = child->NextSiblingElement() ) + { + std::string value = child->Value(); + if ( value == "param" ) + { + it->second.twoStep |= readCommandParam(child, vkData.dependencies.back(), it->second.arguments); + } + else + { + assert( ( value == "implicitexternsyncparams" ) || ( value == "validity" ) ); + } + } + + // HACK: the current vk.xml misses to specify on param pSparseMemoryRequirementCount on command vkGetImageSparseMemoryRequirements! + if (it->first == "getImageSparseMemoryRequirements") + { + it->second.twoStep = true; + } + + assert(!it->second.arguments.empty()); + std::map::iterator hit = vkData.handles.find(it->second.arguments[0].pureType); + if (hit != vkData.handles.end()) + { + hit->second.commands.push_back(it->first); + it->second.handleCommand = true; + DependencyData const& dep = vkData.dependencies.back(); + std::list::iterator dit = std::find_if(vkData.dependencies.begin(), vkData.dependencies.end(), [hit](DependencyData const& dd) { return dd.name == hit->first; }); + for (std::set::const_iterator depit = dep.dependencies.begin(); depit != dep.dependencies.end(); ++depit) + { + if (*depit != hit->first) + { + dit->dependencies.insert(*depit); + } + } + } +} + +void readComment(tinyxml2::XMLElement * element, std::string & header) +{ + assert(element->GetText()); + assert(header.empty()); + header = element->GetText(); + assert(header.find("\nCopyright") == 0); + + size_t pos = header.find("\n\n-----"); + assert(pos != std::string::npos); + header.erase(pos); + + for (size_t pos = header.find('\n'); pos != std::string::npos; pos = header.find('\n', pos + 1)) + { + header.replace(pos, 1, "\n// "); + } + + header += "\n\n// This header is generated from the Khronos Vulkan XML API Registry."; +} + +void readEnums( tinyxml2::XMLElement * element, VkData & vkData ) +{ + assert( element->Attribute( "name" ) ); + std::string name = getEnumName(element->Attribute("name")); + if ( name != "API Constants" ) + { + vkData.dependencies.push_back( DependencyData( DependencyData::Category::ENUM, name ) ); + std::map::iterator it = vkData.enums.insert( std::make_pair( name, EnumData() ) ).first; + std::string tag; + + if (name == "Result") + { + // special handling for VKResult, as its enums just have VK_ in common + it->second.prefix = "VK_"; + } + else + { + assert(element->Attribute("type")); + std::string type = element->Attribute("type"); + assert((type == "bitmask") || (type == "enum")); + it->second.bitmask = (type == "bitmask"); + std::string prefix, postfix; + if (it->second.bitmask) + { + size_t pos = name.find("FlagBits"); + assert(pos != std::string::npos); + it->second.prefix = "VK" + toUpperCase(name.substr(0, pos)) + "_"; + it->second.postfix = "Bit"; + } + else + { + it->second.prefix = "VK" + toUpperCase(name) + "_"; + } + + // if the enum name contains a tag remove it from the prefix to generate correct enum value names. + for (std::set::const_iterator tit = vkData.tags.begin(); tit != vkData.tags.end(); ++tit) + { + size_t pos = it->second.prefix.find(*tit); + if ((pos != std::string::npos) && (pos == it->second.prefix.length() - tit->length() - 1)) + { + it->second.prefix.erase(pos); + tag = *tit; + break; + } + } + } + + readEnumsEnum( element, it->second, tag ); + + assert( vkData.vkTypes.find( name ) == vkData.vkTypes.end() ); + vkData.vkTypes.insert( name ); + } +} + +void readEnumsEnum( tinyxml2::XMLElement * element, EnumData & enumData, std::string const& tag ) +{ + tinyxml2::XMLElement * child = element->FirstChildElement(); + do + { + if ( child->Attribute( "name" ) ) + { + enumData.addEnum(child->Attribute("name"), tag, false); + } + } while ( child = child->NextSiblingElement() ); +} + +void readExtensionRequire(tinyxml2::XMLElement * element, VkData & vkData, std::string const& protect, std::string const& tag) +{ + tinyxml2::XMLElement * child = element->FirstChildElement(); + do + { + std::string value = child->Value(); + + if ( value == "command" ) + { + assert(child->Attribute("name")); + std::string name = stripCommand(child->Attribute("name")); + std::map::iterator cit = vkData.commands.find(name); + assert(cit != vkData.commands.end()); + cit->second.protect = protect; + } + else if (value == "type") + { + assert(child->Attribute("name")); + std::string name = strip(child->Attribute("name"), "Vk"); + std::map::iterator eit = vkData.enums.find(name); + if (eit != vkData.enums.end()) + { + eit->second.protect = protect; + } + else + { + std::map::iterator fit = vkData.flags.find(name); + if (fit != vkData.flags.end()) + { + fit->second.protect = protect; + + // if the enum of this flags is auto-generated, protect it as well + std::string enumName = generateEnumNameForFlags(name); + std::map::iterator eit = vkData.enums.find(enumName); + assert(eit != vkData.enums.end()); + if (eit->second.members.empty()) + { + eit->second.protect = protect; + } + } + else + { + std::map::iterator scit = vkData.scalars.find(name); + if (scit != vkData.scalars.end()) + { + scit->second.protect = protect; + } + else + { + std::map::iterator stit = vkData.structs.find(name); + assert(stit != vkData.structs.end() && stit->second.protect.empty()); + stit->second.protect = protect; + } + } + } + } + else if ( value == "enum") + { + // TODO process enums which don't extend existing enums + if (child->Attribute("extends")) + { + assert(child->Attribute("name")); + assert(vkData.enums.find(getEnumName(child->Attribute("extends"))) != vkData.enums.end()); + assert(!!child->Attribute("bitpos") + !!child->Attribute("offset") + !!child->Attribute("value") == 1); + vkData.enums[getEnumName(child->Attribute("extends"))].addEnum(child->Attribute("name"), child->Attribute("value") ? "" : tag, true ); + } + } + else + { + assert(value=="usage"); + } + } while ( child = child->NextSiblingElement() ); +} + +void readExtensions(tinyxml2::XMLElement * element, VkData & vkData) +{ + tinyxml2::XMLElement * child = element->FirstChildElement(); + assert( child ); + do + { + assert( strcmp( child->Value(), "extension" ) == 0 ); + readExtensionsExtension( child, vkData ); + } while ( child = child->NextSiblingElement() ); +} + +void readExtensionsExtension(tinyxml2::XMLElement * element, VkData & vkData) +{ + assert( element->Attribute( "name" ) ); + std::string tag = extractTag(element->Attribute("name")); + assert(vkData.tags.find(tag) != vkData.tags.end()); + + // don't parse disabled extensions + if (strcmp(element->Attribute("supported"), "disabled") == 0) + { + return; + } + + std::string protect; + if (element->Attribute("protect")) + { + protect = element->Attribute( "protect" ); + } + + tinyxml2::XMLElement * child = element->FirstChildElement(); + assert( child && ( strcmp( child->Value(), "require" ) == 0 ) && !child->NextSiblingElement() ); + readExtensionRequire( child, vkData, protect, tag ); +} + +void readTypeBasetype( tinyxml2::XMLElement * element, std::list & dependencies ) +{ + tinyxml2::XMLElement * typeElement = element->FirstChildElement(); + assert( typeElement && ( strcmp( typeElement->Value(), "type" ) == 0 ) && typeElement->GetText() ); + std::string type = typeElement->GetText(); + assert( ( type == "uint32_t" ) || ( type == "uint64_t" ) ); + + tinyxml2::XMLElement * nameElement = typeElement->NextSiblingElement(); + assert( nameElement && ( strcmp( nameElement->Value(), "name" ) == 0 ) && nameElement->GetText() ); + std::string name = strip( nameElement->GetText(), "Vk" ); + + // skip "Flags", + if ( name != "Flags" ) + { + dependencies.push_back( DependencyData( DependencyData::Category::SCALAR, name ) ); + dependencies.back().dependencies.insert( type ); + } + else + { + assert( type == "uint32_t" ); + } +} + +void readTypeBitmask(tinyxml2::XMLElement * element, VkData & vkData) +{ + tinyxml2::XMLElement * typeElement = element->FirstChildElement(); + assert( typeElement && ( strcmp( typeElement->Value(), "type" ) == 0 ) && typeElement->GetText() && ( strcmp( typeElement->GetText(), "VkFlags" ) == 0 ) ); + std::string type = typeElement->GetText(); + + tinyxml2::XMLElement * nameElement = typeElement->NextSiblingElement(); + assert( nameElement && ( strcmp( nameElement->Value(), "name" ) == 0 ) && nameElement->GetText() ); + std::string name = strip( nameElement->GetText(), "Vk" ); + + assert( !nameElement->NextSiblingElement() ); + + std::string requires; + if (element->Attribute("requires")) + { + requires = strip(element->Attribute("requires"), "Vk"); + } + else { + // Generate FlagBits name + requires = generateEnumNameForFlags(name); + vkData.dependencies.push_back(DependencyData(DependencyData::Category::ENUM, requires)); + std::map::iterator it = vkData.enums.insert(std::make_pair(requires, EnumData())).first; + it->second.bitmask = true; + vkData.vkTypes.insert(requires); + } + + vkData.dependencies.push_back( DependencyData( DependencyData::Category::FLAGS, name ) ); + vkData.dependencies.back().dependencies.insert( requires ); + vkData.flags.insert(std::make_pair(name, FlagData())); + + assert( vkData.vkTypes.find( name ) == vkData.vkTypes.end() ); + vkData.vkTypes.insert( name ); +} + +void readTypeDefine( tinyxml2::XMLElement * element, VkData & vkData ) +{ + tinyxml2::XMLElement * child = element->FirstChildElement(); + if (child && (strcmp(child->GetText(), "VK_HEADER_VERSION") == 0)) + { + vkData.version = element->LastChild()->ToText()->Value(); + } + else if (element->Attribute("name") && strcmp(element->Attribute("name"), "VK_DEFINE_NON_DISPATCHABLE_HANDLE") == 0) + { + std::string text = element->LastChild()->ToText()->Value(); + size_t start = text.find('#'); + size_t end = text.find_first_of("\r\n", start + 1); + vkData.typesafeCheck = text.substr(start, end - start); + } +} + +void readTypeFuncpointer( tinyxml2::XMLElement * element, std::list & dependencies ) +{ + tinyxml2::XMLElement * child = element->FirstChildElement(); + assert( child && ( strcmp( child->Value(), "name" ) == 0 ) && child->GetText() ); + dependencies.push_back( DependencyData( DependencyData::Category::FUNC_POINTER, child->GetText() ) ); +} + +void readTypeHandle(tinyxml2::XMLElement * element, VkData & vkData) +{ + tinyxml2::XMLElement * typeElement = element->FirstChildElement(); + assert( typeElement && ( strcmp( typeElement->Value(), "type" ) == 0 ) && typeElement->GetText() ); +#if !defined(NDEBUG) + std::string type = typeElement->GetText(); + assert( type.find( "VK_DEFINE" ) == 0 ); +#endif + + tinyxml2::XMLElement * nameElement = typeElement->NextSiblingElement(); + assert( nameElement && ( strcmp( nameElement->Value(), "name" ) == 0 ) && nameElement->GetText() ); + std::string name = strip( nameElement->GetText(), "Vk" ); + + vkData.dependencies.push_back( DependencyData( DependencyData::Category::HANDLE, name ) ); + + assert(vkData.vkTypes.find(name) == vkData.vkTypes.end()); + vkData.vkTypes.insert(name); + assert(vkData.handles.find(name) == vkData.handles.end()); + vkData.handles[name]; // add this to the handles map +} + +void readTypeStructMember( tinyxml2::XMLElement * element, std::vector & members, std::set & dependencies ) +{ + members.push_back( MemberData() ); + MemberData & member = members.back(); + + tinyxml2::XMLNode * child = element->FirstChild(); + assert( child ); + if ( child->ToText()) + { + std::string value = trimEnd(child->Value()); + assert( (value == "const") || (value == "struct") ); + member.type = value + " "; + child = child->NextSibling(); + assert( child ); + } + + assert( child->ToElement() ); + assert( ( strcmp( child->Value(), "type" ) == 0 ) && child->ToElement() && child->ToElement()->GetText() ); + std::string type = strip( child->ToElement()->GetText(), "Vk" ); + dependencies.insert( type ); + member.type += type; + member.pureType = type; + + child = child->NextSibling(); + assert( child ); + if ( child->ToText()) + { + std::string value = trimEnd(child->Value()); + assert( ( value == "*" ) || ( value == "**" ) || ( value == "* const*" ) ); + member.type += value; + child = child->NextSibling(); + } + + assert( ( child->ToElement() && strcmp( child->Value(), "name" ) == 0 )); + member.name = child->ToElement()->GetText(); + + if ( member.name.back() == ']' ) + { + assert( !child->NextSibling() ); + size_t pos = member.name.find( '[' ); + assert( pos != std::string::npos ); + member.arraySize = member.name.substr( pos + 1, member.name.length() - 2 - pos ); + member.name.erase( pos ); + } + + child = child->NextSibling(); + if ( child ) + { + assert( member.arraySize.empty() ); + if ( child->ToText() ) + { + std::string value = child->Value(); + if ( value == "[" ) + { + child = child->NextSibling(); + assert( child ); + assert( child->ToElement() && ( strcmp( child->Value(), "enum" ) == 0 ) ); + member.arraySize = child->ToElement()->GetText(); + child = child->NextSibling(); + assert( child ); + assert( child->ToText() ); + assert( strcmp( child->Value(), "]" ) == 0 ); + assert( !child->NextSibling() ); + } + else + { + assert( ( value.front() == '[' ) && ( value.back() == ']' ) ); + member.arraySize = value.substr( 1, value.length() - 2 ); + assert( !child->NextSibling() ); + } + } + } +} + +void readTypeStruct( tinyxml2::XMLElement * element, VkData & vkData ) +{ + assert( !element->Attribute( "returnedonly" ) || ( strcmp( element->Attribute( "returnedonly" ), "true" ) == 0 ) ); + + assert( element->Attribute( "name" ) ); + std::string name = strip( element->Attribute( "name" ), "Vk" ); + + if ( name == "Rect3D" ) + { + return; + } + + vkData.dependencies.push_back( DependencyData( DependencyData::Category::STRUCT, name ) ); + + assert( vkData.structs.find( name ) == vkData.structs.end() ); + std::map::iterator it = vkData.structs.insert( std::make_pair( name, StructData() ) ).first; + it->second.returnedOnly = !!element->Attribute( "returnedonly" ); + + tinyxml2::XMLElement * child = element->FirstChildElement(); + do + { + assert( child->Value() ); + std::string value = child->Value(); + if ( value == "member" ) + { + readTypeStructMember( child, it->second.members, vkData.dependencies.back().dependencies ); + } + else + { + assert( value == "validity" ); + } + } while ( child = child->NextSiblingElement() ); + + assert( vkData.vkTypes.find( name ) == vkData.vkTypes.end() ); + vkData.vkTypes.insert( name ); +} + +void readTypeUnionMember( tinyxml2::XMLElement * element, std::vector & members, std::set & dependencies ) +{ + members.push_back( MemberData() ); + MemberData & member = members.back(); + + tinyxml2::XMLNode * child = element->FirstChild(); + assert( child ); + if ( child->ToText() ) + { + assert( ( strcmp( child->Value(), "const" ) == 0 ) || ( strcmp( child->Value(), "struct" ) == 0 ) ); + member.type = std::string( child->Value() ) + " "; + child = child->NextSibling(); + assert( child ); + } + + assert( child->ToElement() ); + assert( ( strcmp( child->Value(), "type" ) == 0 ) && child->ToElement() && child->ToElement()->GetText() ); + std::string type = strip( child->ToElement()->GetText(), "Vk" ); + dependencies.insert( type ); + member.type += type; + member.pureType = type; + + child = child->NextSibling(); + assert( child ); + if ( child->ToText() ) + { + std::string value = child->Value(); + assert( ( value == "*" ) || ( value == "**" ) || ( value == "* const*" ) ); + member.type += value; + child = child->NextSibling(); + } + + assert( child->ToElement() && ( strcmp( child->Value(), "name" ) == 0 ) ); + member.name = child->ToElement()->GetText(); + + if ( member.name.back() == ']' ) + { + assert( !child->NextSibling() ); + size_t pos = member.name.find( '[' ); + assert( pos != std::string::npos ); + member.arraySize = member.name.substr( pos + 1, member.name.length() - 2 - pos ); + member.name.erase( pos ); + } + + child = child->NextSibling(); + if ( child ) + { + if ( child->ToText() ) + { + std::string value = child->Value(); + if ( value == "[" ) + { + child = child->NextSibling(); + assert( child ); + assert( child->ToElement() && ( strcmp( child->Value(), "enum" ) == 0 ) ); + member.arraySize = child->ToElement()->GetText(); + child = child->NextSibling(); + assert( child ); + assert( child->ToText() ); + assert( strcmp( child->Value(), "]" ) == 0 ); + assert( !child->NextSibling() ); + } + else + { + assert( ( value.front() == '[' ) && ( value.back() == ']' ) ); + member.arraySize = value.substr( 1, value.length() - 2 ); + assert( !child->NextSibling() ); + } + } + } +} + +void readTypeUnion( tinyxml2::XMLElement * element, VkData & vkData ) +{ + assert( element->Attribute( "name" ) ); + std::string name = strip( element->Attribute( "name" ), "Vk" ); + + vkData.dependencies.push_back( DependencyData( DependencyData::Category::UNION, name ) ); + + assert( vkData.structs.find( name ) == vkData.structs.end() ); + std::map::iterator it = vkData.structs.insert( std::make_pair( name, StructData() ) ).first; + + tinyxml2::XMLElement * child = element->FirstChildElement(); + do + { + assert( strcmp( child->Value(), "member" ) == 0 ); + readTypeUnionMember( child, it->second.members, vkData.dependencies.back().dependencies ); + } while ( child = child->NextSiblingElement() ); + + assert( vkData.vkTypes.find( name ) == vkData.vkTypes.end() ); + vkData.vkTypes.insert( name ); +} + +void readTags(tinyxml2::XMLElement * element, std::set & tags) +{ + tags.insert("EXT"); + tags.insert("KHR"); + tinyxml2::XMLElement * child = element->FirstChildElement(); + do + { + assert(child->Attribute("name")); + tags.insert(child->Attribute("name")); + } while (child = child->NextSiblingElement()); +} + +void readTypes(tinyxml2::XMLElement * element, VkData & vkData) +{ + tinyxml2::XMLElement * child = element->FirstChildElement(); + do + { + assert( strcmp( child->Value(), "type" ) == 0 ); + std::string type = child->Value(); + assert( type == "type" ); + if ( child->Attribute( "category" ) ) + { + std::string category = child->Attribute( "category" ); + if ( category == "basetype" ) + { + readTypeBasetype( child, vkData.dependencies ); + } + else if ( category == "bitmask" ) + { + readTypeBitmask( child, vkData); + } + else if ( category == "define" ) + { + readTypeDefine( child, vkData ); + } + else if ( category == "funcpointer" ) + { + readTypeFuncpointer( child, vkData.dependencies ); + } + else if ( category == "handle" ) + { + readTypeHandle( child, vkData ); + } + else if ( category == "struct" ) + { + readTypeStruct( child, vkData ); + } + else if ( category == "union" ) + { + readTypeUnion( child, vkData ); + } + else + { + assert( ( category == "enum" ) || ( category == "include" ) ); + } + } + else + { + assert( child->Attribute( "requires" ) && child->Attribute( "name" ) ); + vkData.dependencies.push_back( DependencyData( DependencyData::Category::REQUIRED, child->Attribute( "name" ) ) ); + } + } while ( child = child->NextSiblingElement() ); +} + +void sortDependencies( std::list & dependencies ) +{ + std::set listedTypes = { "VkFlags" }; + std::list sortedDependencies; + + while ( !dependencies.empty() ) + { +#if !defined(NDEBUG) + bool ok = false; +#endif + for ( std::list::iterator it = dependencies.begin() ; it != dependencies.end() ; ++it ) + { + if ( noDependencies( it->dependencies, listedTypes ) ) + { + sortedDependencies.push_back( *it ); + listedTypes.insert( it->name ); + dependencies.erase( it ); +#if !defined(NDEBUG) + ok = true; +#endif + break; + } + } + assert( ok ); + } + + dependencies.swap(sortedDependencies); +} + +std::string reduceName(std::string const& name, bool stripTrailingS) +{ + assert(1 < name.length()); + std::string reducedName; + if ((name[0] == 'p') && (isupper(name[1]) || name[1] == 'p')) + { + reducedName = strip(name, "p"); + reducedName[0] = tolower(reducedName[0]); + } + else + { + reducedName = name; + } + + if (stripTrailingS && (reducedName.back() == 's')) + { + reducedName.pop_back(); + } + + return reducedName; +} + +std::string strip(std::string const& value, std::string const& prefix, std::string const& postfix) +{ + std::string strippedValue = value; + if (strippedValue.find(prefix) == 0) + { + strippedValue.erase(0, prefix.length()); + } + if (!postfix.empty()) + { + size_t pos = strippedValue.rfind(postfix); + assert(pos != std::string::npos); + strippedValue.erase(pos); + } + return strippedValue; +} + +std::string stripCommand(std::string const& value) +{ + std::string stripped = strip(value, "vk"); + assert(isupper(stripped[0])); + stripped[0] = tolower(stripped[0]); + return stripped; +} + +std::string toCamelCase(std::string const& value) +{ + assert(!value.empty() && (isupper(value[0]) || isdigit(value[0]))); + std::string result; + result.reserve(value.size()); + result.push_back(value[0]); + for (size_t i = 1; i < value.size(); i++) + { + if (value[i] != '_') + { + if ((value[i - 1] == '_') || isdigit(value[i-1])) + { + result.push_back(value[i]); + } + else + { + result.push_back(tolower(value[i])); + } + } + } + return result; +} + +std::string toUpperCase(std::string const& name) +{ + assert(isupper(name.front())); + std::string convertedName; + + for (size_t i = 0; i const& vkTypes, std::map const& vectorParameters, size_t returnIndex, bool firstCall, bool singular) +{ + std::map countIndices; + for (std::map::const_iterator it = vectorParameters.begin(); it != vectorParameters.end(); ++it) + { + countIndices.insert(std::make_pair(it->second, it->first)); + } + if ((vectorParameters.size() == 1) + && ((commandData.arguments[vectorParameters.begin()->first].len == "dataSize/4") || (commandData.arguments[vectorParameters.begin()->first].len == "latexmath:[$dataSize \\over 4$]"))) + { + assert(commandData.arguments[3].name == "dataSize"); + countIndices.insert(std::make_pair(3, vectorParameters.begin()->first)); + } + + assert(islower(name[0])); + ofs << "vk" << static_cast(toupper(name[0])) << name.substr(1) << "( "; + size_t i = 0; + if (commandData.handleCommand) + { + ofs << "m_" << commandData.arguments[0].name; + i++; + } + for (; i < commandData.arguments.size(); i++) + { + if (0 < i) + { + ofs << ", "; + } + std::map::const_iterator it = countIndices.find(i); + if (it != countIndices.end()) + { + if ((returnIndex == it->second) && commandData.twoStep) + { + ofs << "&" << reduceName(commandData.arguments[it->first].name); + } + else + { + if (singular) + { + if (templateIndex == it->second) + { + ofs << "static_cast<" << commandData.arguments[it->first].pureType << ">( sizeof( T ) )"; + } + else + { + ofs << "1"; + } + } + else + { + ofs << "static_cast<" << commandData.arguments[it->first].pureType << ">( " << reduceName(commandData.arguments[it->second].name) << ".size() "; + if (templateIndex == it->second) + { + ofs << "* sizeof( T ) "; + } + ofs << ")"; + } + } + } + else + { + it = vectorParameters.find(i); + if (it != vectorParameters.end()) + { + assert(commandData.arguments[it->first].type.back() == '*'); + if ((returnIndex == it->first) && commandData.twoStep && firstCall) + { + ofs << "nullptr"; + } + else + { + std::set::const_iterator vkit = vkTypes.find(commandData.arguments[it->first].pureType); + if ((vkit != vkTypes.end()) || (it->first == templateIndex)) + { + ofs << "reinterpret_cast<"; + if (commandData.arguments[it->first].type.find("const") != std::string::npos) + { + ofs << "const "; + } + if (vkit != vkTypes.end()) + { + ofs << "Vk"; + } + ofs << commandData.arguments[it->first].pureType << "*>( "; + if (singular) + { + ofs << "&"; + } + ofs << reduceName(commandData.arguments[it->first].name, singular); + if (!singular) + { + ofs << ".data()"; + } + ofs << " )"; + } + else if (commandData.arguments[it->first].pureType == "char") + { + ofs << reduceName(commandData.arguments[it->first].name); + if (commandData.arguments[it->first].optional) + { + ofs << " ? " << reduceName(commandData.arguments[it->first].name) << "->c_str() : nullptr"; + } + else + { + ofs << ".c_str()"; + } + } + else + { + if (singular) + { + ofs << "&"; + } + ofs << reduceName(commandData.arguments[it->first].name, singular); + if (!singular) + { + ofs << ".data()"; + } + } + } + } + else if (vkTypes.find(commandData.arguments[i].pureType) != vkTypes.end()) + { + if (commandData.arguments[i].type.back() == '*') + { + if (commandData.arguments[i].type.find("const") != std::string::npos) + { + ofs << "reinterpret_cast( "; + if (commandData.arguments[i].optional) + { + ofs << "static_cast( "; + } + else + { + ofs << "&"; + } + ofs << reduceName(commandData.arguments[i].name) << (commandData.arguments[i].optional ? "))" : " )"); + } + else + { + assert(!commandData.arguments[i].optional); + ofs << "reinterpret_cast( &" << reduceName(commandData.arguments[i].name) << " )"; + } + } + else + { + ofs << "static_cast( " << commandData.arguments[i].name << " )"; + } + } + else + { + if (commandData.arguments[i].type.back() == '*') + { + if (commandData.arguments[i].type.find("const") != std::string::npos) + { + assert(commandData.arguments[i].type.find("char") != std::string::npos); + ofs << reduceName(commandData.arguments[i].name); + if (commandData.arguments[i].optional) + { + ofs << " ? " << reduceName(commandData.arguments[i].name) << "->c_str() : nullptr"; + } + else + { + ofs << ".c_str()"; + } + } + else + { + assert(commandData.arguments[i].type.find("char") == std::string::npos); + ofs << "&" << reduceName(commandData.arguments[i].name); + } + } + else + { + ofs << commandData.arguments[i].name; + } + } + } + } + ofs << " )"; +} + +void writeExceptionCheck(std::ofstream & ofs, std::string const& indentation, std::string const& className, std::string const& functionName, std::vector const& successCodes) +{ + if (successCodes.size() == 1) + { + assert(successCodes.front() == "eSuccess"); + ofs << indentation << " if ( result != Result::eSuccess )" << std::endl; + } + else + { + assert(successCodes.size() == 2); + ofs << indentation << " if ( ( result != Result::" << successCodes[0] << " ) && ( result != Result::" << successCodes[1] << " ) )" << std::endl; + } + ofs << indentation << " {" << std::endl + << indentation << " throw std::system_error( result, \"vk::"; + if (!className.empty()) + { + ofs << className << "::"; + } + ofs << functionName << "\" );" << std::endl + << indentation << " }" << std::endl; +} + +void writeFunctionBody(std::ofstream & ofs, std::string const& indentation, std::string const& className, std::string const& functionName, std::string const& returnType, size_t templateIndex, DependencyData const& dependencyData, CommandData const& commandData, std::set const& vkTypes, size_t returnIndex, std::map const& vectorParameters, bool singular) +{ + ofs << indentation << "{" << std::endl; + + // add a static_assert if a type is templated and its size needs to be some multiple of the original size + if ((templateIndex != ~0) && (commandData.arguments[templateIndex].pureType != "void")) + { + ofs << indentation << " static_assert( sizeof( T ) % sizeof( " << commandData.arguments[templateIndex].pureType << " ) == 0, \"wrong size of template type T\" );" << std::endl; + } + + // add some error checks if multiple vectors need to have the same size + if (!singular && (1 < vectorParameters.size())) + { + for (std::map::const_iterator it0 = vectorParameters.begin(); it0 != vectorParameters.end(); ++it0) + { + if (it0->first != returnIndex) + { + for (std::map::const_iterator it1 = std::next(it0); it1 != vectorParameters.end(); ++it1) + { + if ((it1->first != returnIndex) && (it0->second == it1->second)) + { + ofs << indentation << " if ( " << reduceName(commandData.arguments[it0->first].name) << ".size() != " << reduceName(commandData.arguments[it1->first].name) << ".size() )" << std::endl + << indentation << " {" << std::endl + << indentation << " throw std::logic_error( \"vk::" << className << "::" << functionName << ": " << reduceName(commandData.arguments[it0->first].name) << ".size() != " << reduceName(commandData.arguments[it1->first].name) << ".size()\" );" << std::endl + << indentation << " }" << std::endl; + } + } + } + } + } + + // write the local variable to hold a returned value + if ((returnIndex != ~0) && (commandData.returnType != returnType)) + { + ofs << indentation << " " << (singular ? commandData.arguments[returnIndex].pureType : returnType) << " " << reduceName(commandData.arguments[returnIndex].name, singular); + + if (!singular) + { + std::map::const_iterator it = vectorParameters.find(returnIndex); + if (it != vectorParameters.end() && !commandData.twoStep) + { + std::string size; + if ((it->second == ~0) && !commandData.arguments[returnIndex].len.empty()) + { + size = reduceName(commandData.arguments[returnIndex].len); + size_t pos = size.find("->"); + assert(pos != std::string::npos); + size.replace(pos, 2, "."); + size += "()"; + } + else + { + for (std::map::const_iterator sit = vectorParameters.begin(); sit != vectorParameters.end(); ++sit) + { + if ((sit->first != returnIndex) && (sit->second == it->second)) + { + size = reduceName(commandData.arguments[sit->first].name) + ".size()"; + break; + } + } + } + assert(!size.empty()); + ofs << "( " << size << " )"; + } + } + ofs << ";" << std::endl; + } + + // local count variable to hold the size of the vector to fill + if (commandData.twoStep) + { + assert(returnIndex != ~0); + + std::map::const_iterator returnit = vectorParameters.find(returnIndex); + assert(returnit != vectorParameters.end() && (returnit->second != ~0)); + assert((commandData.returnType == "Result") || (commandData.returnType == "void")); + + ofs << indentation << " " << commandData.arguments[returnit->second].pureType << " " << reduceName(commandData.arguments[returnit->second].name) << ";" << std::endl; + } + + // write the function call + ofs << indentation << " "; + std::string localIndentation = " "; + if (commandData.returnType == "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( "; + } + else if (commandData.returnType != "void") + { + assert(!commandData.twoStep); + ofs << "return "; + } + writeCall(ofs, dependencyData.name, templateIndex, commandData, vkTypes, vectorParameters, returnIndex, true, singular); + if (commandData.returnType == "Result") + { + ofs << " )"; + } + ofs << ";" << std::endl; + + if (commandData.twoStep) + { + std::map::const_iterator returnit = vectorParameters.find(returnIndex); + + if (commandData.returnType == "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( "; + } + else + { + ofs << indentation << " "; + } + writeCall(ofs, dependencyData.name, templateIndex, commandData, vkTypes, vectorParameters, returnIndex, false, singular); + if (commandData.returnType == "Result") + { + ofs << " )"; + } + ofs << ";" << std::endl; + if (commandData.returnType == "Result") + { + 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 != returnType)) + { + ofs << indentation << " return " << reduceName(commandData.arguments[returnIndex].name, singular) << ";" << std::endl; + } + else if (returnType == "Result") + { + ofs << indentation << " return result;" << std::endl; + } + + ofs << indentation << "}" << std::endl; +} + +void writeFunctionHeader(std::ofstream & ofs, std::string const& indentation, std::string const& returnType, std::string const& name, CommandData const& commandData, size_t returnIndex, size_t templateIndex, std::map const& vectorParameters, bool singular) +{ + std::set skippedArguments; + for (std::map::const_iterator it = vectorParameters.begin(); it != vectorParameters.end(); ++it) + { + 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$]"))) + { + assert(commandData.arguments[3].name == "dataSize"); + skippedArguments.insert(3); + } + if ((returnIndex != ~0) && (commandData.returnType != returnType)) + { + skippedArguments.insert(returnIndex); + } + + ofs << indentation; + if ((templateIndex != ~0) && ((templateIndex != returnIndex) || (returnType == "Result"))) + { + ofs << "template " << std::endl + << indentation; + } + else if (!commandData.handleCommand) + { + ofs << "inline "; + } + ofs << ((singular && (returnIndex != ~0)) ? commandData.arguments[returnIndex].pureType : returnType) << " " << reduceName(name, singular) << "("; + if (skippedArguments.size() + (commandData.handleCommand ? 1 : 0) < commandData.arguments.size()) + { + size_t lastArgument = ~0; + for (size_t i = commandData.arguments.size() - 1; i < commandData.arguments.size(); i--) + { + if (skippedArguments.find(i) == skippedArguments.end()) + { + lastArgument = i; + break; + } + } + + ofs << " "; + bool argEncountered = false; + for (size_t i = commandData.handleCommand ? 1 : 0; i < commandData.arguments.size(); i++) + { + if (skippedArguments.find(i) == skippedArguments.end()) + { + if (argEncountered) + { + ofs << ", "; + } + + std::map::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()) + { + ofs << "[" << commandData.arguments[i].arraySize << "]"; + } + } + else + { + bool optional = commandData.arguments[i].optional && ((it == vectorParameters.end()) || (it->second == ~0)); + if (optional) + { + ofs << "Optional<"; + } + if (vectorParameters.find(i) == vectorParameters.end()) + { + 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 + { + if (templateIndex == i) + { + ofs << (singular ? "T" : "std::vector"); + } + else if (commandData.arguments[i].pureType == "char") + { + ofs << "std::string"; + } + else if (commandData.arguments[i].pureType == "void") + { + ofs << "std::vector"; + } + else if (singular) + { + ofs << commandData.arguments[i].pureType; + } + else + { + ofs << "std::vector<" << commandData.arguments[i].pureType << ">"; + } + if (commandData.arguments[i].type.find("const") != std::string::npos) + { + ofs << " const"; + } + } + if (optional) + { + ofs << "> const"; + } + ofs << " & " << reduceName(commandData.arguments[i].name, singular); + if (optional && (i == lastArgument)) + { + ofs << " = nullptr"; + } + } + argEncountered = true; + } + } + ofs << " "; + } + ofs << ")"; + if (commandData.handleCommand) + { + ofs << " const"; + } + ofs << std::endl; +} + +void writeMemberData(std::ofstream & ofs, MemberData const& memberData, std::set const& vkTypes) +{ + if ( vkTypes.find( memberData.pureType ) != vkTypes.end() ) + { + if ( memberData.type.back() == '*' ) + { + ofs << "reinterpret_cast<"; + if ( memberData.type.find( "const" ) == 0 ) + { + ofs << "const "; + } + ofs << "Vk" << memberData.pureType << '*'; + } + else + { + ofs << "static_cast( " << memberData.name << " )"; + } + else + { + ofs << memberData.name; + } +} + +void writeStructConstructor( std::ofstream & ofs, std::string const& name, std::string const& memberName, StructData const& structData, std::set const& vkTypes, std::map const& defaultValues ) +{ + // check if there is a member element with no default available + bool noDefault = false; + for (size_t i = 0; i < structData.members.size() && !noDefault; i++) + { + std::map::const_iterator it = defaultValues.find(structData.members[i].pureType); + assert(it != defaultValues.end()); + noDefault = it->second.empty(); + } + + if (!noDefault) + { + // if there's a default for all member, provide a default constructor + ofs << " " << name << "()" << std::endl + << " : " << name << "( "; + bool listedArgument = false; + for (size_t i = 0; i < structData.members.size(); i++) + { + if (listedArgument) + { + ofs << ", "; + } + if ((structData.members[i].name != "pNext") && (structData.members[i].name != "sType")) + { + if (structData.members[i].type.back() == '*') + { + ofs << "nullptr"; + } + else + { + std::map::const_iterator it = defaultValues.find(structData.members[i].pureType); + assert((it != defaultValues.end()) && !it->second.empty()); + + if (structData.members[i].arraySize.empty()) + { + ofs << it->second; + } + else + { + ofs << "{ " << it->second << " }"; + } + } + listedArgument = true; + } + } + ofs << " )" << std::endl + << " {}" << std::endl + << std::endl; + } + + // the constructor with all the elements as arguments + ofs << " " << name << "( "; + std::vector noDefaultArgs, defaultArgs; + bool listedArgument = false; + for (size_t i = 0; i const& " + structData.members[i].name; + } + listedArgument = true; + } + } + ofs << ")" << std::endl; + + // now the body of the constructor, copying over data from argument list into wrapped struct + ofs << " {" << std::endl; + for ( size_t i=0 ; i here for the correct name. In this case the 'generic' rule to create the enums doesn't work + if (name == "DebugReportCallbackCreateInfoEXT") + { + ofs << "VK_STRUCTURE_TYPE_DEBUG_REPORT_CREATE_INFO_EXT"; + } + else + { + ofs << "VK_STRUCTURE_TYPE" << toUpperCase(name); + } + } + else + { + writeMemberData( ofs, structData.members[i], vkTypes ); + } + } + ofs << ";" << std::endl; + } + ofs << " }" << std::endl + << std::endl; + + // now write the copy constructor + ofs << " " << name << "(Vk" << name << " const & rhs)" << std::endl + << " : " << memberName << "(rhs)" << std::endl + << " {" << std::endl + << " }" << std::endl + << std::endl; + + // now write the assignment operator + ofs << " " << name << "& operator=(Vk" << name << " const & rhs)" << std::endl + << " {" << std::endl + << " " << memberName << " = rhs;" << std::endl + << " return *this;" << std::endl + << " }" << std::endl + << std::endl; + +} + +void writeStructGetter( std::ofstream & ofs, MemberData const& memberData, std::string const& memberName, std::set const& vkTypes, bool constVersion ) +{ + ofs << " "; + if ( memberData.type.back() == '*' ) + { + if ( constVersion && ( memberData.type.find( "const" ) != 0 ) ) + { + ofs << "const "; + } + ofs << memberData.type; + } + else + { + if (constVersion) + { + ofs << "const "; + } + ofs << memberData.type << ( memberData.arraySize.empty() ? '&' : '*' ); + } + + ofs << " " << memberData.name << "()"; + if (constVersion) + { + ofs << " const"; + } + ofs << std::endl + << " {" << std::endl + << " return "; + if ( ! memberData.arraySize.empty() ) + { + ofs << "reinterpret_cast<"; + if (constVersion) + { + ofs << "const "; + } + ofs << memberData.type << "*>( " << memberName << "." << memberData.name << " )"; + } + else if ( memberData.type.back() == '*' ) + { + ofs << "reinterpret_cast<"; + if (constVersion && (memberData.type.find("const") != 0)) + { + ofs << "const "; + } + ofs << memberData.type << ">( " << memberName << "." << memberData.name << " )"; + } + else if ( vkTypes.find( memberData.pureType ) != vkTypes.end() ) + { + ofs << "reinterpret_cast<"; + if (constVersion) + { + ofs << "const "; + } + ofs << memberData.pureType << "&>( " << memberName << "." << memberData.name << " )"; + } + else + { + ofs << memberName << "." << memberData.name; + } + ofs << ";" << std::endl + << " }" << std::endl + << std::endl; +} + +void writeStructSetter( std::ofstream & ofs, std::string const& name, MemberData const& memberData, std::string const& memberName, std::set const& vkTypes ) +{ + ofs << " " << name << "& " << memberData.name << "( "; + if ( memberData.arraySize.empty() ) + { + ofs << memberData.type << " "; + } + else + { + ofs << "std::array<" << memberData.type << "," << memberData.arraySize << "> "; + } + ofs << memberData.name << " )" << std::endl + << " {" << std::endl; + if ( !memberData.arraySize.empty() ) + { + ofs << " memcpy( &" << memberName << "." << memberData.name << ", " << memberData.name << ".data(), " << memberData.arraySize << " * sizeof( " << memberData.type << " ) )"; + } + else + { + ofs << " " << memberName << "." << memberData.name << " = "; + writeMemberData( ofs, memberData, vkTypes ); + } + ofs << ";" << std::endl + << " return *this;" << std::endl + << " }" << std::endl + << std::endl; +} + +void writeTypeCommand( std::ofstream & ofs, DependencyData const& dependencyData, CommandData const& commandData, std::set const& vkTypes ) +{ + if (!commandData.handleCommand) + { + writeTypeCommandStandard(ofs, " ", dependencyData.name, dependencyData, commandData, vkTypes); + + ofs << std::endl + << "#ifndef VKCPP_DISABLE_ENHANCED_MODE" << std::endl; + writeTypeCommandEnhanced(ofs, " ", "", dependencyData.name, dependencyData, commandData, vkTypes); + ofs << "#endif /*VKCPP_DISABLE_ENHANCED_MODE*/" << std::endl + << std::endl; + } +} + +bool hasSizedVectorParameter(std::map const& vectorParameters, size_t returnIndex) +{ + for (auto it = vectorParameters.begin(); it != vectorParameters.end(); ++it) + { + if ((it->first != returnIndex) && (it->second != ~0)) + { + return true; + } + } + return false; +} + +void writeTypeCommandEnhanced(std::ofstream & ofs, std::string const& indentation, std::string const& className, std::string const& functionName, DependencyData const& dependencyData, CommandData const& commandData, std::set const& vkTypes) +{ + enterProtect(ofs, commandData.protect); + std::map vectorParameters = getVectorParameters(commandData); + size_t returnIndex = findReturnIndex(commandData, vectorParameters); + size_t templateIndex = findTemplateIndex(commandData, vectorParameters); + std::map::const_iterator returnVector = vectorParameters.find(returnIndex); + std::string returnType = determineReturnType(commandData, returnIndex, returnVector != vectorParameters.end()); + + writeFunctionHeader(ofs, indentation, returnType, functionName, commandData, returnIndex, templateIndex, vectorParameters, false); + writeFunctionBody(ofs, indentation, className, functionName, returnType, templateIndex, dependencyData, commandData, vkTypes, returnIndex, vectorParameters, false); + if (hasSizedVectorParameter(vectorParameters, returnIndex)) + { + ofs << std::endl; + writeFunctionHeader(ofs, indentation, returnType, functionName, commandData, returnIndex, templateIndex, vectorParameters, true); + writeFunctionBody(ofs, indentation, className, functionName, returnType, templateIndex, dependencyData, commandData, vkTypes, returnIndex, vectorParameters, true); + } + leaveProtect(ofs, commandData.protect); +} + +void writeTypeCommandStandard(std::ofstream & ofs, std::string const& indentation, std::string const& functionName, DependencyData const& dependencyData, CommandData const& commandData, std::set const& vkTypes) +{ + enterProtect(ofs, commandData.protect); + ofs << indentation; + if (!commandData.handleCommand) + { + ofs << "inline "; + } + ofs << commandData.returnType << " " << functionName << "( "; + bool argEncountered = false; + for (size_t i = commandData.handleCommand ? 1 : 0; i < commandData.arguments.size(); i++) + { + if (argEncountered) + { + ofs << ", "; + } + ofs << commandData.arguments[i].type << " " << commandData.arguments[i].name; + if (!commandData.arguments[i].arraySize.empty()) + { + ofs << "[" << commandData.arguments[i].arraySize << "]"; + } + argEncountered = true; + } + ofs << " )"; + if (commandData.handleCommand) + { + ofs << " const"; + } + ofs << std::endl + << indentation << "{" << std::endl + << indentation << " "; + bool castReturn = false; + if (commandData.returnType != "void") + { + ofs << "return "; + castReturn = (vkTypes.find(commandData.returnType) != vkTypes.end()); + if (castReturn) + { + ofs << "static_cast<" << commandData.returnType << ">( "; + } + } + + std::string callName(dependencyData.name); + assert(islower(callName[0])); + callName[0] = toupper(callName[0]); + + ofs << "vk" << callName << "( "; + if (commandData.handleCommand) + { + ofs << "m_" << commandData.arguments[0].name; + } + argEncountered = false; + for (size_t i = commandData.handleCommand ? 1 : 0; i < commandData.arguments.size(); i++) + { + if (0 < i) + { + ofs << ", "; + } + writeMemberData(ofs, commandData.arguments[i], vkTypes); + } + ofs << " )"; + if (castReturn) + { + ofs << " )"; + } + ofs << ";" << std::endl + << indentation << "}" << std::endl; + leaveProtect(ofs, commandData.protect); +} + +void writeTypeEnum( std::ofstream & ofs, DependencyData const& dependencyData, EnumData const& enumData ) +{ + enterProtect(ofs, enumData.protect); + ofs << " enum class " << dependencyData.name << std::endl + << " {" << std::endl; + for ( size_t i=0 ; iname << ": return \"" << itMember->name.substr(1) << "\";" << std::endl; + } + ofs << " default: return \"unknown\";" << std::endl + << " }" << std::endl; + } + ofs << " }" << std::endl; + leaveProtect(ofs, enumData.protect); + ofs << std::endl; +} + +void writeFlagsToString(std::ofstream & ofs, DependencyData const& dependencyData, EnumData const &enumData) +{ + enterProtect(ofs, enumData.protect); + std::string enumPrefix = *dependencyData.dependencies.begin() + "::"; + ofs << " inline std::string to_string(" << dependencyData.name << (enumData.members.empty() ? ")" : " value)") << std::endl + << " {" << std::endl; + if (enumData.members.empty()) + { + ofs << " return std::string();" << std::endl; + } + else + { + ofs << " if (!value) return std::string();" << std::endl + << " std::string result;" << std::endl; + + for (auto itMember = enumData.members.begin(); itMember != enumData.members.end(); ++itMember) + { + ofs << " if (value & " << enumPrefix + itMember->name << ") result += \"" << itMember->name.substr(1) << " | \";" << std::endl; + } + ofs << " return result.substr(0, result.size() - 3);" << std::endl; + } + ofs << " }" << std::endl; + leaveProtect(ofs, enumData.protect); + ofs << std::endl; +} + +void writeEnumsToString(std::ofstream & ofs, VkData const& vkData) +{ + for (auto it = vkData.dependencies.begin(); it != vkData.dependencies.end(); ++it) + { + switch (it->category) + { + case DependencyData::Category::ENUM: + assert(vkData.enums.find(it->name) != vkData.enums.end()); + writeEnumsToString(ofs, *it, vkData.enums.find(it->name)->second); + break; + case DependencyData::Category::FLAGS: + writeFlagsToString(ofs, *it, vkData.enums.find(*it->dependencies.begin())->second); + break; + } + } +} + +void writeTypeFlags( std::ofstream & ofs, DependencyData const& dependencyData, FlagData const& flagData ) +{ + assert( dependencyData.dependencies.size() == 1 ); + enterProtect(ofs, flagData.protect); + ofs << " typedef Flags<" << *dependencyData.dependencies.begin() << ", Vk" << dependencyData.name << "> " << dependencyData.name << ";" << std::endl + << std::endl + << " inline " << dependencyData.name << " operator|( " << *dependencyData.dependencies.begin() << " bit0, " << *dependencyData.dependencies.begin() << " bit1 )" << std::endl + << " {" << std::endl + << " return " << dependencyData.name << "( bit0 ) | bit1;" << std::endl + << " }" << std::endl; + leaveProtect(ofs, flagData.protect); + ofs << std::endl; +} + +void writeTypeHandle(std::ofstream & ofs, VkData const& vkData, DependencyData const& dependencyData, HandleData const& handle, std::list const& dependencies) +{ + std::string memberName = dependencyData.name; + assert(isupper(memberName[0])); + memberName[0] = tolower(memberName[0]); + + ofs << " class " << dependencyData.name << std::endl + << " {" << std::endl + << " public:" << std::endl + << " " << dependencyData.name << "()" << std::endl + << " : m_" << memberName << "(VK_NULL_HANDLE)" << std::endl + << " {}" << std::endl + << std::endl + << "#if defined(VK_CPP_TYPESAFE_CONVERSION)" << std::endl + // construct from native handle + << " " << dependencyData.name << "(Vk" << dependencyData.name << " " << memberName << ")" << std::endl + << " : m_" << memberName << "(" << memberName << ")" << std::endl + << " {}" << std::endl + << std::endl + << " " << dependencyData.name << "& operator=(Vk" << dependencyData.name << " " << memberName << ")" << std::endl + << " {" << std::endl + << " m_" << memberName << " = " << memberName << ";" << std::endl + << " return *this;" << std::endl + << " }" << std::endl + << "#endif\n" + << std::endl; + + if (!handle.commands.empty()) + { + for (size_t i = 0; i < handle.commands.size(); i++) + { + std::string commandName = handle.commands[i]; + std::map::const_iterator cit = vkData.commands.find(commandName); + assert((cit != vkData.commands.end()) && cit->second.handleCommand); + std::list::const_iterator dep = std::find_if(dependencies.begin(), dependencies.end(), [commandName](DependencyData const& dd) { return dd.name == commandName; }); + assert(dep != dependencies.end()); + std::string className = dependencyData.name; + std::string functionName = determineFunctionName(dep->name, cit->second); + + bool hasPointers = hasPointerArguments(cit->second); + if (!hasPointers) + { + ofs << "#ifdef VKCPP_DISABLE_ENHANCED_MODE" << std::endl; + } + writeTypeCommandStandard(ofs, " ", functionName, *dep, cit->second, vkData.vkTypes); + if (!hasPointers) + { + ofs << "#endif /*!VKCPP_DISABLE_ENHANCED_MODE*/" << std::endl; + } + + ofs << std::endl + << "#ifndef VKCPP_DISABLE_ENHANCED_MODE" << std::endl; + writeTypeCommandEnhanced(ofs, " ", className, functionName, *dep, cit->second, vkData.vkTypes); + ofs << "#endif /*VKCPP_DISABLE_ENHANCED_MODE*/" << std::endl; + + if (i < handle.commands.size() - 1) + { + ofs << std::endl; + } + } + ofs << std::endl; + } + ofs << "#if !defined(VK_CPP_TYPESAFE_CONVERSION)" << std::endl + << " explicit" << std::endl + << "#endif" << std::endl + << " operator Vk" << dependencyData.name << "() const" << std::endl + << " {" << std::endl + << " return m_" << memberName << ";" << std::endl + << " }" << std::endl + << std::endl + << " explicit operator bool() const" << std::endl + << " {" << std::endl + << " return m_" << memberName << " != VK_NULL_HANDLE;" << std::endl + << " }" << std::endl + << std::endl + << " bool operator!() const" << std::endl + << " {" << std::endl + << " return m_" << memberName << " == VK_NULL_HANDLE;" << std::endl + << " }" << std::endl + << std::endl + << " private:" << std::endl + << " Vk" << dependencyData.name << " m_" << memberName << ";" << std::endl + << " };" << std::endl +#if 1 + << " static_assert( sizeof( " << dependencyData.name << " ) == sizeof( Vk" << dependencyData.name << " ), \"handle and wrapper have different size!\" );" << std::endl +#endif + << std::endl; +} + +void writeTypeScalar( std::ofstream & ofs, DependencyData const& dependencyData ) +{ + assert( dependencyData.dependencies.size() == 1 ); + ofs << " typedef " << *dependencyData.dependencies.begin() << " " << dependencyData.name << ";" << std::endl; +} + +void writeTypeStruct( std::ofstream & ofs, VkData const& vkData, DependencyData const& dependencyData, std::map const& defaultValues ) +{ + std::map::const_iterator it = vkData.structs.find( dependencyData.name ); + assert( it != vkData.structs.end() ); + + enterProtect(ofs, it->second.protect); + ofs << " class " << dependencyData.name << std::endl + << " {" << std::endl + << " public:" << std::endl; + + std::string memberName( dependencyData.name ); + assert( isupper( memberName[0] ) ); + memberName[0] = tolower( memberName[0] ); + memberName = "m_" + memberName; + + // only structs that are not returnedOnly get a constructor! + if ( !it->second.returnedOnly ) + { + writeStructConstructor( ofs, dependencyData.name, memberName, it->second, vkData.vkTypes, defaultValues ); + } + + // create the getters and setters + for ( size_t i=0 ; isecond.members.size() ; i++ ) + { + writeStructGetter(ofs, it->second.members[i], memberName, vkData.vkTypes, true); + if (!it->second.returnedOnly) + { + writeStructGetter(ofs, it->second.members[i], memberName, vkData.vkTypes, false); + writeStructSetter( ofs, dependencyData.name, it->second.members[i], memberName, vkData.vkTypes ); + } + } + + // the cast-operator to the wrapped struct, and the struct itself as a private member variable + ofs << " operator const Vk" << dependencyData.name << "&() const" << std::endl + << " {" << std::endl + << " return " << memberName << ";" << std::endl + << " }" << std::endl + << std::endl + << " private:" << std::endl + << " Vk" << dependencyData.name << " " << memberName << ";" << std::endl + << " };" << std::endl; +#if 1 + ofs << " static_assert( sizeof( " << dependencyData.name << " ) == sizeof( Vk" << dependencyData.name << " ), \"struct and wrapper have different size!\" );" << std::endl; +#endif + leaveProtect(ofs, it->second.protect); + ofs << std::endl; +} + +void writeTypeUnion( std::ofstream & ofs, VkData const& vkData, DependencyData const& dependencyData, StructData const& unionData, std::map const& defaultValues ) +{ + std::ostringstream oss; + ofs << " class " << dependencyData.name << std::endl + << " {" << std::endl + << " public:" << std::endl; + + std::string memberName( dependencyData.name ); + assert( isupper( memberName[0] ) ); + memberName[0] = tolower( memberName[0] ); + memberName = "m_" + memberName; + + for ( size_t i=0 ; i& "; + } + ofs << unionData.members[i].name; + + // just the very first constructor gets default arguments + if ( i == 0 ) + { + std::map::const_iterator it = defaultValues.find( unionData.members[i].pureType ); + assert( it != defaultValues.end() ); + if ( unionData.members[i].arraySize.empty() ) + { + ofs << " = " << it->second; + } + else + { + ofs << " = { " << it->second << " }"; + } + } + ofs << " )" << std::endl + << " {" << std::endl + << " "; + if ( unionData.members[i].arraySize.empty() ) + { + ofs << memberName << "." << unionData.members[i].name << " = " << unionData.members[i].name; + } + else + { + ofs << "memcpy( &" << memberName << "." << unionData.members[i].name << ", " << unionData.members[i].name << ".data(), " << unionData.members[i].arraySize << " * sizeof( " << unionData.members[i].type << " ) )"; + } + ofs << ";" << std::endl + << " }" << std::endl + << std::endl; + + // one getter/setter per union element + writeStructGetter(ofs, unionData.members[i], memberName, vkData.vkTypes, true); + + assert(!unionData.returnedOnly); + writeStructGetter(ofs, unionData.members[i], memberName, vkData.vkTypes, false); + writeStructSetter(ofs, dependencyData.name, unionData.members[i], memberName, vkData.vkTypes); + } + ofs << " operator Vk" << dependencyData.name << " const& () const" << std::endl + << " {" << std::endl + << " return " << memberName << ";" << std::endl + << " }" << std::endl + << std::endl + << " private:" << std::endl + << " Vk" << dependencyData.name << " " << memberName << ";" << std::endl + << " };" << std::endl + << std::endl; +} + +void writeTypes(std::ofstream & ofs, VkData const& vkData, std::map const& defaultValues) +{ + for ( std::list::const_iterator it = vkData.dependencies.begin() ; it != vkData.dependencies.end() ; ++it ) + { + switch( it->category ) + { + case DependencyData::Category::COMMAND : + assert( vkData.commands.find( it->name ) != vkData.commands.end() ); + writeTypeCommand( ofs, *it, vkData.commands.find( it->name )->second, vkData.vkTypes ); + break; + case DependencyData::Category::ENUM : + assert( vkData.enums.find( it->name ) != vkData.enums.end() ); + writeTypeEnum( ofs, *it, vkData.enums.find( it->name )->second ); + break; + case DependencyData::Category::FLAGS : + assert(vkData.flags.find(it->name) != vkData.flags.end()); + writeTypeFlags( ofs, *it, vkData.flags.find( it->name)->second ); + break; + case DependencyData::Category::FUNC_POINTER : + case DependencyData::Category::REQUIRED : + // skip FUNC_POINTER and REQUIRED, they just needed to be in the dependencies list to resolve dependencies + break; + case DependencyData::Category::HANDLE : + assert(vkData.handles.find(it->name) != vkData.handles.end()); + writeTypeHandle(ofs, vkData, *it, vkData.handles.find(it->name)->second, vkData.dependencies); + break; + case DependencyData::Category::SCALAR : + writeTypeScalar( ofs, *it ); + break; + case DependencyData::Category::STRUCT : + writeTypeStruct( ofs, vkData, *it, defaultValues ); + break; + case DependencyData::Category::UNION : + assert( vkData.structs.find( it->name ) != vkData.structs.end() ); + writeTypeUnion( ofs, vkData, *it, vkData.structs.find( it->name )->second, defaultValues ); + break; + default : + assert( false ); + break; + } + } +} + +void writeVersionCheck(std::ofstream & ofs, std::string const& version) +{ + ofs << "static_assert( VK_HEADER_VERSION == " << version << " , \"Wrong VK_HEADER_VERSION!\" );" << std::endl + << std::endl; +} + +void writeTypesafeCheck(std::ofstream & ofs, std::string const& typesafeCheck) +{ + ofs << "// 32-bit vulkan is not typesafe for handles, so don't allow copy constructors on this platform by default." << std::endl + << "// To enable this feature on 32-bit platforms please define VK_CPP_TYPESAFE_CONVERSION" << std::endl + << typesafeCheck << std::endl + << "#define VK_CPP_TYPESAFE_CONVERSION 1" << std::endl + << "#endif" << std::endl + << std::endl; +} + +int main( int argc, char **argv ) +{ + try { + tinyxml2::XMLDocument doc; + + std::string filename = (argc == 1) ? VK_SPEC : argv[1]; + std::cout << "Loading vk.xml from " << filename << std::endl; + std::cout << "Writing vk_cpp.hpp to " << VK_CPP << std::endl; + + tinyxml2::XMLError error = doc.LoadFile(filename.c_str()); + if (error != tinyxml2::XML_SUCCESS) + { + std::cout << "VkGenerate: failed to load file " << argv[1] << " . Error code: " << error << std::endl; + return -1; + } + + tinyxml2::XMLElement * registryElement = doc.FirstChildElement(); + assert(strcmp(registryElement->Value(), "registry") == 0); + assert(!registryElement->NextSiblingElement()); + + VkData vkData; + + tinyxml2::XMLElement * child = registryElement->FirstChildElement(); + do + { + assert(child->Value()); + const std::string value = child->Value(); + if (value == "commands") + { + readCommands(child, vkData); + } + else if (value == "comment") + { + readComment(child, vkData.vulkanLicenseHeader); + } + else if (value == "enums") + { + readEnums(child, vkData); + } + else if (value == "extensions") + { + readExtensions(child, vkData); + } + else if (value == "tags") + { + readTags(child, vkData.tags); + } + else if (value == "types") + { + readTypes(child, vkData); + } + else + { + assert((value == "feature") || (value == "vendorids")); + } + } while (child = child->NextSiblingElement()); + + sortDependencies(vkData.dependencies); + + std::map defaultValues; + createDefaults(vkData, defaultValues); + + std::ofstream ofs(VK_CPP); + ofs << nvidiaLicenseHeader << std::endl + << vkData.vulkanLicenseHeader << std::endl + << std::endl + << std::endl + << "#ifndef VK_CPP_H_" << std::endl + << "#define VK_CPP_H_" << std::endl + << std::endl + << "#include " << std::endl + << "#include " << std::endl + << "#include " << std::endl + << "#include " << std::endl + << "#include " << std::endl + << "#include " << std::endl + << "#include " << std::endl + << "#ifndef VKCPP_DISABLE_ENHANCED_MODE" << std::endl + << "# include " << std::endl + << "#endif /*VKCPP_DISABLE_ENHANCED_MODE*/" << std::endl + << std::endl; + + writeVersionCheck(ofs, vkData.version); + writeTypesafeCheck(ofs, vkData.typesafeCheck); + ofs << "namespace vk" << std::endl + << "{" << std::endl + << flagsHeader + << optionalClassHeader; + + // first of all, write out vk::Result and the exception handling stuff + std::list::const_iterator it = std::find_if(vkData.dependencies.begin(), vkData.dependencies.end(), [](DependencyData const& dp) { return dp.name == "Result"; }); + assert(it != vkData.dependencies.end()); + writeTypeEnum(ofs, *it, vkData.enums.find(it->name)->second); + writeEnumsToString(ofs, *it, vkData.enums.find(it->name)->second); + vkData.dependencies.erase(it); + ofs << exceptionHeader; + + ofs << "} // namespace vk" << std::endl + << std::endl + << "namespace std" << std::endl + << "{" << std::endl + << " template <>" << std::endl + << " struct is_error_code_enum : public true_type" << std::endl + << " {};" << std::endl + << "}" << std::endl + << std::endl + << "namespace vk" << std::endl + << "{" << std::endl; + + writeTypes(ofs, vkData, defaultValues); + writeEnumsToString(ofs, vkData); + + ofs << "} // namespace vk" << std::endl + << std::endl + << "#endif" << std::endl; + } + catch (std::exception e) + { + std::cout << "caught exception: " << e.what() << std::endl; + } + catch (...) + { + std::cout << "caught unknown exception" << std::endl; + } +} diff --git a/vulkan/vk_cpp.h b/vulkan/vk_cpp.hpp similarity index 95% rename from vulkan/vk_cpp.h rename to vulkan/vk_cpp.hpp index 2a73b53..2485f8a 100644 --- a/vulkan/vk_cpp.h +++ b/vulkan/vk_cpp.hpp @@ -59,9 +59,9 @@ #include #include #include -#ifdef VKCPP_ENHANCED_MODE +#ifndef VKCPP_DISABLE_ENHANCED_MODE # include -#endif /*VKCPP_ENHANCED_MODE*/ +#endif /*VKCPP_DISABLE_ENHANCED_MODE*/ static_assert( VK_HEADER_VERSION == 8 , "Wrong VK_HEADER_VERSION!" ); @@ -17585,7 +17585,7 @@ namespace vk return static_cast( vkBeginCommandBuffer( m_commandBuffer, reinterpret_cast( pBeginInfo ) ) ); } -#ifdef VKCPP_ENHANCED_MODE +#ifndef VKCPP_DISABLE_ENHANCED_MODE void begin( const CommandBufferBeginInfo & beginInfo ) const { Result result = static_cast( vkBeginCommandBuffer( m_commandBuffer, reinterpret_cast( &beginInfo ) ) ); @@ -17594,16 +17594,16 @@ namespace vk throw std::system_error( result, "vk::CommandBuffer::begin" ); } } -#endif /*VKCPP_ENHANCED_MODE*/ +#endif /*VKCPP_DISABLE_ENHANCED_MODE*/ -#ifndef VKCPP_ENHANCED_MODE +#ifdef VKCPP_DISABLE_ENHANCED_MODE Result end( ) const { return static_cast( vkEndCommandBuffer( m_commandBuffer ) ); } -#endif /*!VKCPP_ENHANCED_MODE*/ +#endif /*!VKCPP_DISABLE_ENHANCED_MODE*/ -#ifdef VKCPP_ENHANCED_MODE +#ifndef VKCPP_DISABLE_ENHANCED_MODE void end() const { Result result = static_cast( vkEndCommandBuffer( m_commandBuffer ) ); @@ -17612,16 +17612,16 @@ namespace vk throw std::system_error( result, "vk::CommandBuffer::end" ); } } -#endif /*VKCPP_ENHANCED_MODE*/ +#endif /*VKCPP_DISABLE_ENHANCED_MODE*/ -#ifndef VKCPP_ENHANCED_MODE +#ifdef VKCPP_DISABLE_ENHANCED_MODE Result reset( CommandBufferResetFlags flags ) const { return static_cast( vkResetCommandBuffer( m_commandBuffer, static_cast( flags ) ) ); } -#endif /*!VKCPP_ENHANCED_MODE*/ +#endif /*!VKCPP_DISABLE_ENHANCED_MODE*/ -#ifdef VKCPP_ENHANCED_MODE +#ifndef VKCPP_DISABLE_ENHANCED_MODE void reset( CommandBufferResetFlags flags ) const { Result result = static_cast( vkResetCommandBuffer( m_commandBuffer, static_cast( flags ) ) ); @@ -17630,28 +17630,28 @@ namespace vk throw std::system_error( result, "vk::CommandBuffer::reset" ); } } -#endif /*VKCPP_ENHANCED_MODE*/ +#endif /*VKCPP_DISABLE_ENHANCED_MODE*/ -#ifndef VKCPP_ENHANCED_MODE +#ifdef VKCPP_DISABLE_ENHANCED_MODE void bindPipeline( PipelineBindPoint pipelineBindPoint, Pipeline pipeline ) const { vkCmdBindPipeline( m_commandBuffer, static_cast( pipelineBindPoint ), static_cast( pipeline ) ); } -#endif /*!VKCPP_ENHANCED_MODE*/ +#endif /*!VKCPP_DISABLE_ENHANCED_MODE*/ -#ifdef VKCPP_ENHANCED_MODE +#ifndef VKCPP_DISABLE_ENHANCED_MODE void bindPipeline( PipelineBindPoint pipelineBindPoint, Pipeline pipeline ) const { vkCmdBindPipeline( m_commandBuffer, static_cast( pipelineBindPoint ), static_cast( pipeline ) ); } -#endif /*VKCPP_ENHANCED_MODE*/ +#endif /*VKCPP_DISABLE_ENHANCED_MODE*/ void setViewport( uint32_t firstViewport, uint32_t viewportCount, const Viewport* pViewports ) const { vkCmdSetViewport( m_commandBuffer, firstViewport, viewportCount, reinterpret_cast( pViewports ) ); } -#ifdef VKCPP_ENHANCED_MODE +#ifndef VKCPP_DISABLE_ENHANCED_MODE void setViewport( uint32_t firstViewport, std::vector const & viewports ) const { vkCmdSetViewport( m_commandBuffer, firstViewport, static_cast( viewports.size() ), reinterpret_cast( viewports.data() ) ); @@ -17661,14 +17661,14 @@ namespace vk { vkCmdSetViewport( m_commandBuffer, firstViewport, 1, reinterpret_cast( &viewport ) ); } -#endif /*VKCPP_ENHANCED_MODE*/ +#endif /*VKCPP_DISABLE_ENHANCED_MODE*/ void setScissor( uint32_t firstScissor, uint32_t scissorCount, const Rect2D* pScissors ) const { vkCmdSetScissor( m_commandBuffer, firstScissor, scissorCount, reinterpret_cast( pScissors ) ); } -#ifdef VKCPP_ENHANCED_MODE +#ifndef VKCPP_DISABLE_ENHANCED_MODE void setScissor( uint32_t firstScissor, std::vector const & scissors ) const { vkCmdSetScissor( m_commandBuffer, firstScissor, static_cast( scissors.size() ), reinterpret_cast( scissors.data() ) ); @@ -17678,112 +17678,112 @@ namespace vk { vkCmdSetScissor( m_commandBuffer, firstScissor, 1, reinterpret_cast( &scissor ) ); } -#endif /*VKCPP_ENHANCED_MODE*/ +#endif /*VKCPP_DISABLE_ENHANCED_MODE*/ -#ifndef VKCPP_ENHANCED_MODE +#ifdef VKCPP_DISABLE_ENHANCED_MODE void setLineWidth( float lineWidth ) const { vkCmdSetLineWidth( m_commandBuffer, lineWidth ); } -#endif /*!VKCPP_ENHANCED_MODE*/ +#endif /*!VKCPP_DISABLE_ENHANCED_MODE*/ -#ifdef VKCPP_ENHANCED_MODE +#ifndef VKCPP_DISABLE_ENHANCED_MODE void setLineWidth( float lineWidth ) const { vkCmdSetLineWidth( m_commandBuffer, lineWidth ); } -#endif /*VKCPP_ENHANCED_MODE*/ +#endif /*VKCPP_DISABLE_ENHANCED_MODE*/ -#ifndef VKCPP_ENHANCED_MODE +#ifdef VKCPP_DISABLE_ENHANCED_MODE void setDepthBias( float depthBiasConstantFactor, float depthBiasClamp, float depthBiasSlopeFactor ) const { vkCmdSetDepthBias( m_commandBuffer, depthBiasConstantFactor, depthBiasClamp, depthBiasSlopeFactor ); } -#endif /*!VKCPP_ENHANCED_MODE*/ +#endif /*!VKCPP_DISABLE_ENHANCED_MODE*/ -#ifdef VKCPP_ENHANCED_MODE +#ifndef VKCPP_DISABLE_ENHANCED_MODE void setDepthBias( float depthBiasConstantFactor, float depthBiasClamp, float depthBiasSlopeFactor ) const { vkCmdSetDepthBias( m_commandBuffer, depthBiasConstantFactor, depthBiasClamp, depthBiasSlopeFactor ); } -#endif /*VKCPP_ENHANCED_MODE*/ +#endif /*VKCPP_DISABLE_ENHANCED_MODE*/ -#ifndef VKCPP_ENHANCED_MODE +#ifdef VKCPP_DISABLE_ENHANCED_MODE void setBlendConstants( const float blendConstants[4] ) const { vkCmdSetBlendConstants( m_commandBuffer, blendConstants ); } -#endif /*!VKCPP_ENHANCED_MODE*/ +#endif /*!VKCPP_DISABLE_ENHANCED_MODE*/ -#ifdef VKCPP_ENHANCED_MODE +#ifndef VKCPP_DISABLE_ENHANCED_MODE void setBlendConstants( const float blendConstants[4] ) const { vkCmdSetBlendConstants( m_commandBuffer, blendConstants ); } -#endif /*VKCPP_ENHANCED_MODE*/ +#endif /*VKCPP_DISABLE_ENHANCED_MODE*/ -#ifndef VKCPP_ENHANCED_MODE +#ifdef VKCPP_DISABLE_ENHANCED_MODE void setDepthBounds( float minDepthBounds, float maxDepthBounds ) const { vkCmdSetDepthBounds( m_commandBuffer, minDepthBounds, maxDepthBounds ); } -#endif /*!VKCPP_ENHANCED_MODE*/ +#endif /*!VKCPP_DISABLE_ENHANCED_MODE*/ -#ifdef VKCPP_ENHANCED_MODE +#ifndef VKCPP_DISABLE_ENHANCED_MODE void setDepthBounds( float minDepthBounds, float maxDepthBounds ) const { vkCmdSetDepthBounds( m_commandBuffer, minDepthBounds, maxDepthBounds ); } -#endif /*VKCPP_ENHANCED_MODE*/ +#endif /*VKCPP_DISABLE_ENHANCED_MODE*/ -#ifndef VKCPP_ENHANCED_MODE +#ifdef VKCPP_DISABLE_ENHANCED_MODE void setStencilCompareMask( StencilFaceFlags faceMask, uint32_t compareMask ) const { vkCmdSetStencilCompareMask( m_commandBuffer, static_cast( faceMask ), compareMask ); } -#endif /*!VKCPP_ENHANCED_MODE*/ +#endif /*!VKCPP_DISABLE_ENHANCED_MODE*/ -#ifdef VKCPP_ENHANCED_MODE +#ifndef VKCPP_DISABLE_ENHANCED_MODE void setStencilCompareMask( StencilFaceFlags faceMask, uint32_t compareMask ) const { vkCmdSetStencilCompareMask( m_commandBuffer, static_cast( faceMask ), compareMask ); } -#endif /*VKCPP_ENHANCED_MODE*/ +#endif /*VKCPP_DISABLE_ENHANCED_MODE*/ -#ifndef VKCPP_ENHANCED_MODE +#ifdef VKCPP_DISABLE_ENHANCED_MODE void setStencilWriteMask( StencilFaceFlags faceMask, uint32_t writeMask ) const { vkCmdSetStencilWriteMask( m_commandBuffer, static_cast( faceMask ), writeMask ); } -#endif /*!VKCPP_ENHANCED_MODE*/ +#endif /*!VKCPP_DISABLE_ENHANCED_MODE*/ -#ifdef VKCPP_ENHANCED_MODE +#ifndef VKCPP_DISABLE_ENHANCED_MODE void setStencilWriteMask( StencilFaceFlags faceMask, uint32_t writeMask ) const { vkCmdSetStencilWriteMask( m_commandBuffer, static_cast( faceMask ), writeMask ); } -#endif /*VKCPP_ENHANCED_MODE*/ +#endif /*VKCPP_DISABLE_ENHANCED_MODE*/ -#ifndef VKCPP_ENHANCED_MODE +#ifdef VKCPP_DISABLE_ENHANCED_MODE void setStencilReference( StencilFaceFlags faceMask, uint32_t reference ) const { vkCmdSetStencilReference( m_commandBuffer, static_cast( faceMask ), reference ); } -#endif /*!VKCPP_ENHANCED_MODE*/ +#endif /*!VKCPP_DISABLE_ENHANCED_MODE*/ -#ifdef VKCPP_ENHANCED_MODE +#ifndef VKCPP_DISABLE_ENHANCED_MODE void setStencilReference( StencilFaceFlags faceMask, uint32_t reference ) const { vkCmdSetStencilReference( m_commandBuffer, static_cast( faceMask ), reference ); } -#endif /*VKCPP_ENHANCED_MODE*/ +#endif /*VKCPP_DISABLE_ENHANCED_MODE*/ void bindDescriptorSets( PipelineBindPoint pipelineBindPoint, PipelineLayout layout, uint32_t firstSet, uint32_t descriptorSetCount, const DescriptorSet* pDescriptorSets, uint32_t dynamicOffsetCount, const uint32_t* pDynamicOffsets ) const { vkCmdBindDescriptorSets( m_commandBuffer, static_cast( pipelineBindPoint ), static_cast( layout ), firstSet, descriptorSetCount, reinterpret_cast( pDescriptorSets ), dynamicOffsetCount, pDynamicOffsets ); } -#ifdef VKCPP_ENHANCED_MODE +#ifndef VKCPP_DISABLE_ENHANCED_MODE void bindDescriptorSets( PipelineBindPoint pipelineBindPoint, PipelineLayout layout, uint32_t firstSet, std::vector const & descriptorSets, std::vector const & dynamicOffsets ) const { vkCmdBindDescriptorSets( m_commandBuffer, static_cast( pipelineBindPoint ), static_cast( layout ), firstSet, static_cast( descriptorSets.size() ), reinterpret_cast( descriptorSets.data() ), static_cast( dynamicOffsets.size() ), dynamicOffsets.data() ); @@ -17793,28 +17793,28 @@ namespace vk { vkCmdBindDescriptorSets( m_commandBuffer, static_cast( pipelineBindPoint ), static_cast( layout ), firstSet, 1, reinterpret_cast( &descriptorSet ), 1, &dynamicOffset ); } -#endif /*VKCPP_ENHANCED_MODE*/ +#endif /*VKCPP_DISABLE_ENHANCED_MODE*/ -#ifndef VKCPP_ENHANCED_MODE +#ifdef VKCPP_DISABLE_ENHANCED_MODE void bindIndexBuffer( Buffer buffer, DeviceSize offset, IndexType indexType ) const { vkCmdBindIndexBuffer( m_commandBuffer, static_cast( buffer ), offset, static_cast( indexType ) ); } -#endif /*!VKCPP_ENHANCED_MODE*/ +#endif /*!VKCPP_DISABLE_ENHANCED_MODE*/ -#ifdef VKCPP_ENHANCED_MODE +#ifndef VKCPP_DISABLE_ENHANCED_MODE void bindIndexBuffer( Buffer buffer, DeviceSize offset, IndexType indexType ) const { vkCmdBindIndexBuffer( m_commandBuffer, static_cast( buffer ), offset, static_cast( indexType ) ); } -#endif /*VKCPP_ENHANCED_MODE*/ +#endif /*VKCPP_DISABLE_ENHANCED_MODE*/ void bindVertexBuffers( uint32_t firstBinding, uint32_t bindingCount, const Buffer* pBuffers, const DeviceSize* pOffsets ) const { vkCmdBindVertexBuffers( m_commandBuffer, firstBinding, bindingCount, reinterpret_cast( pBuffers ), pOffsets ); } -#ifdef VKCPP_ENHANCED_MODE +#ifndef VKCPP_DISABLE_ENHANCED_MODE void bindVertexBuffers( uint32_t firstBinding, std::vector const & buffers, std::vector const & offsets ) const { if ( buffers.size() != offsets.size() ) @@ -17828,98 +17828,98 @@ namespace vk { vkCmdBindVertexBuffers( m_commandBuffer, firstBinding, 1, reinterpret_cast( &buffer ), &offset ); } -#endif /*VKCPP_ENHANCED_MODE*/ +#endif /*VKCPP_DISABLE_ENHANCED_MODE*/ -#ifndef VKCPP_ENHANCED_MODE +#ifdef VKCPP_DISABLE_ENHANCED_MODE void draw( uint32_t vertexCount, uint32_t instanceCount, uint32_t firstVertex, uint32_t firstInstance ) const { vkCmdDraw( m_commandBuffer, vertexCount, instanceCount, firstVertex, firstInstance ); } -#endif /*!VKCPP_ENHANCED_MODE*/ +#endif /*!VKCPP_DISABLE_ENHANCED_MODE*/ -#ifdef VKCPP_ENHANCED_MODE +#ifndef VKCPP_DISABLE_ENHANCED_MODE void draw( uint32_t vertexCount, uint32_t instanceCount, uint32_t firstVertex, uint32_t firstInstance ) const { vkCmdDraw( m_commandBuffer, vertexCount, instanceCount, firstVertex, firstInstance ); } -#endif /*VKCPP_ENHANCED_MODE*/ +#endif /*VKCPP_DISABLE_ENHANCED_MODE*/ -#ifndef VKCPP_ENHANCED_MODE +#ifdef VKCPP_DISABLE_ENHANCED_MODE void drawIndexed( uint32_t indexCount, uint32_t instanceCount, uint32_t firstIndex, int32_t vertexOffset, uint32_t firstInstance ) const { vkCmdDrawIndexed( m_commandBuffer, indexCount, instanceCount, firstIndex, vertexOffset, firstInstance ); } -#endif /*!VKCPP_ENHANCED_MODE*/ +#endif /*!VKCPP_DISABLE_ENHANCED_MODE*/ -#ifdef VKCPP_ENHANCED_MODE +#ifndef VKCPP_DISABLE_ENHANCED_MODE void drawIndexed( uint32_t indexCount, uint32_t instanceCount, uint32_t firstIndex, int32_t vertexOffset, uint32_t firstInstance ) const { vkCmdDrawIndexed( m_commandBuffer, indexCount, instanceCount, firstIndex, vertexOffset, firstInstance ); } -#endif /*VKCPP_ENHANCED_MODE*/ +#endif /*VKCPP_DISABLE_ENHANCED_MODE*/ -#ifndef VKCPP_ENHANCED_MODE +#ifdef VKCPP_DISABLE_ENHANCED_MODE void drawIndirect( Buffer buffer, DeviceSize offset, uint32_t drawCount, uint32_t stride ) const { vkCmdDrawIndirect( m_commandBuffer, static_cast( buffer ), offset, drawCount, stride ); } -#endif /*!VKCPP_ENHANCED_MODE*/ +#endif /*!VKCPP_DISABLE_ENHANCED_MODE*/ -#ifdef VKCPP_ENHANCED_MODE +#ifndef VKCPP_DISABLE_ENHANCED_MODE void drawIndirect( Buffer buffer, DeviceSize offset, uint32_t drawCount, uint32_t stride ) const { vkCmdDrawIndirect( m_commandBuffer, static_cast( buffer ), offset, drawCount, stride ); } -#endif /*VKCPP_ENHANCED_MODE*/ +#endif /*VKCPP_DISABLE_ENHANCED_MODE*/ -#ifndef VKCPP_ENHANCED_MODE +#ifdef VKCPP_DISABLE_ENHANCED_MODE void drawIndexedIndirect( Buffer buffer, DeviceSize offset, uint32_t drawCount, uint32_t stride ) const { vkCmdDrawIndexedIndirect( m_commandBuffer, static_cast( buffer ), offset, drawCount, stride ); } -#endif /*!VKCPP_ENHANCED_MODE*/ +#endif /*!VKCPP_DISABLE_ENHANCED_MODE*/ -#ifdef VKCPP_ENHANCED_MODE +#ifndef VKCPP_DISABLE_ENHANCED_MODE void drawIndexedIndirect( Buffer buffer, DeviceSize offset, uint32_t drawCount, uint32_t stride ) const { vkCmdDrawIndexedIndirect( m_commandBuffer, static_cast( buffer ), offset, drawCount, stride ); } -#endif /*VKCPP_ENHANCED_MODE*/ +#endif /*VKCPP_DISABLE_ENHANCED_MODE*/ -#ifndef VKCPP_ENHANCED_MODE +#ifdef VKCPP_DISABLE_ENHANCED_MODE void dispatch( uint32_t x, uint32_t y, uint32_t z ) const { vkCmdDispatch( m_commandBuffer, x, y, z ); } -#endif /*!VKCPP_ENHANCED_MODE*/ +#endif /*!VKCPP_DISABLE_ENHANCED_MODE*/ -#ifdef VKCPP_ENHANCED_MODE +#ifndef VKCPP_DISABLE_ENHANCED_MODE void dispatch( uint32_t x, uint32_t y, uint32_t z ) const { vkCmdDispatch( m_commandBuffer, x, y, z ); } -#endif /*VKCPP_ENHANCED_MODE*/ +#endif /*VKCPP_DISABLE_ENHANCED_MODE*/ -#ifndef VKCPP_ENHANCED_MODE +#ifdef VKCPP_DISABLE_ENHANCED_MODE void dispatchIndirect( Buffer buffer, DeviceSize offset ) const { vkCmdDispatchIndirect( m_commandBuffer, static_cast( buffer ), offset ); } -#endif /*!VKCPP_ENHANCED_MODE*/ +#endif /*!VKCPP_DISABLE_ENHANCED_MODE*/ -#ifdef VKCPP_ENHANCED_MODE +#ifndef VKCPP_DISABLE_ENHANCED_MODE void dispatchIndirect( Buffer buffer, DeviceSize offset ) const { vkCmdDispatchIndirect( m_commandBuffer, static_cast( buffer ), offset ); } -#endif /*VKCPP_ENHANCED_MODE*/ +#endif /*VKCPP_DISABLE_ENHANCED_MODE*/ void copyBuffer( Buffer srcBuffer, Buffer dstBuffer, uint32_t regionCount, const BufferCopy* pRegions ) const { vkCmdCopyBuffer( m_commandBuffer, static_cast( srcBuffer ), static_cast( dstBuffer ), regionCount, reinterpret_cast( pRegions ) ); } -#ifdef VKCPP_ENHANCED_MODE +#ifndef VKCPP_DISABLE_ENHANCED_MODE void copyBuffer( Buffer srcBuffer, Buffer dstBuffer, std::vector const & regions ) const { vkCmdCopyBuffer( m_commandBuffer, static_cast( srcBuffer ), static_cast( dstBuffer ), static_cast( regions.size() ), reinterpret_cast( regions.data() ) ); @@ -17929,14 +17929,14 @@ namespace vk { vkCmdCopyBuffer( m_commandBuffer, static_cast( srcBuffer ), static_cast( dstBuffer ), 1, reinterpret_cast( ®ion ) ); } -#endif /*VKCPP_ENHANCED_MODE*/ +#endif /*VKCPP_DISABLE_ENHANCED_MODE*/ void copyImage( Image srcImage, ImageLayout srcImageLayout, Image dstImage, ImageLayout dstImageLayout, uint32_t regionCount, const ImageCopy* pRegions ) const { vkCmdCopyImage( m_commandBuffer, static_cast( srcImage ), static_cast( srcImageLayout ), static_cast( dstImage ), static_cast( dstImageLayout ), regionCount, reinterpret_cast( pRegions ) ); } -#ifdef VKCPP_ENHANCED_MODE +#ifndef VKCPP_DISABLE_ENHANCED_MODE void copyImage( Image srcImage, ImageLayout srcImageLayout, Image dstImage, ImageLayout dstImageLayout, std::vector const & regions ) const { vkCmdCopyImage( m_commandBuffer, static_cast( srcImage ), static_cast( srcImageLayout ), static_cast( dstImage ), static_cast( dstImageLayout ), static_cast( regions.size() ), reinterpret_cast( regions.data() ) ); @@ -17946,14 +17946,14 @@ namespace vk { vkCmdCopyImage( m_commandBuffer, static_cast( srcImage ), static_cast( srcImageLayout ), static_cast( dstImage ), static_cast( dstImageLayout ), 1, reinterpret_cast( ®ion ) ); } -#endif /*VKCPP_ENHANCED_MODE*/ +#endif /*VKCPP_DISABLE_ENHANCED_MODE*/ void blitImage( Image srcImage, ImageLayout srcImageLayout, Image dstImage, ImageLayout dstImageLayout, uint32_t regionCount, const ImageBlit* pRegions, Filter filter ) const { vkCmdBlitImage( m_commandBuffer, static_cast( srcImage ), static_cast( srcImageLayout ), static_cast( dstImage ), static_cast( dstImageLayout ), regionCount, reinterpret_cast( pRegions ), static_cast( filter ) ); } -#ifdef VKCPP_ENHANCED_MODE +#ifndef VKCPP_DISABLE_ENHANCED_MODE void blitImage( Image srcImage, ImageLayout srcImageLayout, Image dstImage, ImageLayout dstImageLayout, std::vector const & regions, Filter filter ) const { vkCmdBlitImage( m_commandBuffer, static_cast( srcImage ), static_cast( srcImageLayout ), static_cast( dstImage ), static_cast( dstImageLayout ), static_cast( regions.size() ), reinterpret_cast( regions.data() ), static_cast( filter ) ); @@ -17963,14 +17963,14 @@ namespace vk { vkCmdBlitImage( m_commandBuffer, static_cast( srcImage ), static_cast( srcImageLayout ), static_cast( dstImage ), static_cast( dstImageLayout ), 1, reinterpret_cast( ®ion ), static_cast( filter ) ); } -#endif /*VKCPP_ENHANCED_MODE*/ +#endif /*VKCPP_DISABLE_ENHANCED_MODE*/ void copyBufferToImage( Buffer srcBuffer, Image dstImage, ImageLayout dstImageLayout, uint32_t regionCount, const BufferImageCopy* pRegions ) const { vkCmdCopyBufferToImage( m_commandBuffer, static_cast( srcBuffer ), static_cast( dstImage ), static_cast( dstImageLayout ), regionCount, reinterpret_cast( pRegions ) ); } -#ifdef VKCPP_ENHANCED_MODE +#ifndef VKCPP_DISABLE_ENHANCED_MODE void copyBufferToImage( Buffer srcBuffer, Image dstImage, ImageLayout dstImageLayout, std::vector const & regions ) const { vkCmdCopyBufferToImage( m_commandBuffer, static_cast( srcBuffer ), static_cast( dstImage ), static_cast( dstImageLayout ), static_cast( regions.size() ), reinterpret_cast( regions.data() ) ); @@ -17980,14 +17980,14 @@ namespace vk { vkCmdCopyBufferToImage( m_commandBuffer, static_cast( srcBuffer ), static_cast( dstImage ), static_cast( dstImageLayout ), 1, reinterpret_cast( ®ion ) ); } -#endif /*VKCPP_ENHANCED_MODE*/ +#endif /*VKCPP_DISABLE_ENHANCED_MODE*/ void copyImageToBuffer( Image srcImage, ImageLayout srcImageLayout, Buffer dstBuffer, uint32_t regionCount, const BufferImageCopy* pRegions ) const { vkCmdCopyImageToBuffer( m_commandBuffer, static_cast( srcImage ), static_cast( srcImageLayout ), static_cast( dstBuffer ), regionCount, reinterpret_cast( pRegions ) ); } -#ifdef VKCPP_ENHANCED_MODE +#ifndef VKCPP_DISABLE_ENHANCED_MODE void copyImageToBuffer( Image srcImage, ImageLayout srcImageLayout, Buffer dstBuffer, std::vector const & regions ) const { vkCmdCopyImageToBuffer( m_commandBuffer, static_cast( srcImage ), static_cast( srcImageLayout ), static_cast( dstBuffer ), static_cast( regions.size() ), reinterpret_cast( regions.data() ) ); @@ -17997,42 +17997,42 @@ namespace vk { vkCmdCopyImageToBuffer( m_commandBuffer, static_cast( srcImage ), static_cast( srcImageLayout ), static_cast( dstBuffer ), 1, reinterpret_cast( ®ion ) ); } -#endif /*VKCPP_ENHANCED_MODE*/ +#endif /*VKCPP_DISABLE_ENHANCED_MODE*/ void updateBuffer( Buffer dstBuffer, DeviceSize dstOffset, DeviceSize dataSize, const uint32_t* pData ) const { vkCmdUpdateBuffer( m_commandBuffer, static_cast( dstBuffer ), dstOffset, dataSize, pData ); } -#ifdef VKCPP_ENHANCED_MODE +#ifndef VKCPP_DISABLE_ENHANCED_MODE template void updateBuffer( Buffer dstBuffer, DeviceSize dstOffset, std::vector const & data ) const { static_assert( sizeof( T ) % sizeof( uint32_t ) == 0, "wrong size of template type T" ); vkCmdUpdateBuffer( m_commandBuffer, static_cast( dstBuffer ), dstOffset, static_cast( data.size() * sizeof( T ) ), reinterpret_cast( data.data() ) ); } -#endif /*VKCPP_ENHANCED_MODE*/ +#endif /*VKCPP_DISABLE_ENHANCED_MODE*/ -#ifndef VKCPP_ENHANCED_MODE +#ifdef VKCPP_DISABLE_ENHANCED_MODE void fillBuffer( Buffer dstBuffer, DeviceSize dstOffset, DeviceSize size, uint32_t data ) const { vkCmdFillBuffer( m_commandBuffer, static_cast( dstBuffer ), dstOffset, size, data ); } -#endif /*!VKCPP_ENHANCED_MODE*/ +#endif /*!VKCPP_DISABLE_ENHANCED_MODE*/ -#ifdef VKCPP_ENHANCED_MODE +#ifndef VKCPP_DISABLE_ENHANCED_MODE void fillBuffer( Buffer dstBuffer, DeviceSize dstOffset, DeviceSize size, uint32_t data ) const { vkCmdFillBuffer( m_commandBuffer, static_cast( dstBuffer ), dstOffset, size, data ); } -#endif /*VKCPP_ENHANCED_MODE*/ +#endif /*VKCPP_DISABLE_ENHANCED_MODE*/ void clearColorImage( Image image, ImageLayout imageLayout, const ClearColorValue* pColor, uint32_t rangeCount, const ImageSubresourceRange* pRanges ) const { vkCmdClearColorImage( m_commandBuffer, static_cast( image ), static_cast( imageLayout ), reinterpret_cast( pColor ), rangeCount, reinterpret_cast( pRanges ) ); } -#ifdef VKCPP_ENHANCED_MODE +#ifndef VKCPP_DISABLE_ENHANCED_MODE void clearColorImage( Image image, ImageLayout imageLayout, const ClearColorValue & color, std::vector const & ranges ) const { vkCmdClearColorImage( m_commandBuffer, static_cast( image ), static_cast( imageLayout ), reinterpret_cast( &color ), static_cast( ranges.size() ), reinterpret_cast( ranges.data() ) ); @@ -18042,14 +18042,14 @@ namespace vk { vkCmdClearColorImage( m_commandBuffer, static_cast( image ), static_cast( imageLayout ), reinterpret_cast( &color ), 1, reinterpret_cast( &range ) ); } -#endif /*VKCPP_ENHANCED_MODE*/ +#endif /*VKCPP_DISABLE_ENHANCED_MODE*/ void clearDepthStencilImage( Image image, ImageLayout imageLayout, const ClearDepthStencilValue* pDepthStencil, uint32_t rangeCount, const ImageSubresourceRange* pRanges ) const { vkCmdClearDepthStencilImage( m_commandBuffer, static_cast( image ), static_cast( imageLayout ), reinterpret_cast( pDepthStencil ), rangeCount, reinterpret_cast( pRanges ) ); } -#ifdef VKCPP_ENHANCED_MODE +#ifndef VKCPP_DISABLE_ENHANCED_MODE void clearDepthStencilImage( Image image, ImageLayout imageLayout, const ClearDepthStencilValue & depthStencil, std::vector const & ranges ) const { vkCmdClearDepthStencilImage( m_commandBuffer, static_cast( image ), static_cast( imageLayout ), reinterpret_cast( &depthStencil ), static_cast( ranges.size() ), reinterpret_cast( ranges.data() ) ); @@ -18059,14 +18059,14 @@ namespace vk { vkCmdClearDepthStencilImage( m_commandBuffer, static_cast( image ), static_cast( imageLayout ), reinterpret_cast( &depthStencil ), 1, reinterpret_cast( &range ) ); } -#endif /*VKCPP_ENHANCED_MODE*/ +#endif /*VKCPP_DISABLE_ENHANCED_MODE*/ void clearAttachments( uint32_t attachmentCount, const ClearAttachment* pAttachments, uint32_t rectCount, const ClearRect* pRects ) const { vkCmdClearAttachments( m_commandBuffer, attachmentCount, reinterpret_cast( pAttachments ), rectCount, reinterpret_cast( pRects ) ); } -#ifdef VKCPP_ENHANCED_MODE +#ifndef VKCPP_DISABLE_ENHANCED_MODE void clearAttachments( std::vector const & attachments, std::vector const & rects ) const { vkCmdClearAttachments( m_commandBuffer, static_cast( attachments.size() ), reinterpret_cast( attachments.data() ), static_cast( rects.size() ), reinterpret_cast( rects.data() ) ); @@ -18076,14 +18076,14 @@ namespace vk { vkCmdClearAttachments( m_commandBuffer, 1, reinterpret_cast( &attachment ), 1, reinterpret_cast( &rect ) ); } -#endif /*VKCPP_ENHANCED_MODE*/ +#endif /*VKCPP_DISABLE_ENHANCED_MODE*/ void resolveImage( Image srcImage, ImageLayout srcImageLayout, Image dstImage, ImageLayout dstImageLayout, uint32_t regionCount, const ImageResolve* pRegions ) const { vkCmdResolveImage( m_commandBuffer, static_cast( srcImage ), static_cast( srcImageLayout ), static_cast( dstImage ), static_cast( dstImageLayout ), regionCount, reinterpret_cast( pRegions ) ); } -#ifdef VKCPP_ENHANCED_MODE +#ifndef VKCPP_DISABLE_ENHANCED_MODE void resolveImage( Image srcImage, ImageLayout srcImageLayout, Image dstImage, ImageLayout dstImageLayout, std::vector const & regions ) const { vkCmdResolveImage( m_commandBuffer, static_cast( srcImage ), static_cast( srcImageLayout ), static_cast( dstImage ), static_cast( dstImageLayout ), static_cast( regions.size() ), reinterpret_cast( regions.data() ) ); @@ -18093,42 +18093,42 @@ namespace vk { vkCmdResolveImage( m_commandBuffer, static_cast( srcImage ), static_cast( srcImageLayout ), static_cast( dstImage ), static_cast( dstImageLayout ), 1, reinterpret_cast( ®ion ) ); } -#endif /*VKCPP_ENHANCED_MODE*/ +#endif /*VKCPP_DISABLE_ENHANCED_MODE*/ -#ifndef VKCPP_ENHANCED_MODE +#ifdef VKCPP_DISABLE_ENHANCED_MODE void setEvent( Event event, PipelineStageFlags stageMask ) const { vkCmdSetEvent( m_commandBuffer, static_cast( event ), static_cast( stageMask ) ); } -#endif /*!VKCPP_ENHANCED_MODE*/ +#endif /*!VKCPP_DISABLE_ENHANCED_MODE*/ -#ifdef VKCPP_ENHANCED_MODE +#ifndef VKCPP_DISABLE_ENHANCED_MODE void setEvent( Event event, PipelineStageFlags stageMask ) const { vkCmdSetEvent( m_commandBuffer, static_cast( event ), static_cast( stageMask ) ); } -#endif /*VKCPP_ENHANCED_MODE*/ +#endif /*VKCPP_DISABLE_ENHANCED_MODE*/ -#ifndef VKCPP_ENHANCED_MODE +#ifdef VKCPP_DISABLE_ENHANCED_MODE void resetEvent( Event event, PipelineStageFlags stageMask ) const { vkCmdResetEvent( m_commandBuffer, static_cast( event ), static_cast( stageMask ) ); } -#endif /*!VKCPP_ENHANCED_MODE*/ +#endif /*!VKCPP_DISABLE_ENHANCED_MODE*/ -#ifdef VKCPP_ENHANCED_MODE +#ifndef VKCPP_DISABLE_ENHANCED_MODE void resetEvent( Event event, PipelineStageFlags stageMask ) const { vkCmdResetEvent( m_commandBuffer, static_cast( event ), static_cast( stageMask ) ); } -#endif /*VKCPP_ENHANCED_MODE*/ +#endif /*VKCPP_DISABLE_ENHANCED_MODE*/ void waitEvents( uint32_t eventCount, const Event* pEvents, PipelineStageFlags srcStageMask, PipelineStageFlags dstStageMask, uint32_t memoryBarrierCount, const MemoryBarrier* pMemoryBarriers, uint32_t bufferMemoryBarrierCount, const BufferMemoryBarrier* pBufferMemoryBarriers, uint32_t imageMemoryBarrierCount, const ImageMemoryBarrier* pImageMemoryBarriers ) const { vkCmdWaitEvents( m_commandBuffer, eventCount, reinterpret_cast( pEvents ), static_cast( srcStageMask ), static_cast( dstStageMask ), memoryBarrierCount, reinterpret_cast( pMemoryBarriers ), bufferMemoryBarrierCount, reinterpret_cast( pBufferMemoryBarriers ), imageMemoryBarrierCount, reinterpret_cast( pImageMemoryBarriers ) ); } -#ifdef VKCPP_ENHANCED_MODE +#ifndef VKCPP_DISABLE_ENHANCED_MODE void waitEvents( std::vector const & events, PipelineStageFlags srcStageMask, PipelineStageFlags dstStageMask, std::vector const & memoryBarriers, std::vector const & bufferMemoryBarriers, std::vector const & imageMemoryBarriers ) const { vkCmdWaitEvents( m_commandBuffer, static_cast( events.size() ), reinterpret_cast( events.data() ), static_cast( srcStageMask ), static_cast( dstStageMask ), static_cast( memoryBarriers.size() ), reinterpret_cast( memoryBarriers.data() ), static_cast( bufferMemoryBarriers.size() ), reinterpret_cast( bufferMemoryBarriers.data() ), static_cast( imageMemoryBarriers.size() ), reinterpret_cast( imageMemoryBarriers.data() ) ); @@ -18138,14 +18138,14 @@ namespace vk { vkCmdWaitEvents( m_commandBuffer, 1, reinterpret_cast( &event ), static_cast( srcStageMask ), static_cast( dstStageMask ), 1, reinterpret_cast( &memoryBarrier ), 1, reinterpret_cast( &bufferMemoryBarrier ), 1, reinterpret_cast( &imageMemoryBarrier ) ); } -#endif /*VKCPP_ENHANCED_MODE*/ +#endif /*VKCPP_DISABLE_ENHANCED_MODE*/ void pipelineBarrier( PipelineStageFlags srcStageMask, PipelineStageFlags dstStageMask, DependencyFlags dependencyFlags, uint32_t memoryBarrierCount, const MemoryBarrier* pMemoryBarriers, uint32_t bufferMemoryBarrierCount, const BufferMemoryBarrier* pBufferMemoryBarriers, uint32_t imageMemoryBarrierCount, const ImageMemoryBarrier* pImageMemoryBarriers ) const { vkCmdPipelineBarrier( m_commandBuffer, static_cast( srcStageMask ), static_cast( dstStageMask ), static_cast( dependencyFlags ), memoryBarrierCount, reinterpret_cast( pMemoryBarriers ), bufferMemoryBarrierCount, reinterpret_cast( pBufferMemoryBarriers ), imageMemoryBarrierCount, reinterpret_cast( pImageMemoryBarriers ) ); } -#ifdef VKCPP_ENHANCED_MODE +#ifndef VKCPP_DISABLE_ENHANCED_MODE void pipelineBarrier( PipelineStageFlags srcStageMask, PipelineStageFlags dstStageMask, DependencyFlags dependencyFlags, std::vector const & memoryBarriers, std::vector const & bufferMemoryBarriers, std::vector const & imageMemoryBarriers ) const { vkCmdPipelineBarrier( m_commandBuffer, static_cast( srcStageMask ), static_cast( dstStageMask ), static_cast( dependencyFlags ), static_cast( memoryBarriers.size() ), reinterpret_cast( memoryBarriers.data() ), static_cast( bufferMemoryBarriers.size() ), reinterpret_cast( bufferMemoryBarriers.data() ), static_cast( imageMemoryBarriers.size() ), reinterpret_cast( imageMemoryBarriers.data() ) ); @@ -18155,84 +18155,84 @@ namespace vk { vkCmdPipelineBarrier( m_commandBuffer, static_cast( srcStageMask ), static_cast( dstStageMask ), static_cast( dependencyFlags ), 1, reinterpret_cast( &memoryBarrier ), 1, reinterpret_cast( &bufferMemoryBarrier ), 1, reinterpret_cast( &imageMemoryBarrier ) ); } -#endif /*VKCPP_ENHANCED_MODE*/ +#endif /*VKCPP_DISABLE_ENHANCED_MODE*/ -#ifndef VKCPP_ENHANCED_MODE +#ifdef VKCPP_DISABLE_ENHANCED_MODE void beginQuery( QueryPool queryPool, uint32_t query, QueryControlFlags flags ) const { vkCmdBeginQuery( m_commandBuffer, static_cast( queryPool ), query, static_cast( flags ) ); } -#endif /*!VKCPP_ENHANCED_MODE*/ +#endif /*!VKCPP_DISABLE_ENHANCED_MODE*/ -#ifdef VKCPP_ENHANCED_MODE +#ifndef VKCPP_DISABLE_ENHANCED_MODE void beginQuery( QueryPool queryPool, uint32_t query, QueryControlFlags flags ) const { vkCmdBeginQuery( m_commandBuffer, static_cast( queryPool ), query, static_cast( flags ) ); } -#endif /*VKCPP_ENHANCED_MODE*/ +#endif /*VKCPP_DISABLE_ENHANCED_MODE*/ -#ifndef VKCPP_ENHANCED_MODE +#ifdef VKCPP_DISABLE_ENHANCED_MODE void endQuery( QueryPool queryPool, uint32_t query ) const { vkCmdEndQuery( m_commandBuffer, static_cast( queryPool ), query ); } -#endif /*!VKCPP_ENHANCED_MODE*/ +#endif /*!VKCPP_DISABLE_ENHANCED_MODE*/ -#ifdef VKCPP_ENHANCED_MODE +#ifndef VKCPP_DISABLE_ENHANCED_MODE void endQuery( QueryPool queryPool, uint32_t query ) const { vkCmdEndQuery( m_commandBuffer, static_cast( queryPool ), query ); } -#endif /*VKCPP_ENHANCED_MODE*/ +#endif /*VKCPP_DISABLE_ENHANCED_MODE*/ -#ifndef VKCPP_ENHANCED_MODE +#ifdef VKCPP_DISABLE_ENHANCED_MODE void resetQueryPool( QueryPool queryPool, uint32_t firstQuery, uint32_t queryCount ) const { vkCmdResetQueryPool( m_commandBuffer, static_cast( queryPool ), firstQuery, queryCount ); } -#endif /*!VKCPP_ENHANCED_MODE*/ +#endif /*!VKCPP_DISABLE_ENHANCED_MODE*/ -#ifdef VKCPP_ENHANCED_MODE +#ifndef VKCPP_DISABLE_ENHANCED_MODE void resetQueryPool( QueryPool queryPool, uint32_t firstQuery, uint32_t queryCount ) const { vkCmdResetQueryPool( m_commandBuffer, static_cast( queryPool ), firstQuery, queryCount ); } -#endif /*VKCPP_ENHANCED_MODE*/ +#endif /*VKCPP_DISABLE_ENHANCED_MODE*/ -#ifndef VKCPP_ENHANCED_MODE +#ifdef VKCPP_DISABLE_ENHANCED_MODE void writeTimestamp( PipelineStageFlagBits pipelineStage, QueryPool queryPool, uint32_t query ) const { vkCmdWriteTimestamp( m_commandBuffer, static_cast( pipelineStage ), static_cast( queryPool ), query ); } -#endif /*!VKCPP_ENHANCED_MODE*/ +#endif /*!VKCPP_DISABLE_ENHANCED_MODE*/ -#ifdef VKCPP_ENHANCED_MODE +#ifndef VKCPP_DISABLE_ENHANCED_MODE void writeTimestamp( PipelineStageFlagBits pipelineStage, QueryPool queryPool, uint32_t query ) const { vkCmdWriteTimestamp( m_commandBuffer, static_cast( pipelineStage ), static_cast( queryPool ), query ); } -#endif /*VKCPP_ENHANCED_MODE*/ +#endif /*VKCPP_DISABLE_ENHANCED_MODE*/ -#ifndef VKCPP_ENHANCED_MODE +#ifdef VKCPP_DISABLE_ENHANCED_MODE void copyQueryPoolResults( QueryPool queryPool, uint32_t firstQuery, uint32_t queryCount, Buffer dstBuffer, DeviceSize dstOffset, DeviceSize stride, QueryResultFlags flags ) const { vkCmdCopyQueryPoolResults( m_commandBuffer, static_cast( queryPool ), firstQuery, queryCount, static_cast( dstBuffer ), dstOffset, stride, static_cast( flags ) ); } -#endif /*!VKCPP_ENHANCED_MODE*/ +#endif /*!VKCPP_DISABLE_ENHANCED_MODE*/ -#ifdef VKCPP_ENHANCED_MODE +#ifndef VKCPP_DISABLE_ENHANCED_MODE void copyQueryPoolResults( QueryPool queryPool, uint32_t firstQuery, uint32_t queryCount, Buffer dstBuffer, DeviceSize dstOffset, DeviceSize stride, QueryResultFlags flags ) const { vkCmdCopyQueryPoolResults( m_commandBuffer, static_cast( queryPool ), firstQuery, queryCount, static_cast( dstBuffer ), dstOffset, stride, static_cast( flags ) ); } -#endif /*VKCPP_ENHANCED_MODE*/ +#endif /*VKCPP_DISABLE_ENHANCED_MODE*/ void pushConstants( PipelineLayout layout, ShaderStageFlags stageFlags, uint32_t offset, uint32_t size, const void* pValues ) const { vkCmdPushConstants( m_commandBuffer, static_cast( layout ), static_cast( stageFlags ), offset, size, pValues ); } -#ifdef VKCPP_ENHANCED_MODE +#ifndef VKCPP_DISABLE_ENHANCED_MODE template void pushConstants( PipelineLayout layout, ShaderStageFlags stageFlags, uint32_t offset, std::vector const & values ) const { @@ -18244,54 +18244,54 @@ namespace vk { vkCmdPushConstants( m_commandBuffer, static_cast( layout ), static_cast( stageFlags ), offset, static_cast( sizeof( T ) ), reinterpret_cast( &value ) ); } -#endif /*VKCPP_ENHANCED_MODE*/ +#endif /*VKCPP_DISABLE_ENHANCED_MODE*/ void beginRenderPass( const RenderPassBeginInfo* pRenderPassBegin, SubpassContents contents ) const { vkCmdBeginRenderPass( m_commandBuffer, reinterpret_cast( pRenderPassBegin ), static_cast( contents ) ); } -#ifdef VKCPP_ENHANCED_MODE +#ifndef VKCPP_DISABLE_ENHANCED_MODE void beginRenderPass( const RenderPassBeginInfo & renderPassBegin, SubpassContents contents ) const { vkCmdBeginRenderPass( m_commandBuffer, reinterpret_cast( &renderPassBegin ), static_cast( contents ) ); } -#endif /*VKCPP_ENHANCED_MODE*/ +#endif /*VKCPP_DISABLE_ENHANCED_MODE*/ -#ifndef VKCPP_ENHANCED_MODE +#ifdef VKCPP_DISABLE_ENHANCED_MODE void nextSubpass( SubpassContents contents ) const { vkCmdNextSubpass( m_commandBuffer, static_cast( contents ) ); } -#endif /*!VKCPP_ENHANCED_MODE*/ +#endif /*!VKCPP_DISABLE_ENHANCED_MODE*/ -#ifdef VKCPP_ENHANCED_MODE +#ifndef VKCPP_DISABLE_ENHANCED_MODE void nextSubpass( SubpassContents contents ) const { vkCmdNextSubpass( m_commandBuffer, static_cast( contents ) ); } -#endif /*VKCPP_ENHANCED_MODE*/ +#endif /*VKCPP_DISABLE_ENHANCED_MODE*/ -#ifndef VKCPP_ENHANCED_MODE +#ifdef VKCPP_DISABLE_ENHANCED_MODE void endRenderPass( ) const { vkCmdEndRenderPass( m_commandBuffer ); } -#endif /*!VKCPP_ENHANCED_MODE*/ +#endif /*!VKCPP_DISABLE_ENHANCED_MODE*/ -#ifdef VKCPP_ENHANCED_MODE +#ifndef VKCPP_DISABLE_ENHANCED_MODE void endRenderPass() const { vkCmdEndRenderPass( m_commandBuffer ); } -#endif /*VKCPP_ENHANCED_MODE*/ +#endif /*VKCPP_DISABLE_ENHANCED_MODE*/ void executeCommands( uint32_t commandBufferCount, const CommandBuffer* pCommandBuffers ) const { vkCmdExecuteCommands( m_commandBuffer, commandBufferCount, reinterpret_cast( pCommandBuffers ) ); } -#ifdef VKCPP_ENHANCED_MODE +#ifndef VKCPP_DISABLE_ENHANCED_MODE void executeCommands( std::vector const & commandBuffers ) const { vkCmdExecuteCommands( m_commandBuffer, static_cast( commandBuffers.size() ), reinterpret_cast( commandBuffers.data() ) ); @@ -18301,7 +18301,7 @@ namespace vk { vkCmdExecuteCommands( m_commandBuffer, 1, reinterpret_cast( &commandBuffer ) ); } -#endif /*VKCPP_ENHANCED_MODE*/ +#endif /*VKCPP_DISABLE_ENHANCED_MODE*/ #if !defined(VK_CPP_TYPESAFE_CONVERSION) explicit @@ -18871,7 +18871,7 @@ namespace vk return static_cast( vkQueueSubmit( m_queue, submitCount, reinterpret_cast( pSubmits ), static_cast( fence ) ) ); } -#ifdef VKCPP_ENHANCED_MODE +#ifndef VKCPP_DISABLE_ENHANCED_MODE void submit( std::vector const & submits, Fence fence ) const { Result result = static_cast( vkQueueSubmit( m_queue, static_cast( submits.size() ), reinterpret_cast( submits.data() ), static_cast( fence ) ) ); @@ -18889,16 +18889,16 @@ namespace vk throw std::system_error( result, "vk::Queue::submit" ); } } -#endif /*VKCPP_ENHANCED_MODE*/ +#endif /*VKCPP_DISABLE_ENHANCED_MODE*/ -#ifndef VKCPP_ENHANCED_MODE +#ifdef VKCPP_DISABLE_ENHANCED_MODE Result waitIdle( ) const { return static_cast( vkQueueWaitIdle( m_queue ) ); } -#endif /*!VKCPP_ENHANCED_MODE*/ +#endif /*!VKCPP_DISABLE_ENHANCED_MODE*/ -#ifdef VKCPP_ENHANCED_MODE +#ifndef VKCPP_DISABLE_ENHANCED_MODE void waitIdle() const { Result result = static_cast( vkQueueWaitIdle( m_queue ) ); @@ -18907,14 +18907,14 @@ namespace vk throw std::system_error( result, "vk::Queue::waitIdle" ); } } -#endif /*VKCPP_ENHANCED_MODE*/ +#endif /*VKCPP_DISABLE_ENHANCED_MODE*/ Result bindSparse( uint32_t bindInfoCount, const BindSparseInfo* pBindInfo, Fence fence ) const { return static_cast( vkQueueBindSparse( m_queue, bindInfoCount, reinterpret_cast( pBindInfo ), static_cast( fence ) ) ); } -#ifdef VKCPP_ENHANCED_MODE +#ifndef VKCPP_DISABLE_ENHANCED_MODE void bindSparse( std::vector const & bindInfo, Fence fence ) const { Result result = static_cast( vkQueueBindSparse( m_queue, static_cast( bindInfo.size() ), reinterpret_cast( bindInfo.data() ), static_cast( fence ) ) ); @@ -18932,14 +18932,14 @@ namespace vk throw std::system_error( result, "vk::Queue::bindSparse" ); } } -#endif /*VKCPP_ENHANCED_MODE*/ +#endif /*VKCPP_DISABLE_ENHANCED_MODE*/ Result presentKHR( const PresentInfoKHR* pPresentInfo ) const { return static_cast( vkQueuePresentKHR( m_queue, reinterpret_cast( pPresentInfo ) ) ); } -#ifdef VKCPP_ENHANCED_MODE +#ifndef VKCPP_DISABLE_ENHANCED_MODE Result presentKHR( const PresentInfoKHR & presentInfo ) const { Result result = static_cast( vkQueuePresentKHR( m_queue, reinterpret_cast( &presentInfo ) ) ); @@ -18949,7 +18949,7 @@ namespace vk } return result; } -#endif /*VKCPP_ENHANCED_MODE*/ +#endif /*VKCPP_DISABLE_ENHANCED_MODE*/ #if !defined(VK_CPP_TYPESAFE_CONVERSION) explicit @@ -20205,47 +20205,47 @@ namespace vk return vkGetDeviceProcAddr( m_device, pName ); } -#ifdef VKCPP_ENHANCED_MODE +#ifndef VKCPP_DISABLE_ENHANCED_MODE PFN_vkVoidFunction getProcAddr( std::string const & name ) const { return vkGetDeviceProcAddr( m_device, name.c_str() ); } -#endif /*VKCPP_ENHANCED_MODE*/ +#endif /*VKCPP_DISABLE_ENHANCED_MODE*/ void destroy( const AllocationCallbacks* pAllocator ) const { vkDestroyDevice( m_device, reinterpret_cast( pAllocator ) ); } -#ifdef VKCPP_ENHANCED_MODE +#ifndef VKCPP_DISABLE_ENHANCED_MODE void destroy( Optional const & allocator = nullptr ) const { vkDestroyDevice( m_device, reinterpret_cast( static_cast( allocator)) ); } -#endif /*VKCPP_ENHANCED_MODE*/ +#endif /*VKCPP_DISABLE_ENHANCED_MODE*/ void getQueue( uint32_t queueFamilyIndex, uint32_t queueIndex, Queue* pQueue ) const { vkGetDeviceQueue( m_device, queueFamilyIndex, queueIndex, reinterpret_cast( pQueue ) ); } -#ifdef VKCPP_ENHANCED_MODE +#ifndef VKCPP_DISABLE_ENHANCED_MODE Queue getQueue( uint32_t queueFamilyIndex, uint32_t queueIndex ) const { Queue queue; vkGetDeviceQueue( m_device, queueFamilyIndex, queueIndex, reinterpret_cast( &queue ) ); return queue; } -#endif /*VKCPP_ENHANCED_MODE*/ +#endif /*VKCPP_DISABLE_ENHANCED_MODE*/ -#ifndef VKCPP_ENHANCED_MODE +#ifdef VKCPP_DISABLE_ENHANCED_MODE Result waitIdle( ) const { return static_cast( vkDeviceWaitIdle( m_device ) ); } -#endif /*!VKCPP_ENHANCED_MODE*/ +#endif /*!VKCPP_DISABLE_ENHANCED_MODE*/ -#ifdef VKCPP_ENHANCED_MODE +#ifndef VKCPP_DISABLE_ENHANCED_MODE void waitIdle() const { Result result = static_cast( vkDeviceWaitIdle( m_device ) ); @@ -20254,14 +20254,14 @@ namespace vk throw std::system_error( result, "vk::Device::waitIdle" ); } } -#endif /*VKCPP_ENHANCED_MODE*/ +#endif /*VKCPP_DISABLE_ENHANCED_MODE*/ Result allocateMemory( const MemoryAllocateInfo* pAllocateInfo, const AllocationCallbacks* pAllocator, DeviceMemory* pMemory ) const { return static_cast( vkAllocateMemory( m_device, reinterpret_cast( pAllocateInfo ), reinterpret_cast( pAllocator ), reinterpret_cast( pMemory ) ) ); } -#ifdef VKCPP_ENHANCED_MODE +#ifndef VKCPP_DISABLE_ENHANCED_MODE DeviceMemory allocateMemory( const MemoryAllocateInfo & allocateInfo, Optional const & allocator = nullptr ) const { DeviceMemory memory; @@ -20272,28 +20272,28 @@ namespace vk } return memory; } -#endif /*VKCPP_ENHANCED_MODE*/ +#endif /*VKCPP_DISABLE_ENHANCED_MODE*/ void freeMemory( DeviceMemory memory, const AllocationCallbacks* pAllocator ) const { vkFreeMemory( m_device, static_cast( memory ), reinterpret_cast( pAllocator ) ); } -#ifdef VKCPP_ENHANCED_MODE +#ifndef VKCPP_DISABLE_ENHANCED_MODE void freeMemory( DeviceMemory memory, Optional const & allocator = nullptr ) const { vkFreeMemory( m_device, static_cast( memory ), reinterpret_cast( static_cast( allocator)) ); } -#endif /*VKCPP_ENHANCED_MODE*/ +#endif /*VKCPP_DISABLE_ENHANCED_MODE*/ -#ifndef VKCPP_ENHANCED_MODE +#ifdef VKCPP_DISABLE_ENHANCED_MODE Result mapMemory( DeviceMemory memory, DeviceSize offset, DeviceSize size, MemoryMapFlags flags, void** ppData ) const { return static_cast( vkMapMemory( m_device, static_cast( memory ), offset, size, static_cast( flags ), ppData ) ); } -#endif /*!VKCPP_ENHANCED_MODE*/ +#endif /*!VKCPP_DISABLE_ENHANCED_MODE*/ -#ifdef VKCPP_ENHANCED_MODE +#ifndef VKCPP_DISABLE_ENHANCED_MODE void* mapMemory( DeviceMemory memory, DeviceSize offset, DeviceSize size, MemoryMapFlags flags ) const { void* pData; @@ -20304,28 +20304,28 @@ namespace vk } return pData; } -#endif /*VKCPP_ENHANCED_MODE*/ +#endif /*VKCPP_DISABLE_ENHANCED_MODE*/ -#ifndef VKCPP_ENHANCED_MODE +#ifdef VKCPP_DISABLE_ENHANCED_MODE void unmapMemory( DeviceMemory memory ) const { vkUnmapMemory( m_device, static_cast( memory ) ); } -#endif /*!VKCPP_ENHANCED_MODE*/ +#endif /*!VKCPP_DISABLE_ENHANCED_MODE*/ -#ifdef VKCPP_ENHANCED_MODE +#ifndef VKCPP_DISABLE_ENHANCED_MODE void unmapMemory( DeviceMemory memory ) const { vkUnmapMemory( m_device, static_cast( memory ) ); } -#endif /*VKCPP_ENHANCED_MODE*/ +#endif /*VKCPP_DISABLE_ENHANCED_MODE*/ Result flushMappedMemoryRanges( uint32_t memoryRangeCount, const MappedMemoryRange* pMemoryRanges ) const { return static_cast( vkFlushMappedMemoryRanges( m_device, memoryRangeCount, reinterpret_cast( pMemoryRanges ) ) ); } -#ifdef VKCPP_ENHANCED_MODE +#ifndef VKCPP_DISABLE_ENHANCED_MODE void flushMappedMemoryRanges( std::vector const & memoryRanges ) const { Result result = static_cast( vkFlushMappedMemoryRanges( m_device, static_cast( memoryRanges.size() ), reinterpret_cast( memoryRanges.data() ) ) ); @@ -20343,14 +20343,14 @@ namespace vk throw std::system_error( result, "vk::Device::flushMappedMemoryRanges" ); } } -#endif /*VKCPP_ENHANCED_MODE*/ +#endif /*VKCPP_DISABLE_ENHANCED_MODE*/ Result invalidateMappedMemoryRanges( uint32_t memoryRangeCount, const MappedMemoryRange* pMemoryRanges ) const { return static_cast( vkInvalidateMappedMemoryRanges( m_device, memoryRangeCount, reinterpret_cast( pMemoryRanges ) ) ); } -#ifdef VKCPP_ENHANCED_MODE +#ifndef VKCPP_DISABLE_ENHANCED_MODE void invalidateMappedMemoryRanges( std::vector const & memoryRanges ) const { Result result = static_cast( vkInvalidateMappedMemoryRanges( m_device, static_cast( memoryRanges.size() ), reinterpret_cast( memoryRanges.data() ) ) ); @@ -20368,44 +20368,44 @@ namespace vk throw std::system_error( result, "vk::Device::invalidateMappedMemoryRanges" ); } } -#endif /*VKCPP_ENHANCED_MODE*/ +#endif /*VKCPP_DISABLE_ENHANCED_MODE*/ void getMemoryCommitment( DeviceMemory memory, DeviceSize* pCommittedMemoryInBytes ) const { vkGetDeviceMemoryCommitment( m_device, static_cast( memory ), pCommittedMemoryInBytes ); } -#ifdef VKCPP_ENHANCED_MODE +#ifndef VKCPP_DISABLE_ENHANCED_MODE DeviceSize getMemoryCommitment( DeviceMemory memory ) const { DeviceSize committedMemoryInBytes; vkGetDeviceMemoryCommitment( m_device, static_cast( memory ), &committedMemoryInBytes ); return committedMemoryInBytes; } -#endif /*VKCPP_ENHANCED_MODE*/ +#endif /*VKCPP_DISABLE_ENHANCED_MODE*/ void getBufferMemoryRequirements( Buffer buffer, MemoryRequirements* pMemoryRequirements ) const { vkGetBufferMemoryRequirements( m_device, static_cast( buffer ), reinterpret_cast( pMemoryRequirements ) ); } -#ifdef VKCPP_ENHANCED_MODE +#ifndef VKCPP_DISABLE_ENHANCED_MODE MemoryRequirements getBufferMemoryRequirements( Buffer buffer ) const { MemoryRequirements memoryRequirements; vkGetBufferMemoryRequirements( m_device, static_cast( buffer ), reinterpret_cast( &memoryRequirements ) ); return memoryRequirements; } -#endif /*VKCPP_ENHANCED_MODE*/ +#endif /*VKCPP_DISABLE_ENHANCED_MODE*/ -#ifndef VKCPP_ENHANCED_MODE +#ifdef VKCPP_DISABLE_ENHANCED_MODE Result bindBufferMemory( Buffer buffer, DeviceMemory memory, DeviceSize memoryOffset ) const { return static_cast( vkBindBufferMemory( m_device, static_cast( buffer ), static_cast( memory ), memoryOffset ) ); } -#endif /*!VKCPP_ENHANCED_MODE*/ +#endif /*!VKCPP_DISABLE_ENHANCED_MODE*/ -#ifdef VKCPP_ENHANCED_MODE +#ifndef VKCPP_DISABLE_ENHANCED_MODE void bindBufferMemory( Buffer buffer, DeviceMemory memory, DeviceSize memoryOffset ) const { Result result = static_cast( vkBindBufferMemory( m_device, static_cast( buffer ), static_cast( memory ), memoryOffset ) ); @@ -20414,30 +20414,30 @@ namespace vk throw std::system_error( result, "vk::Device::bindBufferMemory" ); } } -#endif /*VKCPP_ENHANCED_MODE*/ +#endif /*VKCPP_DISABLE_ENHANCED_MODE*/ void getImageMemoryRequirements( Image image, MemoryRequirements* pMemoryRequirements ) const { vkGetImageMemoryRequirements( m_device, static_cast( image ), reinterpret_cast( pMemoryRequirements ) ); } -#ifdef VKCPP_ENHANCED_MODE +#ifndef VKCPP_DISABLE_ENHANCED_MODE MemoryRequirements getImageMemoryRequirements( Image image ) const { MemoryRequirements memoryRequirements; vkGetImageMemoryRequirements( m_device, static_cast( image ), reinterpret_cast( &memoryRequirements ) ); return memoryRequirements; } -#endif /*VKCPP_ENHANCED_MODE*/ +#endif /*VKCPP_DISABLE_ENHANCED_MODE*/ -#ifndef VKCPP_ENHANCED_MODE +#ifdef VKCPP_DISABLE_ENHANCED_MODE Result bindImageMemory( Image image, DeviceMemory memory, DeviceSize memoryOffset ) const { return static_cast( vkBindImageMemory( m_device, static_cast( image ), static_cast( memory ), memoryOffset ) ); } -#endif /*!VKCPP_ENHANCED_MODE*/ +#endif /*!VKCPP_DISABLE_ENHANCED_MODE*/ -#ifdef VKCPP_ENHANCED_MODE +#ifndef VKCPP_DISABLE_ENHANCED_MODE void bindImageMemory( Image image, DeviceMemory memory, DeviceSize memoryOffset ) const { Result result = static_cast( vkBindImageMemory( m_device, static_cast( image ), static_cast( memory ), memoryOffset ) ); @@ -20446,14 +20446,14 @@ namespace vk throw std::system_error( result, "vk::Device::bindImageMemory" ); } } -#endif /*VKCPP_ENHANCED_MODE*/ +#endif /*VKCPP_DISABLE_ENHANCED_MODE*/ void getImageSparseMemoryRequirements( Image image, uint32_t* pSparseMemoryRequirementCount, SparseImageMemoryRequirements* pSparseMemoryRequirements ) const { vkGetImageSparseMemoryRequirements( m_device, static_cast( image ), pSparseMemoryRequirementCount, reinterpret_cast( pSparseMemoryRequirements ) ); } -#ifdef VKCPP_ENHANCED_MODE +#ifndef VKCPP_DISABLE_ENHANCED_MODE std::vector getImageSparseMemoryRequirements( Image image ) const { std::vector sparseMemoryRequirements; @@ -20463,14 +20463,14 @@ namespace vk vkGetImageSparseMemoryRequirements( m_device, static_cast( image ), &sparseMemoryRequirementCount, reinterpret_cast( sparseMemoryRequirements.data() ) ); return sparseMemoryRequirements; } -#endif /*VKCPP_ENHANCED_MODE*/ +#endif /*VKCPP_DISABLE_ENHANCED_MODE*/ Result createFence( const FenceCreateInfo* pCreateInfo, const AllocationCallbacks* pAllocator, Fence* pFence ) const { return static_cast( vkCreateFence( m_device, reinterpret_cast( pCreateInfo ), reinterpret_cast( pAllocator ), reinterpret_cast( pFence ) ) ); } -#ifdef VKCPP_ENHANCED_MODE +#ifndef VKCPP_DISABLE_ENHANCED_MODE Fence createFence( const FenceCreateInfo & createInfo, Optional const & allocator = nullptr ) const { Fence fence; @@ -20481,26 +20481,26 @@ namespace vk } return fence; } -#endif /*VKCPP_ENHANCED_MODE*/ +#endif /*VKCPP_DISABLE_ENHANCED_MODE*/ void destroyFence( Fence fence, const AllocationCallbacks* pAllocator ) const { vkDestroyFence( m_device, static_cast( fence ), reinterpret_cast( pAllocator ) ); } -#ifdef VKCPP_ENHANCED_MODE +#ifndef VKCPP_DISABLE_ENHANCED_MODE void destroyFence( Fence fence, Optional const & allocator = nullptr ) const { vkDestroyFence( m_device, static_cast( fence ), reinterpret_cast( static_cast( allocator)) ); } -#endif /*VKCPP_ENHANCED_MODE*/ +#endif /*VKCPP_DISABLE_ENHANCED_MODE*/ Result resetFences( uint32_t fenceCount, const Fence* pFences ) const { return static_cast( vkResetFences( m_device, fenceCount, reinterpret_cast( pFences ) ) ); } -#ifdef VKCPP_ENHANCED_MODE +#ifndef VKCPP_DISABLE_ENHANCED_MODE void resetFences( std::vector const & fences ) const { Result result = static_cast( vkResetFences( m_device, static_cast( fences.size() ), reinterpret_cast( fences.data() ) ) ); @@ -20518,16 +20518,16 @@ namespace vk throw std::system_error( result, "vk::Device::resetFences" ); } } -#endif /*VKCPP_ENHANCED_MODE*/ +#endif /*VKCPP_DISABLE_ENHANCED_MODE*/ -#ifndef VKCPP_ENHANCED_MODE +#ifdef VKCPP_DISABLE_ENHANCED_MODE Result getFenceStatus( Fence fence ) const { return static_cast( vkGetFenceStatus( m_device, static_cast( fence ) ) ); } -#endif /*!VKCPP_ENHANCED_MODE*/ +#endif /*!VKCPP_DISABLE_ENHANCED_MODE*/ -#ifdef VKCPP_ENHANCED_MODE +#ifndef VKCPP_DISABLE_ENHANCED_MODE Result getFenceStatus( Fence fence ) const { Result result = static_cast( vkGetFenceStatus( m_device, static_cast( fence ) ) ); @@ -20537,14 +20537,14 @@ namespace vk } return result; } -#endif /*VKCPP_ENHANCED_MODE*/ +#endif /*VKCPP_DISABLE_ENHANCED_MODE*/ Result waitForFences( uint32_t fenceCount, const Fence* pFences, Bool32 waitAll, uint64_t timeout ) const { return static_cast( vkWaitForFences( m_device, fenceCount, reinterpret_cast( pFences ), waitAll, timeout ) ); } -#ifdef VKCPP_ENHANCED_MODE +#ifndef VKCPP_DISABLE_ENHANCED_MODE Result waitForFences( std::vector const & fences, Bool32 waitAll, uint64_t timeout ) const { Result result = static_cast( vkWaitForFences( m_device, static_cast( fences.size() ), reinterpret_cast( fences.data() ), waitAll, timeout ) ); @@ -20564,14 +20564,14 @@ namespace vk } return result; } -#endif /*VKCPP_ENHANCED_MODE*/ +#endif /*VKCPP_DISABLE_ENHANCED_MODE*/ Result createSemaphore( const SemaphoreCreateInfo* pCreateInfo, const AllocationCallbacks* pAllocator, Semaphore* pSemaphore ) const { return static_cast( vkCreateSemaphore( m_device, reinterpret_cast( pCreateInfo ), reinterpret_cast( pAllocator ), reinterpret_cast( pSemaphore ) ) ); } -#ifdef VKCPP_ENHANCED_MODE +#ifndef VKCPP_DISABLE_ENHANCED_MODE Semaphore createSemaphore( const SemaphoreCreateInfo & createInfo, Optional const & allocator = nullptr ) const { Semaphore semaphore; @@ -20582,26 +20582,26 @@ namespace vk } return semaphore; } -#endif /*VKCPP_ENHANCED_MODE*/ +#endif /*VKCPP_DISABLE_ENHANCED_MODE*/ void destroySemaphore( Semaphore semaphore, const AllocationCallbacks* pAllocator ) const { vkDestroySemaphore( m_device, static_cast( semaphore ), reinterpret_cast( pAllocator ) ); } -#ifdef VKCPP_ENHANCED_MODE +#ifndef VKCPP_DISABLE_ENHANCED_MODE void destroySemaphore( Semaphore semaphore, Optional const & allocator = nullptr ) const { vkDestroySemaphore( m_device, static_cast( semaphore ), reinterpret_cast( static_cast( allocator)) ); } -#endif /*VKCPP_ENHANCED_MODE*/ +#endif /*VKCPP_DISABLE_ENHANCED_MODE*/ Result createEvent( const EventCreateInfo* pCreateInfo, const AllocationCallbacks* pAllocator, Event* pEvent ) const { return static_cast( vkCreateEvent( m_device, reinterpret_cast( pCreateInfo ), reinterpret_cast( pAllocator ), reinterpret_cast( pEvent ) ) ); } -#ifdef VKCPP_ENHANCED_MODE +#ifndef VKCPP_DISABLE_ENHANCED_MODE Event createEvent( const EventCreateInfo & createInfo, Optional const & allocator = nullptr ) const { Event event; @@ -20612,28 +20612,28 @@ namespace vk } return event; } -#endif /*VKCPP_ENHANCED_MODE*/ +#endif /*VKCPP_DISABLE_ENHANCED_MODE*/ void destroyEvent( Event event, const AllocationCallbacks* pAllocator ) const { vkDestroyEvent( m_device, static_cast( event ), reinterpret_cast( pAllocator ) ); } -#ifdef VKCPP_ENHANCED_MODE +#ifndef VKCPP_DISABLE_ENHANCED_MODE void destroyEvent( Event event, Optional const & allocator = nullptr ) const { vkDestroyEvent( m_device, static_cast( event ), reinterpret_cast( static_cast( allocator)) ); } -#endif /*VKCPP_ENHANCED_MODE*/ +#endif /*VKCPP_DISABLE_ENHANCED_MODE*/ -#ifndef VKCPP_ENHANCED_MODE +#ifdef VKCPP_DISABLE_ENHANCED_MODE Result getEventStatus( Event event ) const { return static_cast( vkGetEventStatus( m_device, static_cast( event ) ) ); } -#endif /*!VKCPP_ENHANCED_MODE*/ +#endif /*!VKCPP_DISABLE_ENHANCED_MODE*/ -#ifdef VKCPP_ENHANCED_MODE +#ifndef VKCPP_DISABLE_ENHANCED_MODE Result getEventStatus( Event event ) const { Result result = static_cast( vkGetEventStatus( m_device, static_cast( event ) ) ); @@ -20643,16 +20643,16 @@ namespace vk } return result; } -#endif /*VKCPP_ENHANCED_MODE*/ +#endif /*VKCPP_DISABLE_ENHANCED_MODE*/ -#ifndef VKCPP_ENHANCED_MODE +#ifdef VKCPP_DISABLE_ENHANCED_MODE Result setEvent( Event event ) const { return static_cast( vkSetEvent( m_device, static_cast( event ) ) ); } -#endif /*!VKCPP_ENHANCED_MODE*/ +#endif /*!VKCPP_DISABLE_ENHANCED_MODE*/ -#ifdef VKCPP_ENHANCED_MODE +#ifndef VKCPP_DISABLE_ENHANCED_MODE void setEvent( Event event ) const { Result result = static_cast( vkSetEvent( m_device, static_cast( event ) ) ); @@ -20661,16 +20661,16 @@ namespace vk throw std::system_error( result, "vk::Device::setEvent" ); } } -#endif /*VKCPP_ENHANCED_MODE*/ +#endif /*VKCPP_DISABLE_ENHANCED_MODE*/ -#ifndef VKCPP_ENHANCED_MODE +#ifdef VKCPP_DISABLE_ENHANCED_MODE Result resetEvent( Event event ) const { return static_cast( vkResetEvent( m_device, static_cast( event ) ) ); } -#endif /*!VKCPP_ENHANCED_MODE*/ +#endif /*!VKCPP_DISABLE_ENHANCED_MODE*/ -#ifdef VKCPP_ENHANCED_MODE +#ifndef VKCPP_DISABLE_ENHANCED_MODE void resetEvent( Event event ) const { Result result = static_cast( vkResetEvent( m_device, static_cast( event ) ) ); @@ -20679,14 +20679,14 @@ namespace vk throw std::system_error( result, "vk::Device::resetEvent" ); } } -#endif /*VKCPP_ENHANCED_MODE*/ +#endif /*VKCPP_DISABLE_ENHANCED_MODE*/ Result createQueryPool( const QueryPoolCreateInfo* pCreateInfo, const AllocationCallbacks* pAllocator, QueryPool* pQueryPool ) const { return static_cast( vkCreateQueryPool( m_device, reinterpret_cast( pCreateInfo ), reinterpret_cast( pAllocator ), reinterpret_cast( pQueryPool ) ) ); } -#ifdef VKCPP_ENHANCED_MODE +#ifndef VKCPP_DISABLE_ENHANCED_MODE QueryPool createQueryPool( const QueryPoolCreateInfo & createInfo, Optional const & allocator = nullptr ) const { QueryPool queryPool; @@ -20697,26 +20697,26 @@ namespace vk } return queryPool; } -#endif /*VKCPP_ENHANCED_MODE*/ +#endif /*VKCPP_DISABLE_ENHANCED_MODE*/ void destroyQueryPool( QueryPool queryPool, const AllocationCallbacks* pAllocator ) const { vkDestroyQueryPool( m_device, static_cast( queryPool ), reinterpret_cast( pAllocator ) ); } -#ifdef VKCPP_ENHANCED_MODE +#ifndef VKCPP_DISABLE_ENHANCED_MODE void destroyQueryPool( QueryPool queryPool, Optional const & allocator = nullptr ) const { vkDestroyQueryPool( m_device, static_cast( queryPool ), reinterpret_cast( static_cast( allocator)) ); } -#endif /*VKCPP_ENHANCED_MODE*/ +#endif /*VKCPP_DISABLE_ENHANCED_MODE*/ Result getQueryPoolResults( QueryPool queryPool, uint32_t firstQuery, uint32_t queryCount, size_t dataSize, void* pData, DeviceSize stride, QueryResultFlags flags ) const { return static_cast( vkGetQueryPoolResults( m_device, static_cast( queryPool ), firstQuery, queryCount, dataSize, pData, stride, static_cast( flags ) ) ); } -#ifdef VKCPP_ENHANCED_MODE +#ifndef VKCPP_DISABLE_ENHANCED_MODE template Result getQueryPoolResults( QueryPool queryPool, uint32_t firstQuery, uint32_t queryCount, std::vector & data, DeviceSize stride, QueryResultFlags flags ) const { @@ -20727,14 +20727,14 @@ namespace vk } return result; } -#endif /*VKCPP_ENHANCED_MODE*/ +#endif /*VKCPP_DISABLE_ENHANCED_MODE*/ Result createBuffer( const BufferCreateInfo* pCreateInfo, const AllocationCallbacks* pAllocator, Buffer* pBuffer ) const { return static_cast( vkCreateBuffer( m_device, reinterpret_cast( pCreateInfo ), reinterpret_cast( pAllocator ), reinterpret_cast( pBuffer ) ) ); } -#ifdef VKCPP_ENHANCED_MODE +#ifndef VKCPP_DISABLE_ENHANCED_MODE Buffer createBuffer( const BufferCreateInfo & createInfo, Optional const & allocator = nullptr ) const { Buffer buffer; @@ -20745,26 +20745,26 @@ namespace vk } return buffer; } -#endif /*VKCPP_ENHANCED_MODE*/ +#endif /*VKCPP_DISABLE_ENHANCED_MODE*/ void destroyBuffer( Buffer buffer, const AllocationCallbacks* pAllocator ) const { vkDestroyBuffer( m_device, static_cast( buffer ), reinterpret_cast( pAllocator ) ); } -#ifdef VKCPP_ENHANCED_MODE +#ifndef VKCPP_DISABLE_ENHANCED_MODE void destroyBuffer( Buffer buffer, Optional const & allocator = nullptr ) const { vkDestroyBuffer( m_device, static_cast( buffer ), reinterpret_cast( static_cast( allocator)) ); } -#endif /*VKCPP_ENHANCED_MODE*/ +#endif /*VKCPP_DISABLE_ENHANCED_MODE*/ Result createBufferView( const BufferViewCreateInfo* pCreateInfo, const AllocationCallbacks* pAllocator, BufferView* pView ) const { return static_cast( vkCreateBufferView( m_device, reinterpret_cast( pCreateInfo ), reinterpret_cast( pAllocator ), reinterpret_cast( pView ) ) ); } -#ifdef VKCPP_ENHANCED_MODE +#ifndef VKCPP_DISABLE_ENHANCED_MODE BufferView createBufferView( const BufferViewCreateInfo & createInfo, Optional const & allocator = nullptr ) const { BufferView view; @@ -20775,26 +20775,26 @@ namespace vk } return view; } -#endif /*VKCPP_ENHANCED_MODE*/ +#endif /*VKCPP_DISABLE_ENHANCED_MODE*/ void destroyBufferView( BufferView bufferView, const AllocationCallbacks* pAllocator ) const { vkDestroyBufferView( m_device, static_cast( bufferView ), reinterpret_cast( pAllocator ) ); } -#ifdef VKCPP_ENHANCED_MODE +#ifndef VKCPP_DISABLE_ENHANCED_MODE void destroyBufferView( BufferView bufferView, Optional const & allocator = nullptr ) const { vkDestroyBufferView( m_device, static_cast( bufferView ), reinterpret_cast( static_cast( allocator)) ); } -#endif /*VKCPP_ENHANCED_MODE*/ +#endif /*VKCPP_DISABLE_ENHANCED_MODE*/ Result createImage( const ImageCreateInfo* pCreateInfo, const AllocationCallbacks* pAllocator, Image* pImage ) const { return static_cast( vkCreateImage( m_device, reinterpret_cast( pCreateInfo ), reinterpret_cast( pAllocator ), reinterpret_cast( pImage ) ) ); } -#ifdef VKCPP_ENHANCED_MODE +#ifndef VKCPP_DISABLE_ENHANCED_MODE Image createImage( const ImageCreateInfo & createInfo, Optional const & allocator = nullptr ) const { Image image; @@ -20805,40 +20805,40 @@ namespace vk } return image; } -#endif /*VKCPP_ENHANCED_MODE*/ +#endif /*VKCPP_DISABLE_ENHANCED_MODE*/ void destroyImage( Image image, const AllocationCallbacks* pAllocator ) const { vkDestroyImage( m_device, static_cast( image ), reinterpret_cast( pAllocator ) ); } -#ifdef VKCPP_ENHANCED_MODE +#ifndef VKCPP_DISABLE_ENHANCED_MODE void destroyImage( Image image, Optional const & allocator = nullptr ) const { vkDestroyImage( m_device, static_cast( image ), reinterpret_cast( static_cast( allocator)) ); } -#endif /*VKCPP_ENHANCED_MODE*/ +#endif /*VKCPP_DISABLE_ENHANCED_MODE*/ void getImageSubresourceLayout( Image image, const ImageSubresource* pSubresource, SubresourceLayout* pLayout ) const { vkGetImageSubresourceLayout( m_device, static_cast( image ), reinterpret_cast( pSubresource ), reinterpret_cast( pLayout ) ); } -#ifdef VKCPP_ENHANCED_MODE +#ifndef VKCPP_DISABLE_ENHANCED_MODE SubresourceLayout getImageSubresourceLayout( Image image, const ImageSubresource & subresource ) const { SubresourceLayout layout; vkGetImageSubresourceLayout( m_device, static_cast( image ), reinterpret_cast( &subresource ), reinterpret_cast( &layout ) ); return layout; } -#endif /*VKCPP_ENHANCED_MODE*/ +#endif /*VKCPP_DISABLE_ENHANCED_MODE*/ Result createImageView( const ImageViewCreateInfo* pCreateInfo, const AllocationCallbacks* pAllocator, ImageView* pView ) const { return static_cast( vkCreateImageView( m_device, reinterpret_cast( pCreateInfo ), reinterpret_cast( pAllocator ), reinterpret_cast( pView ) ) ); } -#ifdef VKCPP_ENHANCED_MODE +#ifndef VKCPP_DISABLE_ENHANCED_MODE ImageView createImageView( const ImageViewCreateInfo & createInfo, Optional const & allocator = nullptr ) const { ImageView view; @@ -20849,26 +20849,26 @@ namespace vk } return view; } -#endif /*VKCPP_ENHANCED_MODE*/ +#endif /*VKCPP_DISABLE_ENHANCED_MODE*/ void destroyImageView( ImageView imageView, const AllocationCallbacks* pAllocator ) const { vkDestroyImageView( m_device, static_cast( imageView ), reinterpret_cast( pAllocator ) ); } -#ifdef VKCPP_ENHANCED_MODE +#ifndef VKCPP_DISABLE_ENHANCED_MODE void destroyImageView( ImageView imageView, Optional const & allocator = nullptr ) const { vkDestroyImageView( m_device, static_cast( imageView ), reinterpret_cast( static_cast( allocator)) ); } -#endif /*VKCPP_ENHANCED_MODE*/ +#endif /*VKCPP_DISABLE_ENHANCED_MODE*/ Result createShaderModule( const ShaderModuleCreateInfo* pCreateInfo, const AllocationCallbacks* pAllocator, ShaderModule* pShaderModule ) const { return static_cast( vkCreateShaderModule( m_device, reinterpret_cast( pCreateInfo ), reinterpret_cast( pAllocator ), reinterpret_cast( pShaderModule ) ) ); } -#ifdef VKCPP_ENHANCED_MODE +#ifndef VKCPP_DISABLE_ENHANCED_MODE ShaderModule createShaderModule( const ShaderModuleCreateInfo & createInfo, Optional const & allocator = nullptr ) const { ShaderModule shaderModule; @@ -20879,26 +20879,26 @@ namespace vk } return shaderModule; } -#endif /*VKCPP_ENHANCED_MODE*/ +#endif /*VKCPP_DISABLE_ENHANCED_MODE*/ void destroyShaderModule( ShaderModule shaderModule, const AllocationCallbacks* pAllocator ) const { vkDestroyShaderModule( m_device, static_cast( shaderModule ), reinterpret_cast( pAllocator ) ); } -#ifdef VKCPP_ENHANCED_MODE +#ifndef VKCPP_DISABLE_ENHANCED_MODE void destroyShaderModule( ShaderModule shaderModule, Optional const & allocator = nullptr ) const { vkDestroyShaderModule( m_device, static_cast( shaderModule ), reinterpret_cast( static_cast( allocator)) ); } -#endif /*VKCPP_ENHANCED_MODE*/ +#endif /*VKCPP_DISABLE_ENHANCED_MODE*/ Result createPipelineCache( const PipelineCacheCreateInfo* pCreateInfo, const AllocationCallbacks* pAllocator, PipelineCache* pPipelineCache ) const { return static_cast( vkCreatePipelineCache( m_device, reinterpret_cast( pCreateInfo ), reinterpret_cast( pAllocator ), reinterpret_cast( pPipelineCache ) ) ); } -#ifdef VKCPP_ENHANCED_MODE +#ifndef VKCPP_DISABLE_ENHANCED_MODE PipelineCache createPipelineCache( const PipelineCacheCreateInfo & createInfo, Optional const & allocator = nullptr ) const { PipelineCache pipelineCache; @@ -20909,26 +20909,26 @@ namespace vk } return pipelineCache; } -#endif /*VKCPP_ENHANCED_MODE*/ +#endif /*VKCPP_DISABLE_ENHANCED_MODE*/ void destroyPipelineCache( PipelineCache pipelineCache, const AllocationCallbacks* pAllocator ) const { vkDestroyPipelineCache( m_device, static_cast( pipelineCache ), reinterpret_cast( pAllocator ) ); } -#ifdef VKCPP_ENHANCED_MODE +#ifndef VKCPP_DISABLE_ENHANCED_MODE void destroyPipelineCache( PipelineCache pipelineCache, Optional const & allocator = nullptr ) const { vkDestroyPipelineCache( m_device, static_cast( pipelineCache ), reinterpret_cast( static_cast( allocator)) ); } -#endif /*VKCPP_ENHANCED_MODE*/ +#endif /*VKCPP_DISABLE_ENHANCED_MODE*/ Result getPipelineCacheData( PipelineCache pipelineCache, size_t* pDataSize, void* pData ) const { return static_cast( vkGetPipelineCacheData( m_device, static_cast( pipelineCache ), pDataSize, pData ) ); } -#ifdef VKCPP_ENHANCED_MODE +#ifndef VKCPP_DISABLE_ENHANCED_MODE std::vector getPipelineCacheData( PipelineCache pipelineCache ) const { std::vector data; @@ -20945,14 +20945,14 @@ namespace vk } return data; } -#endif /*VKCPP_ENHANCED_MODE*/ +#endif /*VKCPP_DISABLE_ENHANCED_MODE*/ Result mergePipelineCaches( PipelineCache dstCache, uint32_t srcCacheCount, const PipelineCache* pSrcCaches ) const { return static_cast( vkMergePipelineCaches( m_device, static_cast( dstCache ), srcCacheCount, reinterpret_cast( pSrcCaches ) ) ); } -#ifdef VKCPP_ENHANCED_MODE +#ifndef VKCPP_DISABLE_ENHANCED_MODE void mergePipelineCaches( PipelineCache dstCache, std::vector const & srcCaches ) const { Result result = static_cast( vkMergePipelineCaches( m_device, static_cast( dstCache ), static_cast( srcCaches.size() ), reinterpret_cast( srcCaches.data() ) ) ); @@ -20970,14 +20970,14 @@ namespace vk throw std::system_error( result, "vk::Device::mergePipelineCaches" ); } } -#endif /*VKCPP_ENHANCED_MODE*/ +#endif /*VKCPP_DISABLE_ENHANCED_MODE*/ Result createGraphicsPipelines( PipelineCache pipelineCache, uint32_t createInfoCount, const GraphicsPipelineCreateInfo* pCreateInfos, const AllocationCallbacks* pAllocator, Pipeline* pPipelines ) const { return static_cast( vkCreateGraphicsPipelines( m_device, static_cast( pipelineCache ), createInfoCount, reinterpret_cast( pCreateInfos ), reinterpret_cast( pAllocator ), reinterpret_cast( pPipelines ) ) ); } -#ifdef VKCPP_ENHANCED_MODE +#ifndef VKCPP_DISABLE_ENHANCED_MODE std::vector createGraphicsPipelines( PipelineCache pipelineCache, std::vector const & createInfos, Optional const & allocator = nullptr ) const { std::vector pipelines( createInfos.size() ); @@ -20999,14 +20999,14 @@ namespace vk } return pipeline; } -#endif /*VKCPP_ENHANCED_MODE*/ +#endif /*VKCPP_DISABLE_ENHANCED_MODE*/ Result createComputePipelines( PipelineCache pipelineCache, uint32_t createInfoCount, const ComputePipelineCreateInfo* pCreateInfos, const AllocationCallbacks* pAllocator, Pipeline* pPipelines ) const { return static_cast( vkCreateComputePipelines( m_device, static_cast( pipelineCache ), createInfoCount, reinterpret_cast( pCreateInfos ), reinterpret_cast( pAllocator ), reinterpret_cast( pPipelines ) ) ); } -#ifdef VKCPP_ENHANCED_MODE +#ifndef VKCPP_DISABLE_ENHANCED_MODE std::vector createComputePipelines( PipelineCache pipelineCache, std::vector const & createInfos, Optional const & allocator = nullptr ) const { std::vector pipelines( createInfos.size() ); @@ -21028,26 +21028,26 @@ namespace vk } return pipeline; } -#endif /*VKCPP_ENHANCED_MODE*/ +#endif /*VKCPP_DISABLE_ENHANCED_MODE*/ void destroyPipeline( Pipeline pipeline, const AllocationCallbacks* pAllocator ) const { vkDestroyPipeline( m_device, static_cast( pipeline ), reinterpret_cast( pAllocator ) ); } -#ifdef VKCPP_ENHANCED_MODE +#ifndef VKCPP_DISABLE_ENHANCED_MODE void destroyPipeline( Pipeline pipeline, Optional const & allocator = nullptr ) const { vkDestroyPipeline( m_device, static_cast( pipeline ), reinterpret_cast( static_cast( allocator)) ); } -#endif /*VKCPP_ENHANCED_MODE*/ +#endif /*VKCPP_DISABLE_ENHANCED_MODE*/ Result createPipelineLayout( const PipelineLayoutCreateInfo* pCreateInfo, const AllocationCallbacks* pAllocator, PipelineLayout* pPipelineLayout ) const { return static_cast( vkCreatePipelineLayout( m_device, reinterpret_cast( pCreateInfo ), reinterpret_cast( pAllocator ), reinterpret_cast( pPipelineLayout ) ) ); } -#ifdef VKCPP_ENHANCED_MODE +#ifndef VKCPP_DISABLE_ENHANCED_MODE PipelineLayout createPipelineLayout( const PipelineLayoutCreateInfo & createInfo, Optional const & allocator = nullptr ) const { PipelineLayout pipelineLayout; @@ -21058,26 +21058,26 @@ namespace vk } return pipelineLayout; } -#endif /*VKCPP_ENHANCED_MODE*/ +#endif /*VKCPP_DISABLE_ENHANCED_MODE*/ void destroyPipelineLayout( PipelineLayout pipelineLayout, const AllocationCallbacks* pAllocator ) const { vkDestroyPipelineLayout( m_device, static_cast( pipelineLayout ), reinterpret_cast( pAllocator ) ); } -#ifdef VKCPP_ENHANCED_MODE +#ifndef VKCPP_DISABLE_ENHANCED_MODE void destroyPipelineLayout( PipelineLayout pipelineLayout, Optional const & allocator = nullptr ) const { vkDestroyPipelineLayout( m_device, static_cast( pipelineLayout ), reinterpret_cast( static_cast( allocator)) ); } -#endif /*VKCPP_ENHANCED_MODE*/ +#endif /*VKCPP_DISABLE_ENHANCED_MODE*/ Result createSampler( const SamplerCreateInfo* pCreateInfo, const AllocationCallbacks* pAllocator, Sampler* pSampler ) const { return static_cast( vkCreateSampler( m_device, reinterpret_cast( pCreateInfo ), reinterpret_cast( pAllocator ), reinterpret_cast( pSampler ) ) ); } -#ifdef VKCPP_ENHANCED_MODE +#ifndef VKCPP_DISABLE_ENHANCED_MODE Sampler createSampler( const SamplerCreateInfo & createInfo, Optional const & allocator = nullptr ) const { Sampler sampler; @@ -21088,26 +21088,26 @@ namespace vk } return sampler; } -#endif /*VKCPP_ENHANCED_MODE*/ +#endif /*VKCPP_DISABLE_ENHANCED_MODE*/ void destroySampler( Sampler sampler, const AllocationCallbacks* pAllocator ) const { vkDestroySampler( m_device, static_cast( sampler ), reinterpret_cast( pAllocator ) ); } -#ifdef VKCPP_ENHANCED_MODE +#ifndef VKCPP_DISABLE_ENHANCED_MODE void destroySampler( Sampler sampler, Optional const & allocator = nullptr ) const { vkDestroySampler( m_device, static_cast( sampler ), reinterpret_cast( static_cast( allocator)) ); } -#endif /*VKCPP_ENHANCED_MODE*/ +#endif /*VKCPP_DISABLE_ENHANCED_MODE*/ Result createDescriptorSetLayout( const DescriptorSetLayoutCreateInfo* pCreateInfo, const AllocationCallbacks* pAllocator, DescriptorSetLayout* pSetLayout ) const { return static_cast( vkCreateDescriptorSetLayout( m_device, reinterpret_cast( pCreateInfo ), reinterpret_cast( pAllocator ), reinterpret_cast( pSetLayout ) ) ); } -#ifdef VKCPP_ENHANCED_MODE +#ifndef VKCPP_DISABLE_ENHANCED_MODE DescriptorSetLayout createDescriptorSetLayout( const DescriptorSetLayoutCreateInfo & createInfo, Optional const & allocator = nullptr ) const { DescriptorSetLayout setLayout; @@ -21118,26 +21118,26 @@ namespace vk } return setLayout; } -#endif /*VKCPP_ENHANCED_MODE*/ +#endif /*VKCPP_DISABLE_ENHANCED_MODE*/ void destroyDescriptorSetLayout( DescriptorSetLayout descriptorSetLayout, const AllocationCallbacks* pAllocator ) const { vkDestroyDescriptorSetLayout( m_device, static_cast( descriptorSetLayout ), reinterpret_cast( pAllocator ) ); } -#ifdef VKCPP_ENHANCED_MODE +#ifndef VKCPP_DISABLE_ENHANCED_MODE void destroyDescriptorSetLayout( DescriptorSetLayout descriptorSetLayout, Optional const & allocator = nullptr ) const { vkDestroyDescriptorSetLayout( m_device, static_cast( descriptorSetLayout ), reinterpret_cast( static_cast( allocator)) ); } -#endif /*VKCPP_ENHANCED_MODE*/ +#endif /*VKCPP_DISABLE_ENHANCED_MODE*/ Result createDescriptorPool( const DescriptorPoolCreateInfo* pCreateInfo, const AllocationCallbacks* pAllocator, DescriptorPool* pDescriptorPool ) const { return static_cast( vkCreateDescriptorPool( m_device, reinterpret_cast( pCreateInfo ), reinterpret_cast( pAllocator ), reinterpret_cast( pDescriptorPool ) ) ); } -#ifdef VKCPP_ENHANCED_MODE +#ifndef VKCPP_DISABLE_ENHANCED_MODE DescriptorPool createDescriptorPool( const DescriptorPoolCreateInfo & createInfo, Optional const & allocator = nullptr ) const { DescriptorPool descriptorPool; @@ -21148,28 +21148,28 @@ namespace vk } return descriptorPool; } -#endif /*VKCPP_ENHANCED_MODE*/ +#endif /*VKCPP_DISABLE_ENHANCED_MODE*/ void destroyDescriptorPool( DescriptorPool descriptorPool, const AllocationCallbacks* pAllocator ) const { vkDestroyDescriptorPool( m_device, static_cast( descriptorPool ), reinterpret_cast( pAllocator ) ); } -#ifdef VKCPP_ENHANCED_MODE +#ifndef VKCPP_DISABLE_ENHANCED_MODE void destroyDescriptorPool( DescriptorPool descriptorPool, Optional const & allocator = nullptr ) const { vkDestroyDescriptorPool( m_device, static_cast( descriptorPool ), reinterpret_cast( static_cast( allocator)) ); } -#endif /*VKCPP_ENHANCED_MODE*/ +#endif /*VKCPP_DISABLE_ENHANCED_MODE*/ -#ifndef VKCPP_ENHANCED_MODE +#ifdef VKCPP_DISABLE_ENHANCED_MODE Result resetDescriptorPool( DescriptorPool descriptorPool, DescriptorPoolResetFlags flags ) const { return static_cast( vkResetDescriptorPool( m_device, static_cast( descriptorPool ), static_cast( flags ) ) ); } -#endif /*!VKCPP_ENHANCED_MODE*/ +#endif /*!VKCPP_DISABLE_ENHANCED_MODE*/ -#ifdef VKCPP_ENHANCED_MODE +#ifndef VKCPP_DISABLE_ENHANCED_MODE void resetDescriptorPool( DescriptorPool descriptorPool, DescriptorPoolResetFlags flags ) const { Result result = static_cast( vkResetDescriptorPool( m_device, static_cast( descriptorPool ), static_cast( flags ) ) ); @@ -21178,14 +21178,14 @@ namespace vk throw std::system_error( result, "vk::Device::resetDescriptorPool" ); } } -#endif /*VKCPP_ENHANCED_MODE*/ +#endif /*VKCPP_DISABLE_ENHANCED_MODE*/ Result allocateDescriptorSets( const DescriptorSetAllocateInfo* pAllocateInfo, DescriptorSet* pDescriptorSets ) const { return static_cast( vkAllocateDescriptorSets( m_device, reinterpret_cast( pAllocateInfo ), reinterpret_cast( pDescriptorSets ) ) ); } -#ifdef VKCPP_ENHANCED_MODE +#ifndef VKCPP_DISABLE_ENHANCED_MODE std::vector allocateDescriptorSets( const DescriptorSetAllocateInfo & allocateInfo ) const { std::vector descriptorSets( allocateInfo.descriptorSetCount() ); @@ -21196,14 +21196,14 @@ namespace vk } return descriptorSets; } -#endif /*VKCPP_ENHANCED_MODE*/ +#endif /*VKCPP_DISABLE_ENHANCED_MODE*/ Result freeDescriptorSets( DescriptorPool descriptorPool, uint32_t descriptorSetCount, const DescriptorSet* pDescriptorSets ) const { return static_cast( vkFreeDescriptorSets( m_device, static_cast( descriptorPool ), descriptorSetCount, reinterpret_cast( pDescriptorSets ) ) ); } -#ifdef VKCPP_ENHANCED_MODE +#ifndef VKCPP_DISABLE_ENHANCED_MODE void freeDescriptorSets( DescriptorPool descriptorPool, std::vector const & descriptorSets ) const { Result result = static_cast( vkFreeDescriptorSets( m_device, static_cast( descriptorPool ), static_cast( descriptorSets.size() ), reinterpret_cast( descriptorSets.data() ) ) ); @@ -21221,14 +21221,14 @@ namespace vk throw std::system_error( result, "vk::Device::freeDescriptorSets" ); } } -#endif /*VKCPP_ENHANCED_MODE*/ +#endif /*VKCPP_DISABLE_ENHANCED_MODE*/ void updateDescriptorSets( uint32_t descriptorWriteCount, const WriteDescriptorSet* pDescriptorWrites, uint32_t descriptorCopyCount, const CopyDescriptorSet* pDescriptorCopies ) const { vkUpdateDescriptorSets( m_device, descriptorWriteCount, reinterpret_cast( pDescriptorWrites ), descriptorCopyCount, reinterpret_cast( pDescriptorCopies ) ); } -#ifdef VKCPP_ENHANCED_MODE +#ifndef VKCPP_DISABLE_ENHANCED_MODE void updateDescriptorSets( std::vector const & descriptorWrites, std::vector const & descriptorCopies ) const { vkUpdateDescriptorSets( m_device, static_cast( descriptorWrites.size() ), reinterpret_cast( descriptorWrites.data() ), static_cast( descriptorCopies.size() ), reinterpret_cast( descriptorCopies.data() ) ); @@ -21238,14 +21238,14 @@ namespace vk { vkUpdateDescriptorSets( m_device, 1, reinterpret_cast( &descriptorWrite ), 1, reinterpret_cast( &descriptorCopie ) ); } -#endif /*VKCPP_ENHANCED_MODE*/ +#endif /*VKCPP_DISABLE_ENHANCED_MODE*/ Result createFramebuffer( const FramebufferCreateInfo* pCreateInfo, const AllocationCallbacks* pAllocator, Framebuffer* pFramebuffer ) const { return static_cast( vkCreateFramebuffer( m_device, reinterpret_cast( pCreateInfo ), reinterpret_cast( pAllocator ), reinterpret_cast( pFramebuffer ) ) ); } -#ifdef VKCPP_ENHANCED_MODE +#ifndef VKCPP_DISABLE_ENHANCED_MODE Framebuffer createFramebuffer( const FramebufferCreateInfo & createInfo, Optional const & allocator = nullptr ) const { Framebuffer framebuffer; @@ -21256,26 +21256,26 @@ namespace vk } return framebuffer; } -#endif /*VKCPP_ENHANCED_MODE*/ +#endif /*VKCPP_DISABLE_ENHANCED_MODE*/ void destroyFramebuffer( Framebuffer framebuffer, const AllocationCallbacks* pAllocator ) const { vkDestroyFramebuffer( m_device, static_cast( framebuffer ), reinterpret_cast( pAllocator ) ); } -#ifdef VKCPP_ENHANCED_MODE +#ifndef VKCPP_DISABLE_ENHANCED_MODE void destroyFramebuffer( Framebuffer framebuffer, Optional const & allocator = nullptr ) const { vkDestroyFramebuffer( m_device, static_cast( framebuffer ), reinterpret_cast( static_cast( allocator)) ); } -#endif /*VKCPP_ENHANCED_MODE*/ +#endif /*VKCPP_DISABLE_ENHANCED_MODE*/ Result createRenderPass( const RenderPassCreateInfo* pCreateInfo, const AllocationCallbacks* pAllocator, RenderPass* pRenderPass ) const { return static_cast( vkCreateRenderPass( m_device, reinterpret_cast( pCreateInfo ), reinterpret_cast( pAllocator ), reinterpret_cast( pRenderPass ) ) ); } -#ifdef VKCPP_ENHANCED_MODE +#ifndef VKCPP_DISABLE_ENHANCED_MODE RenderPass createRenderPass( const RenderPassCreateInfo & createInfo, Optional const & allocator = nullptr ) const { RenderPass renderPass; @@ -21286,40 +21286,40 @@ namespace vk } return renderPass; } -#endif /*VKCPP_ENHANCED_MODE*/ +#endif /*VKCPP_DISABLE_ENHANCED_MODE*/ void destroyRenderPass( RenderPass renderPass, const AllocationCallbacks* pAllocator ) const { vkDestroyRenderPass( m_device, static_cast( renderPass ), reinterpret_cast( pAllocator ) ); } -#ifdef VKCPP_ENHANCED_MODE +#ifndef VKCPP_DISABLE_ENHANCED_MODE void destroyRenderPass( RenderPass renderPass, Optional const & allocator = nullptr ) const { vkDestroyRenderPass( m_device, static_cast( renderPass ), reinterpret_cast( static_cast( allocator)) ); } -#endif /*VKCPP_ENHANCED_MODE*/ +#endif /*VKCPP_DISABLE_ENHANCED_MODE*/ void getRenderAreaGranularity( RenderPass renderPass, Extent2D* pGranularity ) const { vkGetRenderAreaGranularity( m_device, static_cast( renderPass ), reinterpret_cast( pGranularity ) ); } -#ifdef VKCPP_ENHANCED_MODE +#ifndef VKCPP_DISABLE_ENHANCED_MODE Extent2D getRenderAreaGranularity( RenderPass renderPass ) const { Extent2D granularity; vkGetRenderAreaGranularity( m_device, static_cast( renderPass ), reinterpret_cast( &granularity ) ); return granularity; } -#endif /*VKCPP_ENHANCED_MODE*/ +#endif /*VKCPP_DISABLE_ENHANCED_MODE*/ Result createCommandPool( const CommandPoolCreateInfo* pCreateInfo, const AllocationCallbacks* pAllocator, CommandPool* pCommandPool ) const { return static_cast( vkCreateCommandPool( m_device, reinterpret_cast( pCreateInfo ), reinterpret_cast( pAllocator ), reinterpret_cast( pCommandPool ) ) ); } -#ifdef VKCPP_ENHANCED_MODE +#ifndef VKCPP_DISABLE_ENHANCED_MODE CommandPool createCommandPool( const CommandPoolCreateInfo & createInfo, Optional const & allocator = nullptr ) const { CommandPool commandPool; @@ -21330,28 +21330,28 @@ namespace vk } return commandPool; } -#endif /*VKCPP_ENHANCED_MODE*/ +#endif /*VKCPP_DISABLE_ENHANCED_MODE*/ void destroyCommandPool( CommandPool commandPool, const AllocationCallbacks* pAllocator ) const { vkDestroyCommandPool( m_device, static_cast( commandPool ), reinterpret_cast( pAllocator ) ); } -#ifdef VKCPP_ENHANCED_MODE +#ifndef VKCPP_DISABLE_ENHANCED_MODE void destroyCommandPool( CommandPool commandPool, Optional const & allocator = nullptr ) const { vkDestroyCommandPool( m_device, static_cast( commandPool ), reinterpret_cast( static_cast( allocator)) ); } -#endif /*VKCPP_ENHANCED_MODE*/ +#endif /*VKCPP_DISABLE_ENHANCED_MODE*/ -#ifndef VKCPP_ENHANCED_MODE +#ifdef VKCPP_DISABLE_ENHANCED_MODE Result resetCommandPool( CommandPool commandPool, CommandPoolResetFlags flags ) const { return static_cast( vkResetCommandPool( m_device, static_cast( commandPool ), static_cast( flags ) ) ); } -#endif /*!VKCPP_ENHANCED_MODE*/ +#endif /*!VKCPP_DISABLE_ENHANCED_MODE*/ -#ifdef VKCPP_ENHANCED_MODE +#ifndef VKCPP_DISABLE_ENHANCED_MODE void resetCommandPool( CommandPool commandPool, CommandPoolResetFlags flags ) const { Result result = static_cast( vkResetCommandPool( m_device, static_cast( commandPool ), static_cast( flags ) ) ); @@ -21360,14 +21360,14 @@ namespace vk throw std::system_error( result, "vk::Device::resetCommandPool" ); } } -#endif /*VKCPP_ENHANCED_MODE*/ +#endif /*VKCPP_DISABLE_ENHANCED_MODE*/ Result allocateCommandBuffers( const CommandBufferAllocateInfo* pAllocateInfo, CommandBuffer* pCommandBuffers ) const { return static_cast( vkAllocateCommandBuffers( m_device, reinterpret_cast( pAllocateInfo ), reinterpret_cast( pCommandBuffers ) ) ); } -#ifdef VKCPP_ENHANCED_MODE +#ifndef VKCPP_DISABLE_ENHANCED_MODE std::vector allocateCommandBuffers( const CommandBufferAllocateInfo & allocateInfo ) const { std::vector commandBuffers( allocateInfo.commandBufferCount() ); @@ -21378,14 +21378,14 @@ namespace vk } return commandBuffers; } -#endif /*VKCPP_ENHANCED_MODE*/ +#endif /*VKCPP_DISABLE_ENHANCED_MODE*/ void freeCommandBuffers( CommandPool commandPool, uint32_t commandBufferCount, const CommandBuffer* pCommandBuffers ) const { vkFreeCommandBuffers( m_device, static_cast( commandPool ), commandBufferCount, reinterpret_cast( pCommandBuffers ) ); } -#ifdef VKCPP_ENHANCED_MODE +#ifndef VKCPP_DISABLE_ENHANCED_MODE void freeCommandBuffers( CommandPool commandPool, std::vector const & commandBuffers ) const { vkFreeCommandBuffers( m_device, static_cast( commandPool ), static_cast( commandBuffers.size() ), reinterpret_cast( commandBuffers.data() ) ); @@ -21395,14 +21395,14 @@ namespace vk { vkFreeCommandBuffers( m_device, static_cast( commandPool ), 1, reinterpret_cast( &commandBuffer ) ); } -#endif /*VKCPP_ENHANCED_MODE*/ +#endif /*VKCPP_DISABLE_ENHANCED_MODE*/ Result createSharedSwapchainsKHR( uint32_t swapchainCount, const SwapchainCreateInfoKHR* pCreateInfos, const AllocationCallbacks* pAllocator, SwapchainKHR* pSwapchains ) const { return static_cast( vkCreateSharedSwapchainsKHR( m_device, swapchainCount, reinterpret_cast( pCreateInfos ), reinterpret_cast( pAllocator ), reinterpret_cast( pSwapchains ) ) ); } -#ifdef VKCPP_ENHANCED_MODE +#ifndef VKCPP_DISABLE_ENHANCED_MODE std::vector createSharedSwapchainsKHR( std::vector const & createInfos, Optional const & allocator = nullptr ) const { std::vector swapchains( createInfos.size() ); @@ -21424,14 +21424,14 @@ namespace vk } return swapchain; } -#endif /*VKCPP_ENHANCED_MODE*/ +#endif /*VKCPP_DISABLE_ENHANCED_MODE*/ Result createSwapchainKHR( const SwapchainCreateInfoKHR* pCreateInfo, const AllocationCallbacks* pAllocator, SwapchainKHR* pSwapchain ) const { return static_cast( vkCreateSwapchainKHR( m_device, reinterpret_cast( pCreateInfo ), reinterpret_cast( pAllocator ), reinterpret_cast( pSwapchain ) ) ); } -#ifdef VKCPP_ENHANCED_MODE +#ifndef VKCPP_DISABLE_ENHANCED_MODE SwapchainKHR createSwapchainKHR( const SwapchainCreateInfoKHR & createInfo, Optional const & allocator = nullptr ) const { SwapchainKHR swapchain; @@ -21442,26 +21442,26 @@ namespace vk } return swapchain; } -#endif /*VKCPP_ENHANCED_MODE*/ +#endif /*VKCPP_DISABLE_ENHANCED_MODE*/ void destroySwapchainKHR( SwapchainKHR swapchain, const AllocationCallbacks* pAllocator ) const { vkDestroySwapchainKHR( m_device, static_cast( swapchain ), reinterpret_cast( pAllocator ) ); } -#ifdef VKCPP_ENHANCED_MODE +#ifndef VKCPP_DISABLE_ENHANCED_MODE void destroySwapchainKHR( SwapchainKHR swapchain, Optional const & allocator = nullptr ) const { vkDestroySwapchainKHR( m_device, static_cast( swapchain ), reinterpret_cast( static_cast( allocator)) ); } -#endif /*VKCPP_ENHANCED_MODE*/ +#endif /*VKCPP_DISABLE_ENHANCED_MODE*/ Result getSwapchainImagesKHR( SwapchainKHR swapchain, uint32_t* pSwapchainImageCount, Image* pSwapchainImages ) const { return static_cast( vkGetSwapchainImagesKHR( m_device, static_cast( swapchain ), pSwapchainImageCount, reinterpret_cast( pSwapchainImages ) ) ); } -#ifdef VKCPP_ENHANCED_MODE +#ifndef VKCPP_DISABLE_ENHANCED_MODE std::vector getSwapchainImagesKHR( SwapchainKHR swapchain ) const { std::vector swapchainImages; @@ -21482,14 +21482,14 @@ namespace vk } return swapchainImages; } -#endif /*VKCPP_ENHANCED_MODE*/ +#endif /*VKCPP_DISABLE_ENHANCED_MODE*/ Result acquireNextImageKHR( SwapchainKHR swapchain, uint64_t timeout, Semaphore semaphore, Fence fence, uint32_t* pImageIndex ) const { return static_cast( vkAcquireNextImageKHR( m_device, static_cast( swapchain ), timeout, static_cast( semaphore ), static_cast( fence ), pImageIndex ) ); } -#ifdef VKCPP_ENHANCED_MODE +#ifndef VKCPP_DISABLE_ENHANCED_MODE Result acquireNextImageKHR( SwapchainKHR swapchain, uint64_t timeout, Semaphore semaphore, Fence fence, uint32_t & imageIndex ) const { Result result = static_cast( vkAcquireNextImageKHR( m_device, static_cast( swapchain ), timeout, static_cast( semaphore ), static_cast( fence ), &imageIndex ) ); @@ -21499,7 +21499,7 @@ namespace vk } return result; } -#endif /*VKCPP_ENHANCED_MODE*/ +#endif /*VKCPP_DISABLE_ENHANCED_MODE*/ #if !defined(VK_CPP_TYPESAFE_CONVERSION) explicit @@ -21548,21 +21548,21 @@ namespace vk vkGetPhysicalDeviceProperties( m_physicalDevice, reinterpret_cast( pProperties ) ); } -#ifdef VKCPP_ENHANCED_MODE +#ifndef VKCPP_DISABLE_ENHANCED_MODE PhysicalDeviceProperties getProperties() const { PhysicalDeviceProperties properties; vkGetPhysicalDeviceProperties( m_physicalDevice, reinterpret_cast( &properties ) ); return properties; } -#endif /*VKCPP_ENHANCED_MODE*/ +#endif /*VKCPP_DISABLE_ENHANCED_MODE*/ void getQueueFamilyProperties( uint32_t* pQueueFamilyPropertyCount, QueueFamilyProperties* pQueueFamilyProperties ) const { vkGetPhysicalDeviceQueueFamilyProperties( m_physicalDevice, pQueueFamilyPropertyCount, reinterpret_cast( pQueueFamilyProperties ) ); } -#ifdef VKCPP_ENHANCED_MODE +#ifndef VKCPP_DISABLE_ENHANCED_MODE std::vector getQueueFamilyProperties() const { std::vector queueFamilyProperties; @@ -21572,56 +21572,56 @@ namespace vk vkGetPhysicalDeviceQueueFamilyProperties( m_physicalDevice, &queueFamilyPropertyCount, reinterpret_cast( queueFamilyProperties.data() ) ); return queueFamilyProperties; } -#endif /*VKCPP_ENHANCED_MODE*/ +#endif /*VKCPP_DISABLE_ENHANCED_MODE*/ void getMemoryProperties( PhysicalDeviceMemoryProperties* pMemoryProperties ) const { vkGetPhysicalDeviceMemoryProperties( m_physicalDevice, reinterpret_cast( pMemoryProperties ) ); } -#ifdef VKCPP_ENHANCED_MODE +#ifndef VKCPP_DISABLE_ENHANCED_MODE PhysicalDeviceMemoryProperties getMemoryProperties() const { PhysicalDeviceMemoryProperties memoryProperties; vkGetPhysicalDeviceMemoryProperties( m_physicalDevice, reinterpret_cast( &memoryProperties ) ); return memoryProperties; } -#endif /*VKCPP_ENHANCED_MODE*/ +#endif /*VKCPP_DISABLE_ENHANCED_MODE*/ void getFeatures( PhysicalDeviceFeatures* pFeatures ) const { vkGetPhysicalDeviceFeatures( m_physicalDevice, reinterpret_cast( pFeatures ) ); } -#ifdef VKCPP_ENHANCED_MODE +#ifndef VKCPP_DISABLE_ENHANCED_MODE PhysicalDeviceFeatures getFeatures() const { PhysicalDeviceFeatures features; vkGetPhysicalDeviceFeatures( m_physicalDevice, reinterpret_cast( &features ) ); return features; } -#endif /*VKCPP_ENHANCED_MODE*/ +#endif /*VKCPP_DISABLE_ENHANCED_MODE*/ void getFormatProperties( Format format, FormatProperties* pFormatProperties ) const { vkGetPhysicalDeviceFormatProperties( m_physicalDevice, static_cast( format ), reinterpret_cast( pFormatProperties ) ); } -#ifdef VKCPP_ENHANCED_MODE +#ifndef VKCPP_DISABLE_ENHANCED_MODE FormatProperties getFormatProperties( Format format ) const { FormatProperties formatProperties; vkGetPhysicalDeviceFormatProperties( m_physicalDevice, static_cast( format ), reinterpret_cast( &formatProperties ) ); return formatProperties; } -#endif /*VKCPP_ENHANCED_MODE*/ +#endif /*VKCPP_DISABLE_ENHANCED_MODE*/ Result getImageFormatProperties( Format format, ImageType type, ImageTiling tiling, ImageUsageFlags usage, ImageCreateFlags flags, ImageFormatProperties* pImageFormatProperties ) const { return static_cast( vkGetPhysicalDeviceImageFormatProperties( m_physicalDevice, static_cast( format ), static_cast( type ), static_cast( tiling ), static_cast( usage ), static_cast( flags ), reinterpret_cast( pImageFormatProperties ) ) ); } -#ifdef VKCPP_ENHANCED_MODE +#ifndef VKCPP_DISABLE_ENHANCED_MODE ImageFormatProperties getImageFormatProperties( Format format, ImageType type, ImageTiling tiling, ImageUsageFlags usage, ImageCreateFlags flags ) const { ImageFormatProperties imageFormatProperties; @@ -21632,14 +21632,14 @@ namespace vk } return imageFormatProperties; } -#endif /*VKCPP_ENHANCED_MODE*/ +#endif /*VKCPP_DISABLE_ENHANCED_MODE*/ Result createDevice( const DeviceCreateInfo* pCreateInfo, const AllocationCallbacks* pAllocator, Device* pDevice ) const { return static_cast( vkCreateDevice( m_physicalDevice, reinterpret_cast( pCreateInfo ), reinterpret_cast( pAllocator ), reinterpret_cast( pDevice ) ) ); } -#ifdef VKCPP_ENHANCED_MODE +#ifndef VKCPP_DISABLE_ENHANCED_MODE Device createDevice( const DeviceCreateInfo & createInfo, Optional const & allocator = nullptr ) const { Device device; @@ -21650,14 +21650,14 @@ namespace vk } return device; } -#endif /*VKCPP_ENHANCED_MODE*/ +#endif /*VKCPP_DISABLE_ENHANCED_MODE*/ Result enumerateDeviceLayerProperties( uint32_t* pPropertyCount, LayerProperties* pProperties ) const { return static_cast( vkEnumerateDeviceLayerProperties( m_physicalDevice, pPropertyCount, reinterpret_cast( pProperties ) ) ); } -#ifdef VKCPP_ENHANCED_MODE +#ifndef VKCPP_DISABLE_ENHANCED_MODE std::vector enumerateDeviceLayerProperties() const { std::vector properties; @@ -21678,14 +21678,14 @@ namespace vk } return properties; } -#endif /*VKCPP_ENHANCED_MODE*/ +#endif /*VKCPP_DISABLE_ENHANCED_MODE*/ Result enumerateDeviceExtensionProperties( const char* pLayerName, uint32_t* pPropertyCount, ExtensionProperties* pProperties ) const { return static_cast( vkEnumerateDeviceExtensionProperties( m_physicalDevice, pLayerName, pPropertyCount, reinterpret_cast( pProperties ) ) ); } -#ifdef VKCPP_ENHANCED_MODE +#ifndef VKCPP_DISABLE_ENHANCED_MODE std::vector enumerateDeviceExtensionProperties( Optional const & layerName = nullptr ) const { std::vector properties; @@ -21706,14 +21706,14 @@ namespace vk } return properties; } -#endif /*VKCPP_ENHANCED_MODE*/ +#endif /*VKCPP_DISABLE_ENHANCED_MODE*/ void getSparseImageFormatProperties( Format format, ImageType type, SampleCountFlagBits samples, ImageUsageFlags usage, ImageTiling tiling, uint32_t* pPropertyCount, SparseImageFormatProperties* pProperties ) const { vkGetPhysicalDeviceSparseImageFormatProperties( m_physicalDevice, static_cast( format ), static_cast( type ), static_cast( samples ), static_cast( usage ), static_cast( tiling ), pPropertyCount, reinterpret_cast( pProperties ) ); } -#ifdef VKCPP_ENHANCED_MODE +#ifndef VKCPP_DISABLE_ENHANCED_MODE std::vector getSparseImageFormatProperties( Format format, ImageType type, SampleCountFlagBits samples, ImageUsageFlags usage, ImageTiling tiling ) const { std::vector properties; @@ -21723,14 +21723,14 @@ namespace vk vkGetPhysicalDeviceSparseImageFormatProperties( m_physicalDevice, static_cast( format ), static_cast( type ), static_cast( samples ), static_cast( usage ), static_cast( tiling ), &propertyCount, reinterpret_cast( properties.data() ) ); return properties; } -#endif /*VKCPP_ENHANCED_MODE*/ +#endif /*VKCPP_DISABLE_ENHANCED_MODE*/ Result getDisplayPropertiesKHR( uint32_t* pPropertyCount, DisplayPropertiesKHR* pProperties ) const { return static_cast( vkGetPhysicalDeviceDisplayPropertiesKHR( m_physicalDevice, pPropertyCount, reinterpret_cast( pProperties ) ) ); } -#ifdef VKCPP_ENHANCED_MODE +#ifndef VKCPP_DISABLE_ENHANCED_MODE std::vector getDisplayPropertiesKHR() const { std::vector properties; @@ -21751,14 +21751,14 @@ namespace vk } return properties; } -#endif /*VKCPP_ENHANCED_MODE*/ +#endif /*VKCPP_DISABLE_ENHANCED_MODE*/ Result getDisplayPlanePropertiesKHR( uint32_t* pPropertyCount, DisplayPlanePropertiesKHR* pProperties ) const { return static_cast( vkGetPhysicalDeviceDisplayPlanePropertiesKHR( m_physicalDevice, pPropertyCount, reinterpret_cast( pProperties ) ) ); } -#ifdef VKCPP_ENHANCED_MODE +#ifndef VKCPP_DISABLE_ENHANCED_MODE std::vector getDisplayPlanePropertiesKHR() const { std::vector properties; @@ -21779,14 +21779,14 @@ namespace vk } return properties; } -#endif /*VKCPP_ENHANCED_MODE*/ +#endif /*VKCPP_DISABLE_ENHANCED_MODE*/ Result getDisplayPlaneSupportedDisplaysKHR( uint32_t planeIndex, uint32_t* pDisplayCount, DisplayKHR* pDisplays ) const { return static_cast( vkGetDisplayPlaneSupportedDisplaysKHR( m_physicalDevice, planeIndex, pDisplayCount, reinterpret_cast( pDisplays ) ) ); } -#ifdef VKCPP_ENHANCED_MODE +#ifndef VKCPP_DISABLE_ENHANCED_MODE std::vector getDisplayPlaneSupportedDisplaysKHR( uint32_t planeIndex ) const { std::vector displays; @@ -21807,14 +21807,14 @@ namespace vk } return displays; } -#endif /*VKCPP_ENHANCED_MODE*/ +#endif /*VKCPP_DISABLE_ENHANCED_MODE*/ Result getDisplayModePropertiesKHR( DisplayKHR display, uint32_t* pPropertyCount, DisplayModePropertiesKHR* pProperties ) const { return static_cast( vkGetDisplayModePropertiesKHR( m_physicalDevice, static_cast( display ), pPropertyCount, reinterpret_cast( pProperties ) ) ); } -#ifdef VKCPP_ENHANCED_MODE +#ifndef VKCPP_DISABLE_ENHANCED_MODE std::vector getDisplayModePropertiesKHR( DisplayKHR display ) const { std::vector properties; @@ -21835,14 +21835,14 @@ namespace vk } return properties; } -#endif /*VKCPP_ENHANCED_MODE*/ +#endif /*VKCPP_DISABLE_ENHANCED_MODE*/ Result createDisplayModeKHR( DisplayKHR display, const DisplayModeCreateInfoKHR* pCreateInfo, const AllocationCallbacks* pAllocator, DisplayModeKHR* pMode ) const { return static_cast( vkCreateDisplayModeKHR( m_physicalDevice, static_cast( display ), reinterpret_cast( pCreateInfo ), reinterpret_cast( pAllocator ), reinterpret_cast( pMode ) ) ); } -#ifdef VKCPP_ENHANCED_MODE +#ifndef VKCPP_DISABLE_ENHANCED_MODE DisplayModeKHR createDisplayModeKHR( DisplayKHR display, const DisplayModeCreateInfoKHR & createInfo, Optional const & allocator = nullptr ) const { DisplayModeKHR mode; @@ -21853,14 +21853,14 @@ namespace vk } return mode; } -#endif /*VKCPP_ENHANCED_MODE*/ +#endif /*VKCPP_DISABLE_ENHANCED_MODE*/ Result getDisplayPlaneCapabilitiesKHR( DisplayModeKHR mode, uint32_t planeIndex, DisplayPlaneCapabilitiesKHR* pCapabilities ) const { return static_cast( vkGetDisplayPlaneCapabilitiesKHR( m_physicalDevice, static_cast( mode ), planeIndex, reinterpret_cast( pCapabilities ) ) ); } -#ifdef VKCPP_ENHANCED_MODE +#ifndef VKCPP_DISABLE_ENHANCED_MODE DisplayPlaneCapabilitiesKHR getDisplayPlaneCapabilitiesKHR( DisplayModeKHR mode, uint32_t planeIndex ) const { DisplayPlaneCapabilitiesKHR capabilities; @@ -21871,7 +21871,7 @@ namespace vk } return capabilities; } -#endif /*VKCPP_ENHANCED_MODE*/ +#endif /*VKCPP_DISABLE_ENHANCED_MODE*/ #ifdef VK_USE_PLATFORM_MIR_KHR Bool32 getMirPresentationSupportKHR( uint32_t queueFamilyIndex, MirConnection* connection ) const @@ -21880,21 +21880,21 @@ namespace vk } #endif /*VK_USE_PLATFORM_MIR_KHR*/ -#ifdef VKCPP_ENHANCED_MODE +#ifndef VKCPP_DISABLE_ENHANCED_MODE #ifdef VK_USE_PLATFORM_MIR_KHR Bool32 getMirPresentationSupportKHR( uint32_t queueFamilyIndex, MirConnection & connection ) const { return vkGetPhysicalDeviceMirPresentationSupportKHR( m_physicalDevice, queueFamilyIndex, &connection ); } #endif /*VK_USE_PLATFORM_MIR_KHR*/ -#endif /*VKCPP_ENHANCED_MODE*/ +#endif /*VKCPP_DISABLE_ENHANCED_MODE*/ Result getSurfaceSupportKHR( uint32_t queueFamilyIndex, SurfaceKHR surface, Bool32* pSupported ) const { return static_cast( vkGetPhysicalDeviceSurfaceSupportKHR( m_physicalDevice, queueFamilyIndex, static_cast( surface ), pSupported ) ); } -#ifdef VKCPP_ENHANCED_MODE +#ifndef VKCPP_DISABLE_ENHANCED_MODE Bool32 getSurfaceSupportKHR( uint32_t queueFamilyIndex, SurfaceKHR surface ) const { Bool32 supported; @@ -21905,14 +21905,14 @@ namespace vk } return supported; } -#endif /*VKCPP_ENHANCED_MODE*/ +#endif /*VKCPP_DISABLE_ENHANCED_MODE*/ Result getSurfaceCapabilitiesKHR( SurfaceKHR surface, SurfaceCapabilitiesKHR* pSurfaceCapabilities ) const { return static_cast( vkGetPhysicalDeviceSurfaceCapabilitiesKHR( m_physicalDevice, static_cast( surface ), reinterpret_cast( pSurfaceCapabilities ) ) ); } -#ifdef VKCPP_ENHANCED_MODE +#ifndef VKCPP_DISABLE_ENHANCED_MODE Result getSurfaceCapabilitiesKHR( SurfaceKHR surface, SurfaceCapabilitiesKHR & surfaceCapabilities ) const { Result result = static_cast( vkGetPhysicalDeviceSurfaceCapabilitiesKHR( m_physicalDevice, static_cast( surface ), reinterpret_cast( &surfaceCapabilities ) ) ); @@ -21922,14 +21922,14 @@ namespace vk } return result; } -#endif /*VKCPP_ENHANCED_MODE*/ +#endif /*VKCPP_DISABLE_ENHANCED_MODE*/ Result getSurfaceFormatsKHR( SurfaceKHR surface, uint32_t* pSurfaceFormatCount, SurfaceFormatKHR* pSurfaceFormats ) const { return static_cast( vkGetPhysicalDeviceSurfaceFormatsKHR( m_physicalDevice, static_cast( surface ), pSurfaceFormatCount, reinterpret_cast( pSurfaceFormats ) ) ); } -#ifdef VKCPP_ENHANCED_MODE +#ifndef VKCPP_DISABLE_ENHANCED_MODE std::vector getSurfaceFormatsKHR( SurfaceKHR surface ) const { std::vector surfaceFormats; @@ -21950,14 +21950,14 @@ namespace vk } return surfaceFormats; } -#endif /*VKCPP_ENHANCED_MODE*/ +#endif /*VKCPP_DISABLE_ENHANCED_MODE*/ Result getSurfacePresentModesKHR( SurfaceKHR surface, uint32_t* pPresentModeCount, PresentModeKHR* pPresentModes ) const { return static_cast( vkGetPhysicalDeviceSurfacePresentModesKHR( m_physicalDevice, static_cast( surface ), pPresentModeCount, reinterpret_cast( pPresentModes ) ) ); } -#ifdef VKCPP_ENHANCED_MODE +#ifndef VKCPP_DISABLE_ENHANCED_MODE std::vector getSurfacePresentModesKHR( SurfaceKHR surface ) const { std::vector presentModes; @@ -21978,7 +21978,7 @@ namespace vk } return presentModes; } -#endif /*VKCPP_ENHANCED_MODE*/ +#endif /*VKCPP_DISABLE_ENHANCED_MODE*/ #ifdef VK_USE_PLATFORM_WAYLAND_KHR Bool32 getWaylandPresentationSupportKHR( uint32_t queueFamilyIndex, struct wl_display* display ) const @@ -21987,32 +21987,32 @@ namespace vk } #endif /*VK_USE_PLATFORM_WAYLAND_KHR*/ -#ifdef VKCPP_ENHANCED_MODE +#ifndef VKCPP_DISABLE_ENHANCED_MODE #ifdef VK_USE_PLATFORM_WAYLAND_KHR Bool32 getWaylandPresentationSupportKHR( uint32_t queueFamilyIndex, struct wl_display & display ) const { return vkGetPhysicalDeviceWaylandPresentationSupportKHR( m_physicalDevice, queueFamilyIndex, &display ); } #endif /*VK_USE_PLATFORM_WAYLAND_KHR*/ -#endif /*VKCPP_ENHANCED_MODE*/ +#endif /*VKCPP_DISABLE_ENHANCED_MODE*/ -#ifndef VKCPP_ENHANCED_MODE +#ifdef VKCPP_DISABLE_ENHANCED_MODE #ifdef VK_USE_PLATFORM_WIN32_KHR Bool32 getWin32PresentationSupportKHR( uint32_t queueFamilyIndex ) const { return vkGetPhysicalDeviceWin32PresentationSupportKHR( m_physicalDevice, queueFamilyIndex ); } #endif /*VK_USE_PLATFORM_WIN32_KHR*/ -#endif /*!VKCPP_ENHANCED_MODE*/ +#endif /*!VKCPP_DISABLE_ENHANCED_MODE*/ -#ifdef VKCPP_ENHANCED_MODE +#ifndef VKCPP_DISABLE_ENHANCED_MODE #ifdef VK_USE_PLATFORM_WIN32_KHR Bool32 getWin32PresentationSupportKHR( uint32_t queueFamilyIndex ) const { return vkGetPhysicalDeviceWin32PresentationSupportKHR( m_physicalDevice, queueFamilyIndex ); } #endif /*VK_USE_PLATFORM_WIN32_KHR*/ -#endif /*VKCPP_ENHANCED_MODE*/ +#endif /*VKCPP_DISABLE_ENHANCED_MODE*/ #ifdef VK_USE_PLATFORM_XLIB_KHR Bool32 getXlibPresentationSupportKHR( uint32_t queueFamilyIndex, Display* dpy, VisualID visualID ) const @@ -22021,14 +22021,14 @@ namespace vk } #endif /*VK_USE_PLATFORM_XLIB_KHR*/ -#ifdef VKCPP_ENHANCED_MODE +#ifndef VKCPP_DISABLE_ENHANCED_MODE #ifdef VK_USE_PLATFORM_XLIB_KHR Bool32 getXlibPresentationSupportKHR( uint32_t queueFamilyIndex, Display & dpy, VisualID visualID ) const { return vkGetPhysicalDeviceXlibPresentationSupportKHR( m_physicalDevice, queueFamilyIndex, &dpy, visualID ); } #endif /*VK_USE_PLATFORM_XLIB_KHR*/ -#endif /*VKCPP_ENHANCED_MODE*/ +#endif /*VKCPP_DISABLE_ENHANCED_MODE*/ #ifdef VK_USE_PLATFORM_XCB_KHR Bool32 getXcbPresentationSupportKHR( uint32_t queueFamilyIndex, xcb_connection_t* connection, xcb_visualid_t visual_id ) const @@ -22037,14 +22037,14 @@ namespace vk } #endif /*VK_USE_PLATFORM_XCB_KHR*/ -#ifdef VKCPP_ENHANCED_MODE +#ifndef VKCPP_DISABLE_ENHANCED_MODE #ifdef VK_USE_PLATFORM_XCB_KHR Bool32 getXcbPresentationSupportKHR( uint32_t queueFamilyIndex, xcb_connection_t & connection, xcb_visualid_t visual_id ) const { return vkGetPhysicalDeviceXcbPresentationSupportKHR( m_physicalDevice, queueFamilyIndex, &connection, visual_id ); } #endif /*VK_USE_PLATFORM_XCB_KHR*/ -#endif /*VKCPP_ENHANCED_MODE*/ +#endif /*VKCPP_DISABLE_ENHANCED_MODE*/ #if !defined(VK_CPP_TYPESAFE_CONVERSION) explicit @@ -22255,19 +22255,19 @@ namespace vk vkDestroyInstance( m_instance, reinterpret_cast( pAllocator ) ); } -#ifdef VKCPP_ENHANCED_MODE +#ifndef VKCPP_DISABLE_ENHANCED_MODE void destroy( Optional const & allocator = nullptr ) const { vkDestroyInstance( m_instance, reinterpret_cast( static_cast( allocator)) ); } -#endif /*VKCPP_ENHANCED_MODE*/ +#endif /*VKCPP_DISABLE_ENHANCED_MODE*/ Result enumeratePhysicalDevices( uint32_t* pPhysicalDeviceCount, PhysicalDevice* pPhysicalDevices ) const { return static_cast( vkEnumeratePhysicalDevices( m_instance, pPhysicalDeviceCount, reinterpret_cast( pPhysicalDevices ) ) ); } -#ifdef VKCPP_ENHANCED_MODE +#ifndef VKCPP_DISABLE_ENHANCED_MODE std::vector enumeratePhysicalDevices() const { std::vector physicalDevices; @@ -22288,19 +22288,19 @@ namespace vk } return physicalDevices; } -#endif /*VKCPP_ENHANCED_MODE*/ +#endif /*VKCPP_DISABLE_ENHANCED_MODE*/ PFN_vkVoidFunction getProcAddr( const char* pName ) const { return vkGetInstanceProcAddr( m_instance, pName ); } -#ifdef VKCPP_ENHANCED_MODE +#ifndef VKCPP_DISABLE_ENHANCED_MODE PFN_vkVoidFunction getProcAddr( std::string const & name ) const { return vkGetInstanceProcAddr( m_instance, name.c_str() ); } -#endif /*VKCPP_ENHANCED_MODE*/ +#endif /*VKCPP_DISABLE_ENHANCED_MODE*/ #ifdef VK_USE_PLATFORM_ANDROID_KHR Result createAndroidSurfaceKHR( const AndroidSurfaceCreateInfoKHR* pCreateInfo, const AllocationCallbacks* pAllocator, SurfaceKHR* pSurface ) const @@ -22309,7 +22309,7 @@ namespace vk } #endif /*VK_USE_PLATFORM_ANDROID_KHR*/ -#ifdef VKCPP_ENHANCED_MODE +#ifndef VKCPP_DISABLE_ENHANCED_MODE #ifdef VK_USE_PLATFORM_ANDROID_KHR SurfaceKHR createAndroidSurfaceKHR( const AndroidSurfaceCreateInfoKHR & createInfo, Optional const & allocator = nullptr ) const { @@ -22322,14 +22322,14 @@ namespace vk return surface; } #endif /*VK_USE_PLATFORM_ANDROID_KHR*/ -#endif /*VKCPP_ENHANCED_MODE*/ +#endif /*VKCPP_DISABLE_ENHANCED_MODE*/ Result createDisplayPlaneSurfaceKHR( const DisplaySurfaceCreateInfoKHR* pCreateInfo, const AllocationCallbacks* pAllocator, SurfaceKHR* pSurface ) const { return static_cast( vkCreateDisplayPlaneSurfaceKHR( m_instance, reinterpret_cast( pCreateInfo ), reinterpret_cast( pAllocator ), reinterpret_cast( pSurface ) ) ); } -#ifdef VKCPP_ENHANCED_MODE +#ifndef VKCPP_DISABLE_ENHANCED_MODE SurfaceKHR createDisplayPlaneSurfaceKHR( const DisplaySurfaceCreateInfoKHR & createInfo, Optional const & allocator = nullptr ) const { SurfaceKHR surface; @@ -22340,7 +22340,7 @@ namespace vk } return surface; } -#endif /*VKCPP_ENHANCED_MODE*/ +#endif /*VKCPP_DISABLE_ENHANCED_MODE*/ #ifdef VK_USE_PLATFORM_MIR_KHR Result createMirSurfaceKHR( const MirSurfaceCreateInfoKHR* pCreateInfo, const AllocationCallbacks* pAllocator, SurfaceKHR* pSurface ) const @@ -22349,7 +22349,7 @@ namespace vk } #endif /*VK_USE_PLATFORM_MIR_KHR*/ -#ifdef VKCPP_ENHANCED_MODE +#ifndef VKCPP_DISABLE_ENHANCED_MODE #ifdef VK_USE_PLATFORM_MIR_KHR SurfaceKHR createMirSurfaceKHR( const MirSurfaceCreateInfoKHR & createInfo, Optional const & allocator = nullptr ) const { @@ -22362,19 +22362,19 @@ namespace vk return surface; } #endif /*VK_USE_PLATFORM_MIR_KHR*/ -#endif /*VKCPP_ENHANCED_MODE*/ +#endif /*VKCPP_DISABLE_ENHANCED_MODE*/ void destroySurfaceKHR( SurfaceKHR surface, const AllocationCallbacks* pAllocator ) const { vkDestroySurfaceKHR( m_instance, static_cast( surface ), reinterpret_cast( pAllocator ) ); } -#ifdef VKCPP_ENHANCED_MODE +#ifndef VKCPP_DISABLE_ENHANCED_MODE void destroySurfaceKHR( SurfaceKHR surface, Optional const & allocator = nullptr ) const { vkDestroySurfaceKHR( m_instance, static_cast( surface ), reinterpret_cast( static_cast( allocator)) ); } -#endif /*VKCPP_ENHANCED_MODE*/ +#endif /*VKCPP_DISABLE_ENHANCED_MODE*/ #ifdef VK_USE_PLATFORM_WAYLAND_KHR Result createWaylandSurfaceKHR( const WaylandSurfaceCreateInfoKHR* pCreateInfo, const AllocationCallbacks* pAllocator, SurfaceKHR* pSurface ) const @@ -22383,7 +22383,7 @@ namespace vk } #endif /*VK_USE_PLATFORM_WAYLAND_KHR*/ -#ifdef VKCPP_ENHANCED_MODE +#ifndef VKCPP_DISABLE_ENHANCED_MODE #ifdef VK_USE_PLATFORM_WAYLAND_KHR SurfaceKHR createWaylandSurfaceKHR( const WaylandSurfaceCreateInfoKHR & createInfo, Optional const & allocator = nullptr ) const { @@ -22396,7 +22396,7 @@ namespace vk return surface; } #endif /*VK_USE_PLATFORM_WAYLAND_KHR*/ -#endif /*VKCPP_ENHANCED_MODE*/ +#endif /*VKCPP_DISABLE_ENHANCED_MODE*/ #ifdef VK_USE_PLATFORM_WIN32_KHR Result createWin32SurfaceKHR( const Win32SurfaceCreateInfoKHR* pCreateInfo, const AllocationCallbacks* pAllocator, SurfaceKHR* pSurface ) const @@ -22405,7 +22405,7 @@ namespace vk } #endif /*VK_USE_PLATFORM_WIN32_KHR*/ -#ifdef VKCPP_ENHANCED_MODE +#ifndef VKCPP_DISABLE_ENHANCED_MODE #ifdef VK_USE_PLATFORM_WIN32_KHR SurfaceKHR createWin32SurfaceKHR( const Win32SurfaceCreateInfoKHR & createInfo, Optional const & allocator = nullptr ) const { @@ -22418,7 +22418,7 @@ namespace vk return surface; } #endif /*VK_USE_PLATFORM_WIN32_KHR*/ -#endif /*VKCPP_ENHANCED_MODE*/ +#endif /*VKCPP_DISABLE_ENHANCED_MODE*/ #ifdef VK_USE_PLATFORM_XLIB_KHR Result createXlibSurfaceKHR( const XlibSurfaceCreateInfoKHR* pCreateInfo, const AllocationCallbacks* pAllocator, SurfaceKHR* pSurface ) const @@ -22427,7 +22427,7 @@ namespace vk } #endif /*VK_USE_PLATFORM_XLIB_KHR*/ -#ifdef VKCPP_ENHANCED_MODE +#ifndef VKCPP_DISABLE_ENHANCED_MODE #ifdef VK_USE_PLATFORM_XLIB_KHR SurfaceKHR createXlibSurfaceKHR( const XlibSurfaceCreateInfoKHR & createInfo, Optional const & allocator = nullptr ) const { @@ -22440,7 +22440,7 @@ namespace vk return surface; } #endif /*VK_USE_PLATFORM_XLIB_KHR*/ -#endif /*VKCPP_ENHANCED_MODE*/ +#endif /*VKCPP_DISABLE_ENHANCED_MODE*/ #ifdef VK_USE_PLATFORM_XCB_KHR Result createXcbSurfaceKHR( const XcbSurfaceCreateInfoKHR* pCreateInfo, const AllocationCallbacks* pAllocator, SurfaceKHR* pSurface ) const @@ -22449,7 +22449,7 @@ namespace vk } #endif /*VK_USE_PLATFORM_XCB_KHR*/ -#ifdef VKCPP_ENHANCED_MODE +#ifndef VKCPP_DISABLE_ENHANCED_MODE #ifdef VK_USE_PLATFORM_XCB_KHR SurfaceKHR createXcbSurfaceKHR( const XcbSurfaceCreateInfoKHR & createInfo, Optional const & allocator = nullptr ) const { @@ -22462,14 +22462,14 @@ namespace vk return surface; } #endif /*VK_USE_PLATFORM_XCB_KHR*/ -#endif /*VKCPP_ENHANCED_MODE*/ +#endif /*VKCPP_DISABLE_ENHANCED_MODE*/ Result createDebugReportCallbackEXT( const DebugReportCallbackCreateInfoEXT* pCreateInfo, const AllocationCallbacks* pAllocator, DebugReportCallbackEXT* pCallback ) const { return static_cast( vkCreateDebugReportCallbackEXT( m_instance, reinterpret_cast( pCreateInfo ), reinterpret_cast( pAllocator ), reinterpret_cast( pCallback ) ) ); } -#ifdef VKCPP_ENHANCED_MODE +#ifndef VKCPP_DISABLE_ENHANCED_MODE DebugReportCallbackEXT createDebugReportCallbackEXT( const DebugReportCallbackCreateInfoEXT & createInfo, Optional const & allocator = nullptr ) const { DebugReportCallbackEXT callback; @@ -22480,31 +22480,31 @@ namespace vk } return callback; } -#endif /*VKCPP_ENHANCED_MODE*/ +#endif /*VKCPP_DISABLE_ENHANCED_MODE*/ void destroyDebugReportCallbackEXT( DebugReportCallbackEXT callback, const AllocationCallbacks* pAllocator ) const { vkDestroyDebugReportCallbackEXT( m_instance, static_cast( callback ), reinterpret_cast( pAllocator ) ); } -#ifdef VKCPP_ENHANCED_MODE +#ifndef VKCPP_DISABLE_ENHANCED_MODE void destroyDebugReportCallbackEXT( DebugReportCallbackEXT callback, Optional const & allocator = nullptr ) const { vkDestroyDebugReportCallbackEXT( m_instance, static_cast( callback ), reinterpret_cast( static_cast( allocator)) ); } -#endif /*VKCPP_ENHANCED_MODE*/ +#endif /*VKCPP_DISABLE_ENHANCED_MODE*/ void debugReportMessageEXT( DebugReportFlagsEXT flags, DebugReportObjectTypeEXT objectType, uint64_t object, size_t location, int32_t messageCode, const char* pLayerPrefix, const char* pMessage ) const { vkDebugReportMessageEXT( m_instance, static_cast( flags ), static_cast( objectType ), object, location, messageCode, pLayerPrefix, pMessage ); } -#ifdef VKCPP_ENHANCED_MODE +#ifndef VKCPP_DISABLE_ENHANCED_MODE void debugReportMessageEXT( DebugReportFlagsEXT flags, DebugReportObjectTypeEXT objectType, uint64_t object, size_t location, int32_t messageCode, std::string const & layerPrefix, std::string const & message ) const { vkDebugReportMessageEXT( m_instance, static_cast( flags ), static_cast( objectType ), object, location, messageCode, layerPrefix.c_str(), message.c_str() ); } -#endif /*VKCPP_ENHANCED_MODE*/ +#endif /*VKCPP_DISABLE_ENHANCED_MODE*/ #if !defined(VK_CPP_TYPESAFE_CONVERSION) explicit @@ -22540,7 +22540,7 @@ namespace vk return static_cast( vkCreateInstance( reinterpret_cast( pCreateInfo ), reinterpret_cast( pAllocator ), reinterpret_cast( pInstance ) ) ); } -#ifdef VKCPP_ENHANCED_MODE +#ifndef VKCPP_DISABLE_ENHANCED_MODE inline Instance createInstance( const InstanceCreateInfo & createInfo, Optional const & allocator = nullptr ) { Instance instance; @@ -22551,14 +22551,14 @@ namespace vk } return instance; } -#endif /*VKCPP_ENHANCED_MODE*/ +#endif /*VKCPP_DISABLE_ENHANCED_MODE*/ inline Result enumerateInstanceLayerProperties( uint32_t* pPropertyCount, LayerProperties* pProperties ) { return static_cast( vkEnumerateInstanceLayerProperties( pPropertyCount, reinterpret_cast( pProperties ) ) ); } -#ifdef VKCPP_ENHANCED_MODE +#ifndef VKCPP_DISABLE_ENHANCED_MODE inline std::vector enumerateInstanceLayerProperties() { std::vector properties; @@ -22579,14 +22579,14 @@ namespace vk } return properties; } -#endif /*VKCPP_ENHANCED_MODE*/ +#endif /*VKCPP_DISABLE_ENHANCED_MODE*/ inline Result enumerateInstanceExtensionProperties( const char* pLayerName, uint32_t* pPropertyCount, ExtensionProperties* pProperties ) { return static_cast( vkEnumerateInstanceExtensionProperties( pLayerName, pPropertyCount, reinterpret_cast( pProperties ) ) ); } -#ifdef VKCPP_ENHANCED_MODE +#ifndef VKCPP_DISABLE_ENHANCED_MODE inline std::vector enumerateInstanceExtensionProperties( Optional const & layerName = nullptr ) { std::vector properties; @@ -22607,7 +22607,7 @@ namespace vk } return properties; } -#endif /*VKCPP_ENHANCED_MODE*/ +#endif /*VKCPP_DISABLE_ENHANCED_MODE*/ inline std::string to_string(FramebufferCreateFlagBits) {