diff options
author | Jesse Hall <jessehall@google.com> | 2019-09-10 10:42:39 -0700 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2019-09-10 10:42:39 -0700 |
commit | 65d55f13c6ecd261bd439bee00326d7c47cb30a5 (patch) | |
tree | d5a048708a32322f12632670bd061bfba315e4d1 /tools/buildHeaders/jsonToSpirv.h | |
parent | d5f9b40bf17b7d8a5469ef04b67cfe1616a4472c (diff) | |
parent | 259f181dd8ae052ec949754d5b2ab983b5ec7772 (diff) | |
download | platform_external_shaderc_spirv-headers-65d55f13c6ecd261bd439bee00326d7c47cb30a5.tar.gz platform_external_shaderc_spirv-headers-65d55f13c6ecd261bd439bee00326d7c47cb30a5.tar.bz2 platform_external_shaderc_spirv-headers-65d55f13c6ecd261bd439bee00326d7c47cb30a5.zip |
Merge "Merge aosp/master-ndk to aosp/master" am: 36ef3defe8 am: 1bf420a789
am: 259f181dd8
Change-Id: If24ecdf47738b7ce27d889daacc39c8291b45037
Diffstat (limited to 'tools/buildHeaders/jsonToSpirv.h')
-rw-r--r--[-rwxr-xr-x] | tools/buildHeaders/jsonToSpirv.h | 36 |
1 files changed, 28 insertions, 8 deletions
diff --git a/tools/buildHeaders/jsonToSpirv.h b/tools/buildHeaders/jsonToSpirv.h index 00a2f70..beec01c 100755..100644 --- a/tools/buildHeaders/jsonToSpirv.h +++ b/tools/buildHeaders/jsonToSpirv.h @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2018 The Khronos Group Inc. +// Copyright (c) 2014-2019 The Khronos Group Inc. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and/or associated documentation files (the "Materials"), @@ -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 { @@ -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>; |