summaryrefslogtreecommitdiff
path: root/source/operand.cpp
diff options
context:
space:
mode:
authorDejan Mircevski <deki@google.com>2016-04-07 14:41:34 -0400
committerDavid Neto <dneto@google.com>2016-04-18 10:45:57 -0400
commitcb3c49ef82b2878f15d55573c2620b71bcf87d0f (patch)
tree13bebbe4028ea7615a8ccf16727358b96a04fc83 /source/operand.cpp
parente26fdc6bd18cdd1d5150ad4914b1fda818dcfbaa (diff)
downloadSPIRV-Tools-cb3c49ef82b2878f15d55573c2620b71bcf87d0f.tar.gz
SPIRV-Tools-cb3c49ef82b2878f15d55573c2620b71bcf87d0f.tar.bz2
SPIRV-Tools-cb3c49ef82b2878f15d55573c2620b71bcf87d0f.zip
Add SPIR-V 1.1 grammar.
Switch to SPIR-V 1.1 as default. Introduce SPV_ENV_UNIVERSAL_1_1. Add "1_0" to the internal variable names. Add spv_target_env to spv*GetTable().
Diffstat (limited to 'source/operand.cpp')
-rw-r--r--source/operand.cpp31
1 files changed, 24 insertions, 7 deletions
diff --git a/source/operand.cpp b/source/operand.cpp
index d2998af3..f82c36e0 100644
--- a/source/operand.cpp
+++ b/source/operand.cpp
@@ -36,18 +36,35 @@
#define ARRAY_SIZE(A) (static_cast<uint32_t>(sizeof(A) / sizeof(A[0])))
// Pull in operand info tables automatically generated from JSON grammar.
+namespace v1_0 {
#include "operand.kinds-1-0.inc"
+} // namespace v1_0
+namespace v1_1 {
+#include "operand.kinds-1-1.inc"
+} // namespace v1_1
-spv_result_t spvOperandTableGet(spv_operand_table* pOperandTable) {
+spv_result_t spvOperandTableGet(spv_operand_table* pOperandTable,
+ spv_target_env env) {
if (!pOperandTable) return SPV_ERROR_INVALID_POINTER;
- static const spv_operand_table_t table = {
- ARRAY_SIZE(pygen_variable_OperandInfoTable),
- pygen_variable_OperandInfoTable};
+ static const spv_operand_table_t table_1_0 = {
+ ARRAY_SIZE(v1_0::pygen_variable_OperandInfoTable),
+ v1_0::pygen_variable_OperandInfoTable};
+ static const spv_operand_table_t table_1_1 = {
+ ARRAY_SIZE(v1_1::pygen_variable_OperandInfoTable),
+ v1_1::pygen_variable_OperandInfoTable};
- *pOperandTable = &table;
-
- return SPV_SUCCESS;
+ switch (env) {
+ case SPV_ENV_UNIVERSAL_1_0:
+ case SPV_ENV_VULKAN_1_0:
+ *pOperandTable = &table_1_0;
+ return SPV_SUCCESS;
+ case SPV_ENV_UNIVERSAL_1_1:
+ *pOperandTable = &table_1_1;
+ return SPV_SUCCESS;
+ }
+ assert(0 && "Unknown spv_target_env in spvOperandTableGet()");
+ return SPV_ERROR_INVALID_TABLE;
}
#undef ARRAY_SIZE