Remove tint's usage of Validator
Also update comments and arch design to remove references to the Validator. Bug: tint:642 Change-Id: Ic0b4779ae4712a393ff209014daf25e23f32be6d Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/47061 Kokoro: Kokoro <noreply+kokoro@google.com> Reviewed-by: Ben Clayton <bclayton@google.com> Reviewed-by: James Price <jrprice@google.com> Commit-Queue: Antonio Maiorano <amaiorano@google.com>
This commit is contained in:
parent
101f463992
commit
d15391e802
25
docs/arch.md
25
docs/arch.md
|
@ -36,9 +36,9 @@
|
|||
┃ ┃ ┗━━━━━┛ ┗━━━━━━━┛ ┗━━━━━━━━━━┛ ┗━━━━━━━━━┛ ┃
|
||||
┃ ┗━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━┛
|
||||
▲ ▼
|
||||
┏━━━━━┻━━━━━┓ ┏━━━━━┻━━━━━┓ ┏━━━━━━━━━━━┓
|
||||
┃ Transform ┃◄━━━━━━━━━━━━━━━━━◄┃ Validator ┣━━━━━━►┃ Inspector ┃
|
||||
┗━━━━━━━━━━━┛ ┗━━━━━┳━━━━━┛ ┗━━━━━━━━━━━┛
|
||||
┏━━━━━┻━━━━━┓ ┃ ┏━━━━━━━━━━━┓
|
||||
┃ Transform ┃◄━━━━━━━━━━━━━━━━━━━━━━━━╋━━━━━━━━━━━━►┃ Inspector ┃
|
||||
┗━━━━━━━━━━━┛ ┃ ┗━━━━━━━━━━━┛
|
||||
▼
|
||||
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┻━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
|
||||
┃ Writer ┃
|
||||
|
@ -148,11 +148,8 @@ The `Resolver` will automatically run when a `Program` is built.
|
|||
A `Resolver` creates the `Program`s semantic information by analyzing the
|
||||
`Program`s AST and type information.
|
||||
|
||||
The `Resolver` will do the minimal amount of validation required in order
|
||||
to always be accessing valid nodes, reporting any errors found in the
|
||||
`Program`'s diagnostics. Even if the `Resolver` doesn't generate any
|
||||
errors doesn't mean the generated `Program` is semantically valid. Use the
|
||||
`Validator` to check for a `Program`'s final validity.
|
||||
The `Resolver` will validate to make sure the generated `Program` is
|
||||
semantically valid.
|
||||
|
||||
## Program
|
||||
|
||||
|
@ -161,21 +158,13 @@ A `Program` holds an immutable version of the information from the
|
|||
`Resolver`.
|
||||
|
||||
Like `ProgramBuilder`, `Program::IsValid()` may be called to ensure the AST is
|
||||
structurally correct and that the `Resolver` did not report any errors.
|
||||
`Program::IsValid()` does not perform semantic validation, use the `Validator`
|
||||
to check for a `Program`'s final validity.
|
||||
structurally correct and semantically valid, and that the `Resolver` did not
|
||||
report any errors.
|
||||
|
||||
Unlike the `ProgramBuilder`, a `Program` is fully immutable, and is part of the
|
||||
public Tint API. The immutable nature of `Program`s make these entirely safe
|
||||
to share between multiple threads without the use of synchronization primitives.
|
||||
|
||||
## Validation
|
||||
|
||||
The `Validator` checks a `Program` for static validity as specified by the WGSL
|
||||
language, and reports any validation errors found. Attempting to pass a
|
||||
`Program` that does not pass validation on to later stages will result in
|
||||
undefined behavior.
|
||||
|
||||
## Inspector
|
||||
|
||||
The inspectors job is to go through the `Program` and pull out various pieces of
|
||||
|
|
|
@ -84,11 +84,6 @@ int CommonFuzzer::Run(const uint8_t* data, size_t size) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
Validator v;
|
||||
if (!v.Validate(&program)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (inspector_enabled_) {
|
||||
inspector::Inspector inspector(&program);
|
||||
|
||||
|
|
|
@ -671,12 +671,6 @@ int main(int argc, const char** argv) {
|
|||
return 1;
|
||||
}
|
||||
|
||||
tint::Validator v;
|
||||
if (!v.Validate(program.get())) {
|
||||
diag_formatter.format(v.diagnostics(), diag_printer.get());
|
||||
return 1;
|
||||
}
|
||||
|
||||
tint::transform::Manager transform_manager;
|
||||
for (const auto& name : options.transforms) {
|
||||
// TODO(dsinclair): The vertex pulling transform requires setup code to
|
||||
|
|
|
@ -262,8 +262,8 @@ std::map<uint32_t, Scalar> Inspector::GetConstantIDs() {
|
|||
}
|
||||
|
||||
// If there are conflicting defintions for a constant id, that is invalid
|
||||
// WGSL, so the validator should catch it. Thus here the inspector just
|
||||
// assumes all definitians of the constant id are the same, so only needs
|
||||
// WGSL, so the resolver should catch it. Thus here the inspector just
|
||||
// assumes all definitions of the constant id are the same, so only needs
|
||||
// to find the first reference to constant id.
|
||||
uint32_t constant_id = var->constant_id();
|
||||
if (result.find(constant_id) != result.end()) {
|
||||
|
|
|
@ -256,7 +256,7 @@ TEST_P(VariableDecorationTest, IsValid) {
|
|||
}
|
||||
}
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
ValidatorTest,
|
||||
ResolverDecorationValidationTest,
|
||||
VariableDecorationTest,
|
||||
testing::Values(TestParams{DecorationKind::kAccess, false},
|
||||
TestParams{DecorationKind::kAlign, false},
|
||||
|
@ -290,7 +290,7 @@ TEST_P(FunctionDecorationTest, IsValid) {
|
|||
}
|
||||
}
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
ValidatorTest,
|
||||
ResolverDecorationValidationTest,
|
||||
FunctionDecorationTest,
|
||||
testing::Values(TestParams{DecorationKind::kAccess, false},
|
||||
TestParams{DecorationKind::kAlign, false},
|
||||
|
|
|
@ -1252,8 +1252,7 @@ bool Resolver::MemberAccessor(ast::MemberAccessorExpression* expr) {
|
|||
}
|
||||
} else {
|
||||
// The vector will have a number of components equal to the length of
|
||||
// the swizzle. This assumes the validator will check that the swizzle
|
||||
// is correct.
|
||||
// the swizzle.
|
||||
ret = builder_->create<type::Vector>(vec->type(),
|
||||
static_cast<uint32_t>(size));
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue