2019-01-09 10:55:11 +00:00
|
|
|
// Copyright(c) 2015-2019, NVIDIA CORPORATION. All rights reserved.
|
2017-12-21 11:40:48 +00:00
|
|
|
//
|
|
|
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
// you may not use this file except in compliance with the License.
|
|
|
|
// You may obtain a copy of the License at
|
|
|
|
//
|
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
//
|
|
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
// See the License for the specific language governing permissions and
|
|
|
|
// limitations under the License.
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <map>
|
|
|
|
#include <iostream>
|
|
|
|
#include <set>
|
|
|
|
#include <vector>
|
|
|
|
#include <tinyxml2.h>
|
|
|
|
|
|
|
|
class VulkanHppGenerator
|
|
|
|
{
|
|
|
|
public:
|
2020-02-11 13:37:22 +00:00
|
|
|
VulkanHppGenerator(tinyxml2::XMLDocument const& document);
|
2017-12-21 11:40:48 +00:00
|
|
|
|
2019-08-27 07:02:49 +00:00
|
|
|
void appendBaseTypes(std::string & str) const;
|
|
|
|
void appendBitmasks(std::string & str) const;
|
|
|
|
void appendDispatchLoaderDynamic(std::string & str); // use vkGet*ProcAddress to get function pointers
|
|
|
|
void appendDispatchLoaderStatic(std::string & str); // use exported symbols from loader
|
|
|
|
void appendDispatchLoaderDefault(std::string & str); // typedef to DispatchLoaderStatic or undefined type, based on VK_NO_PROTOTYPES
|
|
|
|
void appendEnums(std::string & str) const;
|
|
|
|
void appendForwardDeclarations(std::string & str) const;
|
|
|
|
void appendHandles(std::string & str) const;
|
|
|
|
void appendHandlesCommandDefintions(std::string & str) const;
|
2020-03-30 10:18:06 +00:00
|
|
|
void appendHashStructures(std::string& str) const;
|
2019-08-27 07:02:49 +00:00
|
|
|
void appendResultExceptions(std::string & str) const;
|
|
|
|
void appendStructs(std::string & str) const;
|
|
|
|
void appendStructureChainValidation(std::string & str);
|
|
|
|
void appendThrowExceptions(std::string & str) const;
|
2017-12-21 11:40:48 +00:00
|
|
|
std::string const& getTypesafeCheck() const;
|
|
|
|
std::string const& getVersion() const;
|
|
|
|
std::string const& getVulkanLicenseHeader() const;
|
|
|
|
|
|
|
|
private:
|
2020-02-04 09:35:33 +00:00
|
|
|
struct BaseTypeData
|
|
|
|
{
|
|
|
|
BaseTypeData(std::string const& type_, int line)
|
|
|
|
: type(type_)
|
|
|
|
, xmlLine(line)
|
|
|
|
{}
|
|
|
|
|
|
|
|
std::string type;
|
|
|
|
int xmlLine;
|
|
|
|
};
|
|
|
|
|
2018-01-04 09:51:17 +00:00
|
|
|
struct BitmaskData
|
|
|
|
{
|
2020-03-04 12:33:52 +00:00
|
|
|
BitmaskData(std::string const& r, std::string const& t, int line)
|
2020-02-26 13:24:58 +00:00
|
|
|
: requirements(r)
|
2020-03-04 12:33:52 +00:00
|
|
|
, type(t)
|
2020-02-04 09:35:33 +00:00
|
|
|
, xmlLine(line)
|
2019-01-09 10:55:11 +00:00
|
|
|
{}
|
|
|
|
|
2020-03-04 12:33:52 +00:00
|
|
|
std::string requirements;
|
|
|
|
std::string type;
|
2019-01-09 10:55:11 +00:00
|
|
|
std::string platform;
|
2020-03-04 12:33:52 +00:00
|
|
|
std::string alias;
|
2020-02-04 09:35:33 +00:00
|
|
|
int xmlLine;
|
2018-01-04 09:51:17 +00:00
|
|
|
};
|
|
|
|
|
2020-02-11 13:37:22 +00:00
|
|
|
struct NameData
|
|
|
|
{
|
|
|
|
std::string name;
|
|
|
|
std::vector<std::string> arraySizes;
|
|
|
|
std::string bitCount;
|
|
|
|
};
|
|
|
|
|
2019-01-09 10:55:11 +00:00
|
|
|
struct TypeData
|
2017-12-21 11:40:48 +00:00
|
|
|
{
|
2019-01-09 10:55:11 +00:00
|
|
|
std::string compose() const;
|
2017-12-21 11:40:48 +00:00
|
|
|
|
2019-01-09 10:55:11 +00:00
|
|
|
bool operator==(TypeData const& rhs) const
|
|
|
|
{
|
|
|
|
return (prefix == rhs.prefix) && (type == rhs.type) && (postfix == rhs.postfix);
|
|
|
|
}
|
2017-12-21 11:40:48 +00:00
|
|
|
|
2019-01-09 10:55:11 +00:00
|
|
|
std::string prefix;
|
|
|
|
std::string type;
|
|
|
|
std::string postfix;
|
2017-12-21 11:40:48 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct ParamData
|
|
|
|
{
|
2020-03-05 10:02:55 +00:00
|
|
|
ParamData(int line)
|
2019-01-14 09:09:19 +00:00
|
|
|
: optional(false)
|
2020-03-05 10:02:55 +00:00
|
|
|
, xmlLine(line)
|
2019-01-14 09:09:19 +00:00
|
|
|
{}
|
|
|
|
|
2020-01-13 14:00:59 +00:00
|
|
|
TypeData type;
|
|
|
|
std::string name;
|
|
|
|
std::vector<std::string> arraySizes;
|
|
|
|
std::string len;
|
|
|
|
bool optional;
|
2020-03-05 10:02:55 +00:00
|
|
|
int xmlLine;
|
2017-12-21 11:40:48 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct CommandData
|
|
|
|
{
|
2020-02-04 09:35:33 +00:00
|
|
|
CommandData(int line)
|
2020-03-02 11:32:42 +00:00
|
|
|
: xmlLine(line)
|
2017-12-21 11:40:48 +00:00
|
|
|
{}
|
|
|
|
|
|
|
|
std::vector<ParamData> params;
|
2019-01-09 10:55:11 +00:00
|
|
|
std::string platform;
|
2017-12-21 11:40:48 +00:00
|
|
|
std::string returnType;
|
|
|
|
std::vector<std::string> successCodes;
|
2020-02-11 13:37:22 +00:00
|
|
|
std::vector<std::string> errorCodes;
|
2020-03-02 11:32:42 +00:00
|
|
|
std::set<std::string> aliases;
|
2020-02-04 09:35:33 +00:00
|
|
|
int xmlLine;
|
2017-12-21 11:40:48 +00:00
|
|
|
};
|
|
|
|
|
2019-07-03 11:53:44 +00:00
|
|
|
struct EnumValueData
|
|
|
|
{
|
|
|
|
EnumValueData(std::string const& vulkan, std::string const& vk, bool singleBit_)
|
|
|
|
: vulkanValue(vulkan)
|
|
|
|
, vkValue(vk)
|
|
|
|
, singleBit(singleBit_)
|
|
|
|
{}
|
|
|
|
|
|
|
|
std::string vulkanValue;
|
|
|
|
std::string vkValue;
|
|
|
|
bool singleBit;
|
|
|
|
};
|
|
|
|
|
2017-12-21 11:40:48 +00:00
|
|
|
struct EnumData
|
|
|
|
{
|
2020-02-11 13:37:22 +00:00
|
|
|
void addEnumValue(int line, std::string const& valueName, bool bitmask, bool bitpos, std::string const& prefix, std::string const& postfix, std::string const& tag);
|
2017-12-21 11:40:48 +00:00
|
|
|
|
2020-01-13 14:00:59 +00:00
|
|
|
std::string alias; // alias for this enum
|
2019-01-09 10:55:11 +00:00
|
|
|
std::vector<std::pair<std::string, std::string>> aliases; // pairs of vulkan enum value and corresponding vk::-namespace enum value
|
2020-01-13 14:00:59 +00:00
|
|
|
bool isBitmask = false;
|
2019-03-20 16:39:51 +00:00
|
|
|
std::string platform;
|
2019-07-03 11:53:44 +00:00
|
|
|
std::vector<EnumValueData> values;
|
2017-12-21 11:40:48 +00:00
|
|
|
};
|
|
|
|
|
2020-02-11 13:37:22 +00:00
|
|
|
struct ExtensionData
|
|
|
|
{
|
|
|
|
ExtensionData(int line)
|
|
|
|
: xmlLine(line)
|
|
|
|
{}
|
|
|
|
|
|
|
|
std::string deprecatedBy;
|
|
|
|
std::string obsoletedBy;
|
|
|
|
std::string promotedTo;
|
2020-02-26 13:24:58 +00:00
|
|
|
std::map<std::string, int> requirements;
|
2020-02-11 13:37:22 +00:00
|
|
|
int xmlLine;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct FuncPointerData
|
|
|
|
{
|
|
|
|
FuncPointerData(std::string const& r, int line)
|
2020-02-26 13:24:58 +00:00
|
|
|
: requirements(r)
|
2020-02-11 13:37:22 +00:00
|
|
|
, xmlLine(line)
|
|
|
|
{}
|
|
|
|
|
2020-02-26 13:24:58 +00:00
|
|
|
std::string requirements;
|
2020-02-11 13:37:22 +00:00
|
|
|
int xmlLine;
|
|
|
|
};
|
|
|
|
|
2017-12-21 11:40:48 +00:00
|
|
|
struct HandleData
|
|
|
|
{
|
2020-02-11 13:37:22 +00:00
|
|
|
HandleData(std::vector<std::string> const& p, int line)
|
|
|
|
: parents(p)
|
|
|
|
, xmlLine(line)
|
|
|
|
{}
|
|
|
|
|
2019-01-09 10:55:11 +00:00
|
|
|
std::string alias;
|
2020-02-11 13:37:22 +00:00
|
|
|
std::set<std::string> childrenHandles;
|
2019-01-09 10:55:11 +00:00
|
|
|
std::map<std::string, CommandData> commands;
|
|
|
|
std::string deleteCommand;
|
|
|
|
std::string deletePool;
|
2020-03-02 11:32:42 +00:00
|
|
|
std::string platform;
|
2020-02-11 13:37:22 +00:00
|
|
|
std::vector<std::string> parents;
|
|
|
|
int xmlLine;
|
2017-12-21 11:40:48 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct MemberData
|
|
|
|
{
|
2020-02-11 13:37:22 +00:00
|
|
|
MemberData(int line)
|
|
|
|
: xmlLine(line)
|
|
|
|
{}
|
|
|
|
|
2020-01-13 14:00:59 +00:00
|
|
|
TypeData type;
|
|
|
|
std::string name;
|
|
|
|
std::vector<std::string> arraySizes;
|
|
|
|
std::string bitCount;
|
|
|
|
std::string values;
|
2020-02-11 13:37:22 +00:00
|
|
|
std::string usedConstant;
|
|
|
|
int xmlLine;
|
2017-12-21 11:40:48 +00:00
|
|
|
};
|
|
|
|
|
2019-01-09 10:55:11 +00:00
|
|
|
struct StructureData
|
2017-12-21 11:40:48 +00:00
|
|
|
{
|
2020-02-11 13:37:22 +00:00
|
|
|
StructureData(std::vector<std::string> const& extends, int line)
|
2017-12-21 11:40:48 +00:00
|
|
|
: returnedOnly(false)
|
2019-12-12 10:40:21 +00:00
|
|
|
, isUnion(false)
|
2020-02-11 13:37:22 +00:00
|
|
|
, structExtends(extends)
|
2020-02-04 09:35:33 +00:00
|
|
|
, xmlLine(line)
|
2017-12-21 11:40:48 +00:00
|
|
|
{}
|
|
|
|
|
|
|
|
bool returnedOnly;
|
|
|
|
bool isUnion;
|
|
|
|
std::vector<MemberData> members;
|
2019-04-01 07:30:06 +00:00
|
|
|
std::string platform;
|
2017-12-21 11:40:48 +00:00
|
|
|
std::vector<std::string> structExtends;
|
2020-02-11 13:37:22 +00:00
|
|
|
std::set<std::string> aliases;
|
2018-05-07 14:44:32 +00:00
|
|
|
std::string subStruct;
|
2020-02-04 09:35:33 +00:00
|
|
|
int xmlLine;
|
2017-12-21 11:40:48 +00:00
|
|
|
};
|
|
|
|
|
2020-03-05 10:02:55 +00:00
|
|
|
enum class TypeCategory
|
|
|
|
{
|
|
|
|
Bitmask,
|
|
|
|
BaseType,
|
|
|
|
Define,
|
|
|
|
Enum,
|
|
|
|
FuncPointer,
|
|
|
|
Handle,
|
|
|
|
Requires,
|
|
|
|
Struct,
|
|
|
|
Union,
|
|
|
|
Unknown
|
|
|
|
};
|
|
|
|
|
2017-12-21 11:40:48 +00:00
|
|
|
private:
|
2019-08-27 07:02:49 +00:00
|
|
|
void appendArgumentPlainType(std::string & str, ParamData const& paramData) const;
|
|
|
|
void appendArguments(std::string & str, CommandData const& commandData, size_t returnParamIndex, size_t templateParamIndex, std::map<size_t, size_t> const& vectorParamIndices, bool twoStep, bool firstCall, bool singular, size_t from, size_t to) const;
|
|
|
|
void appendArgumentVector(std::string & str, size_t paramIndex, ParamData const& paramData, size_t returnParamIndex, size_t templateParamIndex, bool twoStep, bool firstCall, bool singular) const;
|
|
|
|
void appendArgumentVulkanType(std::string & str, ParamData const& paramData) const;
|
2020-03-04 12:33:52 +00:00
|
|
|
void appendBitmask(std::string & os, std::string const& bitmaskName, std::string const& bitmaskType, std::string const& bitmaskAlias, std::string const& enumName, std::vector<EnumValueData> const& enumValues) const;
|
2019-08-27 07:02:49 +00:00
|
|
|
void appendBitmaskToStringFunction(std::string & str, std::string const& flagsName, std::string const& enumName, std::vector<EnumValueData> const& enumValues) const;
|
2020-03-25 10:00:02 +00:00
|
|
|
void appendCall(std::string &str, std::string const& name, CommandData const& commandData, size_t returnParamIndex, size_t templateParamIndex, std::map<size_t, size_t> const& vectorParamIndices, bool twoStep, bool firstCall, bool singular) const;
|
|
|
|
void appendCommand(std::string & str, std::string const& indentation, std::string const& name, CommandData const& commandData, bool definition) const;
|
2019-08-27 07:02:49 +00:00
|
|
|
void appendEnum(std::string & str, std::pair<std::string, EnumData> const& enumData) const;
|
2020-03-10 13:26:36 +00:00
|
|
|
void appendEnumInitializer(std::string& str, TypeData const& type, std::vector<std::string> const& arraySizes, std::vector<EnumValueData> const& values, bool argument) const;
|
2019-08-27 07:02:49 +00:00
|
|
|
void appendEnumToString(std::string & str, std::pair<std::string, EnumData> const& enumData) const;
|
2020-03-25 10:00:02 +00:00
|
|
|
void appendFunction(std::string & str, std::string const& indentation, std::string const& name, CommandData const& commandData, size_t returnParamIndex, size_t templateParamIndex, std::map<size_t, size_t> const& vectorParamIndices, bool twoStep, std::string const& enhancedReturnType, bool definition, bool enhanced, bool singular, bool unique, bool isStructureChain, bool withAllocator) const;
|
|
|
|
void appendFunctionBodyEnhanced(std::string & str, std::string const& indentation, std::string const& name, CommandData const& commandData, size_t returnParamIndex, size_t templateParamIndex, std::map<size_t, size_t> const& vectorParamIndices, bool twoStep, std::string const& enhancedReturnType, bool singular, bool unique, bool isStructureChain, bool withAllocator) const;
|
2019-08-27 07:02:49 +00:00
|
|
|
std::string appendFunctionBodyEnhancedLocalReturnVariable(std::string & str, std::string const& indentation, CommandData const& commandData, size_t returnParamIndex, std::map<size_t, size_t> const& vectorParamIndices, bool twoStep, std::string const& enhancedReturnType, bool singular, bool isStructureChain, bool withAllocator) const;
|
|
|
|
void appendFunctionBodyEnhancedLocalReturnVariableVectorSize(std::string & str, std::vector<ParamData> const& params, std::pair<size_t, size_t> const& vectorParamIndex, size_t returnParamIndex, std::map<size_t, size_t> const& vectorParamIndices, bool withAllocator) const;
|
2020-03-25 10:00:02 +00:00
|
|
|
void appendFunctionBodyEnhancedMultiVectorSizeCheck(std::string & str, std::string const& indentation, std::string const& name, CommandData const& commandData, size_t returnParamIndex, std::map<size_t, size_t> const& vectorParamIndices) const;
|
|
|
|
void appendFunctionBodyEnhancedReturnResultValue(std::string & str, std::string const& indentation, std::string const& returnName, std::string const& name, CommandData const& commandData, size_t returnParamIndex, bool twoStep, bool singular, bool unique) const;
|
|
|
|
void appendFunctionBodyEnhancedSingleStep(std::string & str, std::string const& indentation, std::string const& name, CommandData const& commandData, size_t returnParamIndex, size_t templateParamIndex, std::map<size_t, size_t> const& vectorParamIndices, bool singular) const;
|
|
|
|
void appendFunctionBodyEnhancedTwoStep(std::string & str, std::string const& indentation, std::string const& name, CommandData const& commandData, size_t returnParamIndex, size_t templateParamIndex, std::map<size_t, size_t> const& vectorParamIndices, bool singular, std::string const& returnName) const;
|
|
|
|
void appendFunctionBodyEnhancedVectorOfStructureChain(std::string & str, std::string const& indentation, std::string const& name, CommandData const& commandData, size_t returnParamIndex, std::map<size_t, size_t> const& vectorParamIndices, bool withAllocator) const;
|
|
|
|
void appendFunctionBodyEnhancedVectorOfUniqueHandles(std::string & str, std::string const& indentation, std::string const& name, CommandData const& commandData, size_t returnParamIndex, size_t templateParamIndex, std::map<size_t, size_t> const& vectorParamIndices, bool twoStep, bool singular, bool withAllocator) const;
|
|
|
|
void appendFunctionBodyStandard(std::string & str, std::string const& indentation, std::string const& commandName, CommandData const& commandData) const;
|
2020-03-10 14:40:05 +00:00
|
|
|
void appendFunctionBodyStandardArgument(std::string & str, TypeData const& typeData, std::string const& name, std::vector<std::string> const& arraySizes) const;
|
2019-08-27 07:02:49 +00:00
|
|
|
bool appendFunctionHeaderArgumentEnhanced(std::string & str, ParamData const& param, size_t paramIndex, std::map<size_t, size_t> const& vectorParamIndices, bool skip, bool argEncountered, bool isTemplateParam, bool isLastArgument, bool singular, bool withDefaults, bool withAllocator) const;
|
|
|
|
void appendFunctionHeaderArgumentEnhancedPointer(std::string & str, ParamData const& param, std::string const& strippedParameterName, bool withDefaults, bool withAllocator) const;
|
|
|
|
void appendFunctionHeaderArgumentEnhancedSimple(std::string & str, ParamData const& param, bool lastArgument, bool withDefaults, bool withAllocator) const;
|
|
|
|
void appendFunctionHeaderArgumentEnhancedVector(std::string & str, ParamData const& param, std::string const& strippedParameterName, bool hasSizeParam, bool isTemplateParam, bool singular, bool withDefaults, bool withAllocator) const;
|
2020-03-25 10:00:02 +00:00
|
|
|
void appendFunctionHeaderArguments(std::string & str, std::string const& name, CommandData const& commandData, size_t returnParamIndex, size_t templateParamIndex, std::map<size_t, size_t> const& vectorParamIndices, bool enhanced, bool singular, bool withDefaults, bool withAllocator) const;
|
|
|
|
void appendFunctionHeaderArgumentsEnhanced(std::string & str, std::string const& name, CommandData const& commandData, size_t returnParamIndex, size_t templateParamIndex, std::map<size_t, size_t> const& vectorParamIndices, bool singular, bool withDefaults, bool withAllocator) const;
|
|
|
|
void appendFunctionHeaderArgumentsStandard(std::string & str, std::string const& name, CommandData const& commandData, bool withDefaults) const;
|
2019-08-27 07:02:49 +00:00
|
|
|
bool appendFunctionHeaderArgumentStandard(std::string & str, ParamData const& param, bool argEncountered, bool isLastArgument, bool withDefaults) const;
|
2020-01-15 15:54:55 +00:00
|
|
|
void appendFunctionHeaderReturnType(std::string & str, CommandData const& commandData, size_t returnParamIndex, std::map<size_t, size_t> const& vectorParamIndices, std::string const& enhancedReturnType, bool enhanced, bool twoStep, bool singular, bool unique, bool isStructureChain) const;
|
2019-08-27 07:02:49 +00:00
|
|
|
void appendFunctionHeaderTemplate(std::string & str, std::string const& indentation, size_t returnParamIndex, size_t templateParamIndex, std::string const& enhancedReturnType, bool enhanced, bool singular, bool unique, bool withDefault, bool isStructureChain) const;
|
|
|
|
void appendHandle(std::string & str, std::pair<std::string, HandleData> const& handle, std::set<std::string> & listedHandles) const;
|
2020-03-02 11:32:42 +00:00
|
|
|
void appendPlatformEnter(std::string & str, bool isAliased, std::string const& platform) const;
|
|
|
|
void appendPlatformLeave(std::string & str, bool isAliased, std::string const& platform) const;
|
2019-08-27 07:02:49 +00:00
|
|
|
void appendStruct(std::string & str, std::pair<std::string, StructureData> const& structure, std::set<std::string> & listedStructures) const;
|
2020-01-30 09:14:21 +00:00
|
|
|
void appendStructAssignmentOperator(std::string &str, std::pair<std::string, StructureData> const& structure, std::string const& prefix) const;
|
2019-08-27 07:02:49 +00:00
|
|
|
void appendStructCompareOperators(std::string & str, std::pair<std::string, StructureData> const& structure) const;
|
2020-01-30 09:14:21 +00:00
|
|
|
void appendStructConstructor(std::string &str, std::pair<std::string, StructureData> const& structData, std::string const& prefix) const;
|
2019-08-27 07:02:49 +00:00
|
|
|
bool appendStructConstructorArgument(std::string & str, bool listedArgument, std::string const& indentation, MemberData const& memberData) const;
|
2019-11-07 07:22:47 +00:00
|
|
|
void appendStructCopyConstructors(std::string & str, std::string const& vkName) const;
|
|
|
|
void appendStructMembers(std::string & str, std::pair<std::string,StructureData> const& structData, std::string const& prefix) const;
|
2020-04-20 13:26:40 +00:00
|
|
|
void appendStructSetter(std::string & str, std::string const& structureName, bool isUnion, MemberData const& memberData) const;
|
2020-01-30 09:14:21 +00:00
|
|
|
void appendStructSubConstructor(std::string &str, std::pair<std::string, StructureData> const& structData, std::string const& prefix) const;
|
2019-08-27 07:02:49 +00:00
|
|
|
void appendStructure(std::string & str, std::pair<std::string, StructureData> const& structure) const;
|
|
|
|
void appendUnion(std::string & str, std::pair<std::string, StructureData> const& structure) const;
|
|
|
|
void appendUniqueTypes(std::string &str, std::string const& parentType, std::set<std::string> const& childrenTypes) const;
|
2020-01-30 09:14:21 +00:00
|
|
|
std::string constructConstexprString(std::pair<std::string, StructureData> const& structData) const;
|
2020-02-11 13:37:22 +00:00
|
|
|
void checkCorrectness();
|
|
|
|
bool checkLenAttribute(std::string const& len, std::vector<ParamData> const& params);
|
2019-09-23 13:57:48 +00:00
|
|
|
bool containsArray(std::string const& type) const;
|
2019-01-09 10:55:11 +00:00
|
|
|
bool containsUnion(std::string const& type) const;
|
2020-03-24 08:43:50 +00:00
|
|
|
std::string determineEnhancedReturnType(CommandData const& commandData, size_t returnParamIndex, std::map<size_t, size_t> const& vectorParamIndices, bool isStructureChain) const;
|
2019-01-09 10:55:11 +00:00
|
|
|
size_t determineReturnParamIndex(CommandData const& commandData, std::map<size_t, size_t> const& vectorParamIndices, bool twoStep) const;
|
|
|
|
std::string determineSubStruct(std::pair<std::string, StructureData> const& structure) const;
|
|
|
|
size_t determineTemplateParamIndex(std::vector<ParamData> const& params, std::map<size_t, size_t> const& vectorParamIndices) const;
|
|
|
|
std::map<size_t, size_t> determineVectorParamIndices(std::vector<ParamData> const& params) const;
|
2020-04-20 13:26:40 +00:00
|
|
|
bool holdsSType(std::string const& type) const;
|
2019-01-09 10:55:11 +00:00
|
|
|
bool isTwoStepAlgorithm(std::vector<ParamData> const& params) const;
|
2020-02-11 13:37:22 +00:00
|
|
|
void linkCommandToHandle(int line, std::string const& name, CommandData const& commandData);
|
2019-01-09 10:55:11 +00:00
|
|
|
void readBaseType(tinyxml2::XMLElement const* element, std::map<std::string, std::string> const& attributes);
|
|
|
|
void readBitmask(tinyxml2::XMLElement const* element, std::map<std::string, std::string> const& attributes);
|
2020-02-11 13:37:22 +00:00
|
|
|
void readBitmaskAlias(tinyxml2::XMLElement const* element, std::map<std::string, std::string> const& attributes);
|
2019-01-09 10:55:11 +00:00
|
|
|
void readCommand(tinyxml2::XMLElement const* element);
|
2020-02-11 13:37:22 +00:00
|
|
|
void readCommand(tinyxml2::XMLElement const* element, std::map<std::string, std::string> const& attributess);
|
|
|
|
void readCommandAlias(tinyxml2::XMLElement const* element, std::map<std::string, std::string> const& attributes);
|
|
|
|
ParamData readCommandParam(tinyxml2::XMLElement const* element, std::vector<ParamData> const& params);
|
|
|
|
std::pair<std::string, std::string> readCommandProto(tinyxml2::XMLElement const* element);
|
|
|
|
void readCommands(tinyxml2::XMLElement const* element);
|
|
|
|
std::string readComment(tinyxml2::XMLElement const* element);
|
2019-01-09 10:55:11 +00:00
|
|
|
void readDefine(tinyxml2::XMLElement const* element, std::map<std::string, std::string> const& attributes);
|
|
|
|
void readEnum(tinyxml2::XMLElement const* element, EnumData & enumData, bool bitmask, std::string const& prefix, std::string const& postfix);
|
2020-02-11 13:37:22 +00:00
|
|
|
void readEnum(tinyxml2::XMLElement const* element, std::map<std::string, std::string> const& attributes, EnumData & enumData, bool bitmask, std::string const& prefix, std::string const& postfix);
|
|
|
|
void readEnumAlias(tinyxml2::XMLElement const* element, std::map<std::string, std::string> const& attributes, EnumData & enumData, bool bitmask, std::string const& prefix, std::string const& postfix);
|
|
|
|
void readEnumConstant(tinyxml2::XMLElement const* element);
|
|
|
|
void readEnums(tinyxml2::XMLElement const* element);
|
2019-01-09 10:55:11 +00:00
|
|
|
void readExtension(tinyxml2::XMLElement const* element);
|
2020-02-11 13:37:22 +00:00
|
|
|
void readExtensionDisabledCommand(tinyxml2::XMLElement const* element);
|
|
|
|
void readExtensionDisabledEnum(std::string const& extensionName, tinyxml2::XMLElement const* element);
|
|
|
|
void readExtensionDisabledRequire(std::string const& extensionName, tinyxml2::XMLElement const* element);
|
|
|
|
void readExtensionDisabledType(tinyxml2::XMLElement const* element);
|
2020-02-26 13:24:58 +00:00
|
|
|
void readExtensionRequire(tinyxml2::XMLElement const* element, std::string const& platform, std::string const& tag, std::map<std::string, int> & requirements);
|
2019-01-09 10:55:11 +00:00
|
|
|
void readExtensionRequireCommand(tinyxml2::XMLElement const* element, std::string const& platform);
|
|
|
|
void readExtensionRequireType(tinyxml2::XMLElement const* element, std::string const& platform);
|
2020-02-11 13:37:22 +00:00
|
|
|
void readExtensions(tinyxml2::XMLElement const* element);
|
|
|
|
void readFeature(tinyxml2::XMLElement const* element);
|
2017-12-21 11:40:48 +00:00
|
|
|
void readFeatureRequire(tinyxml2::XMLElement const* element);
|
2019-01-09 10:55:11 +00:00
|
|
|
void readFuncpointer(tinyxml2::XMLElement const* element, std::map<std::string, std::string> const& attributes);
|
|
|
|
void readHandle(tinyxml2::XMLElement const* element, std::map<std::string, std::string> const& attributes);
|
2020-02-11 13:37:22 +00:00
|
|
|
std::pair<NameData, TypeData> readNameAndType(tinyxml2::XMLElement const* elements);
|
2018-12-03 13:33:37 +00:00
|
|
|
void readPlatform(tinyxml2::XMLElement const* element);
|
2020-02-11 13:37:22 +00:00
|
|
|
void readPlatforms(tinyxml2::XMLElement const* element);
|
|
|
|
void readRegistry(tinyxml2::XMLElement const* element);
|
|
|
|
void readRequireCommand(tinyxml2::XMLElement const* element);
|
2019-03-18 19:48:10 +00:00
|
|
|
void readRequireEnum(tinyxml2::XMLElement const* element, std::string const& tag);
|
2020-02-11 13:37:22 +00:00
|
|
|
void readRequireEnum(tinyxml2::XMLElement const* element, std::map<std::string, std::string> const& attributes, std::string const& tag);
|
|
|
|
void readRequireEnumAlias(tinyxml2::XMLElement const* element, std::map<std::string, std::string> const& attributes, std::string const& tag);
|
2020-02-04 09:35:33 +00:00
|
|
|
void readRequires(tinyxml2::XMLElement const* element, std::map<std::string, std::string> const& attributes);
|
2020-02-11 13:37:22 +00:00
|
|
|
void readRequireType(tinyxml2::XMLElement const* element);
|
2019-01-09 10:55:11 +00:00
|
|
|
void readStruct(tinyxml2::XMLElement const* element, bool isUnion, std::map<std::string, std::string> const& attributes);
|
2020-02-11 13:37:22 +00:00
|
|
|
void readStructAlias(tinyxml2::XMLElement const* element, std::map<std::string, std::string> const& attributes);
|
|
|
|
void readStructMember(tinyxml2::XMLElement const* element, std::vector<MemberData> & members);
|
|
|
|
void readStructMemberEnum(tinyxml2::XMLElement const* element, MemberData & memberData);
|
|
|
|
void readStructMemberName(tinyxml2::XMLElement const* element, MemberData & memberData, std::vector<MemberData> const& members);
|
|
|
|
void readStructMemberType(tinyxml2::XMLElement const* element, MemberData & memberData);
|
2017-12-21 11:40:48 +00:00
|
|
|
void readTag(tinyxml2::XMLElement const* element);
|
2020-02-11 13:37:22 +00:00
|
|
|
void readTags(tinyxml2::XMLElement const* element);
|
2017-12-21 11:40:48 +00:00
|
|
|
void readType(tinyxml2::XMLElement const* element);
|
2020-01-13 14:00:59 +00:00
|
|
|
void readTypeEnum(tinyxml2::XMLElement const* element, std::map<std::string, std::string> const& attributes);
|
2020-02-04 09:35:33 +00:00
|
|
|
void readTypeInclude(tinyxml2::XMLElement const* element, std::map<std::string, std::string> const& attributes);
|
2020-02-11 13:37:22 +00:00
|
|
|
void readTypes(tinyxml2::XMLElement const* element);
|
2019-01-09 10:55:11 +00:00
|
|
|
void registerDeleter(std::string const& name, std::pair<std::string, CommandData> const& commandData);
|
2020-02-11 13:37:22 +00:00
|
|
|
void setVulkanLicenseHeader(int line, std::string const& comment);
|
2020-03-05 10:02:55 +00:00
|
|
|
std::string toString(TypeCategory category);
|
2017-12-21 11:40:48 +00:00
|
|
|
|
|
|
|
private:
|
2020-02-11 13:37:22 +00:00
|
|
|
std::map<std::string, BaseTypeData> m_baseTypes;
|
|
|
|
std::map<std::string, BitmaskData> m_bitmasks;
|
|
|
|
std::map<std::string, std::string> m_commandToHandle;
|
|
|
|
std::set<std::string> m_constants;
|
2020-03-09 10:23:46 +00:00
|
|
|
std::set<std::string> m_defines;
|
2020-02-11 13:37:22 +00:00
|
|
|
std::map<std::string, EnumData> m_enums;
|
|
|
|
std::set<std::string> m_extendedStructs; // structs which are referenced by the structextends tag
|
|
|
|
std::map<std::string, ExtensionData> m_extensions;
|
|
|
|
std::map<std::string, std::string> m_features;
|
|
|
|
std::map<std::string, FuncPointerData> m_funcPointers;
|
|
|
|
std::map<std::string, HandleData> m_handles;
|
|
|
|
std::set<std::string> m_includes;
|
|
|
|
std::map<std::string, std::string> m_platforms;
|
|
|
|
std::map<std::string, std::string> m_structureAliases;
|
|
|
|
std::map<std::string, StructureData> m_structures;
|
|
|
|
std::set<std::string> m_tags;
|
2020-03-05 10:02:55 +00:00
|
|
|
std::map<std::string, TypeCategory> m_types;
|
2020-02-11 13:37:22 +00:00
|
|
|
std::string m_typesafeCheck;
|
|
|
|
std::string m_version;
|
|
|
|
std::string m_vulkanLicenseHeader;
|
2019-01-09 10:55:11 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
const size_t INVALID_INDEX = (size_t)~0;
|