Make params for FirstIndexOffset fuzzing dynamic

The preamble size in tint_all_transforms_fuzzers is dynamic in
anticipation of more complex preamble calculations in future CLs.

BUG=tint:722

Change-Id: I24a0b00a77aa565b5fe1f146015f017481916c1c
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/49200
Auto-Submit: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
This commit is contained in:
Ryan Harrison 2021-04-27 17:24:47 +00:00 committed by Commit Bot service account
parent d30047fea0
commit a810d71df5
2 changed files with 27 additions and 2 deletions

View File

@ -18,9 +18,22 @@ namespace tint {
namespace fuzzers {
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
struct Config {
uint32_t group;
uint32_t binding;
};
if (size < sizeof(Config)) {
return 0;
}
auto* config = reinterpret_cast<const Config*>(data);
data += sizeof(Config);
size -= sizeof(Config);
tint::transform::Manager transform_manager;
tint::transform::DataMap transform_inputs;
transform_inputs.Add<tint::transform::FirstIndexOffset::BindingPoint>(0, 0);
transform_inputs.Add<tint::transform::FirstIndexOffset::BindingPoint>(
config->binding, config->group);
transform_manager.Add<tint::transform::BoundArrayAccessors>();
transform_manager.Add<tint::transform::EmitVertexPointSize>();
transform_manager.Add<tint::transform::FirstIndexOffset>();

View File

@ -18,9 +18,21 @@ namespace tint {
namespace fuzzers {
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
struct Config {
uint32_t group;
uint32_t binding;
};
if (size < sizeof(Config)) {
return 0;
}
auto* config = reinterpret_cast<const Config*>(data);
data += sizeof(Config);
size -= sizeof(Config);
tint::transform::Manager transform_manager;
tint::transform::DataMap transform_inputs;
transform_inputs.Add<tint::transform::FirstIndexOffset::BindingPoint>(0, 0);
transform_inputs.Add<tint::transform::FirstIndexOffset::BindingPoint>(
config->binding, config->group);
transform_manager.Add<tint::transform::FirstIndexOffset>();
tint::fuzzers::CommonFuzzer fuzzer(InputFormat::kWGSL, OutputFormat::kSpv);