Autoformat all tests and examples

Bug: none
Change-Id: I69904944db1d4c2fbcca74bb8b66b5a7524e76bb
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/24642
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
diff --git a/examples/Animometer.cpp b/examples/Animometer.cpp
index dfd041c..5c197c4 100644
--- a/examples/Animometer.cpp
+++ b/examples/Animometer.cpp
@@ -18,8 +18,8 @@
 #include "utils/SystemUtils.h"
 #include "utils/WGPUHelpers.h"
 
-#include <cstdlib>
 #include <cstdio>
+#include <cstdlib>
 #include <vector>
 
 wgpu::Device device;
@@ -138,8 +138,7 @@
     bufferDesc.usage = wgpu::BufferUsage::CopyDst | wgpu::BufferUsage::Uniform;
     ubo = device.CreateBuffer(&bufferDesc);
 
-    bindGroup =
-        utils::MakeBindGroup(device, bgl, {{0, ubo, 0, sizeof(ShaderData)}});
+    bindGroup = utils::MakeBindGroup(device, bgl, {{0, ubo, 0, sizeof(ShaderData)}});
 }
 
 void frame() {
diff --git a/examples/BUILD.gn b/examples/BUILD.gn
index 39ef9c5..96ae72f 100644
--- a/examples/BUILD.gn
+++ b/examples/BUILD.gn
@@ -49,9 +49,7 @@
 # Template for samples to avoid listing dawn_sample_utils as a dep every time
 template("dawn_sample") {
   executable(target_name) {
-    deps = [
-      ":dawn_sample_utils",
-    ]
+    deps = [ ":dawn_sample_utils" ]
     forward_variables_from(invoker, "*", [ "deps" ])
 
     if (defined(invoker.deps)) {
@@ -61,43 +59,27 @@
 }
 
 dawn_sample("CppHelloTriangle") {
-  sources = [
-    "CppHelloTriangle.cpp",
-  ]
+  sources = [ "CppHelloTriangle.cpp" ]
 }
 
 dawn_sample("CHelloTriangle") {
-  sources = [
-    "CHelloTriangle.cpp",
-  ]
+  sources = [ "CHelloTriangle.cpp" ]
 }
 
 dawn_sample("ComputeBoids") {
-  sources = [
-    "ComputeBoids.cpp",
-  ]
-  deps = [
-    "${dawn_root}/third_party/gn/glm",
-  ]
+  sources = [ "ComputeBoids.cpp" ]
+  deps = [ "${dawn_root}/third_party/gn/glm" ]
 }
 
 dawn_sample("Animometer") {
-  sources = [
-    "Animometer.cpp",
-  ]
+  sources = [ "Animometer.cpp" ]
 }
 
 dawn_sample("CubeReflection") {
-  sources = [
-    "CubeReflection.cpp",
-  ]
-  deps = [
-    "${dawn_root}/third_party/gn/glm",
-  ]
+  sources = [ "CubeReflection.cpp" ]
+  deps = [ "${dawn_root}/third_party/gn/glm" ]
 }
 
 dawn_sample("ManualSwapChainTest") {
-  sources = [
-    "ManualSwapChainTest.cpp",
-  ]
+  sources = [ "ManualSwapChainTest.cpp" ]
 }
diff --git a/examples/CHelloTriangle.cpp b/examples/CHelloTriangle.cpp
index 048fba1..22d8202 100644
--- a/examples/CHelloTriangle.cpp
+++ b/examples/CHelloTriangle.cpp
@@ -120,7 +120,7 @@
     {
         colorAttachment.attachment = backbufferView;
         colorAttachment.resolveTarget = nullptr;
-        colorAttachment.clearColor = { 0.0f, 0.0f, 0.0f, 0.0f };
+        colorAttachment.clearColor = {0.0f, 0.0f, 0.0f, 0.0f};
         colorAttachment.loadOp = WGPULoadOp_Clear;
         colorAttachment.storeOp = WGPUStoreOp_Store;
         renderpassInfo.colorAttachmentCount = 1;
diff --git a/examples/ComputeBoids.cpp b/examples/ComputeBoids.cpp
index 59538df..f958ab4 100644
--- a/examples/ComputeBoids.cpp
+++ b/examples/ComputeBoids.cpp
@@ -67,7 +67,7 @@
     modelBuffer =
         utils::CreateBufferFromData(device, model, sizeof(model), wgpu::BufferUsage::Vertex);
 
-    SimParams params = { 0.04f, 0.1f, 0.025f, 0.025f, 0.02f, 0.05f, 0.005f, kNumParticles };
+    SimParams params = {0.04f, 0.1f, 0.025f, 0.025f, 0.02f, 0.05f, 0.005f, kNumParticles};
     updateParams =
         utils::CreateBufferFromData(device, &params, sizeof(params), wgpu::BufferUsage::Uniform);
 
@@ -75,8 +75,7 @@
     {
         std::mt19937 generator;
         std::uniform_real_distribution<float> dist(-1.0f, 1.0f);
-        for (auto& p : initialParticles)
-        {
+        for (auto& p : initialParticles) {
             p.pos = glm::vec2(dist(generator), dist(generator));
             p.vel = glm::vec2(dist(generator), dist(generator)) * 0.1f;
         }
@@ -253,11 +252,13 @@
     updatePipeline = device.CreateComputePipeline(&csDesc);
 
     for (uint32_t i = 0; i < 2; ++i) {
-        updateBGs[i] = utils::MakeBindGroup(device, bgl, {
-            {0, updateParams, 0, sizeof(SimParams)},
-            {1, particleBuffers[i], 0, kNumParticles * sizeof(Particle)},
-            {2, particleBuffers[(i + 1) % 2], 0, kNumParticles * sizeof(Particle)},
-        });
+        updateBGs[i] = utils::MakeBindGroup(
+            device, bgl,
+            {
+                {0, updateParams, 0, sizeof(SimParams)},
+                {1, particleBuffers[i], 0, kNumParticles * sizeof(Particle)},
+                {2, particleBuffers[(i + 1) % 2], 0, kNumParticles * sizeof(Particle)},
+            });
     }
 }
 
diff --git a/examples/CppHelloTriangle.cpp b/examples/CppHelloTriangle.cpp
index fbc598d..378afa8 100644
--- a/examples/CppHelloTriangle.cpp
+++ b/examples/CppHelloTriangle.cpp
@@ -36,15 +36,15 @@
 
 void initBuffers() {
     static const uint32_t indexData[3] = {
-        0, 1, 2,
+        0,
+        1,
+        2,
     };
     indexBuffer =
         utils::CreateBufferFromData(device, indexData, sizeof(indexData), wgpu::BufferUsage::Index);
 
     static const float vertexData[12] = {
-        0.0f, 0.5f, 0.0f, 1.0f,
-        -0.5f, -0.5f, 0.0f, 1.0f,
-        0.5f, -0.5f, 0.0f, 1.0f,
+        0.0f, 0.5f, 0.0f, 1.0f, -0.5f, -0.5f, 0.0f, 1.0f, 0.5f, -0.5f, 0.0f, 1.0f,
     };
     vertexBuffer = utils::CreateBufferFromData(device, vertexData, sizeof(vertexData),
                                                wgpu::BufferUsage::Vertex);
@@ -141,17 +141,19 @@
 
     wgpu::TextureView view = texture.CreateView();
 
-    bindGroup = utils::MakeBindGroup(device, bgl, {
-        {0, sampler},
-        {1, view}
-    });
+    bindGroup = utils::MakeBindGroup(device, bgl, {{0, sampler}, {1, view}});
 }
 
-struct {uint32_t a; float b;} s;
+struct {
+    uint32_t a;
+    float b;
+} s;
 void frame() {
     s.a = (s.a + 1) % 256;
     s.b += 0.02f;
-    if (s.b >= 1.0f) {s.b = 0.0f;}
+    if (s.b >= 1.0f) {
+        s.b = 0.0f;
+    }
 
     wgpu::TextureView backbufferView = swapchain.GetCurrentTextureView();
     utils::ComboRenderPassDescriptor renderPass({backbufferView}, depthStencilView);
diff --git a/examples/CubeReflection.cpp b/examples/CubeReflection.cpp
index becec87..4ff18e0 100644
--- a/examples/CubeReflection.cpp
+++ b/examples/CubeReflection.cpp
@@ -18,10 +18,10 @@
 #include "utils/SystemUtils.h"
 #include "utils/WGPUHelpers.h"
 
-#include <vector>
 #include <glm/glm.hpp>
 #include <glm/gtc/matrix_transform.hpp>
 #include <glm/gtc/type_ptr.hpp>
+#include <vector>
 
 wgpu::Device device;
 
@@ -43,67 +43,44 @@
 wgpu::RenderPipeline reflectionPipeline;
 
 void initBuffers() {
-    static const uint32_t indexData[6*6] = {
-        0, 1, 2,
-        0, 2, 3,
+    static const uint32_t indexData[6 * 6] = {0,  1,  2,  0,  2,  3,
 
-        4, 5, 6,
-        4, 6, 7,
+                                              4,  5,  6,  4,  6,  7,
 
-        8, 9, 10,
-        8, 10, 11,
+                                              8,  9,  10, 8,  10, 11,
 
-        12, 13, 14,
-        12, 14, 15,
+                                              12, 13, 14, 12, 14, 15,
 
-        16, 17, 18,
-        16, 18, 19,
+                                              16, 17, 18, 16, 18, 19,
 
-        20, 21, 22,
-        20, 22, 23
-    };
+                                              20, 21, 22, 20, 22, 23};
     indexBuffer =
         utils::CreateBufferFromData(device, indexData, sizeof(indexData), wgpu::BufferUsage::Index);
 
     static const float vertexData[6 * 4 * 6] = {
-        -1.0, -1.0,  1.0,    1.0, 0.0, 0.0,
-        1.0, -1.0,  1.0,    1.0, 0.0, 0.0,
-        1.0,  1.0,  1.0,    1.0, 0.0, 0.0,
-        -1.0,  1.0,  1.0,    1.0, 0.0, 0.0,
+        -1.0, -1.0, 1.0,  1.0, 0.0, 0.0, 1.0,  -1.0, 1.0,  1.0, 0.0, 0.0,
+        1.0,  1.0,  1.0,  1.0, 0.0, 0.0, -1.0, 1.0,  1.0,  1.0, 0.0, 0.0,
 
-        -1.0, -1.0, -1.0,    1.0, 1.0, 0.0,
-        -1.0,  1.0, -1.0,    1.0, 1.0, 0.0,
-        1.0,  1.0, -1.0,    1.0, 1.0, 0.0,
-        1.0, -1.0, -1.0,    1.0, 1.0, 0.0,
+        -1.0, -1.0, -1.0, 1.0, 1.0, 0.0, -1.0, 1.0,  -1.0, 1.0, 1.0, 0.0,
+        1.0,  1.0,  -1.0, 1.0, 1.0, 0.0, 1.0,  -1.0, -1.0, 1.0, 1.0, 0.0,
 
-        -1.0,  1.0, -1.0,    1.0, 0.0, 1.0,
-        -1.0,  1.0,  1.0,    1.0, 0.0, 1.0,
-        1.0,  1.0,  1.0,    1.0, 0.0, 1.0,
-        1.0,  1.0, -1.0,    1.0, 0.0, 1.0,
+        -1.0, 1.0,  -1.0, 1.0, 0.0, 1.0, -1.0, 1.0,  1.0,  1.0, 0.0, 1.0,
+        1.0,  1.0,  1.0,  1.0, 0.0, 1.0, 1.0,  1.0,  -1.0, 1.0, 0.0, 1.0,
 
-        -1.0, -1.0, -1.0,    0.0, 1.0, 0.0,
-        1.0, -1.0, -1.0,    0.0, 1.0, 0.0,
-        1.0, -1.0,  1.0,    0.0, 1.0, 0.0,
-        -1.0, -1.0,  1.0,    0.0, 1.0, 0.0,
+        -1.0, -1.0, -1.0, 0.0, 1.0, 0.0, 1.0,  -1.0, -1.0, 0.0, 1.0, 0.0,
+        1.0,  -1.0, 1.0,  0.0, 1.0, 0.0, -1.0, -1.0, 1.0,  0.0, 1.0, 0.0,
 
-        1.0, -1.0, -1.0,    0.0, 1.0, 1.0,
-        1.0,  1.0, -1.0,    0.0, 1.0, 1.0,
-        1.0,  1.0,  1.0,    0.0, 1.0, 1.0,
-        1.0, -1.0,  1.0,    0.0, 1.0, 1.0,
+        1.0,  -1.0, -1.0, 0.0, 1.0, 1.0, 1.0,  1.0,  -1.0, 0.0, 1.0, 1.0,
+        1.0,  1.0,  1.0,  0.0, 1.0, 1.0, 1.0,  -1.0, 1.0,  0.0, 1.0, 1.0,
 
-        -1.0, -1.0, -1.0,    1.0, 1.0, 1.0,
-        -1.0, -1.0,  1.0,    1.0, 1.0, 1.0,
-        -1.0,  1.0,  1.0,    1.0, 1.0, 1.0,
-        -1.0,  1.0, -1.0,    1.0, 1.0, 1.0
-    };
+        -1.0, -1.0, -1.0, 1.0, 1.0, 1.0, -1.0, -1.0, 1.0,  1.0, 1.0, 1.0,
+        -1.0, 1.0,  1.0,  1.0, 1.0, 1.0, -1.0, 1.0,  -1.0, 1.0, 1.0, 1.0};
     vertexBuffer = utils::CreateBufferFromData(device, vertexData, sizeof(vertexData),
                                                wgpu::BufferUsage::Vertex);
 
     static const float planeData[6 * 4] = {
-        -2.0, -1.0, -2.0,    0.5, 0.5, 0.5,
-        2.0, -1.0, -2.0,    0.5, 0.5, 0.5,
-        2.0, -1.0,  2.0,    0.5, 0.5, 0.5,
-        -2.0, -1.0,  2.0,    0.5, 0.5, 0.5,
+        -2.0, -1.0, -2.0, 0.5, 0.5, 0.5, 2.0,  -1.0, -2.0, 0.5, 0.5, 0.5,
+        2.0,  -1.0, 2.0,  0.5, 0.5, 0.5, -2.0, -1.0, 2.0,  0.5, 0.5, 0.5,
     };
     planeBuffer = utils::CreateBufferFromData(device, planeData, sizeof(planeData),
                                               wgpu::BufferUsage::Vertex);
@@ -191,15 +168,13 @@
     transformBuffer[1] = utils::CreateBufferFromData(device, &transform, sizeof(glm::mat4),
                                                      wgpu::BufferUsage::Uniform);
 
-    bindGroup[0] = utils::MakeBindGroup(device, bgl, {
-        {0, cameraBuffer, 0, sizeof(CameraData)},
-        {1, transformBuffer[0], 0, sizeof(glm::mat4)}
-    });
+    bindGroup[0] = utils::MakeBindGroup(
+        device, bgl,
+        {{0, cameraBuffer, 0, sizeof(CameraData)}, {1, transformBuffer[0], 0, sizeof(glm::mat4)}});
 
-    bindGroup[1] = utils::MakeBindGroup(device, bgl, {
-        {0, cameraBuffer, 0, sizeof(CameraData)},
-        {1, transformBuffer[1], 0, sizeof(glm::mat4)}
-    });
+    bindGroup[1] = utils::MakeBindGroup(
+        device, bgl,
+        {{0, cameraBuffer, 0, sizeof(CameraData)}, {1, transformBuffer[1], 0, sizeof(glm::mat4)}});
 
     depthStencilView = CreateDefaultDepthStencilView(device);
 
@@ -250,17 +225,20 @@
     cameraData.proj = glm::perspective(glm::radians(45.0f), 1.f, 1.0f, 100.0f);
 }
 
-struct {uint32_t a; float b;} s;
+struct {
+    uint32_t a;
+    float b;
+} s;
 void frame() {
     s.a = (s.a + 1) % 256;
     s.b += 0.01f;
-    if (s.b >= 1.0f) {s.b = 0.0f;}
+    if (s.b >= 1.0f) {
+        s.b = 0.0f;
+    }
 
-    cameraData.view = glm::lookAt(
-        glm::vec3(8.f * std::sin(glm::radians(s.b * 360.f)), 2.f, 8.f * std::cos(glm::radians(s.b * 360.f))),
-        glm::vec3(0.0f, 0.0f, 0.0f),
-        glm::vec3(0.0f, 1.0f, 0.0f)
-    );
+    cameraData.view = glm::lookAt(glm::vec3(8.f * std::sin(glm::radians(s.b * 360.f)), 2.f,
+                                            8.f * std::cos(glm::radians(s.b * 360.f))),
+                                  glm::vec3(0.0f, 0.0f, 0.0f), glm::vec3(0.0f, 1.0f, 0.0f));
 
     queue.WriteBuffer(cameraBuffer, 0, &cameraData, sizeof(CameraData));
 
diff --git a/examples/ManualSwapChainTest.cpp b/examples/ManualSwapChainTest.cpp
index ee924d3..9e3990d 100644
--- a/examples/ManualSwapChainTest.cpp
+++ b/examples/ManualSwapChainTest.cpp
@@ -150,7 +150,8 @@
 
         utils::ComboRenderPassDescriptor desc({view});
         desc.cColorAttachments[0].loadOp = wgpu::LoadOp::Clear;
-        desc.cColorAttachments[0].clearColor = {data->clearCycle, 1.0f - data->clearCycle, 0.0f, 1.0f};
+        desc.cColorAttachments[0].clearColor = {data->clearCycle, 1.0f - data->clearCycle, 0.0f,
+                                                1.0f};
 
         wgpu::RenderPassEncoder pass = encoder.BeginRenderPass(&desc);
         pass.EndPass();
diff --git a/examples/SampleUtils.cpp b/examples/SampleUtils.cpp
index 17b7c9e..ee7e006 100644
--- a/examples/SampleUtils.cpp
+++ b/examples/SampleUtils.cpp
@@ -60,7 +60,7 @@
 enum class CmdBufType {
     None,
     Terrible,
-    //TODO(cwallez@chromium.org) double terrible cmdbuf
+    // TODO(cwallez@chromium.org): double terrible cmdbuf
 };
 
 // Default to D3D12, Metal, Vulkan, OpenGL in that order as D3D12 and Metal are the preferred on
@@ -74,7 +74,7 @@
 #elif defined(DAWN_ENABLE_BACKEND_OPENGL)
 static wgpu::BackendType backendType = wgpu::BackendType::OpenGL;
 #else
-    #error
+#    error
 #endif
 
 static CmdBufType cmdBufType = CmdBufType::Terrible;
@@ -136,31 +136,29 @@
             cDevice = backendDevice;
             break;
 
-        case CmdBufType::Terrible:
-            {
-                c2sBuf = new utils::TerribleCommandBuffer();
-                s2cBuf = new utils::TerribleCommandBuffer();
+        case CmdBufType::Terrible: {
+            c2sBuf = new utils::TerribleCommandBuffer();
+            s2cBuf = new utils::TerribleCommandBuffer();
 
-                dawn_wire::WireServerDescriptor serverDesc = {};
-                serverDesc.device = backendDevice;
-                serverDesc.procs = &backendProcs;
-                serverDesc.serializer = s2cBuf;
+            dawn_wire::WireServerDescriptor serverDesc = {};
+            serverDesc.device = backendDevice;
+            serverDesc.procs = &backendProcs;
+            serverDesc.serializer = s2cBuf;
 
-                wireServer = new dawn_wire::WireServer(serverDesc);
-                c2sBuf->SetHandler(wireServer);
+            wireServer = new dawn_wire::WireServer(serverDesc);
+            c2sBuf->SetHandler(wireServer);
 
-                dawn_wire::WireClientDescriptor clientDesc = {};
-                clientDesc.serializer = c2sBuf;
+            dawn_wire::WireClientDescriptor clientDesc = {};
+            clientDesc.serializer = c2sBuf;
 
-                wireClient = new dawn_wire::WireClient(clientDesc);
-                WGPUDevice clientDevice = wireClient->GetDevice();
-                DawnProcTable clientProcs = dawn_wire::WireClient::GetProcs();
-                s2cBuf->SetHandler(wireClient);
+            wireClient = new dawn_wire::WireClient(clientDesc);
+            WGPUDevice clientDevice = wireClient->GetDevice();
+            DawnProcTable clientProcs = dawn_wire::WireClient::GetProcs();
+            s2cBuf->SetHandler(wireClient);
 
-                procs = clientProcs;
-                cDevice = clientDevice;
-            }
-            break;
+            procs = clientProcs;
+            cDevice = clientDevice;
+        } break;
     }
 
     dawnProcSetProcs(&procs);
@@ -221,7 +219,8 @@
                 backendType = wgpu::BackendType::Vulkan;
                 continue;
             }
-            fprintf(stderr, "--backend expects a backend name (opengl, metal, d3d12, null, vulkan)\n");
+            fprintf(stderr,
+                    "--backend expects a backend name (opengl, metal, d3d12, null, vulkan)\n");
             return false;
         }
         if (std::string("-c") == argv[i] || std::string("--command-buffer") == argv[i]) {