writer/hlsl: Use unsigned indices for UBOs

These indices were a mix of signed and unsigned.
Modulus on the signed integers was producing FXC warnings about performance.

Change-Id: Ib82f4296199a09d2f03be8b06314feefce0022e2
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/56765
Auto-Submit: Ben Clayton <bclayton@google.com>
Reviewed-by: David Neto <dneto@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
diff --git a/src/writer/hlsl/generator_impl.cc b/src/writer/hlsl/generator_impl.cc
index 26d7d60..9e1736f 100644
--- a/src/writer/hlsl/generator_impl.cc
+++ b/src/writer/hlsl/generator_impl.cc
@@ -623,7 +623,7 @@
   std::string scalar_offset = UniqueIdentifier("scalar_offset");
   {
     auto pre = line();
-    pre << "const int " << scalar_offset << " = (";
+    pre << "const uint " << scalar_offset << " = (";
     if (!EmitExpression(pre, params[1])) {  // offset
       return false;
     }
diff --git a/test/array/assign_to_function_var.wgsl.expected.hlsl b/test/array/assign_to_function_var.wgsl.expected.hlsl
index a52de60..e40aa79 100644
--- a/test/array/assign_to_function_var.wgsl.expected.hlsl
+++ b/test/array/assign_to_function_var.wgsl.expected.hlsl
@@ -14,10 +14,10 @@
 };
 
 tint_array_wrapper tint_symbol_2(uint4 buffer[4], uint offset) {
-  const int scalar_offset = ((offset + 0u)) / 4;
-  const int scalar_offset_1 = ((offset + 16u)) / 4;
-  const int scalar_offset_2 = ((offset + 32u)) / 4;
-  const int scalar_offset_3 = ((offset + 48u)) / 4;
+  const uint scalar_offset = ((offset + 0u)) / 4;
+  const uint scalar_offset_1 = ((offset + 16u)) / 4;
+  const uint scalar_offset_2 = ((offset + 32u)) / 4;
+  const uint scalar_offset_3 = ((offset + 48u)) / 4;
   const tint_array_wrapper tint_symbol_5 = {{{asint(buffer[scalar_offset / 4][scalar_offset % 4])}, {asint(buffer[scalar_offset_1 / 4][scalar_offset_1 % 4])}, {asint(buffer[scalar_offset_2 / 4][scalar_offset_2 % 4])}, {asint(buffer[scalar_offset_3 / 4][scalar_offset_3 % 4])}}};
   return tint_symbol_5;
 }
diff --git a/test/array/assign_to_private_var.wgsl.expected.hlsl b/test/array/assign_to_private_var.wgsl.expected.hlsl
index 52cf9b8..060ef83 100644
--- a/test/array/assign_to_private_var.wgsl.expected.hlsl
+++ b/test/array/assign_to_private_var.wgsl.expected.hlsl
@@ -14,10 +14,10 @@
 };
 
 tint_array_wrapper tint_symbol_2(uint4 buffer[4], uint offset) {
-  const int scalar_offset = ((offset + 0u)) / 4;
-  const int scalar_offset_1 = ((offset + 16u)) / 4;
-  const int scalar_offset_2 = ((offset + 32u)) / 4;
-  const int scalar_offset_3 = ((offset + 48u)) / 4;
+  const uint scalar_offset = ((offset + 0u)) / 4;
+  const uint scalar_offset_1 = ((offset + 16u)) / 4;
+  const uint scalar_offset_2 = ((offset + 32u)) / 4;
+  const uint scalar_offset_3 = ((offset + 48u)) / 4;
   const tint_array_wrapper tint_symbol_5 = {{{asint(buffer[scalar_offset / 4][scalar_offset % 4])}, {asint(buffer[scalar_offset_1 / 4][scalar_offset_1 % 4])}, {asint(buffer[scalar_offset_2 / 4][scalar_offset_2 % 4])}, {asint(buffer[scalar_offset_3 / 4][scalar_offset_3 % 4])}}};
   return tint_symbol_5;
 }
diff --git a/test/array/assign_to_storage_var.wgsl.expected.hlsl b/test/array/assign_to_storage_var.wgsl.expected.hlsl
index 2cf8195..0730f24 100644
--- a/test/array/assign_to_storage_var.wgsl.expected.hlsl
+++ b/test/array/assign_to_storage_var.wgsl.expected.hlsl
@@ -14,10 +14,10 @@
 };
 
 tint_array_wrapper tint_symbol_2(uint4 buffer[4], uint offset) {
-  const int scalar_offset = ((offset + 0u)) / 4;
-  const int scalar_offset_1 = ((offset + 16u)) / 4;
-  const int scalar_offset_2 = ((offset + 32u)) / 4;
-  const int scalar_offset_3 = ((offset + 48u)) / 4;
+  const uint scalar_offset = ((offset + 0u)) / 4;
+  const uint scalar_offset_1 = ((offset + 16u)) / 4;
+  const uint scalar_offset_2 = ((offset + 32u)) / 4;
+  const uint scalar_offset_3 = ((offset + 48u)) / 4;
   const tint_array_wrapper tint_symbol_11 = {{{asint(buffer[scalar_offset / 4][scalar_offset % 4])}, {asint(buffer[scalar_offset_1 / 4][scalar_offset_1 % 4])}, {asint(buffer[scalar_offset_2 / 4][scalar_offset_2 % 4])}, {asint(buffer[scalar_offset_3 / 4][scalar_offset_3 % 4])}}};
   return tint_symbol_11;
 }
diff --git a/test/array/assign_to_workgroup_var.wgsl.expected.hlsl b/test/array/assign_to_workgroup_var.wgsl.expected.hlsl
index 14443ac..52d8984 100644
--- a/test/array/assign_to_workgroup_var.wgsl.expected.hlsl
+++ b/test/array/assign_to_workgroup_var.wgsl.expected.hlsl
@@ -14,10 +14,10 @@
 };
 
 tint_array_wrapper tint_symbol_2(uint4 buffer[4], uint offset) {
-  const int scalar_offset = ((offset + 0u)) / 4;
-  const int scalar_offset_1 = ((offset + 16u)) / 4;
-  const int scalar_offset_2 = ((offset + 32u)) / 4;
-  const int scalar_offset_3 = ((offset + 48u)) / 4;
+  const uint scalar_offset = ((offset + 0u)) / 4;
+  const uint scalar_offset_1 = ((offset + 16u)) / 4;
+  const uint scalar_offset_2 = ((offset + 32u)) / 4;
+  const uint scalar_offset_3 = ((offset + 48u)) / 4;
   const tint_array_wrapper tint_symbol_5 = {{{asint(buffer[scalar_offset / 4][scalar_offset % 4])}, {asint(buffer[scalar_offset_1 / 4][scalar_offset_1 % 4])}, {asint(buffer[scalar_offset_2 / 4][scalar_offset_2 % 4])}, {asint(buffer[scalar_offset_3 / 4][scalar_offset_3 % 4])}}};
   return tint_symbol_5;
 }
diff --git a/test/bug/dawn/947.wgsl.expected.hlsl b/test/bug/dawn/947.wgsl.expected.hlsl
index 6d11ed1..a8e164a 100644
--- a/test/bug/dawn/947.wgsl.expected.hlsl
+++ b/test/bug/dawn/947.wgsl.expected.hlsl
@@ -22,18 +22,18 @@
   tint_array_wrapper texcoord = {{float2(-0.5f, 0.0f), float2(1.5f, 0.0f), float2(0.5f, 2.0f)}};
   VertexOutputs output = (VertexOutputs)0;
   output.position = float4(((texcoord.arr[VertexIndex] * 2.0f) - float2(1.0f, 1.0f)), 0.0f, 1.0f);
-  const int scalar_offset = (4u) / 4;
+  const uint scalar_offset = (4u) / 4;
   bool flipY = (asfloat(uniforms[scalar_offset / 4][scalar_offset % 4]) < 0.0f);
   if (flipY) {
-    const int scalar_offset_1 = (0u) / 4;
+    const uint scalar_offset_1 = (0u) / 4;
     uint4 ubo_load = uniforms[scalar_offset_1 / 4];
-    const int scalar_offset_2 = (8u) / 4;
+    const uint scalar_offset_2 = (8u) / 4;
     uint4 ubo_load_1 = uniforms[scalar_offset_2 / 4];
     output.texcoords = ((((texcoord.arr[VertexIndex] * asfloat(((scalar_offset_1 & 2) ? ubo_load.zw : ubo_load.xy))) + asfloat(((scalar_offset_2 & 2) ? ubo_load_1.zw : ubo_load_1.xy))) * float2(1.0f, -1.0f)) + float2(0.0f, 1.0f));
   } else {
-    const int scalar_offset_3 = (0u) / 4;
+    const uint scalar_offset_3 = (0u) / 4;
     uint4 ubo_load_2 = uniforms[scalar_offset_3 / 4];
-    const int scalar_offset_4 = (8u) / 4;
+    const uint scalar_offset_4 = (8u) / 4;
     uint4 ubo_load_3 = uniforms[scalar_offset_4 / 4];
     output.texcoords = ((((texcoord.arr[VertexIndex] * float2(1.0f, -1.0f)) + float2(0.0f, 1.0f)) * asfloat(((scalar_offset_3 & 2) ? ubo_load_2.zw : ubo_load_2.xy))) + asfloat(((scalar_offset_4 & 2) ? ubo_load_3.zw : ubo_load_3.xy)));
   }
diff --git a/test/bug/tint/403.wgsl.expected.hlsl b/test/bug/tint/403.wgsl.expected.hlsl
index 534a355..5076215 100644
--- a/test/bug/tint/403.wgsl.expected.hlsl
+++ b/test/bug/tint/403.wgsl.expected.hlsl
@@ -1,15 +1,15 @@
 float2x2 tint_symbol_4(uint4 buffer[1], uint offset) {
-  const int scalar_offset = ((offset + 0u)) / 4;
+  const uint scalar_offset = ((offset + 0u)) / 4;
   uint4 ubo_load = buffer[scalar_offset / 4];
-  const int scalar_offset_1 = ((offset + 8u)) / 4;
+  const uint scalar_offset_1 = ((offset + 8u)) / 4;
   uint4 ubo_load_1 = buffer[scalar_offset_1 / 4];
   return float2x2(asfloat(((scalar_offset & 2) ? ubo_load.zw : ubo_load.xy)), asfloat(((scalar_offset_1 & 2) ? ubo_load_1.zw : ubo_load_1.xy)));
 }
 
 float2x2 tint_symbol_6(uint4 buffer[1], uint offset) {
-  const int scalar_offset_2 = ((offset + 0u)) / 4;
+  const uint scalar_offset_2 = ((offset + 0u)) / 4;
   uint4 ubo_load_2 = buffer[scalar_offset_2 / 4];
-  const int scalar_offset_3 = ((offset + 8u)) / 4;
+  const uint scalar_offset_3 = ((offset + 8u)) / 4;
   uint4 ubo_load_3 = buffer[scalar_offset_3 / 4];
   return float2x2(asfloat(((scalar_offset_2 & 2) ? ubo_load_2.zw : ubo_load_2.xy)), asfloat(((scalar_offset_3 & 2) ? ubo_load_3.zw : ubo_load_3.xy)));
 }
diff --git a/test/bug/tint/534.wgsl.expected.hlsl b/test/bug/tint/534.wgsl.expected.hlsl
index 19f5f6b..54c56dd 100644
--- a/test/bug/tint/534.wgsl.expected.hlsl
+++ b/test/bug/tint/534.wgsl.expected.hlsl
@@ -30,7 +30,7 @@
   int2 size = tint_tmp;
   int2 dstTexCoord = int2(GlobalInvocationID.xy);
   int2 srcTexCoord = dstTexCoord;
-  const int scalar_offset = (0u) / 4;
+  const uint scalar_offset = (0u) / 4;
   if ((uniforms[scalar_offset / 4][scalar_offset % 4] == 1u)) {
     srcTexCoord.y = ((size.y - dstTexCoord.y) - 1);
   }
@@ -42,7 +42,7 @@
   {
     uint i = 0u;
     while (true) {
-      const int scalar_offset_1 = (12u) / 4;
+      const uint scalar_offset_1 = (12u) / 4;
       if (!((i < uniforms[scalar_offset_1 / 4][scalar_offset_1 % 4]))) {
         break;
       }
diff --git a/test/bug/tint/744.wgsl.expected.hlsl b/test/bug/tint/744.wgsl.expected.hlsl
index b23e414..d986a62 100644
--- a/test/bug/tint/744.wgsl.expected.hlsl
+++ b/test/bug/tint/744.wgsl.expected.hlsl
@@ -13,9 +13,9 @@
 void main(tint_symbol_1 tint_symbol) {
   const uint3 global_id = tint_symbol.global_id;
   const uint2 resultCell = uint2(global_id.y, global_id.x);
-  const int scalar_offset = (4u) / 4;
+  const uint scalar_offset = (4u) / 4;
   const uint dimInner = uniforms[scalar_offset / 4][scalar_offset % 4];
-  const int scalar_offset_1 = (20u) / 4;
+  const uint scalar_offset_1 = (20u) / 4;
   const uint dimOutter = uniforms[scalar_offset_1 / 4][scalar_offset_1 % 4];
   uint result = 0u;
   {
diff --git a/test/bug/tint/749.spvasm.expected.hlsl b/test/bug/tint/749.spvasm.expected.hlsl
index cb147b1..fe1e826 100644
--- a/test/bug/tint/749.spvasm.expected.hlsl
+++ b/test/bug/tint/749.spvasm.expected.hlsl
@@ -866,7 +866,7 @@
   const float2 x_762 = uv;
   uv = float2(0.0f, 0.0f);
   uv = x_762;
-  const int scalar_offset = (0u) / 4;
+  const uint scalar_offset = (0u) / 4;
   uint4 ubo_load = x_188[scalar_offset / 4];
   const float2 x_191 = asfloat(((scalar_offset & 2) ? ubo_load.zw : ubo_load.xy));
   const QuicksortObject x_763 = obj;
diff --git a/test/bug/tint/913.wgsl.expected.hlsl b/test/bug/tint/913.wgsl.expected.hlsl
index a39e60e..18dca3f 100644
--- a/test/bug/tint/913.wgsl.expected.hlsl
+++ b/test/bug/tint/913.wgsl.expected.hlsl
@@ -25,22 +25,22 @@
   const uint2 dstTexCoord = uint2(GlobalInvocationID.xy);
   const float4 nonCoveredColor = float4(0.0f, 1.0f, 0.0f, 1.0f);
   bool success = true;
-  const int scalar_offset = (16u) / 4;
+  const uint scalar_offset = (16u) / 4;
   bool tint_tmp_4 = (dstTexCoord.x < uniforms[scalar_offset / 4][scalar_offset % 4]);
   if (!tint_tmp_4) {
-    const int scalar_offset_1 = (20u) / 4;
+    const uint scalar_offset_1 = (20u) / 4;
     tint_tmp_4 = (dstTexCoord.y < uniforms[scalar_offset_1 / 4][scalar_offset_1 % 4]);
   }
   bool tint_tmp_3 = (tint_tmp_4);
   if (!tint_tmp_3) {
-    const int scalar_offset_2 = (16u) / 4;
-    const int scalar_offset_3 = (24u) / 4;
+    const uint scalar_offset_2 = (16u) / 4;
+    const uint scalar_offset_3 = (24u) / 4;
     tint_tmp_3 = (dstTexCoord.x >= (uniforms[scalar_offset_2 / 4][scalar_offset_2 % 4] + uniforms[scalar_offset_3 / 4][scalar_offset_3 % 4]));
   }
   bool tint_tmp_2 = (tint_tmp_3);
   if (!tint_tmp_2) {
-    const int scalar_offset_4 = (20u) / 4;
-    const int scalar_offset_5 = (28u) / 4;
+    const uint scalar_offset_4 = (20u) / 4;
+    const uint scalar_offset_5 = (28u) / 4;
     tint_tmp_2 = (dstTexCoord.y >= (uniforms[scalar_offset_4 / 4][scalar_offset_4 % 4] + uniforms[scalar_offset_5 / 4][scalar_offset_5 % 4]));
   }
   if ((tint_tmp_2)) {
@@ -50,18 +50,18 @@
     }
     success = (tint_tmp_5);
   } else {
-    const int scalar_offset_6 = (16u) / 4;
+    const uint scalar_offset_6 = (16u) / 4;
     uint4 ubo_load = uniforms[scalar_offset_6 / 4];
-    const int scalar_offset_7 = (8u) / 4;
+    const uint scalar_offset_7 = (8u) / 4;
     uint4 ubo_load_1 = uniforms[scalar_offset_7 / 4];
     uint2 srcTexCoord = ((dstTexCoord - ((scalar_offset_6 & 2) ? ubo_load.zw : ubo_load.xy)) + ((scalar_offset_7 & 2) ? ubo_load_1.zw : ubo_load_1.xy));
-    const int scalar_offset_8 = (0u) / 4;
+    const uint scalar_offset_8 = (0u) / 4;
     if ((uniforms[scalar_offset_8 / 4][scalar_offset_8 % 4] == 1u)) {
       srcTexCoord.y = ((uint(srcSize.y) - srcTexCoord.y) - 1u);
     }
     const float4 srcColor = src.Load(int3(srcTexCoord, 0));
     const float4 dstColor = tint_symbol.Load(int3(dstTexCoord, 0));
-    const int scalar_offset_9 = (4u) / 4;
+    const uint scalar_offset_9 = (4u) / 4;
     if ((uniforms[scalar_offset_9 / 4][scalar_offset_9 % 4] == 2u)) {
       bool tint_tmp_7 = success;
       if (tint_tmp_7) {
diff --git a/test/bug/tint/914.wgsl.expected.hlsl b/test/bug/tint/914.wgsl.expected.hlsl
index fdc2717..4059091 100644
--- a/test/bug/tint/914.wgsl.expected.hlsl
+++ b/test/bug/tint/914.wgsl.expected.hlsl
@@ -6,14 +6,14 @@
 };
 
 float mm_readA(uint row, uint col) {
-  const int scalar_offset = (0u) / 4;
+  const uint scalar_offset = (0u) / 4;
   bool tint_tmp = (row < uniforms[scalar_offset / 4][scalar_offset % 4]);
   if (tint_tmp) {
-    const int scalar_offset_1 = (4u) / 4;
+    const uint scalar_offset_1 = (4u) / 4;
     tint_tmp = (col < uniforms[scalar_offset_1 / 4][scalar_offset_1 % 4]);
   }
   if ((tint_tmp)) {
-    const int scalar_offset_2 = (4u) / 4;
+    const uint scalar_offset_2 = (4u) / 4;
     const float result = asfloat(firstMatrix.Load((4u * ((row * uniforms[scalar_offset_2 / 4][scalar_offset_2 % 4]) + col))));
     return result;
   }
@@ -21,14 +21,14 @@
 }
 
 float mm_readB(uint row, uint col) {
-  const int scalar_offset_3 = (4u) / 4;
+  const uint scalar_offset_3 = (4u) / 4;
   bool tint_tmp_1 = (row < uniforms[scalar_offset_3 / 4][scalar_offset_3 % 4]);
   if (tint_tmp_1) {
-    const int scalar_offset_4 = (8u) / 4;
+    const uint scalar_offset_4 = (8u) / 4;
     tint_tmp_1 = (col < uniforms[scalar_offset_4 / 4][scalar_offset_4 % 4]);
   }
   if ((tint_tmp_1)) {
-    const int scalar_offset_5 = (8u) / 4;
+    const uint scalar_offset_5 = (8u) / 4;
     const float result = asfloat(secondMatrix.Load((4u * ((row * uniforms[scalar_offset_5 / 4][scalar_offset_5 % 4]) + col))));
     return result;
   }
@@ -36,14 +36,14 @@
 }
 
 void mm_write(uint row, uint col, float value) {
-  const int scalar_offset_6 = (0u) / 4;
+  const uint scalar_offset_6 = (0u) / 4;
   bool tint_tmp_2 = (row < uniforms[scalar_offset_6 / 4][scalar_offset_6 % 4]);
   if (tint_tmp_2) {
-    const int scalar_offset_7 = (8u) / 4;
+    const uint scalar_offset_7 = (8u) / 4;
     tint_tmp_2 = (col < uniforms[scalar_offset_7 / 4][scalar_offset_7 % 4]);
   }
   if ((tint_tmp_2)) {
-    const int scalar_offset_8 = (8u) / 4;
+    const uint scalar_offset_8 = (8u) / 4;
     const uint index = (col + (row * uniforms[scalar_offset_8 / 4][scalar_offset_8 % 4]));
     resultMatrix.Store((4u * index), asuint(value));
   }
@@ -93,7 +93,7 @@
   const uint tileCol = (local_id.x * ColPerThread);
   const uint globalRow = (global_id.y * RowPerThread);
   const uint globalCol = (global_id.x * ColPerThread);
-  const int scalar_offset_9 = (4u) / 4;
+  const uint scalar_offset_9 = (4u) / 4;
   const uint numTiles = (((uniforms[scalar_offset_9 / 4][scalar_offset_9 % 4] - 1u) / TileInner) + 1u);
   tint_array_wrapper_2 acc = (tint_array_wrapper_2)0;
   float ACached = 0.0f;
diff --git a/test/bug/tint/922.wgsl.expected.hlsl b/test/bug/tint/922.wgsl.expected.hlsl
index f2d9626..cb96b2b 100644
--- a/test/bug/tint/922.wgsl.expected.hlsl
+++ b/test/bug/tint/922.wgsl.expected.hlsl
@@ -15,25 +15,25 @@
 };
 
 Mat4x4_ tint_symbol_7(uint4 buffer[4], uint offset) {
-  const int scalar_offset = ((offset + 0u)) / 4;
-  const int scalar_offset_1 = ((offset + 16u)) / 4;
-  const int scalar_offset_2 = ((offset + 32u)) / 4;
-  const int scalar_offset_3 = ((offset + 48u)) / 4;
+  const uint scalar_offset = ((offset + 0u)) / 4;
+  const uint scalar_offset_1 = ((offset + 16u)) / 4;
+  const uint scalar_offset_2 = ((offset + 32u)) / 4;
+  const uint scalar_offset_3 = ((offset + 48u)) / 4;
   const Mat4x4_ tint_symbol_10 = {asfloat(buffer[scalar_offset / 4]), asfloat(buffer[scalar_offset_1 / 4]), asfloat(buffer[scalar_offset_2 / 4]), asfloat(buffer[scalar_offset_3 / 4])};
   return tint_symbol_10;
 }
 
 Mat4x2_ tint_symbol_9(uint4 buffer[3], uint offset) {
-  const int scalar_offset_4 = ((offset + 0u)) / 4;
-  const int scalar_offset_5 = ((offset + 16u)) / 4;
+  const uint scalar_offset_4 = ((offset + 0u)) / 4;
+  const uint scalar_offset_5 = ((offset + 16u)) / 4;
   const Mat4x2_ tint_symbol_11 = {asfloat(buffer[scalar_offset_4 / 4]), asfloat(buffer[scalar_offset_5 / 4])};
   return tint_symbol_11;
 }
 
 Mat4x3_ tint_symbol_5(uint4 buffer[96], uint offset) {
-  const int scalar_offset_6 = ((offset + 0u)) / 4;
-  const int scalar_offset_7 = ((offset + 16u)) / 4;
-  const int scalar_offset_8 = ((offset + 32u)) / 4;
+  const uint scalar_offset_6 = ((offset + 0u)) / 4;
+  const uint scalar_offset_7 = ((offset + 16u)) / 4;
+  const uint scalar_offset_8 = ((offset + 32u)) / 4;
   const Mat4x3_ tint_symbol_12 = {asfloat(buffer[scalar_offset_6 / 4]), asfloat(buffer[scalar_offset_7 / 4]), asfloat(buffer[scalar_offset_8 / 4])};
   return tint_symbol_12;
 }
@@ -259,7 +259,7 @@
   gl_Position = _e49;
   const float4 _e50 = a_Color1;
   v_Color = _e50;
-  const int scalar_offset_9 = (32u) / 4;
+  const uint scalar_offset_9 = (32u) / 4;
   const float4 _e52 = asfloat(global1[scalar_offset_9 / 4]);
   if ((_e52.x == 2.0f)) {
     {
diff --git a/test/ptr_ref/load/local/ptr_uniform.wgsl.expected.hlsl b/test/ptr_ref/load/local/ptr_uniform.wgsl.expected.hlsl
index 80d076b..45ec648 100644
--- a/test/ptr_ref/load/local/ptr_uniform.wgsl.expected.hlsl
+++ b/test/ptr_ref/load/local/ptr_uniform.wgsl.expected.hlsl
@@ -4,7 +4,7 @@
 
 [numthreads(1, 1, 1)]
 void main() {
-  const int scalar_offset = (0u) / 4;
+  const uint scalar_offset = (0u) / 4;
   const int use = (asint(v[scalar_offset / 4][scalar_offset % 4]) + 1);
   return;
 }
diff --git a/test/samples/compute_boids.wgsl.expected.hlsl b/test/samples/compute_boids.wgsl.expected.hlsl
index b90f8fb..1593974 100644
--- a/test/samples/compute_boids.wgsl.expected.hlsl
+++ b/test/samples/compute_boids.wgsl.expected.hlsl
@@ -66,16 +66,16 @@
       }
       pos = asfloat(particlesA.Load2((16u * i))).xy;
       vel = asfloat(particlesA.Load2(((16u * i) + 8u))).xy;
-      const int scalar_offset = (4u) / 4;
+      const uint scalar_offset = (4u) / 4;
       if ((distance(pos, vPos) < asfloat(params[scalar_offset / 4][scalar_offset % 4]))) {
         cMass = (cMass + pos);
         cMassCount = (cMassCount + 1);
       }
-      const int scalar_offset_1 = (8u) / 4;
+      const uint scalar_offset_1 = (8u) / 4;
       if ((distance(pos, vPos) < asfloat(params[scalar_offset_1 / 4][scalar_offset_1 % 4]))) {
         colVel = (colVel - (pos - vPos));
       }
-      const int scalar_offset_2 = (12u) / 4;
+      const uint scalar_offset_2 = (12u) / 4;
       if ((distance(pos, vPos) < asfloat(params[scalar_offset_2 / 4][scalar_offset_2 % 4]))) {
         cVel = (cVel + vel);
         cVelCount = (cVelCount + 1);
@@ -91,12 +91,12 @@
   if ((cVelCount > 0)) {
     cVel = (cVel / float2(float(cVelCount), float(cVelCount)));
   }
-  const int scalar_offset_3 = (16u) / 4;
-  const int scalar_offset_4 = (20u) / 4;
-  const int scalar_offset_5 = (24u) / 4;
+  const uint scalar_offset_3 = (16u) / 4;
+  const uint scalar_offset_4 = (20u) / 4;
+  const uint scalar_offset_5 = (24u) / 4;
   vVel = (((vVel + (cMass * asfloat(params[scalar_offset_3 / 4][scalar_offset_3 % 4]))) + (colVel * asfloat(params[scalar_offset_4 / 4][scalar_offset_4 % 4]))) + (cVel * asfloat(params[scalar_offset_5 / 4][scalar_offset_5 % 4])));
   vVel = (normalize(vVel) * clamp(length(vVel), 0.0f, 0.100000001f));
-  const int scalar_offset_6 = (0u) / 4;
+  const uint scalar_offset_6 = (0u) / 4;
   vPos = (vPos + (vVel * asfloat(params[scalar_offset_6 / 4][scalar_offset_6 % 4])));
   if ((vPos.x < -1.0f)) {
     vPos.x = 1.0f;
diff --git a/test/samples/cube.wgsl.expected.hlsl b/test/samples/cube.wgsl.expected.hlsl
index 5c36f5b..851f523 100644
--- a/test/samples/cube.wgsl.expected.hlsl
+++ b/test/samples/cube.wgsl.expected.hlsl
@@ -1,8 +1,8 @@
 float4x4 tint_symbol_7(uint4 buffer[4], uint offset) {
-  const int scalar_offset = ((offset + 0u)) / 4;
-  const int scalar_offset_1 = ((offset + 16u)) / 4;
-  const int scalar_offset_2 = ((offset + 32u)) / 4;
-  const int scalar_offset_3 = ((offset + 48u)) / 4;
+  const uint scalar_offset = ((offset + 0u)) / 4;
+  const uint scalar_offset_1 = ((offset + 16u)) / 4;
+  const uint scalar_offset_2 = ((offset + 32u)) / 4;
+  const uint scalar_offset_3 = ((offset + 48u)) / 4;
   return float4x4(asfloat(buffer[scalar_offset / 4]), asfloat(buffer[scalar_offset_1 / 4]), asfloat(buffer[scalar_offset_2 / 4]), asfloat(buffer[scalar_offset_3 / 4]));
 }