writer: Remove legacy generator API

Make the sanitizer transforms internal, as the new generator API
automatically runs them.

Change-Id: Ia2674762328b5d91d8370b8c18c31693936e8566
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/57102
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
This commit is contained in:
James Price 2021-07-14 13:23:45 +00:00
parent bbda5723da
commit 4aed3150b5
9 changed files with 0 additions and 191 deletions

View File

@ -44,7 +44,6 @@
#if TINT_BUILD_SPV_WRITER
#include "spirv-tools/libspirv.hpp"
#include "src/transform/spirv.h"
#include "src/writer/spirv/generator.h"
#endif // TINT_BUILD_SPV_WRITER
@ -53,12 +52,10 @@
#endif // TINT_BUILD_WGSL_WRITER
#if TINT_BUILD_MSL_WRITER
#include "src/transform/msl.h"
#include "src/writer/msl/generator.h"
#endif // TINT_BUILD_MSL_WRITER
#if TINT_BUILD_HLSL_WRITER
#include "src/transform/hlsl.h"
#include "src/writer/hlsl/generator.h"
#endif // TINT_BUILD_HLSL_WRITER

View File

@ -54,27 +54,6 @@ Result Generate(const Program* program, const Options&) {
return result;
}
Generator::Generator(const Program* program)
: impl_(std::make_unique<GeneratorImpl>(program)) {}
Generator::~Generator() = default;
bool Generator::Generate() {
auto ret = impl_->Generate();
if (!ret) {
error_ = impl_->error();
}
return ret;
}
std::string Generator::result() const {
return impl_->result();
}
std::string Generator::error() const {
return impl_->error();
}
} // namespace hlsl
} // namespace writer
} // namespace tint

View File

@ -69,31 +69,6 @@ struct Result {
/// @returns the resulting HLSL and supplementary information
Result Generate(const Program* program, const Options& options);
// TODO(jrprice): Remove this once Dawn is using the new interface.
/// Class to generate HLSL source
class Generator : public Text {
public:
/// Constructor
/// @param program the program to convert
explicit Generator(const Program* program);
/// Destructor
~Generator() override;
/// Generates the result data
/// @returns true on successful generation; false otherwise
bool Generate() override;
/// @returns the result data
std::string result() const override;
/// @returns the error
std::string error() const;
private:
std::unique_ptr<GeneratorImpl> impl_;
};
} // namespace hlsl
} // namespace writer
} // namespace tint

View File

@ -53,27 +53,6 @@ Result Generate(const Program* program, const Options& options) {
return result;
}
Generator::Generator(const Program* program)
: impl_(std::make_unique<GeneratorImpl>(program)) {}
Generator::~Generator() = default;
bool Generator::Generate() {
auto ret = impl_->Generate();
if (!ret) {
error_ = impl_->error();
}
return ret;
}
std::string Generator::result() const {
return impl_->result();
}
std::string Generator::error() const {
return impl_->error();
}
} // namespace msl
} // namespace writer
} // namespace tint

View File

@ -76,34 +76,6 @@ struct Result {
/// @returns the resulting MSL and supplementary information
Result Generate(const Program* program, const Options& options);
// TODO(jrprice): Remove this once Dawn is using the new interface.
/// Class to generate MSL source
class Generator : public Text {
public:
/// Constructor
/// @param program the program to convert
explicit Generator(const Program* program);
/// Destructor
~Generator() override;
/// Generates the result data
/// @returns true on successful generation; false otherwise
bool Generate() override;
/// @returns the result data
std::string result() const override;
/// @returns the error
std::string error() const;
private:
Generator(const Generator&) = delete;
Generator& operator=(const Generator&) = delete;
std::unique_ptr<GeneratorImpl> impl_;
};
} // namespace msl
} // namespace writer
} // namespace tint

View File

@ -57,27 +57,6 @@ Result Generate(const Program* program, const Options& options) {
return result;
}
Generator::Generator(const Program* program)
: builder_(std::make_unique<Builder>(program)),
writer_(std::make_unique<BinaryWriter>()) {}
Generator::~Generator() = default;
bool Generator::Generate() {
if (!builder_->Build()) {
set_error(builder_->error());
return false;
}
writer_->WriteHeader(builder_->id_bound());
writer_->WriteBuilder(builder_.get());
return true;
}
const std::vector<uint32_t>& Generator::result() const {
return writer_->result();
}
} // namespace spirv
} // namespace writer
} // namespace tint

View File

@ -69,29 +69,6 @@ struct Result {
/// @returns the resulting SPIR-V and supplementary information
Result Generate(const Program* program, const Options& options);
// TODO(jrprice): Remove this once Dawn is using the new interface.
/// Class to generate SPIR-V from a Tint program
class Generator : public writer::Writer {
public:
/// Constructor
/// @param program the program to convert
explicit Generator(const Program* program);
/// Destructor
~Generator() override;
/// Generates the result data
/// @returns true on successful generation; false otherwise
bool Generate() override;
/// @returns the result data
const std::vector<uint32_t>& result() const;
private:
std::unique_ptr<Builder> builder_;
std::unique_ptr<BinaryWriter> writer_;
};
} // namespace spirv
} // namespace writer
} // namespace tint

View File

@ -35,27 +35,6 @@ Result Generate(const Program* program, const Options&) {
return result;
}
Generator::Generator(const Program* program)
: impl_(std::make_unique<GeneratorImpl>(program)) {}
Generator::~Generator() = default;
bool Generator::Generate() {
auto ret = impl_->Generate();
if (!ret) {
error_ = impl_->error();
}
return ret;
}
std::string Generator::result() const {
return impl_->result();
}
std::string Generator::error() const {
return impl_->error();
}
} // namespace wgsl
} // namespace writer
} // namespace tint

View File

@ -62,34 +62,6 @@ struct Result {
/// @returns the resulting WGSL and supplementary information
Result Generate(const Program* program, const Options& options);
// TODO(jrprice): Remove this once Dawn is using the new interface.
/// Class to generate WGSL source
class Generator : public Text {
public:
/// Constructor
/// @param program the program to convert
explicit Generator(const Program* program);
/// Destructor
~Generator() override;
/// Generates the result data
/// @returns true on successful generation; false otherwise
bool Generate() override;
/// @returns the result data
std::string result() const override;
/// @returns the error
std::string error() const;
private:
Generator(const Generator&) = delete;
Generator& operator=(const Generator&) = delete;
std::unique_ptr<GeneratorImpl> impl_;
};
} // namespace wgsl
} // namespace writer
} // namespace tint