dawn-cmake/test/tint/statements/compound_assign/complex_lhs.wgsl.expected.hlsl
James Price 508a9660a5 hlsl: Implement compound assignment
Use the ExpandCompoundAssignment transform to convert compound
assignments to regular assignments.

Bug: tint:1325
Change-Id: Ic843964ec24d8a2f00f801823f8f8bbf1c6fab5c
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/85284
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-03-31 22:30:10 +00:00

33 lines
586 B
HLSL

void set_int4(inout int4 vec, int idx, int val) {
vec = (idx.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : vec;
}
[numthreads(1, 1, 1)]
void unused_entry_point() {
return;
}
struct S {
int4 a[4];
};
static int counter = 0;
int foo() {
counter = (counter + 1);
return counter;
}
int bar() {
counter = (counter + 2);
return counter;
}
void main() {
S x = (S)0;
const int tint_symbol_2 = foo();
const int tint_symbol_save = tint_symbol_2;
const int tint_symbol_1 = bar();
set_int4(x.a[tint_symbol_save], tint_symbol_1, (x.a[tint_symbol_save][tint_symbol_1] + 5));
}