resolver: Validate uniform buffer types

Fixed: tint:210
Change-Id: I7763ca23a5dce09755a1ca71d35f24897a875ac0
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/48604
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: James Price <jrprice@google.com>
This commit is contained in:
Ben Clayton
2021-04-21 17:55:12 +00:00
committed by Commit Bot service account
parent 8db818840e
commit 42708348b7
10 changed files with 463 additions and 346 deletions

View File

@@ -985,13 +985,42 @@ class ProgramBuilder {
decorations);
}
/// @param args the arguments to pass to Var()
/// @returns a `ast::Variable` constructed by calling Var() with the arguments
/// of `args`, which is automatically registered as a global variable with the
/// ast::Module.
template <typename... ARGS>
ast::Variable* Global(ARGS&&... args) {
auto* var = Var(std::forward<ARGS>(args)...);
/// @param name the variable name
/// @param type the variable type
/// @param storage the variable storage class
/// @param constructor constructor expression
/// @param decorations variable decorations
/// @returns a new `ast::Variable`, which is automatically registered as a
/// global variable with the ast::Module.
template <typename NAME>
ast::Variable* Global(NAME&& name,
sem::Type* type,
ast::StorageClass storage,
ast::Expression* constructor = nullptr,
ast::DecorationList decorations = {}) {
auto* var =
Var(std::forward<NAME>(name), type, storage, constructor, decorations);
AST().AddGlobalVariable(var);
return var;
}
/// @param source the variable source
/// @param name the variable name
/// @param type the variable type
/// @param storage the variable storage class
/// @param constructor constructor expression
/// @param decorations variable decorations
/// @returns a new `ast::Variable`, which is automatically registered as a
/// global variable with the ast::Module.
template <typename NAME>
ast::Variable* Global(const Source& source,
NAME&& name,
sem::Type* type,
ast::StorageClass storage,
ast::Expression* constructor = nullptr,
ast::DecorationList decorations = {}) {
auto* var = Var(source, std::forward<NAME>(name), type, storage,
constructor, decorations);
AST().AddGlobalVariable(var);
return var;
}