[tint][fuzz][ast] Add VertexPulling fuzzer

Bug: tint:2223
Change-Id: I88664d06d0b5837e929da0690f9a3bc5713d0afb
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/186047
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: James Price <jrprice@google.com>
diff --git a/src/tint/fuzzers/transform_builder.h b/src/tint/fuzzers/transform_builder.h
index c716084..41dd8a8 100644
--- a/src/tint/fuzzers/transform_builder.h
+++ b/src/tint/fuzzers/transform_builder.h
@@ -208,7 +208,7 @@
         DataBuilder* b) {
         ast::transform::VertexAttributeDescriptor desc{};
         desc.format = b->enum_class<ast::transform::VertexFormat>(
-            static_cast<uint8_t>(ast::transform::VertexFormat::kLastEntry) + 1);
+            static_cast<uint8_t>(ast::transform::VertexFormat::kUnorm10_10_10_2) + 1);
         desc.offset = b->build<uint32_t>();
         desc.shader_location = b->build<uint32_t>();
         return desc;
@@ -221,7 +221,7 @@
         ast::transform::VertexBufferLayoutDescriptor desc;
         desc.array_stride = b->build<uint32_t>();
         desc.step_mode = b->enum_class<ast::transform::VertexStepMode>(
-            static_cast<uint8_t>(ast::transform::VertexStepMode::kLastEntry) + 1);
+            static_cast<uint8_t>(ast::transform::VertexStepMode::kInstance) + 1);
         desc.attributes =
             b->vector<ast::transform::VertexAttributeDescriptor>(GenerateVertexAttributeDescriptor);
         return desc;
diff --git a/src/tint/lang/wgsl/ast/transform/BUILD.cmake b/src/tint/lang/wgsl/ast/transform/BUILD.cmake
index e0e7571..e12f32b 100644
--- a/src/tint/lang/wgsl/ast/transform/BUILD.cmake
+++ b/src/tint/lang/wgsl/ast/transform/BUILD.cmake
@@ -273,6 +273,7 @@
   lang/wgsl/ast/transform/std140_fuzz.cc
   lang/wgsl/ast/transform/unshadow_fuzz.cc
   lang/wgsl/ast/transform/vectorize_scalar_matrix_initializers_fuzz.cc
+  lang/wgsl/ast/transform/vertex_pulling_fuzz.cc
   lang/wgsl/ast/transform/zero_init_workgroup_memory_fuzz.cc
 )
 
diff --git a/src/tint/lang/wgsl/ast/transform/BUILD.gn b/src/tint/lang/wgsl/ast/transform/BUILD.gn
index 458d7b2..2a5d618 100644
--- a/src/tint/lang/wgsl/ast/transform/BUILD.gn
+++ b/src/tint/lang/wgsl/ast/transform/BUILD.gn
@@ -263,6 +263,7 @@
       "std140_fuzz.cc",
       "unshadow_fuzz.cc",
       "vectorize_scalar_matrix_initializers_fuzz.cc",
+      "vertex_pulling_fuzz.cc",
       "zero_init_workgroup_memory_fuzz.cc",
     ]
     deps = [
diff --git a/src/tint/lang/wgsl/ast/transform/vertex_pulling.h b/src/tint/lang/wgsl/ast/transform/vertex_pulling.h
index 13016a7..a0b77a1 100644
--- a/src/tint/lang/wgsl/ast/transform/vertex_pulling.h
+++ b/src/tint/lang/wgsl/ast/transform/vertex_pulling.h
@@ -71,13 +71,11 @@
     kSint32x3,         // sint32x3
     kSint32x4,         // sint32x4
     kUnorm10_10_10_2,  // unorm10-10-10-2
-
-    kLastEntry = kSint32x4,
 };
 
 /// Describes if a vertex attributes increments with vertex index or instance
 /// index
-enum class VertexStepMode { kVertex, kInstance, kLastEntry = kInstance };
+enum class VertexStepMode { kVertex, kInstance };
 
 /// Describes a vertex attribute within a buffer
 struct VertexAttributeDescriptor {
@@ -198,4 +196,14 @@
 
 }  // namespace tint::ast::transform
 
+namespace tint {
+
+/// Reflection for VertexFormat
+TINT_REFLECT_ENUM_RANGE(tint::ast::transform::VertexFormat, kUint8x2, kUnorm10_10_10_2);
+
+/// Reflection for VertexStepMode
+TINT_REFLECT_ENUM_RANGE(tint::ast::transform::VertexStepMode, kVertex, kInstance);
+
+}  // namespace tint
+
 #endif  // SRC_TINT_LANG_WGSL_AST_TRANSFORM_VERTEX_PULLING_H_
diff --git a/src/tint/lang/wgsl/ast/transform/vertex_pulling_fuzz.cc b/src/tint/lang/wgsl/ast/transform/vertex_pulling_fuzz.cc
new file mode 100644
index 0000000..68de96f
--- /dev/null
+++ b/src/tint/lang/wgsl/ast/transform/vertex_pulling_fuzz.cc
@@ -0,0 +1,47 @@
+// Copyright 2024 The Dawn & Tint Authors
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+//
+// 1. Redistributions of source code must retain the above copyright notice, this
+//    list of conditions and the following disclaimer.
+//
+// 2. Redistributions in binary form must reproduce the above copyright notice,
+//    this list of conditions and the following disclaimer in the documentation
+//    and/or other materials provided with the distribution.
+//
+// 3. Neither the name of the copyright holder nor the names of its
+//    contributors may be used to endorse or promote products derived from
+//    this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+#include "src/tint/cmd/fuzz/wgsl/fuzz.h"
+#include "src/tint/lang/wgsl/ast/module.h"
+#include "src/tint/lang/wgsl/ast/transform/vertex_pulling.h"
+
+namespace tint::ast::transform {
+
+void VertexPullingFuzzer(const Program& program, const VertexPulling::Config& config) {
+    DataMap inputs;
+    inputs.Add<VertexPulling::Config>(config);
+
+    DataMap outputs;
+    if (auto result = VertexPulling{}.Apply(program, DataMap{}, outputs)) {
+        // Note: We're not ensuring that the returned program is valid, as the rules for this are
+        // complicated. Just ensure that the transform doesn't crash or upset sanitizers.
+    }
+}
+
+}  // namespace tint::ast::transform
+
+TINT_WGSL_PROGRAM_FUZZER(tint::ast::transform::VertexPullingFuzzer);