Convert @binding to an expression

This CL updates the binding attribute to store an expression
instead of a single value. The parser always produces an
IntLiteralExpression at the moment.

Bug: tint:1633
Change-Id: I14b2a61b5bcdea66e9e24df7afbb55fb60be785e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/100440
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
This commit is contained in:
dan sinclair
2022-08-29 21:13:00 +00:00
committed by Dawn LUCI CQ
parent cbe8b36256
commit f9b831c39a
67 changed files with 636 additions and 525 deletions

View File

@@ -126,7 +126,7 @@ void InspectorBuilder::AddUniformBuffer(const std::string& name,
const ast::Type* type,
uint32_t group,
uint32_t binding) {
GlobalVar(name, type, ast::StorageClass::kUniform, Binding(binding), Group(group));
GlobalVar(name, type, ast::StorageClass::kUniform, Binding(AInt(binding)), Group(group));
}
void InspectorBuilder::AddWorkgroupStorage(const std::string& name, const ast::Type* type) {
@@ -138,7 +138,8 @@ void InspectorBuilder::AddStorageBuffer(const std::string& name,
ast::Access access,
uint32_t group,
uint32_t binding) {
GlobalVar(name, type, ast::StorageClass::kStorage, access, Binding(binding), Group(group));
GlobalVar(name, type, ast::StorageClass::kStorage, access, Binding(AInt(binding)),
Group(group));
}
void InspectorBuilder::MakeStructVariableReferenceBodyFunction(
@@ -170,20 +171,20 @@ void InspectorBuilder::MakeStructVariableReferenceBodyFunction(
}
void InspectorBuilder::AddSampler(const std::string& name, uint32_t group, uint32_t binding) {
GlobalVar(name, sampler_type(), Binding(binding), Group(group));
GlobalVar(name, sampler_type(), Binding(AInt(binding)), Group(group));
}
void InspectorBuilder::AddComparisonSampler(const std::string& name,
uint32_t group,
uint32_t binding) {
GlobalVar(name, comparison_sampler_type(), Binding(binding), Group(group));
GlobalVar(name, comparison_sampler_type(), Binding(AInt(binding)), Group(group));
}
void InspectorBuilder::AddResource(const std::string& name,
const ast::Type* type,
uint32_t group,
uint32_t binding) {
GlobalVar(name, type, Binding(binding), Group(group));
GlobalVar(name, type, Binding(AInt(binding)), Group(group));
}
void InspectorBuilder::AddGlobalVariable(const std::string& name, const ast::Type* type) {
@@ -285,7 +286,7 @@ void InspectorBuilder::AddStorageTexture(const std::string& name,
const ast::Type* type,
uint32_t group,
uint32_t binding) {
GlobalVar(name, type, Binding(binding), Group(group));
GlobalVar(name, type, Binding(AInt(binding)), Group(group));
}
const ast::Function* InspectorBuilder::MakeStorageTextureBodyFunction(