Create SPIR-V writer skeleton.

This CL creates the skeleton for the SPIR-V writer.

Bug: tint:5
Change-Id: I849d8766d32d48314a51096710272f9821e2c1c4
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/16641
Reviewed-by: David Neto <dneto@google.com>
This commit is contained in:
dan sinclair
2020-03-17 21:00:22 +00:00
committed by David Neto
parent 3040f618a5
commit e4392c9ab5
19 changed files with 886 additions and 20 deletions

View File

@@ -22,7 +22,7 @@
#include "src/reader/wgsl/parser.h"
#include "src/type_determiner.h"
#include "src/validator.h"
#include "src/writer/spv/generator.h"
#include "src/writer/spirv/generator.h"
#include "src/writer/wgsl/generator.h"
#include "src/writer/writer.h"
@@ -280,7 +280,8 @@ int main(int argc, const char** argv) {
std::unique_ptr<tint::writer::Writer> writer;
if (options.format == Format::kSpirv || options.format == Format::kSpvAsm) {
writer = std::make_unique<tint::writer::spv::Generator>(std::move(module));
writer =
std::make_unique<tint::writer::spirv::Generator>(std::move(module));
} else if (options.format == Format::kWgsl) {
writer = std::make_unique<tint::writer::wgsl::Generator>(std::move(module));
} else {
@@ -294,12 +295,12 @@ int main(int argc, const char** argv) {
}
if (options.format == Format::kSpvAsm) {
auto w = static_cast<tint::writer::spv::Generator*>(writer.get());
auto w = static_cast<tint::writer::spirv::Generator*>(writer.get());
auto str = Disassemble(w->result());
// TODO(dsinclair): Write to file if output_file given
std::cout << str << std::endl;
} else if (options.format == Format::kSpirv) {
// auto w = static_cast<tint::writer::spv::Generator*>(writer.get());
// auto w = static_cast<tint::writer::spirv::Generator*>(writer.get());
// TODO(dsincliair): Write to to file
} else if (options.format == Format::kWgsl) {
auto w = static_cast<tint::writer::wgsl::Generator*>(writer.get());