mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-20 10:25:28 +00:00
fuzzers: Don't pointlessly format diagnostics
Fuzzers like to generate silly long source, and formatting large spans of these can take considerable time. Only format the diagnostic if it is going to be displayed. Significantly speeds up some fuzzing tests, fixing some timeouts. Also add a minor optimization to the formatter repeat() implementation. Fixed: chromium:1230313 Change-Id: Ib1f6ac0b31010f86cb7f4e1432dc703ecbe52cb0 Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/58841 Auto-Submit: Ben Clayton <bclayton@google.com> Commit-Queue: Ryan Harrison <rharrison@chromium.org> Kokoro: Kokoro <noreply+kokoro@google.com> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
This commit is contained in:
committed by
Tint LUCI CQ
parent
efceb83536
commit
b29396e472
@@ -217,7 +217,7 @@ int CommonFuzzer::Run(const uint8_t* data, size_t size) {
|
||||
}
|
||||
|
||||
if (!program.IsValid()) {
|
||||
errors_ = diag::Formatter().format(program.Diagnostics());
|
||||
diagnostics_ = program.Diagnostics();
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -234,68 +234,77 @@ int CommonFuzzer::Run(const uint8_t* data, size_t size) {
|
||||
|
||||
auto entry_points = inspector.GetEntryPoints();
|
||||
if (inspector.has_error()) {
|
||||
errors_ = inspector.error();
|
||||
diagnostics_.add_error(tint::diag::System::Inspector, inspector.error());
|
||||
return 0;
|
||||
}
|
||||
|
||||
for (auto& ep : entry_points) {
|
||||
auto remapped_name = inspector.GetRemappedNameForEntryPoint(ep.name);
|
||||
if (inspector.has_error()) {
|
||||
errors_ = inspector.error();
|
||||
diagnostics_.add_error(tint::diag::System::Inspector,
|
||||
inspector.error());
|
||||
return 0;
|
||||
}
|
||||
|
||||
auto constant_ids = inspector.GetConstantIDs();
|
||||
if (inspector.has_error()) {
|
||||
errors_ = inspector.error();
|
||||
diagnostics_.add_error(tint::diag::System::Inspector,
|
||||
inspector.error());
|
||||
return 0;
|
||||
}
|
||||
|
||||
auto uniform_bindings =
|
||||
inspector.GetUniformBufferResourceBindings(ep.name);
|
||||
if (inspector.has_error()) {
|
||||
errors_ = inspector.error();
|
||||
diagnostics_.add_error(tint::diag::System::Inspector,
|
||||
inspector.error());
|
||||
return 0;
|
||||
}
|
||||
|
||||
auto storage_bindings =
|
||||
inspector.GetStorageBufferResourceBindings(ep.name);
|
||||
if (inspector.has_error()) {
|
||||
errors_ = inspector.error();
|
||||
diagnostics_.add_error(tint::diag::System::Inspector,
|
||||
inspector.error());
|
||||
return 0;
|
||||
}
|
||||
|
||||
auto readonly_bindings =
|
||||
inspector.GetReadOnlyStorageBufferResourceBindings(ep.name);
|
||||
if (inspector.has_error()) {
|
||||
errors_ = inspector.error();
|
||||
diagnostics_.add_error(tint::diag::System::Inspector,
|
||||
inspector.error());
|
||||
return 0;
|
||||
}
|
||||
|
||||
auto sampler_bindings = inspector.GetSamplerResourceBindings(ep.name);
|
||||
if (inspector.has_error()) {
|
||||
errors_ = inspector.error();
|
||||
diagnostics_.add_error(tint::diag::System::Inspector,
|
||||
inspector.error());
|
||||
return 0;
|
||||
}
|
||||
|
||||
auto comparison_sampler_bindings =
|
||||
inspector.GetComparisonSamplerResourceBindings(ep.name);
|
||||
if (inspector.has_error()) {
|
||||
errors_ = inspector.error();
|
||||
diagnostics_.add_error(tint::diag::System::Inspector,
|
||||
inspector.error());
|
||||
return 0;
|
||||
}
|
||||
|
||||
auto sampled_texture_bindings =
|
||||
inspector.GetSampledTextureResourceBindings(ep.name);
|
||||
if (inspector.has_error()) {
|
||||
errors_ = inspector.error();
|
||||
diagnostics_.add_error(tint::diag::System::Inspector,
|
||||
inspector.error());
|
||||
return 0;
|
||||
}
|
||||
|
||||
auto multisampled_texture_bindings =
|
||||
inspector.GetMultisampledTextureResourceBindings(ep.name);
|
||||
if (inspector.has_error()) {
|
||||
errors_ = inspector.error();
|
||||
diagnostics_.add_error(tint::diag::System::Inspector,
|
||||
inspector.error());
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user