diff options
author | John Kessenich <cepheus@frii.com> | 2019-03-12 06:22:47 -0600 |
---|---|---|
committer | John Kessenich <cepheus@frii.com> | 2019-03-12 06:22:47 -0600 |
commit | 3beb2a0373101562e1a1206edc33cf64fae87b54 (patch) | |
tree | da07d75a39fda4c3a64f74c27a7bfa565d6acb12 /tools | |
parent | 2d08d12d8caf0a6bf9ea1f79c039b51b75b8aac4 (diff) | |
download | platform_external_shaderc_spirv-headers-3beb2a0373101562e1a1206edc33cf64fae87b54.tar.gz platform_external_shaderc_spirv-headers-3beb2a0373101562e1a1206edc33cf64fae87b54.tar.bz2 platform_external_shaderc_spirv-headers-3beb2a0373101562e1a1206edc33cf64fae87b54.zip |
Add ability to skip ranges of instructions; no impact to public headers
Diffstat (limited to 'tools')
-rw-r--r-- | tools/buildHeaders/jsonToSpirv.cpp | 18 | ||||
-rw-r--r-- | tools/buildHeaders/jsonToSpirv.h | 2 | ||||
-rw-r--r-- | tools/buildHeaders/main.cpp | 2 |
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); |