diff --git a/.gitmodules b/.gitmodules index 00c049d19..435fcc92e 100644 --- a/.gitmodules +++ b/.gitmodules @@ -34,3 +34,6 @@ [submodule "third_party/yaml-cpp"] path = third_party/yaml-cpp url = https://github.com/jbeder/yaml-cpp.git +[submodule "third_party/spirv-headers"] + path = third_party/spirv-headers + url = https://github.com/KhronosGroup/SPIRV-Headers diff --git a/src/xenia/ui/spirv/spirv_assembler.cc b/src/xenia/ui/spirv/spirv_assembler.cc index 4ade9204b..1a1c234f2 100644 --- a/src/xenia/ui/spirv/spirv_assembler.cc +++ b/src/xenia/ui/spirv/spirv_assembler.cc @@ -50,7 +50,8 @@ size_t SpirvAssembler::Result::word_count() const { return binary_ ? binary_->wordCount : 0; } -SpirvAssembler::SpirvAssembler() : spv_context_(spvContextCreate()) {} +SpirvAssembler::SpirvAssembler() + : spv_context_(spvContextCreate(SPV_ENV_VULKAN_1_0)) {} SpirvAssembler::~SpirvAssembler() { spvContextDestroy(spv_context_); } diff --git a/src/xenia/ui/spirv/spirv_disassembler.cc b/src/xenia/ui/spirv/spirv_disassembler.cc index d213582ae..2945c6131 100644 --- a/src/xenia/ui/spirv/spirv_disassembler.cc +++ b/src/xenia/ui/spirv/spirv_disassembler.cc @@ -53,7 +53,8 @@ void SpirvDisassembler::Result::AppendText(StringBuffer* target_buffer) const { } } -SpirvDisassembler::SpirvDisassembler() : spv_context_(spvContextCreate()) {} +SpirvDisassembler::SpirvDisassembler() + : spv_context_(spvContextCreate(SPV_ENV_VULKAN_1_0)) {} SpirvDisassembler::~SpirvDisassembler() { spvContextDestroy(spv_context_); } diff --git a/src/xenia/ui/spirv/spirv_util.h b/src/xenia/ui/spirv/spirv_util.h index ac7a9a05e..b0555d7fa 100644 --- a/src/xenia/ui/spirv/spirv_util.h +++ b/src/xenia/ui/spirv/spirv_util.h @@ -10,8 +10,8 @@ #ifndef XENIA_UI_SPIRV_SPIRV_UTIL_H_ #define XENIA_UI_SPIRV_SPIRV_UTIL_H_ +#include "third_party/spirv-headers/include/spirv/1.1/spirv.hpp11" #include "third_party/spirv/GLSL.std.450.hpp11" -#include "third_party/spirv/spirv.hpp11" // Forward declarations from SPIRV-Tools so we don't pollute /so/ much. struct spv_binary_t; diff --git a/src/xenia/ui/spirv/spirv_validator.cc b/src/xenia/ui/spirv/spirv_validator.cc index 734688eb6..87c68fd77 100644 --- a/src/xenia/ui/spirv/spirv_validator.cc +++ b/src/xenia/ui/spirv/spirv_validator.cc @@ -53,7 +53,8 @@ void SpirvValidator::Result::AppendText(StringBuffer* target_buffer) const { } } -SpirvValidator::SpirvValidator() : spv_context_(spvContextCreate()) {} +SpirvValidator::SpirvValidator() + : spv_context_(spvContextCreate(SPV_ENV_UNIVERSAL_1_1)) {} SpirvValidator::~SpirvValidator() { spvContextDestroy(spv_context_); } std::unique_ptr SpirvValidator::Validate( @@ -61,8 +62,7 @@ std::unique_ptr SpirvValidator::Validate( spv_text text = nullptr; spv_diagnostic diagnostic = nullptr; spv_const_binary_t binary = {words, word_count}; - auto result_code = - spvValidate(spv_context_, &binary, SPV_VALIDATE_ALL, &diagnostic); + auto result_code = spvValidate(spv_context_, &binary, &diagnostic); std::unique_ptr result(new Result(text, diagnostic)); if (result_code) { XELOGE("Failed to validate spv: %d", result_code); diff --git a/third_party/spirv-headers b/third_party/spirv-headers new file mode 160000 index 000000000..34d319db9 --- /dev/null +++ b/third_party/spirv-headers @@ -0,0 +1 @@ +Subproject commit 34d319db9d6cefe93191b921f5f1593378a98c4c diff --git a/third_party/spirv-tools b/third_party/spirv-tools index 4d2f2239b..327bc49a2 160000 --- a/third_party/spirv-tools +++ b/third_party/spirv-tools @@ -1 +1 @@ -Subproject commit 4d2f2239bf896dc14127e25011f41ac79d687052 +Subproject commit 327bc49a2d811ce3c8b3443c2624f1f807965c62 diff --git a/third_party/spirv-tools.lua b/third_party/spirv-tools.lua index afa3cdef5..bb35e2859 100644 --- a/third_party/spirv-tools.lua +++ b/third_party/spirv-tools.lua @@ -9,14 +9,30 @@ project("spirv-tools") "_LIB", }) includedirs({ - "spirv-tools/external/include", + "spirv-headers/include", "spirv-tools/include", + "spirv-tools/source", }) files({ - "spirv-tools/include/spirv/GLSL.std.450.h", - "spirv-tools/include/spirv/OpenCL.std.h", - "spirv-tools/include/spirv/spirv.h", "spirv-tools/include/spirv-tools/libspirv.h", + -- "spirv-tools/source/opt/basic_block.h", + -- "spirv-tools/source/opt/function.cpp", + -- "spirv-tools/source/opt/function.h", + -- "spirv-tools/source/opt/instruction.cpp", + -- "spirv-tools/source/opt/instruction.h", + -- "spirv-tools/source/opt/ir_loader.cpp", + -- "spirv-tools/source/opt/ir_loader.h", + -- "spirv-tools/source/opt/module.cpp", + -- "spirv-tools/source/opt/module.h", + -- "spirv-tools/source/opt/reflect.h", + "spirv-tools/source/val/BasicBlock.cpp", + "spirv-tools/source/val/BasicBlock.h", + "spirv-tools/source/val/Construct.cpp", + "spirv-tools/source/val/Construct.h", + "spirv-tools/source/val/Function.cpp", + "spirv-tools/source/val/Function.h", + "spirv-tools/source/val/ValidationState.cpp", + "spirv-tools/source/val/ValidationState.h", "spirv-tools/source/assembly_grammar.cpp", "spirv-tools/source/assembly_grammar.h", "spirv-tools/source/binary.cpp", @@ -28,19 +44,20 @@ project("spirv-tools") "spirv-tools/source/ext_inst.h", "spirv-tools/source/instruction.cpp", "spirv-tools/source/instruction.h", + "spirv-tools/source/macro.h", "spirv-tools/source/opcode.cpp", "spirv-tools/source/opcode.h", - "spirv-tools/source/opcode.inc", - "spirv-tools/source/opencl_std_ext_inst.inc", "spirv-tools/source/operand.cpp", "spirv-tools/source/operand.h", "spirv-tools/source/print.cpp", "spirv-tools/source/print.h", + -- "spirv-tools/source/software_version.cpp", "spirv-tools/source/spirv_constant.h", "spirv-tools/source/spirv_definition.h", "spirv-tools/source/spirv_endian.cpp", "spirv-tools/source/spirv_endian.h", - "spirv-tools/source/spirv_operands.h", + "spirv-tools/source/spirv_target_env.cpp", + "spirv-tools/source/spirv_target_env.h", "spirv-tools/source/table.cpp", "spirv-tools/source/table.h", "spirv-tools/source/text.cpp", @@ -53,9 +70,7 @@ project("spirv-tools") "spirv-tools/source/validate_id.cpp", "spirv-tools/source/validate_instruction.cpp", "spirv-tools/source/validate_layout.cpp", - "spirv-tools/source/validate_passes.h", "spirv-tools/source/validate_ssa.cpp", - "spirv-tools/source/validate_types.cpp", "spirv-tools/source/util/bitutils.h", "spirv-tools/source/util/hex_float.h", })