writer/hlsl: UnwrapRef() on atomic types

Fixed: tint:1113
Change-Id: I9aa255f5b308cc4d53b0ea40407cc398096a502c
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/61780
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: James Price <jrprice@google.com>
Commit-Queue: James Price <jrprice@google.com>
Auto-Submit: Ben Clayton <bclayton@google.com>
This commit is contained in:
Ben Clayton
2021-08-12 18:23:10 +00:00
committed by Tint LUCI CQ
parent 13463daa95
commit 080fdf2ac0
6 changed files with 1355 additions and 3 deletions

View File

@@ -993,7 +993,7 @@ bool GeneratorImpl::EmitStorageAtomicCall(
case Op::kAtomicStore: {
// HLSL does not have an InterlockedStore, so we emulate it with
// InterlockedExchange and discard the returned value
auto* value_ty = TypeOf(expr->params()[2]);
auto* value_ty = TypeOf(expr->params()[2])->UnwrapRef();
auto name = UniqueIdentifier("atomicStore");
{
auto fn = line(&buf);
@@ -1024,7 +1024,7 @@ bool GeneratorImpl::EmitStorageAtomicCall(
return name;
}
case Op::kAtomicCompareExchangeWeak: {
auto* value_ty = TypeOf(expr->params()[2]);
auto* value_ty = TypeOf(expr->params()[2])->UnwrapRef();
auto name = UniqueIdentifier("atomicCompareExchangeWeak");
{
@@ -1167,7 +1167,7 @@ bool GeneratorImpl::EmitWorkgroupAtomicCall(std::ostream& out,
// InterlockedExchange and discard the returned value
{ // T result = 0;
auto pre = line();
auto* value_ty = intrinsic->Parameters()[1]->Type();
auto* value_ty = intrinsic->Parameters()[1]->Type()->UnwrapRef();
if (!EmitTypeAndName(pre, value_ty, ast::StorageClass::kNone,
ast::Access::kUndefined, result)) {
return false;