Update spirv-tools and add spirv-headers

This commit is contained in:
Dr. Chat 2016-06-27 20:33:05 -05:00
parent 9abfc52b77
commit 753911146b
8 changed files with 37 additions and 16 deletions

3
.gitmodules vendored
View File

@ -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

View File

@ -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_); }

View File

@ -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_); }

View File

@ -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;

View File

@ -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::Result> SpirvValidator::Validate(
@ -61,8 +62,7 @@ std::unique_ptr<SpirvValidator::Result> 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> result(new Result(text, diagnostic));
if (result_code) {
XELOGE("Failed to validate spv: %d", result_code);

1
third_party/spirv-headers vendored Submodule

@ -0,0 +1 @@
Subproject commit 34d319db9d6cefe93191b921f5f1593378a98c4c

@ -1 +1 @@
Subproject commit 4d2f2239bf896dc14127e25011f41ac79d687052
Subproject commit 327bc49a2d811ce3c8b3443c2624f1f807965c62

View File

@ -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",
})