mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-08 13:14:56 +00:00
transform: API cleanup
Transforms are meant to be reusable. Those that hold state cannot be used concurrently. State leakage between runs is dangerous. To fix this: * Add transform::Data - A new base class for extra information emitted by transforms. * Add transform::DataMap - A container of Data, keyed by type. * Add a transform::DataMap field to Transform::Output. * Have FirstIndexOffset emit a FirstIndexOffset::Data. * Deprecate the getters on the transform. Mutability of the transform config is also dangerous as setters can be called while a transform is actively running on another thread. To fix: * Expose a VertexPulling::Config structure and add a constructor that accepts this. * Deprecate the setters on VertexPulling. Also deprecate Transform::Output::diagnostics. Put all the transform diagnostics into the returned Program. Reduces error handling of the client. Change-Id: Ibd228dc2fbf004ede4720e2d6019c024bc5934d1 Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/42264 Reviewed-by: dan sinclair <dsinclair@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: Ben Clayton <bclayton@google.com>
This commit is contained in:
committed by
Commit Bot service account
parent
94b36c3e86
commit
eb496d0a4d
@@ -28,8 +28,8 @@
|
||||
|
||||
namespace {
|
||||
|
||||
[[noreturn]]
|
||||
void TintInternalCompilerErrorReporter(const tint::diag::List& diagnostics) {
|
||||
[[noreturn]] void TintInternalCompilerErrorReporter(
|
||||
const tint::diag::List& diagnostics) {
|
||||
auto printer = tint::diag::Printer::create(stderr, true);
|
||||
tint::diag::Formatter{}.format(diagnostics, printer.get());
|
||||
exit(1);
|
||||
@@ -569,8 +569,8 @@ int main(int argc, const char** argv) {
|
||||
}
|
||||
|
||||
auto out = transform_manager.Run(program.get());
|
||||
if (out.diagnostics.contains_errors()) {
|
||||
diag_formatter.format(out.diagnostics, diag_printer.get());
|
||||
if (!out.program.IsValid()) {
|
||||
diag_formatter.format(out.program.Diagnostics(), diag_printer.get());
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user