1# Copyright (c) 2021 The Android Open Source Project
2# Copyright (c) 2021 Google Inc.
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8#     http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15
16KNOWN_FUNCTION_OPCODES = {
17    "vkCreateInstance": 20000,
18    "vkDestroyInstance": 20001,
19    "vkEnumeratePhysicalDevices": 20002,
20    "vkGetPhysicalDeviceFeatures": 20003,
21    "vkGetPhysicalDeviceFormatProperties": 20004,
22    "vkGetPhysicalDeviceImageFormatProperties": 20005,
23    "vkGetPhysicalDeviceProperties": 20006,
24    "vkGetPhysicalDeviceQueueFamilyProperties": 20007,
25    "vkGetPhysicalDeviceMemoryProperties": 20008,
26    "vkGetInstanceProcAddr": 20009,
27    "vkGetDeviceProcAddr": 20010,
28    "vkCreateDevice": 20011,
29    "vkDestroyDevice": 20012,
30    "vkEnumerateInstanceExtensionProperties": 20013,
31    "vkEnumerateDeviceExtensionProperties": 20014,
32    "vkEnumerateInstanceLayerProperties": 20015,
33    "vkEnumerateDeviceLayerProperties": 20016,
34    "vkGetDeviceQueue": 20017,
35    "vkQueueSubmit": 20018,
36    "vkQueueWaitIdle": 20019,
37    "vkDeviceWaitIdle": 20020,
38    "vkAllocateMemory": 20021,
39    "vkFreeMemory": 20022,
40    "vkMapMemory": 20023,
41    "vkUnmapMemory": 20024,
42    "vkFlushMappedMemoryRanges": 20025,
43    "vkInvalidateMappedMemoryRanges": 20026,
44    "vkGetDeviceMemoryCommitment": 20027,
45    "vkBindBufferMemory": 20028,
46    "vkBindImageMemory": 20029,
47    "vkGetBufferMemoryRequirements": 20030,
48    "vkGetImageMemoryRequirements": 20031,
49    "vkGetImageSparseMemoryRequirements": 20032,
50    "vkGetPhysicalDeviceSparseImageFormatProperties": 20033,
51    "vkQueueBindSparse": 20034,
52    "vkCreateFence": 20035,
53    "vkDestroyFence": 20036,
54    "vkResetFences": 20037,
55    "vkGetFenceStatus": 20038,
56    "vkWaitForFences": 20039,
57    "vkCreateSemaphore": 20040,
58    "vkDestroySemaphore": 20041,
59    "vkCreateEvent": 20042,
60    "vkDestroyEvent": 20043,
61    "vkGetEventStatus": 20044,
62    "vkSetEvent": 20045,
63    "vkResetEvent": 20046,
64    "vkCreateQueryPool": 20047,
65    "vkDestroyQueryPool": 20048,
66    "vkGetQueryPoolResults": 20049,
67    "vkCreateBuffer": 20050,
68    "vkDestroyBuffer": 20051,
69    "vkCreateBufferView": 20052,
70    "vkDestroyBufferView": 20053,
71    "vkCreateImage": 20054,
72    "vkDestroyImage": 20055,
73    "vkGetImageSubresourceLayout": 20056,
74    "vkCreateImageView": 20057,
75    "vkDestroyImageView": 20058,
76    "vkCreateShaderModule": 20059,
77    "vkDestroyShaderModule": 20060,
78    "vkCreatePipelineCache": 20061,
79    "vkDestroyPipelineCache": 20062,
80    "vkGetPipelineCacheData": 20063,
81    "vkMergePipelineCaches": 20064,
82    "vkCreateGraphicsPipelines": 20065,
83    "vkCreateComputePipelines": 20066,
84    "vkDestroyPipeline": 20067,
85    "vkCreatePipelineLayout": 20068,
86    "vkDestroyPipelineLayout": 20069,
87    "vkCreateSampler": 20070,
88    "vkDestroySampler": 20071,
89    "vkCreateDescriptorSetLayout": 20072,
90    "vkDestroyDescriptorSetLayout": 20073,
91    "vkCreateDescriptorPool": 20074,
92    "vkDestroyDescriptorPool": 20075,
93    "vkResetDescriptorPool": 20076,
94    "vkAllocateDescriptorSets": 20077,
95    "vkFreeDescriptorSets": 20078,
96    "vkUpdateDescriptorSets": 20079,
97    "vkCreateFramebuffer": 20080,
98    "vkDestroyFramebuffer": 20081,
99    "vkCreateRenderPass": 20082,
100    "vkDestroyRenderPass": 20083,
101    "vkGetRenderAreaGranularity": 20084,
102    "vkCreateCommandPool": 20085,
103    "vkDestroyCommandPool": 20086,
104    "vkResetCommandPool": 20087,
105    "vkAllocateCommandBuffers": 20088,
106    "vkFreeCommandBuffers": 20089,
107    "vkBeginCommandBuffer": 20090,
108    "vkEndCommandBuffer": 20091,
109    "vkResetCommandBuffer": 20092,
110    "vkCmdBindPipeline": 20093,
111    "vkCmdSetViewport": 20094,
112    "vkCmdSetScissor": 20095,
113    "vkCmdSetLineWidth": 20096,
114    "vkCmdSetDepthBias": 20097,
115    "vkCmdSetBlendConstants": 20098,
116    "vkCmdSetDepthBounds": 20099,
117    "vkCmdSetStencilCompareMask": 20100,
118    "vkCmdSetStencilWriteMask": 20101,
119    "vkCmdSetStencilReference": 20102,
120    "vkCmdBindDescriptorSets": 20103,
121    "vkCmdBindIndexBuffer": 20104,
122    "vkCmdBindVertexBuffers": 20105,
123    "vkCmdDraw": 20106,
124    "vkCmdDrawIndexed": 20107,
125    "vkCmdDrawIndirect": 20108,
126    "vkCmdDrawIndexedIndirect": 20109,
127    "vkCmdDispatch": 20110,
128    "vkCmdDispatchIndirect": 20111,
129    "vkCmdCopyBuffer": 20112,
130    "vkCmdCopyImage": 20113,
131    "vkCmdBlitImage": 20114,
132    "vkCmdCopyBufferToImage": 20115,
133    "vkCmdCopyImageToBuffer": 20116,
134    "vkCmdUpdateBuffer": 20117,
135    "vkCmdFillBuffer": 20118,
136    "vkCmdClearColorImage": 20119,
137    "vkCmdClearDepthStencilImage": 20120,
138    "vkCmdClearAttachments": 20121,
139    "vkCmdResolveImage": 20122,
140    "vkCmdSetEvent": 20123,
141    "vkCmdResetEvent": 20124,
142    "vkCmdWaitEvents": 20125,
143    "vkCmdPipelineBarrier": 20126,
144    "vkCmdBeginQuery": 20127,
145    "vkCmdEndQuery": 20128,
146    "vkCmdResetQueryPool": 20129,
147    "vkCmdWriteTimestamp": 20130,
148    "vkCmdCopyQueryPoolResults": 20131,
149    "vkCmdPushConstants": 20132,
150    "vkCmdBeginRenderPass": 20133,
151    "vkCmdNextSubpass": 20134,
152    "vkCmdEndRenderPass": 20135,
153    "vkCmdExecuteCommands": 20136,
154    "vkEnumerateInstanceVersion": 20137,
155    "vkBindBufferMemory2": 20138,
156    "vkBindImageMemory2": 20139,
157    "vkGetDeviceGroupPeerMemoryFeatures": 20140,
158    "vkCmdSetDeviceMask": 20141,
159    "vkCmdDispatchBase": 20142,
160    "vkEnumeratePhysicalDeviceGroups": 20143,
161    "vkGetImageMemoryRequirements2": 20144,
162    "vkGetBufferMemoryRequirements2": 20145,
163    "vkGetImageSparseMemoryRequirements2": 20146,
164    "vkGetPhysicalDeviceFeatures2": 20147,
165    "vkGetPhysicalDeviceProperties2": 20148,
166    "vkGetPhysicalDeviceFormatProperties2": 20149,
167    "vkGetPhysicalDeviceImageFormatProperties2": 20150,
168    "vkGetPhysicalDeviceQueueFamilyProperties2": 20151,
169    "vkGetPhysicalDeviceMemoryProperties2": 20152,
170    "vkGetPhysicalDeviceSparseImageFormatProperties2": 20153,
171    "vkTrimCommandPool": 20154,
172    "vkGetDeviceQueue2": 20155,
173    "vkCreateSamplerYcbcrConversion": 20156,
174    "vkDestroySamplerYcbcrConversion": 20157,
175    "vkCreateDescriptorUpdateTemplate": 20158,
176    "vkDestroyDescriptorUpdateTemplate": 20159,
177    "vkUpdateDescriptorSetWithTemplate": 20160,
178    "vkGetPhysicalDeviceExternalBufferProperties": 20161,
179    "vkGetPhysicalDeviceExternalFenceProperties": 20162,
180    "vkGetPhysicalDeviceExternalSemaphoreProperties": 20163,
181    "vkGetDescriptorSetLayoutSupport": 20164,
182    "vkDestroySurfaceKHR": 20165,
183    "vkGetPhysicalDeviceSurfaceSupportKHR": 20166,
184    "vkGetPhysicalDeviceSurfaceCapabilitiesKHR": 20167,
185    "vkGetPhysicalDeviceSurfaceFormatsKHR": 20168,
186    "vkGetPhysicalDeviceSurfacePresentModesKHR": 20169,
187    "vkCreateSwapchainKHR": 20170,
188    "vkDestroySwapchainKHR": 20171,
189    "vkGetSwapchainImagesKHR": 20172,
190    "vkAcquireNextImageKHR": 20173,
191    "vkQueuePresentKHR": 20174,
192    "vkGetDeviceGroupPresentCapabilitiesKHR": 20175,
193    "vkGetDeviceGroupSurfacePresentModesKHR": 20176,
194    "vkGetPhysicalDevicePresentRectanglesKHR": 20177,
195    "vkAcquireNextImage2KHR": 20178,
196    "vkGetPhysicalDeviceDisplayPropertiesKHR": 20179,
197    "vkGetPhysicalDeviceDisplayPlanePropertiesKHR": 20180,
198    "vkGetDisplayPlaneSupportedDisplaysKHR": 20181,
199    "vkGetDisplayModePropertiesKHR": 20182,
200    "vkCreateDisplayModeKHR": 20183,
201    "vkGetDisplayPlaneCapabilitiesKHR": 20184,
202    "vkCreateDisplayPlaneSurfaceKHR": 20185,
203    "vkCreateSharedSwapchainsKHR": 20186,
204    "vkCreateXlibSurfaceKHR": 20187,
205    "vkGetPhysicalDeviceXlibPresentationSupportKHR": 20188,
206    "vkCreateXcbSurfaceKHR": 20189,
207    "vkGetPhysicalDeviceXcbPresentationSupportKHR": 20190,
208    "vkCreateWaylandSurfaceKHR": 20191,
209    "vkGetPhysicalDeviceWaylandPresentationSupportKHR": 20192,
210    "vkCreateMirSurfaceKHR": 20193,
211    "vkGetPhysicalDeviceMirPresentationSupportKHR": 20194,
212    "vkCreateAndroidSurfaceKHR": 20195,
213    "vkCreateWin32SurfaceKHR": 20196,
214    "vkGetPhysicalDeviceWin32PresentationSupportKHR": 20197,
215    "vkGetPhysicalDeviceFeatures2KHR": 20198,
216    "vkGetPhysicalDeviceProperties2KHR": 20199,
217    "vkGetPhysicalDeviceFormatProperties2KHR": 20200,
218    "vkGetPhysicalDeviceImageFormatProperties2KHR": 20201,
219    "vkGetPhysicalDeviceQueueFamilyProperties2KHR": 20202,
220    "vkGetPhysicalDeviceMemoryProperties2KHR": 20203,
221    "vkGetPhysicalDeviceSparseImageFormatProperties2KHR": 20204,
222    "vkGetDeviceGroupPeerMemoryFeaturesKHR": 20205,
223    "vkCmdSetDeviceMaskKHR": 20206,
224    "vkCmdDispatchBaseKHR": 20207,
225    "vkTrimCommandPoolKHR": 20208,
226    "vkEnumeratePhysicalDeviceGroupsKHR": 20209,
227    "vkGetPhysicalDeviceExternalBufferPropertiesKHR": 20210,
228    "vkGetMemoryWin32HandleKHR": 20211,
229    "vkGetMemoryWin32HandlePropertiesKHR": 20212,
230    "vkGetMemoryFdKHR": 20213,
231    "vkGetMemoryFdPropertiesKHR": 20214,
232    "vkGetPhysicalDeviceExternalSemaphorePropertiesKHR": 20215,
233    "vkImportSemaphoreWin32HandleKHR": 20216,
234    "vkGetSemaphoreWin32HandleKHR": 20217,
235    "vkImportSemaphoreFdKHR": 20218,
236    "vkGetSemaphoreFdKHR": 20219,
237    "vkCmdPushDescriptorSetKHR": 20220,
238    "vkCmdPushDescriptorSetWithTemplateKHR": 20221,
239    "vkCreateDescriptorUpdateTemplateKHR": 20222,
240    "vkDestroyDescriptorUpdateTemplateKHR": 20223,
241    "vkUpdateDescriptorSetWithTemplateKHR": 20224,
242    "vkCreateRenderPass2KHR": 20225,
243    "vkCmdBeginRenderPass2KHR": 20226,
244    "vkCmdNextSubpass2KHR": 20227,
245    "vkCmdEndRenderPass2KHR": 20228,
246    "vkGetSwapchainStatusKHR": 20229,
247    "vkGetPhysicalDeviceExternalFencePropertiesKHR": 20230,
248    "vkImportFenceWin32HandleKHR": 20231,
249    "vkGetFenceWin32HandleKHR": 20232,
250    "vkImportFenceFdKHR": 20233,
251    "vkGetFenceFdKHR": 20234,
252    "vkGetPhysicalDeviceSurfaceCapabilities2KHR": 20235,
253    "vkGetPhysicalDeviceSurfaceFormats2KHR": 20236,
254    "vkGetPhysicalDeviceDisplayProperties2KHR": 20237,
255    "vkGetPhysicalDeviceDisplayPlaneProperties2KHR": 20238,
256    "vkGetDisplayModeProperties2KHR": 20239,
257    "vkGetDisplayPlaneCapabilities2KHR": 20240,
258    "vkGetImageMemoryRequirements2KHR": 20241,
259    "vkGetBufferMemoryRequirements2KHR": 20242,
260    "vkGetImageSparseMemoryRequirements2KHR": 20243,
261    "vkCreateSamplerYcbcrConversionKHR": 20244,
262    "vkDestroySamplerYcbcrConversionKHR": 20245,
263    "vkBindBufferMemory2KHR": 20246,
264    "vkBindImageMemory2KHR": 20247,
265    "vkGetDescriptorSetLayoutSupportKHR": 20248,
266    "vkCmdDrawIndirectCountKHR": 20249,
267    "vkCmdDrawIndexedIndirectCountKHR": 20250,
268    "vkGetSwapchainGrallocUsageANDROID": 20251,
269    "vkAcquireImageANDROID": 20252,
270    "vkQueueSignalReleaseImageANDROID": 20253,
271    "vkCreateDebugReportCallbackEXT": 20254,
272    "vkDestroyDebugReportCallbackEXT": 20255,
273    "vkDebugReportMessageEXT": 20256,
274    "vkDebugMarkerSetObjectTagEXT": 20257,
275    "vkDebugMarkerSetObjectNameEXT": 20258,
276    "vkCmdDebugMarkerBeginEXT": 20259,
277    "vkCmdDebugMarkerEndEXT": 20260,
278    "vkCmdDebugMarkerInsertEXT": 20261,
279    "vkCmdDrawIndirectCountAMD": 20262,
280    "vkCmdDrawIndexedIndirectCountAMD": 20263,
281    "vkGetShaderInfoAMD": 20264,
282    "vkGetPhysicalDeviceExternalImageFormatPropertiesNV": 20265,
283    "vkGetMemoryWin32HandleNV": 20266,
284    "vkCreateViSurfaceNN": 20267,
285    "vkCmdBeginConditionalRenderingEXT": 20268,
286    "vkCmdEndConditionalRenderingEXT": 20269,
287    "vkCmdProcessCommandsNVX": 20270,
288    "vkCmdReserveSpaceForCommandsNVX": 20271,
289    "vkCreateIndirectCommandsLayoutNVX": 20272,
290    "vkDestroyIndirectCommandsLayoutNVX": 20273,
291    "vkCreateObjectTableNVX": 20274,
292    "vkDestroyObjectTableNVX": 20275,
293    "vkRegisterObjectsNVX": 20276,
294    "vkUnregisterObjectsNVX": 20277,
295    "vkGetPhysicalDeviceGeneratedCommandsPropertiesNVX": 20278,
296    "vkCmdSetViewportWScalingNV": 20279,
297    "vkReleaseDisplayEXT": 20280,
298    "vkAcquireXlibDisplayEXT": 20281,
299    "vkGetRandROutputDisplayEXT": 20282,
300    "vkGetPhysicalDeviceSurfaceCapabilities2EXT": 20283,
301    "vkDisplayPowerControlEXT": 20284,
302    "vkRegisterDeviceEventEXT": 20285,
303    "vkRegisterDisplayEventEXT": 20286,
304    "vkGetSwapchainCounterEXT": 20287,
305    "vkGetRefreshCycleDurationGOOGLE": 20288,
306    "vkGetPastPresentationTimingGOOGLE": 20289,
307    "vkCmdSetDiscardRectangleEXT": 20290,
308    "vkSetHdrMetadataEXT": 20291,
309    "vkCreateIOSSurfaceMVK": 20292,
310    "vkCreateMacOSSurfaceMVK": 20293,
311    "vkSetDebugUtilsObjectNameEXT": 20294,
312    "vkSetDebugUtilsObjectTagEXT": 20295,
313    "vkQueueBeginDebugUtilsLabelEXT": 20296,
314    "vkQueueEndDebugUtilsLabelEXT": 20297,
315    "vkQueueInsertDebugUtilsLabelEXT": 20298,
316    "vkCmdBeginDebugUtilsLabelEXT": 20299,
317    "vkCmdEndDebugUtilsLabelEXT": 20300,
318    "vkCmdInsertDebugUtilsLabelEXT": 20301,
319    "vkCreateDebugUtilsMessengerEXT": 20302,
320    "vkDestroyDebugUtilsMessengerEXT": 20303,
321    "vkSubmitDebugUtilsMessageEXT": 20304,
322    "vkGetAndroidHardwareBufferPropertiesANDROID": 20305,
323    "vkGetMemoryAndroidHardwareBufferANDROID": 20306,
324    "vkCmdSetSampleLocationsEXT": 20307,
325    "vkGetPhysicalDeviceMultisamplePropertiesEXT": 20308,
326    "vkCreateValidationCacheEXT": 20309,
327    "vkDestroyValidationCacheEXT": 20310,
328    "vkMergeValidationCachesEXT": 20311,
329    "vkGetValidationCacheDataEXT": 20312,
330    "vkGetMemoryHostPointerPropertiesEXT": 20313,
331    "vkCmdWriteBufferMarkerAMD": 20314,
332    "vkCmdSetCheckpointNV": 20315,
333    "vkGetQueueCheckpointDataNV": 20316,
334    "vkMapMemoryIntoAddressSpaceGOOGLE": 20317,
335    "vkUpdateDescriptorSetWithTemplateSizedGOOGLE": 20320,
336    "vkBeginCommandBufferAsyncGOOGLE": 20321,
337    "vkEndCommandBufferAsyncGOOGLE": 20322,
338    "vkResetCommandBufferAsyncGOOGLE": 20323,
339    "vkCommandBufferHostSyncGOOGLE": 20324,
340    "vkCreateImageWithRequirementsGOOGLE": 20325,
341    "vkCreateBufferWithRequirementsGOOGLE": 20326,
342    "vkGetMemoryHostAddressInfoGOOGLE": 20327,
343    "vkFreeMemorySyncGOOGLE": 20328,
344    "vkQueueHostSyncGOOGLE": 20329,
345    "vkQueueSubmitAsyncGOOGLE": 20330,
346    "vkQueueWaitIdleAsyncGOOGLE": 20331,
347    "vkQueueBindSparseAsyncGOOGLE": 20332,
348    "vkGetLinearImageLayoutGOOGLE": 20333,
349    "vkGetMTLDeviceMVK": 20334,
350    "vkSetMTLTextureMVK": 20335,
351    "vkGetMTLTextureMVK": 20336,
352    "vkGetMTLBufferMVK": 20337,
353    "vkUseIOSurfaceMVK": 20338,
354    "vkGetIOSurfaceMVK": 20339,
355    "vkQueueFlushCommandsGOOGLE": 20340,
356    "vkGetBlobGOOGLE": 20341,
357}
358
359CUSTOM_MARSHAL_TYPES = {
360    "VkAccelerationStructureInstanceKHR": {
361        "common": """
362typedef struct VkAccelerationStructureInstanceKHRWithoutBitFields {
363    VkTransformMatrixKHR          transform;
364    uint32_t                      dwords[2];
365    uint64_t                      accelerationStructureReference;
366} VkAccelerationStructureInstanceKHRWithoutBitFields;
367""",
368        "marshaling": """
369const VkAccelerationStructureInstanceKHRWithoutBitFields* {newInputVarName} = (const VkAccelerationStructureInstanceKHRWithoutBitFields*)({inputVarName});
370marshal_VkTransformMatrixKHR({streamVarName}, {rootTypeVarName}, (VkTransformMatrixKHR*)(&{newInputVarName}->transform));
371for (uint32_t i = 0; i < 2; i++) {{
372    {streamVarName}->write((uint32_t*)&({newInputVarName}->dwords[i]), sizeof(uint32_t));
373}}
374{streamVarName}->write((uint64_t*)&{newInputVarName}->accelerationStructureReference, sizeof(uint64_t));
375""",
376        "unmarshaling": """
377VkAccelerationStructureInstanceKHRWithoutBitFields* {newInputVarName} = (VkAccelerationStructureInstanceKHRWithoutBitFields*)({inputVarName});
378unmarshal_VkTransformMatrixKHR({streamVarName}, {rootTypeVarName}, (VkTransformMatrixKHR*)(&{newInputVarName}->transform));
379for (uint32_t i = 0; i < 2; i++) {{
380    {streamVarName}->read((uint32_t*)&({newInputVarName}->dwords[i]), sizeof(uint32_t));
381}}
382{streamVarName}->read((uint64_t*)&{newInputVarName}->accelerationStructureReference, sizeof(uint64_t));
383""",
384        "reservedmarshaling": """
385(void)vkStream;
386const VkAccelerationStructureInstanceKHRWithoutBitFields* {newInputVarName} = (const VkAccelerationStructureInstanceKHRWithoutBitFields*)({inputVarName});
387reservedmarshal_VkTransformMatrixKHR({streamVarName}, {rootTypeVarName}, (VkTransformMatrixKHR*)(&{newInputVarName}->transform), ptr);
388for (uint32_t i = 0; i < 2; i++) {{
389    memcpy(*ptr, (uint32_t*)&({newInputVarName}->dwords[i]), sizeof(uint32_t));
390    *ptr += sizeof(uint32_t);
391}}
392memcpy(*ptr, (uint64_t*)&{newInputVarName}->accelerationStructureReference, sizeof(uint64_t));
393*ptr += sizeof(uint64_t);
394""",
395        "reservedunmarshaling": """
396VkAccelerationStructureInstanceKHRWithoutBitFields* {newInputVarName} = (VkAccelerationStructureInstanceKHRWithoutBitFields*)({inputVarName});
397reservedunmarshal_VkTransformMatrixKHR({streamVarName}, {rootTypeVarName}, (VkTransformMatrixKHR*)(&{newInputVarName}->transform), ptr);
398for (uint32_t i = 0; i < 2; i++) {{
399    memcpy((uint32_t*)&({newInputVarName}->dwords[i]), *ptr, sizeof(uint32_t));
400    *ptr += sizeof(uint32_t);
401}}
402memcpy((uint64_t*)&{newInputVarName}->accelerationStructureReference, *ptr, sizeof(uint64_t));
403*ptr += sizeof(uint64_t);
404""",
405    },
406    "VkAccelerationStructureMatrixMotionInstanceNV": {
407        "common": """
408typedef struct VkAccelerationStructureMatrixMotionInstanceNVWithoutBitFields {
409    VkTransformMatrixKHR          transformT0;
410    VkTransformMatrixKHR          transformT1;
411    uint32_t                      dwords[2];
412    uint64_t                      accelerationStructureReference;
413} VkAccelerationStructureMatrixMotionInstanceNVWithoutBitFields;
414""",
415        "marshaling": """
416const VkAccelerationStructureMatrixMotionInstanceNVWithoutBitFields* {newInputVarName} = (const VkAccelerationStructureMatrixMotionInstanceNVWithoutBitFields*)({inputVarName});
417marshal_VkTransformMatrixKHR({streamVarName}, {rootTypeVarName}, (VkTransformMatrixKHR*)(&{newInputVarName}->transformT0));
418marshal_VkTransformMatrixKHR({streamVarName}, {rootTypeVarName}, (VkTransformMatrixKHR*)(&{newInputVarName}->transformT1));
419for (uint32_t i = 0; i < 2; i++) {{
420    {streamVarName}->write((uint32_t*)&({newInputVarName}->dwords[i]), sizeof(uint32_t));
421}}
422{streamVarName}->write((uint64_t*)&{newInputVarName}->accelerationStructureReference, sizeof(uint64_t));
423""",
424        "unmarshaling": """
425VkAccelerationStructureMatrixMotionInstanceNVWithoutBitFields* {newInputVarName} = (VkAccelerationStructureMatrixMotionInstanceNVWithoutBitFields*)({inputVarName});
426unmarshal_VkTransformMatrixKHR({streamVarName}, {rootTypeVarName}, (VkTransformMatrixKHR*)(&{newInputVarName}->transformT0));
427unmarshal_VkTransformMatrixKHR({streamVarName}, {rootTypeVarName}, (VkTransformMatrixKHR*)(&{newInputVarName}->transformT1));
428for (uint32_t i = 0; i < 2; i++) {{
429    {streamVarName}->read((uint32_t*)&({newInputVarName}->dwords[i]), sizeof(uint32_t));
430}}
431{streamVarName}->read((uint64_t*)&{newInputVarName}->accelerationStructureReference, sizeof(uint64_t));
432""",
433        "reservedmarshaling": """
434(void)vkStream;
435const VkAccelerationStructureMatrixMotionInstanceNVWithoutBitFields* {newInputVarName} = (const VkAccelerationStructureMatrixMotionInstanceNVWithoutBitFields*)({inputVarName});
436reservedmarshal_VkTransformMatrixKHR({streamVarName}, {rootTypeVarName}, (VkTransformMatrixKHR*)(&{newInputVarName}->transformT0), ptr);
437reservedmarshal_VkTransformMatrixKHR({streamVarName}, {rootTypeVarName}, (VkTransformMatrixKHR*)(&{newInputVarName}->transformT1), ptr);
438for (uint32_t i = 0; i < 2; i++) {{
439    memcpy(*ptr, (uint32_t*)&({newInputVarName}->dwords[i]), sizeof(uint32_t));
440    *ptr += sizeof(uint32_t);
441}}
442memcpy(*ptr, (uint64_t*)&{newInputVarName}->accelerationStructureReference, sizeof(uint64_t));
443*ptr += sizeof(uint64_t);
444""",
445        "reservedunmarshaling": """
446VkAccelerationStructureMatrixMotionInstanceNVWithoutBitFields* {newInputVarName} = (VkAccelerationStructureMatrixMotionInstanceNVWithoutBitFields*)({inputVarName});
447reservedunmarshal_VkTransformMatrixKHR({streamVarName}, {rootTypeVarName}, (VkTransformMatrixKHR*)(&{newInputVarName}->transformT0), ptr);
448reservedunmarshal_VkTransformMatrixKHR({streamVarName}, {rootTypeVarName}, (VkTransformMatrixKHR*)(&{newInputVarName}->transformT1), ptr);
449for (uint32_t i = 0; i < 2; i++) {{
450    memcpy((uint32_t*)&({newInputVarName}->dwords[i]), *ptr, sizeof(uint32_t));
451    *ptr += sizeof(uint32_t);
452}}
453memcpy((uint64_t*)&{newInputVarName}->accelerationStructureReference, *ptr, sizeof(uint64_t));
454*ptr += sizeof(uint64_t);
455""",
456    },
457    "VkAccelerationStructureSRTMotionInstanceNV": {
458        "common": """
459typedef struct VkAccelerationStructureSRTMotionInstanceNVWithoutBitFields {
460    VkSRTDataNV          transformT0;
461    VkSRTDataNV          transformT1;
462    uint32_t             dwords[2];
463    uint64_t             accelerationStructureReference;
464} VkAccelerationStructureSRTMotionInstanceNVWithoutBitFields;
465""",
466        "marshaling": """
467const VkAccelerationStructureSRTMotionInstanceNVWithoutBitFields* {newInputVarName} = (const VkAccelerationStructureSRTMotionInstanceNVWithoutBitFields*)({inputVarName});
468marshal_VkSRTDataNV({streamVarName}, {rootTypeVarName}, (VkSRTDataNV*)(&{newInputVarName}->transformT0));
469marshal_VkSRTDataNV({streamVarName}, {rootTypeVarName}, (VkSRTDataNV*)(&{newInputVarName}->transformT1));
470for (uint32_t i = 0; i < 2; i++) {{
471    {streamVarName}->write((uint32_t*)&({newInputVarName}->dwords[i]), sizeof(uint32_t));
472}}
473{streamVarName}->write((uint64_t*)&{newInputVarName}->accelerationStructureReference, sizeof(uint64_t));
474""",
475        "unmarshaling": """
476VkAccelerationStructureSRTMotionInstanceNVWithoutBitFields* {newInputVarName} = (VkAccelerationStructureSRTMotionInstanceNVWithoutBitFields*)({inputVarName});
477unmarshal_VkSRTDataNV({streamVarName}, {rootTypeVarName}, (VkSRTDataNV*)(&{newInputVarName}->transformT0));
478unmarshal_VkSRTDataNV({streamVarName}, {rootTypeVarName}, (VkSRTDataNV*)(&{newInputVarName}->transformT1));
479for (uint32_t i = 0; i < 2; i++) {{
480    {streamVarName}->read((uint32_t*)&({newInputVarName}->dwords[i]), sizeof(uint32_t));
481}}
482{streamVarName}->read((uint64_t*)&{newInputVarName}->accelerationStructureReference, sizeof(uint64_t));
483""",
484        "reservedmarshaling": """
485(void)vkStream;
486const VkAccelerationStructureSRTMotionInstanceNVWithoutBitFields* {newInputVarName} = (const VkAccelerationStructureSRTMotionInstanceNVWithoutBitFields*)({inputVarName});
487reservedmarshal_VkSRTDataNV({streamVarName}, {rootTypeVarName}, (VkSRTDataNV*)(&{newInputVarName}->transformT0), ptr);
488reservedmarshal_VkSRTDataNV({streamVarName}, {rootTypeVarName}, (VkSRTDataNV*)(&{newInputVarName}->transformT1), ptr);
489for (uint32_t i = 0; i < 2; i++) {{
490    memcpy(*ptr, (uint32_t*)&({newInputVarName}->dwords[i]), sizeof(uint32_t));
491    *ptr += sizeof(uint32_t);
492}}
493memcpy(*ptr, (uint64_t*)&{newInputVarName}->accelerationStructureReference, sizeof(uint64_t));
494*ptr += sizeof(uint64_t);
495""",
496        "reservedunmarshaling": """
497VkAccelerationStructureSRTMotionInstanceNVWithoutBitFields* {newInputVarName} = (VkAccelerationStructureSRTMotionInstanceNVWithoutBitFields*)({inputVarName});
498reservedunmarshal_VkSRTDataNV({streamVarName}, {rootTypeVarName}, (VkSRTDataNV*)(&{newInputVarName}->transformT0), ptr);
499reservedunmarshal_VkSRTDataNV({streamVarName}, {rootTypeVarName}, (VkSRTDataNV*)(&{newInputVarName}->transformT1), ptr);
500for (uint32_t i = 0; i < 2; i++) {{
501    memcpy((uint32_t*)&({newInputVarName}->dwords[i]), *ptr, sizeof(uint32_t));
502    *ptr += sizeof(uint32_t);
503}}
504memcpy((uint64_t*)&{newInputVarName}->accelerationStructureReference, *ptr, sizeof(uint64_t));
505*ptr += sizeof(uint64_t);
506""",
507    },
508    "VkXcbSurfaceCreateInfoKHR": {
509        "common": """
510// This struct should never be marshaled / unmarshaled.
511__builtin_trap();
512""",
513        "marshaling": "",
514        "unmarshaling": "",
515        "reservedmarshaling": "",
516        "reservedunmarshaling": "",
517    },
518    "VkMetalSurfaceCreateInfoEXT": {
519        "common": """
520// This struct should never be marshaled / unmarshaled.
521__builtin_trap();
522""",
523        "marshaling": "",
524        "unmarshaling": "",
525        "reservedmarshaling": "",
526        "reservedunmarshaling": "",
527    },
528}
529