Refactors WireCmd.cpp generation to remove callbacks/userdata.

- Removes callbacks and userdata from Transfer structs.
- Uses "void *" type for userdata instead of "void" with "*" annotation.

Bug: github.com/webgpu-native/webgpu-headers/issues/172
Change-Id: I48c50c9a79f2b15ab4ed6d6761601a07401d90e7
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/136042
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Loko Kung <lokokung@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
diff --git a/dawn.json b/dawn.json
index 87f94e7..92e54f1 100644
--- a/dawn.json
+++ b/dawn.json
@@ -73,7 +73,7 @@
             {"name": "status", "type": "request adapter status"},
             {"name": "adapter", "type": "adapter"},
             {"name": "message", "type": "char", "annotation": "const*", "length": "strlen", "optional": true},
-            {"name": "userdata", "type": "void", "annotation": "*"}
+            {"name": "userdata", "type": "void *"}
         ]
     },
     "adapter": {
@@ -117,7 +117,7 @@
                 "args": [
                     {"name": "descriptor", "type": "device descriptor", "annotation": "const*", "optional": true, "no_default": true},
                     {"name": "callback", "type": "request device callback"},
-                    {"name": "userdata", "type": "void", "annotation": "*"}
+                    {"name": "userdata", "type": "void *"}
                 ]
             },
             {
@@ -421,7 +421,7 @@
                     {"name": "offset", "type": "size_t"},
                     {"name": "size", "type": "size_t"},
                     {"name": "callback", "type": "buffer map callback"},
-                    {"name": "userdata", "type": "void", "annotation": "*"}
+                    {"name": "userdata", "type": "void *"}
                 ]
             },
             {
@@ -481,7 +481,7 @@
         "category": "function pointer",
         "args": [
             {"name": "status", "type": "buffer map async status"},
-            {"name": "userdata", "type": "void", "annotation": "*"}
+            {"name": "userdata", "type": "void *"}
         ]
     },
     "buffer map async status": {
@@ -742,7 +742,7 @@
         "args": [
             {"name": "status", "type": "compilation info request status"},
             {"name": "compilation info", "type": "compilation info", "annotation": "const*"},
-            {"name": "userdata", "type": "void", "annotation": "*"}
+            {"name": "userdata", "type": "void *"}
         ]
     },
     "compilation info request status": {
@@ -945,7 +945,7 @@
             {"name": "status", "type": "create pipeline async status"},
             {"name": "pipeline", "type": "compute pipeline"},
             {"name": "message", "type": "char", "annotation": "const*", "length": "strlen"},
-            {"name": "userdata", "type": "void", "annotation": "*"}
+            {"name": "userdata", "type": "void *"}
         ]
     },
     "create pipeline async status": {
@@ -966,7 +966,7 @@
             {"name": "status", "type": "create pipeline async status"},
             {"name": "pipeline", "type": "render pipeline"},
             {"name": "message", "type": "char", "annotation": "const*", "length": "strlen"},
-            {"name": "userdata", "type": "void", "annotation": "*"}
+            {"name": "userdata", "type": "void *"}
         ]
     },
     "cull mode": {
@@ -1029,7 +1029,7 @@
                 "args": [
                     {"name": "descriptor", "type": "compute pipeline descriptor", "annotation": "const*"},
                     {"name": "callback", "type": "create compute pipeline async callback"},
-                    {"name": "userdata", "type": "void", "annotation": "*"}
+                    {"name": "userdata", "type": "void *"}
                 ]
             },
             {
@@ -1065,7 +1065,7 @@
                 "args": [
                     {"name": "descriptor", "type": "render pipeline descriptor", "annotation": "const*"},
                     {"name": "callback", "type": "create render pipeline async callback"},
-                    {"name": "userdata", "type": "void", "annotation": "*"}
+                    {"name": "userdata", "type": "void *"}
                 ]
             },
             {
@@ -1187,7 +1187,7 @@
                 "no autolock": true,
                 "args": [
                     {"name": "callback", "type": "error callback"},
-                    {"name": "userdata", "type": "void", "annotation": "*"}
+                    {"name": "userdata", "type": "void *"}
                 ]
             },
             {
@@ -1196,7 +1196,7 @@
                 "tags": ["dawn"],
                 "args": [
                     {"name": "callback", "type": "logging callback"},
-                    {"name": "userdata", "type": "void", "annotation": "*"}
+                    {"name": "userdata", "type": "void *"}
                 ]
             },
             {
@@ -1205,7 +1205,7 @@
                 "tags": ["deprecated"],
                 "args": [
                     {"name": "callback", "type": "device lost callback"},
-                    {"name": "userdata", "type": "void", "annotation": "*"}
+                    {"name": "userdata", "type": "void *"}
                 ]
             },
             {
@@ -1218,7 +1218,7 @@
                 "name": "pop error scope",
                 "args": [
                     {"name": "callback", "type": "error callback"},
-                    {"name": "userdata", "type": "void", "annotation": "*"}
+                    {"name": "userdata", "type": "void *"}
                 ]
             },
             {
@@ -1250,7 +1250,7 @@
         "args": [
             {"name": "reason", "type": "device lost reason"},
             {"name": "message", "type": "char", "annotation": "const*"},
-            {"name": "userdata", "type": "void", "annotation": "*"}
+            {"name": "userdata", "type": "void *"}
         ]
     },
     "device lost reason": {
@@ -1269,7 +1269,7 @@
         "args": [
             {"name": "type", "type": "error type"},
             {"name": "message", "type": "char", "annotation": "const*"},
-            {"name": "userdata", "type": "void", "annotation": "*"}
+            {"name": "userdata", "type": "void *"}
         ]
     },
     "limits": {
@@ -1328,7 +1328,7 @@
         "args": [
             {"name": "type", "type": "logging type"},
             {"name": "message", "type": "char", "annotation": "const*"},
-            {"name": "userdata", "type": "void", "annotation": "*"}
+            {"name": "userdata", "type": "void *"}
         ]
     },
     "error filter": {
@@ -1535,7 +1535,7 @@
                 "args": [
                     {"name": "options", "type": "request adapter options", "annotation": "const*", "optional": true, "no_default": true},
                     {"name": "callback", "type": "request adapter callback"},
-                    {"name": "userdata", "type": "void", "annotation": "*"}
+                    {"name": "userdata", "type": "void *"}
                 ]
             }
         ]
@@ -1745,7 +1745,7 @@
                 "args": [
                     {"name": "signal value", "type": "uint64_t"},
                     {"name": "callback", "type": "queue work done callback"},
-                    {"name": "userdata", "type": "void", "annotation": "*"}
+                    {"name": "userdata", "type": "void *"}
                 ]
             },
             {
@@ -1753,7 +1753,7 @@
                 "tags": ["upstream"],
                 "args": [
                     {"name": "callback", "type": "queue work done callback"},
-                    {"name": "userdata", "type": "void", "annotation": "*"}
+                    {"name": "userdata", "type": "void *"}
                 ]
             },
             {
@@ -1817,7 +1817,7 @@
         "category": "function pointer",
         "args": [
             {"name": "status", "type": "queue work done status"},
-            {"name": "userdata", "type": "void", "annotation": "*"}
+            {"name": "userdata", "type": "void *"}
         ]
     },
     "queue work done status": {
@@ -2224,7 +2224,7 @@
             {"name": "status", "type": "request device status"},
             {"name": "device", "type": "device"},
             {"name": "message", "type": "char", "annotation": "const*", "length": "strlen", "optional": true},
-            {"name": "userdata", "type": "void", "annotation": "*"}
+            {"name": "userdata", "type": "void *"}
         ]
     },
 
@@ -2378,7 +2378,7 @@
                 "name": "get compilation info",
                 "args": [
                     {"name": "callback", "type": "compilation info callback"},
-                    {"name": "userdata", "type": "void", "annotation": "*"}
+                    {"name": "userdata", "type": "void *"}
                 ]
             },
             {
diff --git a/generator/dawn_json_generator.py b/generator/dawn_json_generator.py
index 564b53b..1605ceb 100644
--- a/generator/dawn_json_generator.py
+++ b/generator/dawn_json_generator.py
@@ -147,7 +147,6 @@
         Type.__init__(self, name, json_data)
         self.return_type = None
         self.arguments = []
-        self.is_wire_transparent = True
 
 
 class TypedefType(Type):
diff --git a/generator/templates/dawn/wire/WireCmd.cpp b/generator/templates/dawn/wire/WireCmd.cpp
index 0b293a4..26f235a 100644
--- a/generator/templates/dawn/wire/WireCmd.cpp
+++ b/generator/templates/dawn/wire/WireCmd.cpp
@@ -71,12 +71,9 @@
         //* trusted boundary.
         {%- set Provider = ", provider" if member.type.may_have_dawn_object else "" -%}
         WIRE_TRY({{as_cType(member.type.name)}}Serialize({{in}}, &{{out}}, buffer{{Provider}}));
-    {%- elif member.type.category == "function pointer" -%}
-        //* Function pointers cannot be serialized.
-        if ({{in}} != nullptr) {
-            return WireResult::FatalError;
-        }
-        {{out}} = nullptr;
+    {%- elif member.type.category == "function pointer" or member.type.name.get() == "void *" -%}
+        //* Function pointers and explicit "void *" types (i.e. userdata) cannot be serialized.
+        if ({{in}} != nullptr) return WireResult::FatalError;
     {%- else -%}
         {{out}} = {{in}};
     {%- endif -%}
@@ -98,11 +95,8 @@
                 {%- endif -%}
             ));
         {%- endif -%}
-    {%- elif member.type.category == "function pointer" -%}
-        //* Function pointers cannot be deserialized.
-        if ({{in}} != nullptr) {
-            return WireResult::FatalError;
-        }
+    {%- elif member.type.category == "function pointer" or member.type.name.get() == "void *" -%}
+        //* Function pointers and explicit "void *" types (i.e. userdata) cannot be deserialized.
         {{out}} = nullptr;
     {%- elif member.type.name.get() == "size_t" -%}
         // Deserializing into size_t requires check that the uint64_t used on the wire won't narrow.
@@ -141,6 +135,10 @@
         {% endif %}
 
         {% for member in members %}
+            //* Function pointers and explicit "void *" types (i.e. userdata) do not get serialized.
+            {% if member.type.category == "function pointer" or  member.type.name.get() == "void *" %}
+                {% continue %}
+            {% endif %}
             //* Value types are directly in the command, objects being replaced with their IDs.
             {% if member.annotation == "value" %}
                 {{member_transfer_type(member)}} {{as_varName(member.name)}};