diff --git a/Android.mk b/Android.mk index f9baa6aa..3129e53e 100644 --- a/Android.mk +++ b/Android.mk @@ -108,12 +108,12 @@ SPVTOOLS_OPT_SRC_FILES := \ SPV_CORE10_GRAMMAR=$(SPVHEADERS_LOCAL_PATH)/include/spirv/1.0/spirv.core.grammar.json SPV_CORE11_GRAMMAR=$(SPVHEADERS_LOCAL_PATH)/include/spirv/1.1/spirv.core.grammar.json SPV_CORE12_GRAMMAR=$(SPVHEADERS_LOCAL_PATH)/include/spirv/1.2/spirv.core.grammar.json -SPV_GLSL_GRAMMAR=$(SPVHEADERS_LOCAL_PATH)/include/spirv/1.0/extinst.glsl.std.450.grammar.json -SPV_OPENCL_GRAMMAR=$(SPVHEADERS_LOCAL_PATH)/include/spirv/1.0/extinst.opencl.std.100.grammar.json +SPV_GLSL_GRAMMAR=$(SPVHEADERS_LOCAL_PATH)/include/spirv/1.2/extinst.glsl.std.450.grammar.json +SPV_OPENCL_GRAMMAR=$(SPVHEADERS_LOCAL_PATH)/include/spirv/1.2/extinst.opencl.std.100.grammar.json define gen_spvtools_grammar_tables $(call generate-file-dir,$(1)/core.insts-1.0.inc) -$(1)/core.insts-1.0.inc $(1)/operand.kinds-1.0.inc $(1)/glsl.std.450.insts-1.0.inc $(1)/opencl.std.insts-1.0.inc: \ +$(1)/core.insts-1.0.inc $(1)/operand.kinds-1.0.inc $(1)/glsl.std.450.insts.inc $(1)/opencl.std.insts.inc: \ $(LOCAL_PATH)/utils/generate_grammar_tables.py \ $(SPV_CORE10_GRAMMAR) \ $(SPV_GLSL_GRAMMAR) \ @@ -123,8 +123,8 @@ $(1)/core.insts-1.0.inc $(1)/operand.kinds-1.0.inc $(1)/glsl.std.450.insts-1.0.i --extinst-glsl-grammar=$(SPV_GLSL_GRAMMAR) \ --extinst-opencl-grammar=$(SPV_OPENCL_GRAMMAR) \ --core-insts-output=$(1)/core.insts-1.0.inc \ - --glsl-insts-output=$(1)/glsl.std.450.insts-1.0.inc \ - --opencl-insts-output=$(1)/opencl.std.insts-1.0.inc \ + --glsl-insts-output=$(1)/glsl.std.450.insts.inc \ + --opencl-insts-output=$(1)/opencl.std.insts.inc \ --operand-kinds-output=$(1)/operand.kinds-1.0.inc @echo "[$(TARGET_ARCH_ABI)] Grammar v1.0 : instructions & operands <= grammar JSON files" $(1)/core.insts-1.1.inc $(1)/operand.kinds-1.1.inc: \ @@ -145,7 +145,7 @@ $(1)/core.insts-1.2.inc $(1)/operand.kinds-1.2.inc: \ @echo "[$(TARGET_ARCH_ABI)] Grammar v1.2 : instructions & operands <= grammar JSON files" $(LOCAL_PATH)/source/opcode.cpp: $(1)/core.insts-1.0.inc $(1)/core.insts-1.1.inc $(1)/core.insts-1.2.inc $(LOCAL_PATH)/source/operand.cpp: $(1)/operand.kinds-1.0.inc $(1)/operand.kinds-1.1.inc $(1)/operand.kinds-1.2.inc -$(LOCAL_PATH)/source/ext_inst.cpp: $(1)/glsl.std.450.insts-1.0.inc $(1)/opencl.std.insts-1.0.inc +$(LOCAL_PATH)/source/ext_inst.cpp: $(1)/glsl.std.450.insts.inc $(1)/opencl.std.insts.inc endef $(eval $(call gen_spvtools_grammar_tables,$(SPVTOOLS_OUT_PATH))) diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt index 87819d55..9f4d3ebc 100644 --- a/source/CMakeLists.txt +++ b/source/CMakeLists.txt @@ -70,7 +70,7 @@ endmacro(spvtools_vimsyntax) macro(spvtools_glsl_tables VERSION) set(CORE_GRAMMAR_JSON_FILE "${SPIRV_HEADER_INCLUDE_DIR}/spirv/${VERSION}/spirv.core.grammar.json") set(GLSL_GRAMMAR_JSON_FILE "${SPIRV_HEADER_INCLUDE_DIR}/spirv/${VERSION}/extinst.glsl.std.450.grammar.json") - set(GRAMMAR_INC_FILE "${spirv-tools_BINARY_DIR}/glsl.std.450.insts-${VERSION}.inc") + set(GRAMMAR_INC_FILE "${spirv-tools_BINARY_DIR}/glsl.std.450.insts.inc") add_custom_command(OUTPUT ${GRAMMAR_INC_FILE} COMMAND ${PYTHON_EXECUTABLE} ${GRAMMAR_PROCESSING_SCRIPT} --spirv-core-grammar=${CORE_GRAMMAR_JSON_FILE} @@ -84,7 +84,7 @@ endmacro(spvtools_glsl_tables) macro(spvtools_opencl_tables VERSION) set(CORE_GRAMMAR_JSON_FILE "${SPIRV_HEADER_INCLUDE_DIR}/spirv/${VERSION}/spirv.core.grammar.json") set(OPENCL_GRAMMAR_JSON_FILE "${SPIRV_HEADER_INCLUDE_DIR}/spirv/${VERSION}/extinst.opencl.std.100.grammar.json") - set(GRAMMAR_INC_FILE "${spirv-tools_BINARY_DIR}/opencl.std.insts-${VERSION}.inc") + set(GRAMMAR_INC_FILE "${spirv-tools_BINARY_DIR}/opencl.std.insts.inc") add_custom_command(OUTPUT ${GRAMMAR_INC_FILE} COMMAND ${PYTHON_EXECUTABLE} ${GRAMMAR_PROCESSING_SCRIPT} --spirv-core-grammar=${CORE_GRAMMAR_JSON_FILE} @@ -113,8 +113,8 @@ spvtools_core_tables("1.0") spvtools_core_tables("1.1") spvtools_core_tables("1.2") spvtools_enum_string_mapping("1.2") -spvtools_opencl_tables("1.0") -spvtools_glsl_tables("1.0") +spvtools_opencl_tables("1.2") +spvtools_glsl_tables("1.2") spvtools_vendor_tables("spv-amd-shader-explicit-vertex-parameter") spvtools_vendor_tables("spv-amd-shader-trinary-minmax") spvtools_vendor_tables("spv-amd-gcn-shader") @@ -210,6 +210,9 @@ set(SPIRV_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/extensions.h ${CMAKE_CURRENT_SOURCE_DIR}/id_descriptor.h ${CMAKE_CURRENT_SOURCE_DIR}/instruction.h + ${CMAKE_CURRENT_SOURCE_DIR}/latest_version_glsl_std_450_header.h + ${CMAKE_CURRENT_SOURCE_DIR}/latest_version_opencl_std_header.h + ${CMAKE_CURRENT_SOURCE_DIR}/latest_version_spirv_header.h ${CMAKE_CURRENT_SOURCE_DIR}/macro.h ${CMAKE_CURRENT_SOURCE_DIR}/name_mapper.h ${CMAKE_CURRENT_SOURCE_DIR}/opcode.h diff --git a/source/assembly_grammar.h b/source/assembly_grammar.h index bfbfe762..e37c457e 100644 --- a/source/assembly_grammar.h +++ b/source/assembly_grammar.h @@ -15,9 +15,9 @@ #ifndef LIBSPIRV_ASSEMBLY_GRAMMAR_H_ #define LIBSPIRV_ASSEMBLY_GRAMMAR_H_ +#include "latest_version_spirv_header.h" #include "operand.h" #include "spirv-tools/libspirv.h" -#include "spirv/1.2/spirv.h" #include "table.h" namespace libspirv { diff --git a/source/comp/markv_codec.cpp b/source/comp/markv_codec.cpp index dec4d735..ff1c582f 100644 --- a/source/comp/markv_codec.cpp +++ b/source/comp/markv_codec.cpp @@ -34,9 +34,9 @@ #include #include -#include "spirv/1.2/GLSL.std.450.h" -#include "spirv/1.2/OpenCL.std.h" -#include "spirv/1.2/spirv.h" +#include "latest_version_glsl_std_450_header.h" +#include "latest_version_opencl_std_header.h" +#include "latest_version_spirv_header.h" #include "binary.h" #include "diagnostic.h" diff --git a/source/comp/markv_model.h b/source/comp/markv_model.h index 630942c6..606396e6 100644 --- a/source/comp/markv_model.h +++ b/source/comp/markv_model.h @@ -19,8 +19,8 @@ #include #include +#include "latest_version_spirv_header.h" #include "spirv-tools/libspirv.h" -#include "spirv/1.2/spirv.h" #include "util/huffman_codec.h" namespace spvtools { diff --git a/source/enum_set.h b/source/enum_set.h index b956b495..75a49f06 100644 --- a/source/enum_set.h +++ b/source/enum_set.h @@ -21,7 +21,7 @@ #include #include -#include "spirv/1.2/spirv.h" +#include "latest_version_spirv_header.h" namespace libspirv { diff --git a/source/ext_inst.cpp b/source/ext_inst.cpp index fc8a486a..fa2c9b65 100644 --- a/source/ext_inst.cpp +++ b/source/ext_inst.cpp @@ -17,14 +17,14 @@ #include #include -#include "spirv/1.0/GLSL.std.450.h" -#include "spirv/1.0/OpenCL.std.h" +#include "latest_version_glsl_std_450_header.h" +#include "latest_version_opencl_std_header.h" #include "spirv_definition.h" #include "macro.h" -#include "glsl.std.450.insts-1.0.inc" // defines glsl_entries -#include "opencl.std.insts-1.0.inc" // defines opencl_entries +#include "glsl.std.450.insts.inc" // defines glsl_entries +#include "opencl.std.insts.inc" // defines opencl_entries #include "spv-amd-gcn-shader.insts.inc" #include "spv-amd-shader-ballot.insts.inc" diff --git a/source/instruction.h b/source/instruction.h index 2afa6d45..884276d7 100644 --- a/source/instruction.h +++ b/source/instruction.h @@ -18,8 +18,8 @@ #include #include +#include "latest_version_spirv_header.h" #include "spirv-tools/libspirv.h" -#include "spirv/1.2/spirv.h" // Describes an instruction. struct spv_instruction_t { diff --git a/source/latest_version_glsl_std_450_header.h b/source/latest_version_glsl_std_450_header.h new file mode 100644 index 00000000..3fbddb89 --- /dev/null +++ b/source/latest_version_glsl_std_450_header.h @@ -0,0 +1,20 @@ +// Copyright (c) 2017 Google Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef LIBSPIRV_LATEST_VERSION_GLSL_STD_450_HEADER_H_ +#define LIBSPIRV_LATEST_VERSION_GLSL_STD_450_HEADER_H_ + +#include "spirv/1.2/GLSL.std.450.h" + +#endif // LIBSPIRV_LATEST_VERSION_GLSL_STD_450_HEADER_H_ diff --git a/source/latest_version_opencl_std_header.h b/source/latest_version_opencl_std_header.h new file mode 100644 index 00000000..aa68f08b --- /dev/null +++ b/source/latest_version_opencl_std_header.h @@ -0,0 +1,20 @@ +// Copyright (c) 2017 Google Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef LIBSPIRV_LATEST_VERSION_OPENCL_STD_HEADER_H_ +#define LIBSPIRV_LATEST_VERSION_OPENCL_STD_HEADER_H_ + +#include "spirv/1.2/OpenCL.std.h" + +#endif // LIBSPIRV_LATEST_VERSION_OPENCL_STD_HEADER_H_ diff --git a/source/latest_version_spirv_header.h b/source/latest_version_spirv_header.h new file mode 100644 index 00000000..ea9f45cd --- /dev/null +++ b/source/latest_version_spirv_header.h @@ -0,0 +1,20 @@ +// Copyright (c) 2017 Google Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef LIBSPIRV_LATEST_VERSION_SPIRV_HEADER_H_ +#define LIBSPIRV_LATEST_VERSION_SPIRV_HEADER_H_ + +#include "spirv/1.2/spirv.h" + +#endif // LIBSPIRV_LATEST_VERSION_SPIRV_HEADER_H_ diff --git a/source/opcode.h b/source/opcode.h index 3ba99df6..25c8de96 100644 --- a/source/opcode.h +++ b/source/opcode.h @@ -16,8 +16,8 @@ #define LIBSPIRV_OPCODE_H_ #include "instruction.h" +#include "latest_version_spirv_header.h" #include "spirv-tools/libspirv.h" -#include "spirv/1.2/spirv.h" #include "table.h" // Returns the name of a registered SPIR-V generator as a null-terminated diff --git a/source/opt/aggressive_dead_code_elim_pass.cpp b/source/opt/aggressive_dead_code_elim_pass.cpp index 512cdd70..b9b5486a 100644 --- a/source/opt/aggressive_dead_code_elim_pass.cpp +++ b/source/opt/aggressive_dead_code_elim_pass.cpp @@ -18,7 +18,7 @@ #include "cfa.h" #include "iterator.h" -#include "spirv/1.0/GLSL.std.450.h" +#include "latest_version_glsl_std_450_header.h" #include diff --git a/source/opt/instruction.h b/source/opt/instruction.h index 1bd1344e..3ddf7418 100644 --- a/source/opt/instruction.h +++ b/source/opt/instruction.h @@ -24,8 +24,8 @@ #include "operand.h" #include "util/ilist_node.h" +#include "latest_version_spirv_header.h" #include "spirv-tools/libspirv.h" -#include "spirv/1.2/spirv.h" namespace spvtools { namespace ir { diff --git a/source/opt/instruction_list.h b/source/opt/instruction_list.h index 2b7b931f..182317fb 100644 --- a/source/opt/instruction_list.h +++ b/source/opt/instruction_list.h @@ -25,8 +25,8 @@ #include "operand.h" #include "util/ilist.h" +#include "latest_version_spirv_header.h" #include "spirv-tools/libspirv.h" -#include "spirv/1.2/spirv.h" namespace spvtools { namespace ir { @@ -104,11 +104,10 @@ class InstructionList : public utils::IntrusiveList { // Runs the given function |f| on the instructions in the list and optionally // on the preceding debug line instructions. - inline void ForEachInst( - const std::function& f, - bool run_on_debug_line_insts) { + inline void ForEachInst(const std::function& f, + bool run_on_debug_line_insts) { auto next = begin(); - for( auto i = next; i != end(); i = next ) { + for (auto i = next; i != end(); i = next) { ++next; i->ForEachInst(f, run_on_debug_line_insts); } diff --git a/source/opt/ir_context.cpp b/source/opt/ir_context.cpp index 9f68db74..c899591f 100644 --- a/source/opt/ir_context.cpp +++ b/source/opt/ir_context.cpp @@ -13,9 +13,9 @@ // limitations under the License. #include "ir_context.h" +#include "latest_version_glsl_std_450_header.h" #include "log.h" #include "mem_pass.h" -#include "spirv/1.0/GLSL.std.450.h" #include diff --git a/source/opt/local_single_store_elim_pass.cpp b/source/opt/local_single_store_elim_pass.cpp index 139f53c7..cb40ba09 100644 --- a/source/opt/local_single_store_elim_pass.cpp +++ b/source/opt/local_single_store_elim_pass.cpp @@ -18,7 +18,7 @@ #include "cfa.h" #include "iterator.h" -#include "spirv/1.0/GLSL.std.450.h" +#include "latest_version_glsl_std_450_header.h" namespace spvtools { namespace opt { diff --git a/source/opt/reflect.h b/source/opt/reflect.h index ce5c3316..c5fd6531 100644 --- a/source/opt/reflect.h +++ b/source/opt/reflect.h @@ -15,7 +15,7 @@ #ifndef LIBSPIRV_OPT_REFLECT_H_ #define LIBSPIRV_OPT_REFLECT_H_ -#include "spirv/1.2/spirv.h" +#include "latest_version_spirv_header.h" namespace spvtools { namespace ir { diff --git a/source/opt/types.h b/source/opt/types.h index b6b62c53..f1c8e3ef 100644 --- a/source/opt/types.h +++ b/source/opt/types.h @@ -21,8 +21,8 @@ #include #include +#include "latest_version_spirv_header.h" #include "spirv-tools/libspirv.h" -#include "spirv/1.2/spirv.h" namespace spvtools { namespace opt { diff --git a/source/spirv_constant.h b/source/spirv_constant.h index c70ade10..92ccd151 100644 --- a/source/spirv_constant.h +++ b/source/spirv_constant.h @@ -15,8 +15,8 @@ #ifndef LIBSPIRV_SPIRV_CONSTANT_H_ #define LIBSPIRV_SPIRV_CONSTANT_H_ +#include "latest_version_spirv_header.h" #include "spirv-tools/libspirv.h" -#include "spirv/1.2/spirv.h" // Version number macros. diff --git a/source/spirv_definition.h b/source/spirv_definition.h index b82bda16..9e22108f 100644 --- a/source/spirv_definition.h +++ b/source/spirv_definition.h @@ -17,7 +17,7 @@ #include -#include "spirv/1.2/spirv.h" +#include "latest_version_spirv_header.h" #define spvIsInBitfield(value, bitfield) ((value) == ((value)&bitfield)) diff --git a/source/table.h b/source/table.h index 1422db46..dc185e24 100644 --- a/source/table.h +++ b/source/table.h @@ -15,7 +15,7 @@ #ifndef LIBSPIRV_TABLE_H_ #define LIBSPIRV_TABLE_H_ -#include "spirv/1.2/spirv.h" +#include "latest_version_spirv_header.h" #include "extensions.h" #include "message.h" diff --git a/source/val/basic_block.h b/source/val/basic_block.h index f42d6247..c2a5bb8f 100644 --- a/source/val/basic_block.h +++ b/source/val/basic_block.h @@ -15,7 +15,7 @@ #ifndef LIBSPIRV_VAL_BASICBLOCK_H_ #define LIBSPIRV_VAL_BASICBLOCK_H_ -#include "spirv/1.2/spirv.h" +#include "latest_version_spirv_header.h" #include diff --git a/source/val/decoration.h b/source/val/decoration.h index e6e85ea5..b1d894a4 100644 --- a/source/val/decoration.h +++ b/source/val/decoration.h @@ -19,7 +19,7 @@ #include #include -#include "spirv/1.2/spirv.h" +#include "latest_version_spirv_header.h" namespace libspirv { diff --git a/source/val/function.h b/source/val/function.h index eb23201c..f6afb716 100644 --- a/source/val/function.h +++ b/source/val/function.h @@ -23,8 +23,8 @@ #include #include +#include "latest_version_spirv_header.h" #include "spirv-tools/libspirv.h" -#include "spirv/1.2/spirv.h" #include "val/basic_block.h" #include "val/construct.h" diff --git a/source/val/validation_state.h b/source/val/validation_state.h index 60056051..986d7592 100644 --- a/source/val/validation_state.h +++ b/source/val/validation_state.h @@ -26,8 +26,8 @@ #include "decoration.h" #include "diagnostic.h" #include "enum_set.h" +#include "latest_version_spirv_header.h" #include "spirv-tools/libspirv.h" -#include "spirv/1.2/spirv.h" #include "spirv_definition.h" #include "val/function.h" #include "val/instruction.h" diff --git a/test/binary_parse_test.cpp b/test/binary_parse_test.cpp index c979751e..bb1d6ffd 100644 --- a/test/binary_parse_test.cpp +++ b/test/binary_parse_test.cpp @@ -17,9 +17,9 @@ #include #include "gmock/gmock.h" +#include "latest_version_opencl_std_header.h" #include "source/message.h" #include "source/table.h" -#include "spirv/1.0/OpenCL.std.h" #include "test_fixture.h" #include "unit_spirv.h" diff --git a/test/ext_inst.glsl_test.cpp b/test/ext_inst.glsl_test.cpp index e1da2f95..5e569ead 100644 --- a/test/ext_inst.glsl_test.cpp +++ b/test/ext_inst.glsl_test.cpp @@ -15,7 +15,7 @@ #include #include -#include "spirv/1.0/GLSL.std.450.h" +#include "latest_version_glsl_std_450_header.h" #include "unit_spirv.h" namespace { diff --git a/test/ext_inst.opencl_test.cpp b/test/ext_inst.opencl_test.cpp index af739f6d..6829e3ca 100644 --- a/test/ext_inst.opencl_test.cpp +++ b/test/ext_inst.opencl_test.cpp @@ -15,7 +15,7 @@ #include "unit_spirv.h" #include -#include "spirv/1.0/OpenCL.std.h" +#include "latest_version_opencl_std_header.h" #include "test_fixture.h" namespace { diff --git a/test/stats/stats_analyzer_test.cpp b/test/stats/stats_analyzer_test.cpp index 6667969a..9608af8d 100644 --- a/test/stats/stats_analyzer_test.cpp +++ b/test/stats/stats_analyzer_test.cpp @@ -17,7 +17,7 @@ #include #include -#include "spirv/1.1/spirv.h" +#include "latest_version_spirv_header.h" #include "test_fixture.h" #include "tools/stats/stats_analyzer.h" diff --git a/test/text_to_binary.extension_test.cpp b/test/text_to_binary.extension_test.cpp index e2a5101d..032c38ee 100644 --- a/test/text_to_binary.extension_test.cpp +++ b/test/text_to_binary.extension_test.cpp @@ -18,8 +18,8 @@ #include "unit_spirv.h" #include "gmock/gmock.h" -#include "spirv/1.0/GLSL.std.450.h" -#include "spirv/1.0/OpenCL.std.h" +#include "latest_version_glsl_std_450_header.h" +#include "latest_version_opencl_std_header.h" #include "test_fixture.h" namespace { diff --git a/test/val/val_state_test.cpp b/test/val/val_state_test.cpp index ea09cf97..c63a0c5c 100644 --- a/test/val/val_state_test.cpp +++ b/test/val/val_state_test.cpp @@ -18,7 +18,7 @@ #include #include "gtest/gtest.h" -#include "spirv/1.1/spirv.h" +#include "latest_version_spirv_header.h" #include "enum_set.h" #include "extensions.h"