writer/msl: Fix texture intrinsic generation

Wrap the texture expression in parentheses when it has lower
precendence than the function call operator.

Cast integer coordinates to unsigned integers as required by MSL.

Fixed: tint:536
Change-Id: I957e6be3c51044959e25e0be96c2d2c65db18187
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/53962
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: James Price <jrprice@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
diff --git a/test/intrinsics/gen/textureStore/38e8d7.wgsl.expected.msl b/test/intrinsics/gen/textureStore/38e8d7.wgsl.expected.msl
index a29fc29..ac9cdd5 100644
--- a/test/intrinsics/gen/textureStore/38e8d7.wgsl.expected.msl
+++ b/test/intrinsics/gen/textureStore/38e8d7.wgsl.expected.msl
@@ -1,32 +1,27 @@
-SKIP: FAILED
-
-
-
-Validation Failure:
 #include <metal_stdlib>
 
 using namespace metal;
-void textureStore_38e8d7() {
-  arg_0.write(uint4(), int2(), 1);
+struct tint_symbol {
+  float4 value [[position]];
+};
+
+void textureStore_38e8d7(texture2d_array<uint, access::write> tint_symbol_2) {
+  tint_symbol_2.write(uint4(), uint2(int2()), 1);
 }
 
-vertex void vertex_main() {
-  textureStore_38e8d7();
+vertex tint_symbol vertex_main(texture2d_array<uint, access::write> tint_symbol_3 [[texture(0)]]) {
+  textureStore_38e8d7(tint_symbol_3);
+  tint_symbol const tint_symbol_1 = {.value=float4()};
+  return tint_symbol_1;
+}
+
+fragment void fragment_main(texture2d_array<uint, access::write> tint_symbol_4 [[texture(0)]]) {
+  textureStore_38e8d7(tint_symbol_4);
   return;
 }
 
-fragment void fragment_main() {
-  textureStore_38e8d7();
+kernel void compute_main(texture2d_array<uint, access::write> tint_symbol_5 [[texture(0)]]) {
+  textureStore_38e8d7(tint_symbol_5);
   return;
 }
 
-kernel void compute_main() {
-  textureStore_38e8d7();
-  return;
-}
-
-
-tint_x2IjFo.metal:5:3: error: use of undeclared identifier 'arg_0'
-  arg_0.write(uint4(), int2(), 1);
-  ^
-1 error generated.