From cb3c49ef82b2878f15d55573c2620b71bcf87d0f Mon Sep 17 00:00:00 2001 From: Dejan Mircevski Date: Thu, 7 Apr 2016 14:41:34 -0400 Subject: 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(). --- source/operand.cpp | 31 ++++++++++++++++++++++++------- 1 file changed, 24 insertions(+), 7 deletions(-) (limited to 'source/operand.cpp') 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(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 -- cgit v1.2.3