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) {
|
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
|
||||||
tint::transform::Manager transform_manager;
|
tint::transform::Manager transform_manager;
|
||||||
transform_manager.append(
|
tint::transform::DataMap transform_inputs;
|
||||||
std::make_unique<tint::transform::BoundArrayAccessors>());
|
transform_inputs.Add<tint::transform::FirstIndexOffset::BindingPoint>(0, 0);
|
||||||
transform_manager.append(
|
transform_manager.Add<tint::transform::BoundArrayAccessors>();
|
||||||
std::make_unique<tint::transform::EmitVertexPointSize>());
|
transform_manager.Add<tint::transform::EmitVertexPointSize>();
|
||||||
transform_manager.append(
|
transform_manager.Add<tint::transform::FirstIndexOffset>();
|
||||||
std::make_unique<tint::transform::FirstIndexOffset>(0, 0));
|
|
||||||
|
|
||||||
tint::fuzzers::CommonFuzzer fuzzer(InputFormat::kWGSL, OutputFormat::kSpv);
|
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);
|
return fuzzer.Run(data, size);
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,11 +19,10 @@ namespace fuzzers {
|
||||||
|
|
||||||
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
|
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
|
||||||
tint::transform::Manager transform_manager;
|
tint::transform::Manager transform_manager;
|
||||||
transform_manager.append(
|
transform_manager.Add<tint::transform::BoundArrayAccessors>();
|
||||||
std::make_unique<tint::transform::BoundArrayAccessors>());
|
|
||||||
|
|
||||||
tint::fuzzers::CommonFuzzer fuzzer(InputFormat::kWGSL, OutputFormat::kSpv);
|
tint::fuzzers::CommonFuzzer fuzzer(InputFormat::kWGSL, OutputFormat::kSpv);
|
||||||
fuzzer.SetTransformManager(&transform_manager);
|
fuzzer.SetTransformManager(&transform_manager, {});
|
||||||
|
|
||||||
return fuzzer.Run(data, size);
|
return fuzzer.Run(data, size);
|
||||||
}
|
}
|
||||||
|
|
|
@ -147,7 +147,7 @@ int CommonFuzzer::Run(const uint8_t* data, size_t size) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (transform_manager_) {
|
if (transform_manager_) {
|
||||||
auto out = transform_manager_->Run(&program);
|
auto out = transform_manager_->Run(&program, transform_inputs_);
|
||||||
if (!out.program.IsValid()) {
|
if (!out.program.IsValid()) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,6 +15,8 @@
|
||||||
#ifndef FUZZERS_TINT_COMMON_FUZZER_H_
|
#ifndef FUZZERS_TINT_COMMON_FUZZER_H_
|
||||||
#define FUZZERS_TINT_COMMON_FUZZER_H_
|
#define FUZZERS_TINT_COMMON_FUZZER_H_
|
||||||
|
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
#include "include/tint/tint.h"
|
#include "include/tint/tint.h"
|
||||||
|
|
||||||
namespace tint {
|
namespace tint {
|
||||||
|
@ -29,7 +31,10 @@ class CommonFuzzer {
|
||||||
explicit CommonFuzzer(InputFormat input, OutputFormat output);
|
explicit CommonFuzzer(InputFormat input, OutputFormat output);
|
||||||
~CommonFuzzer();
|
~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; }
|
void EnableInspector() { inspector_enabled_ = true; }
|
||||||
|
|
||||||
int Run(const uint8_t* data, size_t size);
|
int Run(const uint8_t* data, size_t size);
|
||||||
|
@ -38,6 +43,7 @@ class CommonFuzzer {
|
||||||
InputFormat input_;
|
InputFormat input_;
|
||||||
OutputFormat output_;
|
OutputFormat output_;
|
||||||
transform::Manager* transform_manager_;
|
transform::Manager* transform_manager_;
|
||||||
|
transform::DataMap transform_inputs_;
|
||||||
bool inspector_enabled_;
|
bool inspector_enabled_;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -19,11 +19,10 @@ namespace fuzzers {
|
||||||
|
|
||||||
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
|
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
|
||||||
tint::transform::Manager transform_manager;
|
tint::transform::Manager transform_manager;
|
||||||
transform_manager.append(
|
transform_manager.Add<tint::transform::EmitVertexPointSize>();
|
||||||
std::make_unique<tint::transform::EmitVertexPointSize>());
|
|
||||||
|
|
||||||
tint::fuzzers::CommonFuzzer fuzzer(InputFormat::kWGSL, OutputFormat::kSpv);
|
tint::fuzzers::CommonFuzzer fuzzer(InputFormat::kWGSL, OutputFormat::kSpv);
|
||||||
fuzzer.SetTransformManager(&transform_manager);
|
fuzzer.SetTransformManager(&transform_manager, {});
|
||||||
|
|
||||||
return fuzzer.Run(data, size);
|
return fuzzer.Run(data, size);
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,11 +19,12 @@ namespace fuzzers {
|
||||||
|
|
||||||
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
|
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
|
||||||
tint::transform::Manager transform_manager;
|
tint::transform::Manager transform_manager;
|
||||||
transform_manager.append(
|
tint::transform::DataMap transform_inputs;
|
||||||
std::make_unique<tint::transform::FirstIndexOffset>(0, 0));
|
transform_inputs.Add<tint::transform::FirstIndexOffset::BindingPoint>(0, 0);
|
||||||
|
transform_manager.Add<tint::transform::FirstIndexOffset>();
|
||||||
|
|
||||||
tint::fuzzers::CommonFuzzer fuzzer(InputFormat::kWGSL, OutputFormat::kSpv);
|
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);
|
return fuzzer.Run(data, size);
|
||||||
}
|
}
|
||||||
|
|
|
@ -675,22 +675,22 @@ int main(int argc, const char** argv) {
|
||||||
}
|
}
|
||||||
|
|
||||||
tint::transform::Manager transform_manager;
|
tint::transform::Manager transform_manager;
|
||||||
|
tint::transform::DataMap transform_inputs;
|
||||||
for (const auto& name : options.transforms) {
|
for (const auto& name : options.transforms) {
|
||||||
// TODO(dsinclair): The vertex pulling transform requires setup code to
|
// 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
|
// be run that needs user input. Should we find a way to support that here
|
||||||
// maybe through a provided file?
|
// maybe through a provided file?
|
||||||
|
|
||||||
if (name == "bound_array_accessors") {
|
if (name == "bound_array_accessors") {
|
||||||
transform_manager.append(
|
transform_manager.Add<tint::transform::BoundArrayAccessors>();
|
||||||
std::make_unique<tint::transform::BoundArrayAccessors>());
|
|
||||||
} else if (name == "emit_vertex_point_size") {
|
} else if (name == "emit_vertex_point_size") {
|
||||||
transform_manager.append(
|
transform_manager.Add<tint::transform::EmitVertexPointSize>();
|
||||||
std::make_unique<tint::transform::EmitVertexPointSize>());
|
|
||||||
} else if (name == "first_index_offset") {
|
} else if (name == "first_index_offset") {
|
||||||
transform_manager.append(
|
transform_inputs.Add<tint::transform::FirstIndexOffset::BindingPoint>(0,
|
||||||
std::make_unique<tint::transform::FirstIndexOffset>(0, 0));
|
0);
|
||||||
|
transform_manager.Add<tint::transform::FirstIndexOffset>();
|
||||||
} else if (name == "renamer") {
|
} else if (name == "renamer") {
|
||||||
transform_manager.append(std::make_unique<tint::transform::Renamer>());
|
transform_manager.Add<tint::transform::Renamer>();
|
||||||
} else {
|
} else {
|
||||||
std::cerr << "Unknown transform name: " << name << std::endl;
|
std::cerr << "Unknown transform name: " << name << std::endl;
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -701,7 +701,7 @@ int main(int argc, const char** argv) {
|
||||||
#if TINT_BUILD_SPV_WRITER
|
#if TINT_BUILD_SPV_WRITER
|
||||||
case Format::kSpirv:
|
case Format::kSpirv:
|
||||||
case Format::kSpvAsm:
|
case Format::kSpvAsm:
|
||||||
transform_manager.append(std::make_unique<tint::transform::Spirv>());
|
transform_manager.Add<tint::transform::Spirv>();
|
||||||
break;
|
break;
|
||||||
#endif // TINT_BUILD_SPV_WRITER
|
#endif // TINT_BUILD_SPV_WRITER
|
||||||
#if TINT_BUILD_MSL_WRITER
|
#if TINT_BUILD_MSL_WRITER
|
||||||
|
@ -710,7 +710,7 @@ int main(int argc, const char** argv) {
|
||||||
tint::transform::Renamer::Target::kMslKeywords};
|
tint::transform::Renamer::Target::kMslKeywords};
|
||||||
transform_manager.append(
|
transform_manager.append(
|
||||||
std::make_unique<tint::transform::Renamer>(renamer_config));
|
std::make_unique<tint::transform::Renamer>(renamer_config));
|
||||||
transform_manager.append(std::make_unique<tint::transform::Msl>());
|
transform_manager.Add<tint::transform::Msl>();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#endif // TINT_BUILD_MSL_WRITER
|
#endif // TINT_BUILD_MSL_WRITER
|
||||||
|
@ -720,7 +720,7 @@ int main(int argc, const char** argv) {
|
||||||
tint::transform::Renamer::Target::kHlslKeywords};
|
tint::transform::Renamer::Target::kHlslKeywords};
|
||||||
transform_manager.append(
|
transform_manager.append(
|
||||||
std::make_unique<tint::transform::Renamer>(renamer_config));
|
std::make_unique<tint::transform::Renamer>(renamer_config));
|
||||||
transform_manager.append(std::make_unique<tint::transform::Hlsl>());
|
transform_manager.Add<tint::transform::Hlsl>();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#endif // TINT_BUILD_HLSL_WRITER
|
#endif // TINT_BUILD_HLSL_WRITER
|
||||||
|
@ -728,7 +728,7 @@ int main(int argc, const char** argv) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto out = transform_manager.Run(program.get());
|
auto out = transform_manager.Run(program.get(), std::move(transform_inputs));
|
||||||
if (!out.program.IsValid()) {
|
if (!out.program.IsValid()) {
|
||||||
diag_formatter.format(out.program.Diagnostics(), diag_printer.get());
|
diag_formatter.format(out.program.Diagnostics(), diag_printer.get());
|
||||||
return 1;
|
return 1;
|
||||||
|
|
|
@ -55,9 +55,6 @@ FirstIndexOffset::Data::Data(const Data&) = default;
|
||||||
FirstIndexOffset::Data::~Data() = default;
|
FirstIndexOffset::Data::~Data() = default;
|
||||||
|
|
||||||
FirstIndexOffset::FirstIndexOffset() = default;
|
FirstIndexOffset::FirstIndexOffset() = default;
|
||||||
FirstIndexOffset::FirstIndexOffset(uint32_t binding, uint32_t group)
|
|
||||||
: binding_(binding), group_(group) {}
|
|
||||||
|
|
||||||
FirstIndexOffset::~FirstIndexOffset() = default;
|
FirstIndexOffset::~FirstIndexOffset() = default;
|
||||||
|
|
||||||
Output FirstIndexOffset::Run(const Program* in, const DataMap& data) {
|
Output FirstIndexOffset::Run(const Program* in, const DataMap& data) {
|
||||||
|
|
|
@ -109,11 +109,7 @@ class FirstIndexOffset : public Transform {
|
||||||
|
|
||||||
/// Constructor
|
/// Constructor
|
||||||
FirstIndexOffset();
|
FirstIndexOffset();
|
||||||
/// Constructor
|
/// Destructor
|
||||||
/// [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);
|
|
||||||
~FirstIndexOffset() override;
|
~FirstIndexOffset() override;
|
||||||
|
|
||||||
/// Runs the transform on `program`, returning the transformation result.
|
/// 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));
|
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));
|
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));
|
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));
|
EXPECT_EQ(expect, str(got));
|
||||||
|
|
||||||
|
|
|
@ -147,9 +147,6 @@ class Output {
|
||||||
/// Interface for Program transforms
|
/// Interface for Program transforms
|
||||||
class Transform {
|
class Transform {
|
||||||
public:
|
public:
|
||||||
/// [DEPRECATED]: Use transform::Output
|
|
||||||
using Output = transform::Output;
|
|
||||||
|
|
||||||
/// Constructor
|
/// Constructor
|
||||||
Transform();
|
Transform();
|
||||||
/// Destructor
|
/// Destructor
|
||||||
|
|
|
@ -567,8 +567,6 @@ struct State {
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
VertexPulling::VertexPulling() = default;
|
VertexPulling::VertexPulling() = default;
|
||||||
VertexPulling::VertexPulling(const Config& config) : cfg_(config) {}
|
|
||||||
|
|
||||||
VertexPulling::~VertexPulling() = default;
|
VertexPulling::~VertexPulling() = default;
|
||||||
|
|
||||||
Output VertexPulling::Run(const Program* in, const DataMap& data) {
|
Output VertexPulling::Run(const Program* in, const DataMap& data) {
|
||||||
|
|
|
@ -160,11 +160,6 @@ class VertexPulling : public Transform {
|
||||||
/// Constructor
|
/// Constructor
|
||||||
VertexPulling();
|
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
|
/// Destructor
|
||||||
~VertexPulling() override;
|
~VertexPulling() override;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue