src/transform: Remove deprecated APIs
These have now been removed from Dawn. Change-Id: I50e784141e6eb07f4f0d3f508bb8c6199429dd63 Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/48044 Auto-Submit: Ben Clayton <bclayton@google.com> Commit-Queue: Ben Clayton <bclayton@google.com> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
This commit is contained in:
parent
19b4b6cc2b
commit
5d5ec24571
|
@ -19,15 +19,14 @@ namespace fuzzers {
|
|||
|
||||
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
|
||||
tint::transform::Manager transform_manager;
|
||||
transform_manager.append(
|
||||
std::make_unique<tint::transform::BoundArrayAccessors>());
|
||||
transform_manager.append(
|
||||
std::make_unique<tint::transform::EmitVertexPointSize>());
|
||||
transform_manager.append(
|
||||
std::make_unique<tint::transform::FirstIndexOffset>(0, 0));
|
||||
tint::transform::DataMap transform_inputs;
|
||||
transform_inputs.Add<tint::transform::FirstIndexOffset::BindingPoint>(0, 0);
|
||||
transform_manager.Add<tint::transform::BoundArrayAccessors>();
|
||||
transform_manager.Add<tint::transform::EmitVertexPointSize>();
|
||||
transform_manager.Add<tint::transform::FirstIndexOffset>();
|
||||
|
||||
tint::fuzzers::CommonFuzzer fuzzer(InputFormat::kWGSL, OutputFormat::kSpv);
|
||||
fuzzer.SetTransformManager(&transform_manager);
|
||||
fuzzer.SetTransformManager(&transform_manager, std::move(transform_inputs));
|
||||
|
||||
return fuzzer.Run(data, size);
|
||||
}
|
||||
|
|
|
@ -19,11 +19,10 @@ namespace fuzzers {
|
|||
|
||||
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
|
||||
tint::transform::Manager transform_manager;
|
||||
transform_manager.append(
|
||||
std::make_unique<tint::transform::BoundArrayAccessors>());
|
||||
transform_manager.Add<tint::transform::BoundArrayAccessors>();
|
||||
|
||||
tint::fuzzers::CommonFuzzer fuzzer(InputFormat::kWGSL, OutputFormat::kSpv);
|
||||
fuzzer.SetTransformManager(&transform_manager);
|
||||
fuzzer.SetTransformManager(&transform_manager, {});
|
||||
|
||||
return fuzzer.Run(data, size);
|
||||
}
|
||||
|
|
|
@ -147,7 +147,7 @@ int CommonFuzzer::Run(const uint8_t* data, size_t size) {
|
|||
}
|
||||
|
||||
if (transform_manager_) {
|
||||
auto out = transform_manager_->Run(&program);
|
||||
auto out = transform_manager_->Run(&program, transform_inputs_);
|
||||
if (!out.program.IsValid()) {
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -15,6 +15,8 @@
|
|||
#ifndef FUZZERS_TINT_COMMON_FUZZER_H_
|
||||
#define FUZZERS_TINT_COMMON_FUZZER_H_
|
||||
|
||||
#include <utility>
|
||||
|
||||
#include "include/tint/tint.h"
|
||||
|
||||
namespace tint {
|
||||
|
@ -29,7 +31,10 @@ class CommonFuzzer {
|
|||
explicit CommonFuzzer(InputFormat input, OutputFormat output);
|
||||
~CommonFuzzer();
|
||||
|
||||
void SetTransformManager(transform::Manager* tm) { transform_manager_ = tm; }
|
||||
void SetTransformManager(transform::Manager* tm, transform::DataMap inputs) {
|
||||
transform_manager_ = tm;
|
||||
transform_inputs_ = std::move(inputs);
|
||||
}
|
||||
void EnableInspector() { inspector_enabled_ = true; }
|
||||
|
||||
int Run(const uint8_t* data, size_t size);
|
||||
|
@ -38,6 +43,7 @@ class CommonFuzzer {
|
|||
InputFormat input_;
|
||||
OutputFormat output_;
|
||||
transform::Manager* transform_manager_;
|
||||
transform::DataMap transform_inputs_;
|
||||
bool inspector_enabled_;
|
||||
};
|
||||
|
||||
|
|
|
@ -19,11 +19,10 @@ namespace fuzzers {
|
|||
|
||||
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
|
||||
tint::transform::Manager transform_manager;
|
||||
transform_manager.append(
|
||||
std::make_unique<tint::transform::EmitVertexPointSize>());
|
||||
transform_manager.Add<tint::transform::EmitVertexPointSize>();
|
||||
|
||||
tint::fuzzers::CommonFuzzer fuzzer(InputFormat::kWGSL, OutputFormat::kSpv);
|
||||
fuzzer.SetTransformManager(&transform_manager);
|
||||
fuzzer.SetTransformManager(&transform_manager, {});
|
||||
|
||||
return fuzzer.Run(data, size);
|
||||
}
|
||||
|
|
|
@ -19,11 +19,12 @@ namespace fuzzers {
|
|||
|
||||
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
|
||||
tint::transform::Manager transform_manager;
|
||||
transform_manager.append(
|
||||
std::make_unique<tint::transform::FirstIndexOffset>(0, 0));
|
||||
tint::transform::DataMap transform_inputs;
|
||||
transform_inputs.Add<tint::transform::FirstIndexOffset::BindingPoint>(0, 0);
|
||||
transform_manager.Add<tint::transform::FirstIndexOffset>();
|
||||
|
||||
tint::fuzzers::CommonFuzzer fuzzer(InputFormat::kWGSL, OutputFormat::kSpv);
|
||||
fuzzer.SetTransformManager(&transform_manager);
|
||||
fuzzer.SetTransformManager(&transform_manager, std::move(transform_inputs));
|
||||
|
||||
return fuzzer.Run(data, size);
|
||||
}
|
||||
|
|
|
@ -675,22 +675,22 @@ int main(int argc, const char** argv) {
|
|||
}
|
||||
|
||||
tint::transform::Manager transform_manager;
|
||||
tint::transform::DataMap transform_inputs;
|
||||
for (const auto& name : options.transforms) {
|
||||
// TODO(dsinclair): The vertex pulling transform requires setup code to
|
||||
// be run that needs user input. Should we find a way to support that here
|
||||
// maybe through a provided file?
|
||||
|
||||
if (name == "bound_array_accessors") {
|
||||
transform_manager.append(
|
||||
std::make_unique<tint::transform::BoundArrayAccessors>());
|
||||
transform_manager.Add<tint::transform::BoundArrayAccessors>();
|
||||
} else if (name == "emit_vertex_point_size") {
|
||||
transform_manager.append(
|
||||
std::make_unique<tint::transform::EmitVertexPointSize>());
|
||||
transform_manager.Add<tint::transform::EmitVertexPointSize>();
|
||||
} else if (name == "first_index_offset") {
|
||||
transform_manager.append(
|
||||
std::make_unique<tint::transform::FirstIndexOffset>(0, 0));
|
||||
transform_inputs.Add<tint::transform::FirstIndexOffset::BindingPoint>(0,
|
||||
0);
|
||||
transform_manager.Add<tint::transform::FirstIndexOffset>();
|
||||
} else if (name == "renamer") {
|
||||
transform_manager.append(std::make_unique<tint::transform::Renamer>());
|
||||
transform_manager.Add<tint::transform::Renamer>();
|
||||
} else {
|
||||
std::cerr << "Unknown transform name: " << name << std::endl;
|
||||
return 1;
|
||||
|
@ -701,7 +701,7 @@ int main(int argc, const char** argv) {
|
|||
#if TINT_BUILD_SPV_WRITER
|
||||
case Format::kSpirv:
|
||||
case Format::kSpvAsm:
|
||||
transform_manager.append(std::make_unique<tint::transform::Spirv>());
|
||||
transform_manager.Add<tint::transform::Spirv>();
|
||||
break;
|
||||
#endif // TINT_BUILD_SPV_WRITER
|
||||
#if TINT_BUILD_MSL_WRITER
|
||||
|
@ -710,7 +710,7 @@ int main(int argc, const char** argv) {
|
|||
tint::transform::Renamer::Target::kMslKeywords};
|
||||
transform_manager.append(
|
||||
std::make_unique<tint::transform::Renamer>(renamer_config));
|
||||
transform_manager.append(std::make_unique<tint::transform::Msl>());
|
||||
transform_manager.Add<tint::transform::Msl>();
|
||||
break;
|
||||
}
|
||||
#endif // TINT_BUILD_MSL_WRITER
|
||||
|
@ -720,7 +720,7 @@ int main(int argc, const char** argv) {
|
|||
tint::transform::Renamer::Target::kHlslKeywords};
|
||||
transform_manager.append(
|
||||
std::make_unique<tint::transform::Renamer>(renamer_config));
|
||||
transform_manager.append(std::make_unique<tint::transform::Hlsl>());
|
||||
transform_manager.Add<tint::transform::Hlsl>();
|
||||
break;
|
||||
}
|
||||
#endif // TINT_BUILD_HLSL_WRITER
|
||||
|
@ -728,7 +728,7 @@ int main(int argc, const char** argv) {
|
|||
break;
|
||||
}
|
||||
|
||||
auto out = transform_manager.Run(program.get());
|
||||
auto out = transform_manager.Run(program.get(), std::move(transform_inputs));
|
||||
if (!out.program.IsValid()) {
|
||||
diag_formatter.format(out.program.Diagnostics(), diag_printer.get());
|
||||
return 1;
|
||||
|
|
|
@ -55,9 +55,6 @@ FirstIndexOffset::Data::Data(const Data&) = default;
|
|||
FirstIndexOffset::Data::~Data() = default;
|
||||
|
||||
FirstIndexOffset::FirstIndexOffset() = default;
|
||||
FirstIndexOffset::FirstIndexOffset(uint32_t binding, uint32_t group)
|
||||
: binding_(binding), group_(group) {}
|
||||
|
||||
FirstIndexOffset::~FirstIndexOffset() = default;
|
||||
|
||||
Output FirstIndexOffset::Run(const Program* in, const DataMap& data) {
|
||||
|
|
|
@ -109,11 +109,7 @@ class FirstIndexOffset : public Transform {
|
|||
|
||||
/// Constructor
|
||||
FirstIndexOffset();
|
||||
/// Constructor
|
||||
/// [DEPRECATED] - pass BindingPoint as part of the `data` to Run()
|
||||
/// @param binding the binding() for firstVertex/Instance uniform
|
||||
/// @param group the group() for firstVertex/Instance uniform
|
||||
FirstIndexOffset(uint32_t binding, uint32_t group);
|
||||
/// Destructor
|
||||
~FirstIndexOffset() override;
|
||||
|
||||
/// Runs the transform on `program`, returning the transformation result.
|
||||
|
|
|
@ -366,7 +366,9 @@ fn entry() {
|
|||
}
|
||||
)";
|
||||
|
||||
auto got = Run(src, std::make_unique<FirstIndexOffset>(1, 2));
|
||||
DataMap config;
|
||||
config.Add<FirstIndexOffset::BindingPoint>(1, 2);
|
||||
auto got = Run<FirstIndexOffset>(src, std::move(config));
|
||||
|
||||
EXPECT_EQ(expect, str(got));
|
||||
|
||||
|
@ -419,7 +421,9 @@ fn entry() {
|
|||
}
|
||||
)";
|
||||
|
||||
auto got = Run(src, std::make_unique<FirstIndexOffset>(1, 7));
|
||||
DataMap config;
|
||||
config.Add<FirstIndexOffset::BindingPoint>(1, 7);
|
||||
auto got = Run<FirstIndexOffset>(src, std::move(config));
|
||||
|
||||
EXPECT_EQ(expect, str(got));
|
||||
|
||||
|
@ -475,7 +479,9 @@ fn entry() {
|
|||
}
|
||||
)";
|
||||
|
||||
auto got = Run(src, std::make_unique<FirstIndexOffset>(1, 2));
|
||||
DataMap config;
|
||||
config.Add<FirstIndexOffset::BindingPoint>(1, 2);
|
||||
auto got = Run<FirstIndexOffset>(src, std::move(config));
|
||||
|
||||
EXPECT_EQ(expect, str(got));
|
||||
|
||||
|
@ -535,7 +541,9 @@ fn entry() {
|
|||
}
|
||||
)";
|
||||
|
||||
auto got = Run(src, std::make_unique<FirstIndexOffset>(1, 2));
|
||||
DataMap config;
|
||||
config.Add<FirstIndexOffset::BindingPoint>(1, 2);
|
||||
auto got = Run<FirstIndexOffset>(src, std::move(config));
|
||||
|
||||
EXPECT_EQ(expect, str(got));
|
||||
|
||||
|
|
|
@ -147,9 +147,6 @@ class Output {
|
|||
/// Interface for Program transforms
|
||||
class Transform {
|
||||
public:
|
||||
/// [DEPRECATED]: Use transform::Output
|
||||
using Output = transform::Output;
|
||||
|
||||
/// Constructor
|
||||
Transform();
|
||||
/// Destructor
|
||||
|
|
|
@ -567,8 +567,6 @@ struct State {
|
|||
} // namespace
|
||||
|
||||
VertexPulling::VertexPulling() = default;
|
||||
VertexPulling::VertexPulling(const Config& config) : cfg_(config) {}
|
||||
|
||||
VertexPulling::~VertexPulling() = default;
|
||||
|
||||
Output VertexPulling::Run(const Program* in, const DataMap& data) {
|
||||
|
|
|
@ -160,11 +160,6 @@ class VertexPulling : public Transform {
|
|||
/// Constructor
|
||||
VertexPulling();
|
||||
|
||||
/// Constructor
|
||||
/// [DEPRECATED] - pass Config as part of the `data` to Run()
|
||||
/// @param config the configuration options for the transform
|
||||
explicit VertexPulling(const Config& config);
|
||||
|
||||
/// Destructor
|
||||
~VertexPulling() override;
|
||||
|
||||
|
|
Loading…
Reference in New Issue