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-03-12 15:22:47 +0300
committerJohn Kessenich <cepheus@frii.com>2019-03-12 15:22:47 +0300
commit3beb2a0373101562e1a1206edc33cf64fae87b54 (patch)
treeda07d75a39fda4c3a64f74c27a7bfa565d6acb12 /tools
parent2d08d12d8caf0a6bf9ea1f79c039b51b75b8aac4 (diff)
Add ability to skip ranges of instructions; no impact to public headers
Diffstat (limited to 'tools')
-rw-r--r--tools/buildHeaders/jsonToSpirv.cpp18
-rw-r--r--tools/buildHeaders/jsonToSpirv.h2
-rw-r--r--tools/buildHeaders/main.cpp2
3 files changed, 19 insertions, 3 deletions
diff --git a/tools/buildHeaders/jsonToSpirv.cpp b/tools/buildHeaders/jsonToSpirv.cpp
index 62b85a8..e137241 100644
--- a/tools/buildHeaders/jsonToSpirv.cpp
+++ b/tools/buildHeaders/jsonToSpirv.cpp
@@ -230,7 +230,21 @@ unsigned int NumberStringToBit(const std::string& str)
return bit;
}
-void jsonToSpirv(const std::string& jsonPath)
+bool ExcludeInstruction(unsigned op, bool buildingHeaders)
+{
+ // Some instructions in the grammar don't need to be reflected
+ // in the specification.
+
+ if (buildingHeaders)
+ return false;
+
+ if (op >= 5699 /* OpVmeImageINTEL */ && op <= 5816 /* OpSubgroupAvcSicGetInterRawSadsINTEL */)
+ return true;
+
+ return false;
+}
+
+void jsonToSpirv(const std::string& jsonPath, bool buildingHeaders)
{
// only do this once.
static bool initialized = false;
@@ -288,6 +302,8 @@ void jsonToSpirv(const std::string& jsonPath)
const Json::Value insts = root["instructions"];
for (const auto& inst : insts) {
const unsigned int opcode = inst["opcode"].asUInt();
+ if (ExcludeInstruction(opcode, buildingHeaders))
+ continue;
const std::string name = inst["opname"].asString();
EnumCaps caps = getCaps(inst);
std::string version = inst["version"].asString();
diff --git a/tools/buildHeaders/jsonToSpirv.h b/tools/buildHeaders/jsonToSpirv.h
index bc63a4d..68a141d 100644
--- a/tools/buildHeaders/jsonToSpirv.h
+++ b/tools/buildHeaders/jsonToSpirv.h
@@ -38,7 +38,7 @@ namespace spv {
std::pair<bool, std::string> ReadFile(const std::string& path);
// Fill in all the parameters
-void jsonToSpirv(const std::string& jsonPath);
+void jsonToSpirv(const std::string& jsonPath, bool buildingHeaders);
// For parameterizing operands.
enum OperandClass {
diff --git a/tools/buildHeaders/main.cpp b/tools/buildHeaders/main.cpp
index 67d676c..7e5f7f8 100644
--- a/tools/buildHeaders/main.cpp
+++ b/tools/buildHeaders/main.cpp
@@ -119,7 +119,7 @@ int main(int argc, char* argv[])
return 1;
}
- spv::jsonToSpirv(jsonPath);
+ spv::jsonToSpirv(jsonPath, (Options & EOptionPrintHeader) != 0);
if (Options & EOptionPrintHeader)
spv::PrintHeader(Language, std::cout);