Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/KhronosGroup/SPIRV-Headers.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorJohn Kessenich <cepheus@frii.com>2019-05-07 08:34:36 +0300
committerJohn Kessenich <cepheus@frii.com>2019-05-07 08:34:36 +0300
commitc4f8f65792d4bf2657ca751904c511bbcf2ac77b (patch)
tree79aefbc2b6cd41270616a5466339f303da949d61 /tools
parenta5d33a253b47e183e54dcb9cf0e8ee729e88f6db (diff)
Move to version 1.4 of SPIR-V.1.4.1
Diffstat (limited to 'tools')
-rw-r--r--tools/buildHeaders/header.cpp6
-rw-r--r--tools/buildHeaders/jsonToSpirv.cpp13
-rw-r--r--tools/buildHeaders/jsonToSpirv.h32
3 files changed, 36 insertions, 15 deletions
diff --git a/tools/buildHeaders/header.cpp b/tools/buildHeaders/header.cpp
index 83553fc..68a2929 100644
--- a/tools/buildHeaders/header.cpp
+++ b/tools/buildHeaders/header.cpp
@@ -68,9 +68,9 @@ namespace {
TPrinter();
static const int DocMagicNumber = 0x07230203;
- static const int DocVersion = 0x00010300;
- static const int DocRevision = 7;
- #define DocRevisionString "7"
+ static const int DocVersion = 0x00010400;
+ static const int DocRevision = 1;
+ #define DocRevisionString "1"
static const std::string DocCopyright;
static const std::string DocComment1;
static const std::string DocComment2;
diff --git a/tools/buildHeaders/jsonToSpirv.cpp b/tools/buildHeaders/jsonToSpirv.cpp
index e137241..e6cab48 100644
--- a/tools/buildHeaders/jsonToSpirv.cpp
+++ b/tools/buildHeaders/jsonToSpirv.cpp
@@ -119,8 +119,7 @@ ClassOptionality ToOperandClassAndOptionality(const std::string& operandKind, co
else if (quantifier == "?")
return {OperandLiteralString, true};
else {
- assert(0 && "this case should not exist");
- return {OperandNone, false};
+ return {OperandOptionalLiteralStrings, false};
}
} else if (operandKind == "PairLiteralIntegerIdRef") {
// Used by OpSwitch in the grammar
@@ -198,7 +197,7 @@ ClassOptionality ToOperandClassAndOptionality(const std::string& operandKind, co
} else if (operandKind == "FunctionControl") {
type = OperandFunction;
} else if (operandKind == "MemoryAccess") {
- type = OperandMemoryAccess;
+ type = OperandMemoryOperands;
}
if (type == OperandNone) {
@@ -307,6 +306,7 @@ void jsonToSpirv(const std::string& jsonPath, bool buildingHeaders)
const std::string name = inst["opname"].asString();
EnumCaps caps = getCaps(inst);
std::string version = inst["version"].asString();
+ std::string lastVersion = inst["lastVersion"].asString();
Extensions exts = getExts(inst);
OperandParameters operands;
bool defResultId = false;
@@ -322,7 +322,7 @@ void jsonToSpirv(const std::string& jsonPath, bool buildingHeaders)
}
InstructionDesc.emplace_back(
std::move(EnumValue(opcode, name,
- std::move(caps), std::move(version), std::move(exts),
+ std::move(caps), std::move(version), std::move(lastVersion), std::move(exts),
std::move(operands))),
defTypeId, defResultId);
}
@@ -355,6 +355,7 @@ void jsonToSpirv(const std::string& jsonPath, bool buildingHeaders)
continue;
EnumCaps caps(getCaps(enumerant));
std::string version = enumerant["version"].asString();
+ std::string lastVersion = enumerant["lastVersion"].asString();
Extensions exts(getExts(enumerant));
OperandParameters params;
const Json::Value& paramsJson = enumerant["parameters"];
@@ -369,7 +370,7 @@ void jsonToSpirv(const std::string& jsonPath, bool buildingHeaders)
}
dest->emplace_back(
value, enumerant["enumerant"].asString(),
- std::move(caps), std::move(version), std::move(exts), std::move(params));
+ std::move(caps), std::move(version), std::move(lastVersion), std::move(exts), std::move(params));
}
};
@@ -437,7 +438,7 @@ void jsonToSpirv(const std::string& jsonPath, bool buildingHeaders)
} else if (enumName == "Dim") {
establishOperandClass(enumName, OperandDimensionality, &DimensionalityParams, operandEnum, category);
} else if (enumName == "MemoryAccess") {
- establishOperandClass(enumName, OperandMemoryAccess, &MemoryAccessParams, operandEnum, category);
+ establishOperandClass(enumName, OperandMemoryOperands, &MemoryAccessParams, operandEnum, category);
} else if (enumName == "Scope") {
establishOperandClass(enumName, OperandScope, &ScopeParams, operandEnum, category);
} else if (enumName == "GroupOperation") {
diff --git a/tools/buildHeaders/jsonToSpirv.h b/tools/buildHeaders/jsonToSpirv.h
index 68a141d..beec01c 100644
--- a/tools/buildHeaders/jsonToSpirv.h
+++ b/tools/buildHeaders/jsonToSpirv.h
@@ -47,6 +47,7 @@ enum OperandClass {
OperandVariableIds,
OperandOptionalLiteral,
OperandOptionalLiteralString,
+ OperandOptionalLiteralStrings,
OperandVariableLiterals,
OperandVariableIdLiteral,
OperandVariableLiteralId,
@@ -76,7 +77,7 @@ enum OperandClass {
OperandLoop,
OperandFunction,
OperandMemorySemantics,
- OperandMemoryAccess,
+ OperandMemoryOperands,
OperandScope,
OperandGroupOperation,
OperandKernelEnqueueFlags,
@@ -145,6 +146,12 @@ public:
assert((where != end()) && "Could not find enum in the enum list");
return *where;
}
+ // gets *all* entries for the value, including the first one
+ void gatherAliases(unsigned value, std::vector<EValue*>& aliases) {
+ std::for_each(begin(), end(), [&](EValue& e) {
+ if (value == e.value)
+ aliases.push_back(&e);});
+ }
// Returns the EValue with the given name. We assume uniqueness
// by name.
EValue& at(std::string name) {
@@ -167,9 +174,11 @@ private:
class EnumValue {
public:
EnumValue() : value(0), desc(nullptr) {}
- EnumValue(unsigned int the_value, const std::string& the_name, EnumCaps&& the_caps, const std::string& the_version,
- Extensions&& the_extensions, OperandParameters&& the_operands) :
- value(the_value), name(the_name), capabilities(std::move(the_caps)), version(std::move(the_version)),
+ EnumValue(unsigned int the_value, const std::string& the_name, EnumCaps&& the_caps,
+ const std::string& the_firstVersion, const std::string& the_lastVersion,
+ Extensions&& the_extensions, OperandParameters&& the_operands) :
+ value(the_value), name(the_name), capabilities(std::move(the_caps)),
+ firstVersion(std::move(the_firstVersion)), lastVersion(std::move(the_lastVersion)),
extensions(std::move(the_extensions)), operands(std::move(the_operands)), desc(nullptr) { }
// For ValueEnum, the value from the JSON file.
@@ -178,7 +187,8 @@ public:
unsigned value;
std::string name;
EnumCaps capabilities;
- std::string version;
+ std::string firstVersion;
+ std::string lastVersion;
// A feature only be enabled by certain extensions.
// An empty list means the feature does not require an extension.
// Normally, only Capability enums are enabled by extension. In turn,
@@ -233,10 +243,19 @@ public:
opDesc("TBD"),
opClass(0),
typePresent(has_type),
- resultPresent(has_result) {}
+ resultPresent(has_result),
+ alias(this) { }
+ InstructionValue(const InstructionValue& v)
+ {
+ *this = v;
+ alias = this;
+ }
bool hasResult() const { return resultPresent != 0; }
bool hasType() const { return typePresent != 0; }
+ void setAlias(const InstructionValue& a) { alias = &a; }
+ const InstructionValue& getAlias() const { return *alias; }
+ bool isAlias() const { return alias != this; }
const char* opDesc;
int opClass;
@@ -244,6 +263,7 @@ public:
protected:
int typePresent : 1;
int resultPresent : 1;
+ const InstructionValue* alias; // correct only after discovering the aliases; otherwise points to this
};
using InstructionValues = EnumValuesContainer<InstructionValue>;