resolver: Allocate IDs for named pipeline constants

Keep track of any constant IDs specified in the shader, and then
allocate IDs for the remaining constants when creating the semantic
info.

Bug: tint:755
Change-Id: I6a76b1193cac459b62582cde7469b092dde51d5d
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/50841
Commit-Queue: James Price <jrprice@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Auto-Submit: James Price <jrprice@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
This commit is contained in:
James Price
2021-05-13 20:32:32 +00:00
committed by Commit Bot service account
parent 8650247ddb
commit f2f3bfc677
8 changed files with 236 additions and 5 deletions

View File

@@ -38,6 +38,7 @@
#include "src/ast/member_accessor_expression.h"
#include "src/ast/module.h"
#include "src/ast/multisampled_texture.h"
#include "src/ast/override_decoration.h"
#include "src/ast/pointer.h"
#include "src/ast/return_statement.h"
#include "src/ast/sampled_texture.h"
@@ -1786,6 +1787,32 @@ class ProgramBuilder {
return create<ast::LocationDecoration>(source_, location);
}
/// Creates an ast::OverrideDecoration with a specific constant ID
/// @param source the source information
/// @param id the id value
/// @returns the override decoration pointer
ast::OverrideDecoration* Override(const Source& source, uint32_t id) {
return create<ast::OverrideDecoration>(source, id);
}
/// Creates an ast::OverrideDecoration with a specific constant ID
/// @param id the optional id value
/// @returns the override decoration pointer
ast::OverrideDecoration* Override(uint32_t id) {
return Override(source_, id);
}
/// Creates an ast::OverrideDecoration without a constant ID
/// @param source the source information
/// @returns the override decoration pointer
ast::OverrideDecoration* Override(const Source& source) {
return create<ast::OverrideDecoration>(source);
}
/// Creates an ast::OverrideDecoration without a constant ID
/// @returns the override decoration pointer
ast::OverrideDecoration* Override() { return Override(source_); }
/// Creates an ast::StageDecoration
/// @param source the source information
/// @param stage the pipeline stage