diff --git a/src/writer/spirv/generator.cc b/src/writer/spirv/generator.cc index 41dfb07065..190af5f4c1 100644 --- a/src/writer/spirv/generator.cc +++ b/src/writer/spirv/generator.cc @@ -51,6 +51,22 @@ bool Generator::Generate() { return true; } +bool Generator::GenerateUnsafe() { + auto unsafe_namer = std::make_unique(module_); + builder_ = std::make_unique(module_, unsafe_namer.get()); + + if (!builder_->Build()) { + set_error(builder_->error()); + return false; + } + + writer_->WriteHeader(builder_->id_bound()); + writer_->WriteBuilder(builder_.get()); + + builder_ = std::make_unique(module_, namer_.get()); + return true; +} + bool Generator::GenerateEntryPoint(ast::PipelineStage, const std::string&) { return false; } diff --git a/src/writer/spirv/generator.h b/src/writer/spirv/generator.h index d84d753afc..7f73d490d8 100644 --- a/src/writer/spirv/generator.h +++ b/src/writer/spirv/generator.h @@ -48,6 +48,11 @@ class Generator : public writer::Writer { /// @returns true on successful generation; false otherwise bool Generate() override; + /// Generates the result data + /// DO NOT USE. Temporary fix for Dawn usage of SPRIV-Cross + /// @returns true on successful generation; false otherwise + bool GenerateUnsafe(); + /// Converts a single entry point /// @param stage the pipeline stage /// @param name the entry point name