writer/msl: Generate address spaces for pointers

Add more E2E tests to cover pointers with different storage classes.

Fixed: tint:815
Change-Id: I224a794cdf60648ce71dc9a0922d489542995be1
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/51404
Auto-Submit: James Price <jrprice@google.com>
Commit-Queue: Ben Clayton <bclayton@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@chromium.org>
This commit is contained in:
James Price
2021-05-19 10:38:18 +00:00
committed by Commit Bot service account
parent 09d53d5ed1
commit cbe816f93d
34 changed files with 304 additions and 10 deletions

View File

@@ -1913,7 +1913,23 @@ bool GeneratorImpl::EmitType(const sem::Type* type, const std::string& name) {
}
out_ << mat->columns() << "x" << mat->rows();
} else if (auto* ptr = type->As<sem::Pointer>()) {
// TODO(dsinclair): Storage class?
switch (ptr->StorageClass()) {
case ast::StorageClass::kFunction:
case ast::StorageClass::kPrivate:
out_ << "thread ";
break;
case ast::StorageClass::kWorkgroup:
out_ << "threadgroup ";
break;
case ast::StorageClass::kStorage:
out_ << "device ";
break;
case ast::StorageClass::kUniform:
out_ << "constant ";
break;
default:
TINT_ICE(diagnostics_) << "unhandled storage class for pointer";
}
if (!EmitType(ptr->StoreType(), "")) {
return false;
}