transform/DMA: Fix ignore() for buffer members

https://dawn-review.googlesource.com/c/tint/+/60213 special cased ignore() to work around tint:1046.
This fix produced bad output for structures when they are fully decomposed into ByteAddressBuffers, as the final HLSL references a structure that no longer exists.

Fixes CTS tests, and tint->dawn roll.

Change-Id: If6eab083c5f0bcca4a90c582df255b77e97a8e9f
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/60347
Commit-Queue: Ben Clayton <bclayton@google.com>
Auto-Submit: Ben Clayton <bclayton@google.com>
Kokoro: Ben Clayton <bclayton@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
This commit is contained in:
Ben Clayton
2021-07-30 15:13:58 +00:00
committed by Tint LUCI CQ
parent 89a0bde59c
commit 38c5a28efd
21 changed files with 243 additions and 2 deletions

View File

@@ -917,8 +917,15 @@ void DecomposeMemoryAccess::Run(CloneContext& ctx, const DataMap&, DataMap&) {
if (auto* intrinsic = call->Target()->As<sem::Intrinsic>()) {
if (intrinsic->Type() == sem::IntrinsicType::kIgnore) {
// ignore(X)
// Don't convert X into a load, this isn't actually used.
state.TakeAccess(call_expr->params()[0]);
// If X is an memory access, don't transform it into a load, as it
// may refer to a structure holding a runtime array, which cannot be
// loaded. Instead replace X with the underlying storage / uniform
// buffer variable.
if (auto access = state.TakeAccess(call_expr->params()[0])) {
ctx.Replace(call_expr->params()[0], [=, &ctx] {
return ctx.CloneWithoutTransform(access.var->Declaration());
});
}
continue;
}
if (intrinsic->Type() == sem::IntrinsicType::kArrayLength) {