[writer/hlsl]: Fix order of atomic method arguments.

Change-Id: Ice1b07c748bc6502a51b29690dfc00466a684c12
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/57461
Auto-Submit: Ben Clayton <bclayton@google.com>
Commit-Queue: James Price <jrprice@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: James Price <jrprice@google.com>
This commit is contained in:
Ben Clayton 2021-07-09 12:35:54 +00:00 committed by Tint LUCI CQ
parent 3d9f0e99c2
commit 1843c0b8d7
16 changed files with 20 additions and 16 deletions

View File

@ -880,6 +880,10 @@ bool GeneratorImpl::EmitStorageAtomicCall(
auto* offset = expr->params()[1]; auto* offset = expr->params()[1];
auto call_buffer_method = [&](const char* name) { auto call_buffer_method = [&](const char* name) {
// First two arguments to the DecomposeMemoryAccess::Intrinsic are the
// buffer and offset. The buffer is the moved to the LHS of the '.', and the
// offset becomes the first argument. The rest of the method's arguments are
// the same.
auto pre = line(); auto pre = line();
if (!EmitExpression(pre, buffer)) { if (!EmitExpression(pre, buffer)) {
return false; return false;
@ -891,7 +895,7 @@ bool GeneratorImpl::EmitStorageAtomicCall(
return false; return false;
} }
for (size_t i = 1; i < expr->params().size() - 1; i++) { for (size_t i = 2; i < expr->params().size(); i++) {
auto* arg = expr->params()[i]; auto* arg = expr->params()[i];
pre << ", "; pre << ", ";
if (!EmitExpression(pre, arg)) { if (!EmitExpression(pre, arg)) {

View File

@ -9,7 +9,7 @@ struct tint_symbol_1 {
void computeMain(tint_symbol_1 tint_symbol) { void computeMain(tint_symbol_1 tint_symbol) {
const uint3 global_id = tint_symbol.global_id; const uint3 global_id = tint_symbol.global_id;
uint atomic_result = 0u; uint atomic_result = 0u;
drawOut.InterlockedAdd(0u, 0u, atomic_result); drawOut.InterlockedAdd(0u, cubeVerts, atomic_result);
const uint firstVertex = atomic_result; const uint firstVertex = atomic_result;
return; return;
} }

View File

@ -2,7 +2,7 @@ RWByteAddressBuffer sb_rw : register(u0, space0);
void atomicAdd_8a199a() { void atomicAdd_8a199a() {
uint atomic_result = 0u; uint atomic_result = 0u;
sb_rw.InterlockedAdd(0u, 0u, atomic_result); sb_rw.InterlockedAdd(0u, 1u, atomic_result);
uint res = atomic_result; uint res = atomic_result;
} }

View File

@ -2,7 +2,7 @@ RWByteAddressBuffer sb_rw : register(u0, space0);
void atomicAdd_d32fe4() { void atomicAdd_d32fe4() {
int atomic_result = 0; int atomic_result = 0;
sb_rw.InterlockedAdd(0u, 0u, atomic_result); sb_rw.InterlockedAdd(0u, 1, atomic_result);
int res = atomic_result; int res = atomic_result;
} }

View File

@ -2,7 +2,7 @@ RWByteAddressBuffer sb_rw : register(u0, space0);
void atomicAnd_152966() { void atomicAnd_152966() {
int atomic_result = 0; int atomic_result = 0;
sb_rw.InterlockedAnd(0u, 0u, atomic_result); sb_rw.InterlockedAnd(0u, 1, atomic_result);
int res = atomic_result; int res = atomic_result;
} }

View File

@ -2,7 +2,7 @@ RWByteAddressBuffer sb_rw : register(u0, space0);
void atomicAnd_85a8d9() { void atomicAnd_85a8d9() {
uint atomic_result = 0u; uint atomic_result = 0u;
sb_rw.InterlockedAnd(0u, 0u, atomic_result); sb_rw.InterlockedAnd(0u, 1u, atomic_result);
uint res = atomic_result; uint res = atomic_result;
} }

View File

@ -2,7 +2,7 @@ RWByteAddressBuffer sb_rw : register(u0, space0);
void atomicExchange_d59712() { void atomicExchange_d59712() {
uint atomic_result = 0u; uint atomic_result = 0u;
sb_rw.InterlockedExchange(0u, 0u, atomic_result); sb_rw.InterlockedExchange(0u, 1u, atomic_result);
uint res = atomic_result; uint res = atomic_result;
} }

View File

@ -2,7 +2,7 @@ RWByteAddressBuffer sb_rw : register(u0, space0);
void atomicExchange_f2e22f() { void atomicExchange_f2e22f() {
int atomic_result = 0; int atomic_result = 0;
sb_rw.InterlockedExchange(0u, 0u, atomic_result); sb_rw.InterlockedExchange(0u, 1, atomic_result);
int res = atomic_result; int res = atomic_result;
} }

View File

@ -2,7 +2,7 @@ RWByteAddressBuffer sb_rw : register(u0, space0);
void atomicMax_51b9be() { void atomicMax_51b9be() {
uint atomic_result = 0u; uint atomic_result = 0u;
sb_rw.InterlockedMax(0u, 0u, atomic_result); sb_rw.InterlockedMax(0u, 1u, atomic_result);
uint res = atomic_result; uint res = atomic_result;
} }

View File

@ -2,7 +2,7 @@ RWByteAddressBuffer sb_rw : register(u0, space0);
void atomicMax_92aa72() { void atomicMax_92aa72() {
int atomic_result = 0; int atomic_result = 0;
sb_rw.InterlockedMax(0u, 0u, atomic_result); sb_rw.InterlockedMax(0u, 1, atomic_result);
int res = atomic_result; int res = atomic_result;
} }

View File

@ -2,7 +2,7 @@ RWByteAddressBuffer sb_rw : register(u0, space0);
void atomicMin_8e38dc() { void atomicMin_8e38dc() {
int atomic_result = 0; int atomic_result = 0;
sb_rw.InterlockedMin(0u, 0u, atomic_result); sb_rw.InterlockedMin(0u, 1, atomic_result);
int res = atomic_result; int res = atomic_result;
} }

View File

@ -2,7 +2,7 @@ RWByteAddressBuffer sb_rw : register(u0, space0);
void atomicMin_c67a74() { void atomicMin_c67a74() {
uint atomic_result = 0u; uint atomic_result = 0u;
sb_rw.InterlockedMin(0u, 0u, atomic_result); sb_rw.InterlockedMin(0u, 1u, atomic_result);
uint res = atomic_result; uint res = atomic_result;
} }

View File

@ -2,7 +2,7 @@ RWByteAddressBuffer sb_rw : register(u0, space0);
void atomicOr_5e95d4() { void atomicOr_5e95d4() {
uint atomic_result = 0u; uint atomic_result = 0u;
sb_rw.InterlockedOr(0u, 0u, atomic_result); sb_rw.InterlockedOr(0u, 1u, atomic_result);
uint res = atomic_result; uint res = atomic_result;
} }

View File

@ -2,7 +2,7 @@ RWByteAddressBuffer sb_rw : register(u0, space0);
void atomicOr_8d96a0() { void atomicOr_8d96a0() {
int atomic_result = 0; int atomic_result = 0;
sb_rw.InterlockedOr(0u, 0u, atomic_result); sb_rw.InterlockedOr(0u, 1, atomic_result);
int res = atomic_result; int res = atomic_result;
} }

View File

@ -2,7 +2,7 @@ RWByteAddressBuffer sb_rw : register(u0, space0);
void atomicXor_54510e() { void atomicXor_54510e() {
uint atomic_result = 0u; uint atomic_result = 0u;
sb_rw.InterlockedXor(0u, 0u, atomic_result); sb_rw.InterlockedXor(0u, 1u, atomic_result);
uint res = atomic_result; uint res = atomic_result;
} }

View File

@ -2,7 +2,7 @@ RWByteAddressBuffer sb_rw : register(u0, space0);
void atomicXor_c1b78c() { void atomicXor_c1b78c() {
int atomic_result = 0; int atomic_result = 0;
sb_rw.InterlockedXor(0u, 0u, atomic_result); sb_rw.InterlockedXor(0u, 1, atomic_result);
int res = atomic_result; int res = atomic_result;
} }