glave: move code-gen'ed files.

* glave-generate.py has moved into tools/glave/scripts/ and renamed to vk_generate.py
* still reference xgl.py and xgl_helper.py from GL-Next directory.
* all glave-specific code-gen'ed files now live in the source tree
* all glave-specific code-gen'ed files are now generated into a "codegen" directory local to the project to make it easier to spot when a generated file has changed or is being debugged.
* all glave-specific code-gen'ed files are now being checked in so that we can better track differences caused by the code-gen as the header file evolves.

(based on squash of the follow two cherry-picks, plus some additional changes to remove files generated by xgl_helper.py since they change every build)
(cherry picked from commit eec461f4bc68c5ac12a6b73b9f6e5464be0640bf)
(cherry picked from commit 2614252bfc3fe9c2cd8470b3b42b529a69f2e3f3)
diff --git a/tools/glave/scripts/vk_generate.py b/tools/glave/scripts/vk_generate.py
new file mode 100755
index 0000000..e60ea94
--- /dev/null
+++ b/tools/glave/scripts/vk_generate.py
@@ -0,0 +1,3878 @@
+#!/usr/bin/env python3
+#
+# XGL
+#
+# Copyright (C) 2014 LunarG, Inc.
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without limitation
+# the rights to use, copy, modify, merge, publish, distribute, sublicense,
+# and/or sell copies of the Software, and to permit persons to whom the
+# Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included
+# in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+# DEALINGS IN THE SOFTWARE.
+#
+
+import os, sys
+
+# add main repo directory so xgl.py can be imported. This needs to be a complete path.
+glv_scripts_path = os.path.dirname(os.path.abspath(__file__))
+main_path = os.path.abspath(glv_scripts_path + "/../../../")
+sys.path.append(main_path)
+
+import xgl
+
+class Subcommand(object):
+    def __init__(self, argv):
+        self.argv = argv
+        self.headers = xgl.headers
+        self.protos = xgl.protos
+
+    def run(self):
+        print(self.generate())
+
+    def generate(self):
+        copyright = self.generate_copyright()
+        header = self.generate_header()
+        body = self.generate_body()
+        footer = self.generate_footer()
+
+        contents = []
+        if copyright:
+            contents.append(copyright)
+        if header:
+            contents.append(header)
+        if body:
+            contents.append(body)
+        if footer:
+            contents.append(footer)
+
+        return "\n\n".join(contents)
+
+    def generate_copyright(self):
+        return """/* THIS FILE IS GENERATED.  DO NOT EDIT. */
+
+/*
+ * XGL
+ *
+ * Copyright (C) 2014 LunarG, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */"""
+
+    def generate_header(self):
+        return "\n".join(["#include <" + h + ">" for h in self.headers])
+
+    def generate_body(self):
+        pass
+
+    def generate_footer(self):
+        pass
+
+    # Return set of printf '%' qualifier, input to that qualifier, and any dereference
+    def _get_printf_params(self, xgl_type, name, output_param):
+        deref = ""
+        # TODO : Need ENUM and STRUCT checks here
+        if "_TYPE" in xgl_type: # TODO : This should be generic ENUM check
+            return ("%s", "string_%s(%s)" % (xgl_type.replace('const ', '').strip('*'), name), deref)
+        if "char*" == xgl_type:
+            return ("%s", name, "*")
+        if "uint64_t" in xgl_type:
+            if '*' in xgl_type:
+                return ("%lu",  "(%s == NULL) ? 0 : *(%s)" % (name, name), "*")
+            return ("%lu", name, deref)
+        if "size_t" in xgl_type:
+            if '*' in xgl_type:
+                return ("%zu", "(%s == NULL) ? 0 : *(%s)" % (name, name), "*")
+            return ("%zu", name, deref)
+        if "float" in xgl_type:
+            if '[' in xgl_type: # handle array, current hard-coded to 4 (TODO: Make this dynamic)
+                return ("[%f, %f, %f, %f]", "%s[0], %s[1], %s[2], %s[3]" % (name, name, name, name), deref)
+            return ("%f", name, deref)
+        if "bool" in xgl_type or 'xcb_randr_crtc_t' in xgl_type:
+            return ("%u", name, deref)
+        if True in [t in xgl_type for t in ["int", "FLAGS", "MASK", "xcb_window_t"]]:
+            if '[' in xgl_type: # handle array, current hard-coded to 4 (TODO: Make this dynamic)
+                return ("[%i, %i, %i, %i]", "%s[0], %s[1], %s[2], %s[3]" % (name, name, name, name), deref)
+            if '*' in xgl_type:
+                return ("%i", "(%s == NULL) ? 0 : *(%s)" % (name, name), "*")
+            return ("%i", name, deref)
+        if output_param:
+            return ("%p", "(void*)%s" % name, deref)
+        return ("%p", "(void*)(%s)" % name, deref)
+
+    def _generate_trace_func_ptrs(self):
+        func_ptrs = []
+        func_ptrs.append('// Pointers to real functions and declarations of hooked functions')
+        func_ptrs.append('#ifdef WIN32')
+        func_ptrs.append('extern INIT_ONCE gInitOnce;')
+        for proto in self.protos:
+            if True not in [skip_str in proto.name for skip_str in ['Dbg', 'Wsi']]: #Dbg' not in proto.name and 'Wsi' not in proto.name:
+                func_ptrs.append('#define __HOOKED_xgl%s hooked_xgl%s' % (proto.name, proto.name))
+
+        func_ptrs.append('\n#elif defined(PLATFORM_LINUX)')
+        func_ptrs.append('extern pthread_once_t gInitOnce;')
+        for proto in self.protos:
+            if True not in [skip_str in proto.name for skip_str in ['Dbg', 'Wsi']]:
+                func_ptrs.append('#define __HOOKED_xgl%s xgl%s' % (proto.name, proto.name))
+
+        func_ptrs.append('#endif\n')
+        return "\n".join(func_ptrs)
+
+    def _generate_trace_func_ptrs_ext(self, func_class='Wsi'):
+        func_ptrs = []
+        func_ptrs.append('#ifdef WIN32')
+        for proto in self.protos:
+            if func_class in proto.name:
+                func_ptrs.append('#define __HOOKED_xgl%s hooked_xgl%s' % (proto.name, proto.name))
+
+        func_ptrs.append('#elif defined(__linux__)')
+        for proto in self.protos:
+            if func_class in proto.name:
+                func_ptrs.append('#define __HOOKED_xgl%s xgl%s' % (proto.name, proto.name))
+
+        func_ptrs.append('#endif\n')
+        return "\n".join(func_ptrs)
+
+    def _generate_trace_func_protos(self):
+        func_protos = []
+        func_protos.append('// Hooked function prototypes\n')
+        for proto in self.protos:
+            if 'Dbg' not in proto.name and 'Wsi' not in proto.name:
+                func_protos.append('GLVTRACER_EXPORT %s;' % proto.c_func(prefix="__HOOKED_xgl", attr="XGLAPI"))
+
+        return "\n".join(func_protos)
+
+    def _generate_trace_func_protos_ext(self, func_class='Wsi'):
+        func_protos = []
+        func_protos.append('// Hooked function prototypes\n')
+        for proto in self.protos:
+            if func_class in proto.name:
+                func_protos.append('GLVTRACER_EXPORT %s;' % proto.c_func(prefix="__HOOKED_xgl", attr="XGLAPI"))
+
+        return "\n".join(func_protos)
+
+
+    def _generate_func_ptr_assignments(self):
+        func_ptr_assign = []
+        for proto in self.protos:
+            if 'Dbg' not in proto.name and 'Wsi' not in proto.name:
+                func_ptr_assign.append('static %s( XGLAPI * real_xgl%s)(' % (proto.ret, proto.name))
+                for p in proto.params:
+                    if 'color' == p.name:
+                        func_ptr_assign.append('    %s %s[4],' % (p.ty.replace('[4]', ''), p.name))
+                    else:
+                        func_ptr_assign.append('    %s %s,' % (p.ty, p.name))
+                func_ptr_assign[-1] = func_ptr_assign[-1].replace(',', ') = xgl%s;\n' % (proto.name))
+        func_ptr_assign.append('static BOOL isHooked = FALSE;\n')
+        return "\n".join(func_ptr_assign)
+
+    def _generate_func_ptr_assignments_ext(self, func_class='Wsi'):
+        func_ptr_assign = []
+        for proto in self.protos:
+            if func_class in proto.name:
+                func_ptr_assign.append('static %s( XGLAPI * real_xgl%s)(' % (proto.ret, proto.name))
+                for p in proto.params:
+                    func_ptr_assign.append('    %s %s,' % (p.ty, p.name))
+                func_ptr_assign[-1] = func_ptr_assign[-1].replace(',', ') = xgl%s;\n' % (proto.name))
+        return "\n".join(func_ptr_assign)
+
+    def _generate_attach_hooks(self):
+        hooks_txt = []
+        hooks_txt.append('void AttachHooks()\n{\n   BOOL hookSuccess = TRUE;\n#if defined(WIN32)')
+        hooks_txt.append('    Mhook_BeginMultiOperation(FALSE);')
+        # TODO : Verify if CreateInstance is appropriate to key off of here
+        hooks_txt.append('    if (real_xglCreateInstance != NULL)')
+        hooks_txt.append('    {\n        isHooked = TRUE;')
+        hook_operator = '='
+        for proto in self.protos:
+            if 'Dbg' not in proto.name and 'Wsi' not in proto.name:
+                hooks_txt.append('        hookSuccess %s Mhook_SetHook((PVOID*)&real_xgl%s, hooked_xgl%s);' % (hook_operator, proto.name, proto.name))
+                hook_operator = '&='
+        hooks_txt.append('    }\n')
+        hooks_txt.append('    if (!hookSuccess)\n    {')
+        hooks_txt.append('        glv_LogError("Failed to hook XGL.");\n    }\n')
+        hooks_txt.append('    Mhook_EndMultiOperation();\n')
+        hooks_txt.append('#elif defined(__linux__)')
+        hooks_txt.append('    if (real_xglCreateInstance == xglCreateInstance)')
+        hooks_txt.append('        hookSuccess = glv_platform_get_next_lib_sym((PVOID*)&real_xglCreateInstance,"xglCreateInstance");')
+        hooks_txt.append('    isHooked = TRUE;')
+        for proto in self.protos:
+            if 'Dbg' not in proto.name and 'Wsi' not in proto.name and 'CreateInstance' not in proto.name:
+                hooks_txt.append('    hookSuccess %s glv_platform_get_next_lib_sym((PVOID*)&real_xgl%s, "xgl%s");' % (hook_operator, proto.name, proto.name))
+        hooks_txt.append('    if (!hookSuccess)\n    {')
+        hooks_txt.append('        glv_LogError("Failed to hook XGL.");\n    }\n')
+        hooks_txt.append('#endif\n}\n')
+        return "\n".join(hooks_txt)
+
+    def _generate_attach_hooks_ext(self, func_class='Wsi'):
+        func_ext_dict = {'Wsi': '_xglwsix11ext', 'Dbg': '_xgldbg'}
+        first_proto_dict = {'Wsi': 'WsiX11AssociateConnection', 'Dbg': 'DbgSetValidationLevel'}
+        hooks_txt = []
+        hooks_txt.append('void AttachHooks%s()\n{\n    BOOL hookSuccess = TRUE;\n#if defined(WIN32)' % func_ext_dict[func_class])
+        hooks_txt.append('    Mhook_BeginMultiOperation(FALSE);')
+        hooks_txt.append('    if (real_xgl%s != NULL)' % first_proto_dict[func_class])
+        hooks_txt.append('    {')
+        hook_operator = '='
+        for proto in self.protos:
+            if func_class in proto.name:
+                hooks_txt.append('        hookSuccess %s Mhook_SetHook((PVOID*)&real_xgl%s, hooked_xgl%s);' % (hook_operator, proto.name, proto.name))
+                hook_operator = '&='
+        hooks_txt.append('    }\n')
+        hooks_txt.append('    if (!hookSuccess)\n    {')
+        hooks_txt.append('        glv_LogError("Failed to hook XGL ext %s.");\n    }\n' % func_class)
+        hooks_txt.append('    Mhook_EndMultiOperation();\n')
+        hooks_txt.append('#elif defined(__linux__)')
+        hooks_txt.append('    hookSuccess = glv_platform_get_next_lib_sym((PVOID*)&real_xgl%s, "xgl%s");' % (first_proto_dict[func_class], first_proto_dict[func_class]))
+        for proto in self.protos:
+            if func_class in proto.name and first_proto_dict[func_class] not in proto.name:
+                hooks_txt.append('    hookSuccess %s glv_platform_get_next_lib_sym((PVOID*)&real_xgl%s, "xgl%s");' % (hook_operator, proto.name, proto.name))
+        hooks_txt.append('    if (!hookSuccess)\n    {')
+        hooks_txt.append('        glv_LogError("Failed to hook XGL ext %s.");\n    }\n' % func_class)
+        hooks_txt.append('#endif\n}\n')
+        return "\n".join(hooks_txt)
+
+    def _generate_detach_hooks(self):
+        hooks_txt = []
+        hooks_txt.append('void DetachHooks()\n{\n#ifdef __linux__\n    return;\n#elif defined(WIN32)')
+        hooks_txt.append('    BOOL unhookSuccess = TRUE;\n    if (real_xglGetGpuInfo != NULL)\n    {')
+        hook_operator = '='
+        for proto in self.protos:
+            if 'Dbg' not in proto.name and 'Wsi' not in proto.name:
+                hooks_txt.append('        unhookSuccess %s Mhook_Unhook((PVOID*)&real_xgl%s);' % (hook_operator, proto.name))
+                hook_operator = '&='
+        hooks_txt.append('    }\n    isHooked = FALSE;')
+        hooks_txt.append('    if (!unhookSuccess)\n    {')
+        hooks_txt.append('        glv_LogError("Failed to unhook XGL.");\n    }')
+        hooks_txt.append('#endif\n}')
+        hooks_txt.append('#ifdef WIN32\nINIT_ONCE gInitOnce = INIT_ONCE_STATIC_INIT;\n#elif defined(PLATFORM_LINUX)\npthread_once_t gInitOnce = PTHREAD_ONCE_INIT;\n#endif\n')
+        return "\n".join(hooks_txt)
+
+    def _generate_detach_hooks_ext(self, func_class='Wsi'):
+        func_ext_dict = {'Wsi': '_xglwsix11ext', 'Dbg': '_xgldbg'}
+        first_proto_dict = {'Wsi': 'WsiX11AssociateConnection', 'Dbg': 'DbgSetValidationLevel'}
+        hooks_txt = []
+        hooks_txt.append('void DetachHooks%s()\n{\n#ifdef WIN32' % func_ext_dict[func_class])
+        hooks_txt.append('    BOOL unhookSuccess = TRUE;\n    if (real_xgl%s != NULL)\n    {' % first_proto_dict[func_class])
+        hook_operator = '='
+        for proto in self.protos:
+            if func_class in proto.name:
+                hooks_txt.append('        unhookSuccess %s Mhook_Unhook((PVOID*)&real_xgl%s);' % (hook_operator, proto.name))
+                hook_operator = '&='
+        hooks_txt.append('    }')
+        hooks_txt.append('    if (!unhookSuccess)\n    {')
+        hooks_txt.append('        glv_LogError("Failed to unhook XGL ext %s.");\n    }' % func_class)
+        hooks_txt.append('#elif defined(__linux__)\n    return;\n#endif\n}\n')
+        return "\n".join(hooks_txt)
+
+    def _generate_init_funcs(self):
+        init_tracer = []
+        init_tracer.append('void send_xgl_api_version_packet()\n{')
+        init_tracer.append('    struct_xglApiVersion* pPacket;')
+        init_tracer.append('    glv_trace_packet_header* pHeader;')
+        init_tracer.append('    pHeader = glv_create_trace_packet(GLV_TID_XGL, GLV_TPI_XGL_xglApiVersion, sizeof(struct_xglApiVersion), 0);')
+        init_tracer.append('    pPacket = interpret_body_as_xglApiVersion(pHeader, FALSE);')
+        init_tracer.append('    pPacket->version = XGL_API_VERSION;')
+        init_tracer.append('    FINISH_TRACE_PACKET();\n}\n')
+
+        init_tracer.append('static GLV_CRITICAL_SECTION g_memInfoLock;')
+        init_tracer.append('void InitTracer(void)\n{')
+        init_tracer.append('    char *ipAddr = glv_get_global_var("GLVLIB_TRACE_IPADDR");')
+        init_tracer.append('    if (ipAddr == NULL)')
+        init_tracer.append('        ipAddr = "127.0.0.1";')
+        init_tracer.append('    gMessageStream = glv_MessageStream_create(FALSE, ipAddr, GLV_BASE_PORT + GLV_TID_XGL);')
+        init_tracer.append('    glv_trace_set_trace_file(glv_FileLike_create_msg(gMessageStream));')
+        init_tracer.append('//    glv_tracelog_set_log_file(glv_FileLike_create_file(fopen("glv_log_traceside.txt","w")));')
+        init_tracer.append('    glv_tracelog_set_tracer_id(GLV_TID_XGL);')
+        init_tracer.append('    glv_create_critical_section(&g_memInfoLock);')
+        init_tracer.append('    send_xgl_api_version_packet();\n}\n')
+        return "\n".join(init_tracer)
+
+    def _gen_unmap_memory(self):
+        um_body = []
+        um_body.append('GLVTRACER_EXPORT XGL_RESULT XGLAPI __HOOKED_xglUnmapMemory(')
+        um_body.append('    XGL_GPU_MEMORY mem)')
+        um_body.append('{')
+        um_body.append('    glv_trace_packet_header* pHeader;')
+        um_body.append('    XGL_RESULT result;')
+        um_body.append('    struct_xglUnmapMemory* pPacket;')
+        um_body.append('    XGLAllocInfo *entry;')
+        um_body.append('    SEND_ENTRYPOINT_PARAMS("xglUnmapMemory(mem %p)\\n", mem);')
+        um_body.append('    // insert into packet the data that was written by CPU between the xglMapMemory call and here')
+        um_body.append('    // Note must do this prior to the real xglUnMap() or else may get a FAULT')
+        um_body.append('    glv_enter_critical_section(&g_memInfoLock);')
+        um_body.append('    entry = find_mem_info_entry(mem);')
+        um_body.append('    CREATE_TRACE_PACKET(xglUnmapMemory, (entry) ? entry->size : 0);')
+        um_body.append('    pPacket = interpret_body_as_xglUnmapMemory(pHeader);')
+        um_body.append('    if (entry)')
+        um_body.append('    {')
+        um_body.append('        assert(entry->handle == mem);')
+        um_body.append('        glv_add_buffer_to_trace_packet(pHeader, (void**) &(pPacket->pData), entry->size, entry->pData);')
+        um_body.append('        glv_finalize_buffer_address(pHeader, (void**)&(pPacket->pData));')
+        um_body.append('        entry->pData = NULL;')
+        um_body.append('    } else')
+        um_body.append('    {')
+        um_body.append('         glv_LogError("Failed to copy app memory into trace packet (idx = %u) on xglUnmapMemory\\n", pHeader->global_packet_index);')
+        um_body.append('    }')
+        um_body.append('    glv_leave_critical_section(&g_memInfoLock);')
+        um_body.append('    result = real_xglUnmapMemory(mem);')
+        um_body.append('    pPacket->mem = mem;')
+        um_body.append('    pPacket->result = result;')
+        um_body.append('    FINISH_TRACE_PACKET();')
+        um_body.append('    return result;')
+        um_body.append('}\n')
+        return "\n".join(um_body)
+
+    # Take a list of params and return a list of dicts w/ ptr param details
+    def _get_packet_ptr_param_list(self, params):
+        ptr_param_list = []
+        # TODO : This is a slightly nicer way to handle custom cases than initial code, however
+        #   this can still be further generalized to eliminate more custom code
+        #   big case to handle is when ptrs to structs have embedded data that needs to be accounted for in packet
+        custom_ptr_dict = {'XGL_DEVICE_CREATE_INFO': {'add_txt': 'add_XGL_DEVICE_CREATE_INFO_to_packet(pHeader, (XGL_DEVICE_CREATE_INFO**) &(pPacket->pCreateInfo), pCreateInfo)',
+                                                  'finalize_txt': ''},
+                           'XGL_APPLICATION_INFO': {'add_txt': 'add_XGL_APPLICATION_INFO_to_packet(pHeader, (XGL_APPLICATION_INFO**)&(pPacket->pAppInfo), pAppInfo)',
+                                                'finalize_txt': ''},
+                           'XGL_PHYSICAL_GPU': {'add_txt': 'glv_add_buffer_to_trace_packet(pHeader, (void**)&(pPacket->pGpus), *pGpuCount*sizeof(XGL_PHYSICAL_GPU), pGpus)',
+                                                'finalize_txt': 'default'},
+                           'pDataSize': {'add_txt': 'glv_add_buffer_to_trace_packet(pHeader, (void**)&(pPacket->pDataSize), sizeof(size_t), &_dataSize)',
+                                         'finalize_txt': 'glv_finalize_buffer_address(pHeader, (void**)&(pPacket->pDataSize))'},
+                           'pData': {'add_txt': 'glv_add_buffer_to_trace_packet(pHeader, (void**)&(pPacket->pData), _dataSize, pData)',
+                                     'finalize_txt': 'default'},
+                           'pName': {'add_txt': 'glv_add_buffer_to_trace_packet(pHeader, (void**)&(pPacket->pName), ((pName != NULL) ? strlen(pName) + 1 : 0), pName)',
+                                     'finalize_txt': 'default'},
+                           'pExtName': {'add_txt': 'glv_add_buffer_to_trace_packet(pHeader, (void**)&(pPacket->pExtName), ((pExtName != NULL) ? strlen(pExtName) + 1 : 0), pExtName)',
+                                        'finalize_txt': 'default'},
+                           'pDescriptorSets': {'add_txt': 'glv_add_buffer_to_trace_packet(pHeader, (void**)&(pPacket->pDescriptorSets), customSize, pDescriptorSets)',
+                                               'finalize_txt': 'default'},
+                           'pUpdateChain': {'add_txt': 'add_update_descriptors_to_trace_packet(pHeader, (void**)&(pPacket->pUpdateChain), pUpdateChain)',
+                                            'finalize_txt': 'default'},
+                           'XGL_SHADER_CREATE_INFO': {'add_txt': 'glv_add_buffer_to_trace_packet(pHeader, (void**)&(pPacket->pCreateInfo), sizeof(XGL_SHADER_CREATE_INFO), pCreateInfo);\n    glv_add_buffer_to_trace_packet(pHeader, (void**)&(pPacket->pCreateInfo->pCode), ((pCreateInfo != NULL) ? pCreateInfo->codeSize : 0), pCreateInfo->pCode)',
+                                                      'finalize_txt': 'glv_finalize_buffer_address(pHeader, (void**)&(pPacket->pCreateInfo->pCode));\n    glv_finalize_buffer_address(pHeader, (void**)&(pPacket->pCreateInfo))'},
+                           'XGL_FRAMEBUFFER_CREATE_INFO': {'add_txt': 'glv_add_buffer_to_trace_packet(pHeader, (void**)&(pPacket->pCreateInfo), sizeof(XGL_FRAMEBUFFER_CREATE_INFO), pCreateInfo);\n    glv_add_buffer_to_trace_packet(pHeader, (void**)&(pPacket->pCreateInfo->pColorAttachments), colorCount * sizeof(XGL_COLOR_ATTACHMENT_BIND_INFO), pCreateInfo->pColorAttachments);\n    glv_add_buffer_to_trace_packet(pHeader, (void**)&(pPacket->pCreateInfo->pDepthStencilAttachment), dsSize, pCreateInfo->pDepthStencilAttachment)',
+                                                           'finalize_txt': 'glv_finalize_buffer_address(pHeader, (void**)&(pPacket->pCreateInfo->pColorAttachments));\n    glv_finalize_buffer_address(pHeader, (void**)&(pPacket->pCreateInfo->pDepthStencilAttachment));\n    glv_finalize_buffer_address(pHeader, (void**)&(pPacket->pCreateInfo))'},
+                           'XGL_RENDER_PASS_CREATE_INFO': {'add_txt': 'glv_add_buffer_to_trace_packet(pHeader, (void**)&(pPacket->pCreateInfo), sizeof(XGL_RENDER_PASS_CREATE_INFO), pCreateInfo);\n    glv_add_buffer_to_trace_packet(pHeader, (void**)&(pPacket->pCreateInfo->pColorLoadOps), colorCount * sizeof(XGL_ATTACHMENT_LOAD_OP), pCreateInfo->pColorLoadOps);\n    glv_add_buffer_to_trace_packet(pHeader, (void**)&(pPacket->pCreateInfo->pColorStoreOps), colorCount * sizeof(XGL_ATTACHMENT_STORE_OP), pCreateInfo->pColorStoreOps);\n    glv_add_buffer_to_trace_packet(pHeader, (void**)&(pPacket->pCreateInfo->pColorLoadClearValues), colorCount * sizeof(XGL_CLEAR_COLOR), pCreateInfo->pColorLoadClearValues)',
+                                                          'finalize_txt': 'glv_finalize_buffer_address(pHeader, (void**)&(pPacket->pCreateInfo->pColorLoadOps));\n    glv_finalize_buffer_address(pHeader, (void**)&(pPacket->pCreateInfo->pColorStoreOps));\n    glv_finalize_buffer_address(pHeader, (void**)&(pPacket->pCreateInfo->pColorLoadClearValues));\n    glv_finalize_buffer_address(pHeader, (void**)&(pPacket->pCreateInfo))'},
+                           'XGL_CMD_BUFFER_BEGIN_INFO': {'add_txt': 'glv_add_buffer_to_trace_packet(pHeader, (void**)&(pPacket->pBeginInfo), sizeof(XGL_CMD_BUFFER_BEGIN_INFO), pBeginInfo);\n    add_begin_cmdbuf_to_trace_packet(pHeader, (void**)&(pPacket->pBeginInfo->pNext), pBeginInfo->pNext)',
+                                                         'finalize_txt': 'glv_finalize_buffer_address(pHeader, (void**)&(pPacket->pBeginInfo))'},
+                           'XGL_DYNAMIC_VP_STATE_CREATE_INFO': {'add_txt': 'glv_add_buffer_to_trace_packet(pHeader, (void**)&(pPacket->pCreateInfo), sizeof(XGL_DYNAMIC_VP_STATE_CREATE_INFO), pCreateInfo);\n    glv_add_buffer_to_trace_packet(pHeader, (void**)&(pPacket->pCreateInfo->pViewports), vpsCount * sizeof(XGL_VIEWPORT), pCreateInfo->pViewports);\n    glv_add_buffer_to_trace_packet(pHeader, (void**)&(pPacket->pCreateInfo->pScissors), vpsCount * sizeof(XGL_RECT), pCreateInfo->pScissors)',
+                                                                'finalize_txt': 'glv_finalize_buffer_address(pHeader, (void**)&(pPacket->pCreateInfo->pViewports));\n    glv_finalize_buffer_address(pHeader, (void**)&(pPacket->pCreateInfo->pScissors));\n    glv_finalize_buffer_address(pHeader, (void**)&(pPacket->pCreateInfo))'},
+                           'XGL_MEMORY_ALLOC_INFO': {'add_txt': 'glv_add_buffer_to_trace_packet(pHeader, (void**)&(pPacket->pAllocInfo), sizeof(XGL_MEMORY_ALLOC_INFO), pAllocInfo);\n    add_alloc_memory_to_trace_packet(pHeader, (void**)&(pPacket->pAllocInfo->pNext), pAllocInfo->pNext)',
+                                                     'finalize_txt': 'glv_finalize_buffer_address(pHeader, (void**)&(pPacket->pAllocInfo))'},
+                           'XGL_GRAPHICS_PIPELINE_CREATE_INFO': {'add_txt': 'glv_add_buffer_to_trace_packet(pHeader, (void**)&(pPacket->pCreateInfo), sizeof(XGL_GRAPHICS_PIPELINE_CREATE_INFO), pCreateInfo);\n    add_pipeline_state_to_trace_packet(pHeader, (void**)&(pPacket->pCreateInfo->pNext), pCreateInfo->pNext)',
+                                                                 'finalize_txt': 'glv_finalize_buffer_address(pHeader, (void**)&(pPacket->pCreateInfo))'},
+                           'XGL_DESCRIPTOR_SET_LAYOUT_CREATE_INFO': {'add_txt': 'glv_add_buffer_to_trace_packet(pHeader, (void**)&(pPacket->pSetLayoutInfoList), sizeof(XGL_DESCRIPTOR_SET_LAYOUT_CREATE_INFO), pSetLayoutInfoList);\n    if (pSetLayoutInfoList)\n        add_create_ds_layout_to_trace_packet(pHeader, (void**)&(pPacket->pSetLayoutInfoList->pNext), pSetLayoutInfoList->pNext)',
+                                                                     'finalize_txt': 'glv_finalize_buffer_address(pHeader, (void**)&(pPacket->pSetLayoutInfoList))'},
+                           'XGL_DESCRIPTOR_REGION_CREATE_INFO': {'add_txt': 'glv_add_buffer_to_trace_packet(pHeader, (void**)&(pPacket->pCreateInfo), sizeof(XGL_DESCRIPTOR_REGION_CREATE_INFO), pCreateInfo);\n    glv_add_buffer_to_trace_packet(pHeader, (void**)&(pPacket->pCreateInfo->pTypeCount), rgCount * sizeof(XGL_DESCRIPTOR_TYPE_COUNT), pCreateInfo->pTypeCount)',
+                                                                 'finalize_txt': 'glv_finalize_buffer_address(pHeader, (void**)&(pPacket->pCreateInfo->pTypeCount));\n    glv_finalize_buffer_address(pHeader, (void**)&(pPacket->pCreateInfo))'},
+                           'XGL_COMPUTE_PIPELINE_CREATE_INFO': {'add_txt': 'glv_add_buffer_to_trace_packet(pHeader, (void**)&(pPacket->pCreateInfo), sizeof(XGL_COMPUTE_PIPELINE_CREATE_INFO), pCreateInfo);\n    add_pipeline_state_to_trace_packet(pHeader, (void**)&(pPacket->pCreateInfo->pNext), pCreateInfo->pNext);\n    add_pipeline_shader_to_trace_packet(pHeader, (XGL_PIPELINE_SHADER*)&pPacket->pCreateInfo->cs, &pCreateInfo->cs)',
+                                                                'finalize_txt': 'finalize_pipeline_shader_address(pHeader, &pPacket->pCreateInfo->cs);\n    glv_finalize_buffer_address(pHeader, (void**)&(pPacket->pCreateInfo))'},
+                                                  }
+        for p in params:
+            pp_dict = {}
+            if '*' in p.ty and p.name not in ['pSysMem', 'pReserved']:
+                if 'const' in p.ty.lower() and 'count' in params[params.index(p)-1].name.lower():
+                    pp_dict['add_txt'] = 'glv_add_buffer_to_trace_packet(pHeader, (void**)&(pPacket->%s), %s*sizeof(%s), %s)' % (p.name, params[params.index(p)-1].name, p.ty.strip('*').replace('const ', ''), p.name)
+                elif p.ty.strip('*').replace('const ', '') in custom_ptr_dict:
+                    pp_dict['add_txt'] = custom_ptr_dict[p.ty.strip('*').replace('const ', '')]['add_txt']
+                    pp_dict['finalize_txt'] = custom_ptr_dict[p.ty.strip('*').replace('const ', '')]['finalize_txt']
+                elif p.name in custom_ptr_dict:
+                    pp_dict['add_txt'] = custom_ptr_dict[p.name]['add_txt']
+                    pp_dict['finalize_txt'] = custom_ptr_dict[p.name]['finalize_txt']
+                    # TODO : This is custom hack to account for 2 pData items with dataSize param for sizing
+                    if 'pData' == p.name and 'dataSize' == params[params.index(p)-1].name:
+                        pp_dict['add_txt'] = pp_dict['add_txt'].replace('_dataSize', 'dataSize')
+                else:
+                    pp_dict['add_txt'] = 'glv_add_buffer_to_trace_packet(pHeader, (void**)&(pPacket->%s), sizeof(%s), %s)' % (p.name, p.ty.strip('*').replace('const ', ''), p.name)
+                if 'finalize_txt' not in pp_dict or 'default' == pp_dict['finalize_txt']:
+                    pp_dict['finalize_txt'] = 'glv_finalize_buffer_address(pHeader, (void**)&(pPacket->%s))' % (p.name)
+                pp_dict['index'] = params.index(p)
+                ptr_param_list.append(pp_dict)
+        return ptr_param_list
+
+    # Take a list of params and return a list of packet size elements
+    def _get_packet_size(self, params):
+        ps = [] # List of elements to be added together to account for packet size for given params
+        skip_list = [] # store params that are already accounted for so we don't count them twice
+        # Dict of specific params with unique custom sizes
+        custom_size_dict = {'pSetBindPoints': '(XGL_SHADER_STAGE_COMPUTE * sizeof(uint32_t))', # Accounting for largest possible array
+                            }
+        for p in params:
+            #First handle custom cases
+            if p.name in ['pCreateInfo', 'pUpdateChain', 'pSetLayoutInfoList', 'pBeginInfo', 'pAllocInfo']:
+                ps.append('get_struct_chain_size((void*)%s)' % p.name)
+                skip_list.append(p.name)
+            elif p.name in custom_size_dict:
+                ps.append(custom_size_dict[p.name])
+                skip_list.append(p.name)
+            # Skip any params already handled
+            if p.name in skip_list:
+                continue
+            # Now check to identify dynamic arrays which depend on two params
+            if 'count' in p.name.lower():
+                next_idx = params.index(p)+1
+                # If next element is a const *, then multiply count and array type
+                if next_idx < len(params) and '*' in params[next_idx].ty and 'const' in params[next_idx].ty.lower():
+                    if '*' in p.ty:
+                        ps.append('*%s*sizeof(%s)' % (p.name, params[next_idx].ty.strip('*').replace('const ', '')))
+                    else:
+                        ps.append('%s*sizeof(%s)' % (p.name, params[next_idx].ty.strip('*').replace('const ', '')))
+                    skip_list.append(params[next_idx].name)
+            elif '*' in p.ty and p.name not in ['pSysMem', 'pReserved']:
+                if 'pData' == p.name:
+                    if 'dataSize' == params[params.index(p)-1].name:
+                        ps.append('dataSize')
+                    elif 'counterCount' == params[params.index(p)-1].name:
+                        ps.append('sizeof(%s)' % p.ty.strip('*').replace('const ', ''))
+                    else:
+                        ps.append('((pDataSize != NULL && pData != NULL) ? *pDataSize : 0)')
+                elif '**' in p.ty and 'void' in p.ty:
+                    ps.append('sizeof(void*)')
+                elif 'void' in p.ty:
+                    ps.append('sizeof(%s)' % p.name)
+                elif 'char' in p.ty:
+                    ps.append('((%s != NULL) ? strlen(%s) + 1 : 0)' % (p.name, p.name))
+                elif 'pDataSize' in p.name:
+                    ps.append('((pDataSize != NULL) ? sizeof(size_t) : 0)')
+                elif 'IMAGE_SUBRESOURCE' in p.ty and 'pSubresource' == p.name:
+                    ps.append('((pSubresource != NULL) ? sizeof(XGL_IMAGE_SUBRESOURCE) : 0)')
+                else:
+                    ps.append('sizeof(%s)' % (p.ty.strip('*').replace('const ', '')))
+        return ps
+
+    # Generate functions used to trace API calls and store the input and result data into a packet
+    # Here's the general flow of code insertion w/ option items flagged w/ "?"
+    # Result decl?
+    # Packet struct decl
+    # ?Special case : setup call to function first and do custom API call time tracking
+    # CREATE_PACKET
+    # Call (w/ result?)
+    # Assign packet values
+    # FINISH packet
+    # return result?
+    def _generate_trace_funcs(self):
+        func_body = []
+        for proto in self.protos:
+            if 'UnmapMemory' == proto.name:
+                func_body.append(self._gen_unmap_memory())
+            elif 'Dbg' not in proto.name and 'Wsi' not in proto.name:
+                raw_packet_update_list = [] # non-ptr elements placed directly into packet
+                ptr_packet_update_list = [] # ptr elements to be updated into packet
+                return_txt = ''
+                packet_size = []
+                in_data_size = False # flag when we need to capture local input size variable for in/out size
+                func_body.append('GLVTRACER_EXPORT %s XGLAPI __HOOKED_xgl%s(' % (proto.ret, proto.name))
+                for p in proto.params: # TODO : For all of the ptr types, check them for NULL and return 0 if NULL
+                    if '[' in p.ty: # Correctly declare static arrays in function parameters
+                        func_body.append('    %s %s[%s],' % (p.ty[:p.ty.find('[')], p.name, p.ty[p.ty.find('[')+1:p.ty.find(']')]))
+                    else:
+                        func_body.append('    %s %s,' % (p.ty, p.name))
+                    if '*' in p.ty and p.name not in ['pSysMem', 'pReserved']:
+                        if 'pDataSize' in p.name:
+                            in_data_size = True;
+                    else:
+                        if '[' in p.ty:
+                            array_str = p.ty[p.ty.find('[')+1:p.ty.find(']')]
+                            raw_packet_update_list.append('    memcpy((void*)pPacket->color, color, %s * sizeof(%s));' % (array_str, p.ty.strip('*').replace('const ', '').replace('[%s]' % array_str, '')))
+                        else:
+                            raw_packet_update_list.append('    pPacket->%s = %s;' % (p.name, p.name))
+                # Get list of packet size modifiers due to ptr params
+                packet_size = self._get_packet_size(proto.params)
+                ptr_packet_update_list = self._get_packet_ptr_param_list(proto.params)
+                func_body[-1] = func_body[-1].replace(',', ')')
+                # End of function declaration portion, begin function body
+                func_body.append('{\n    glv_trace_packet_header* pHeader;')
+                if 'void' not in proto.ret or '*' in proto.ret:
+                    func_body.append('    %s result;' % proto.ret)
+                    return_txt = 'result = '
+                if in_data_size:
+                    func_body.append('    size_t _dataSize;')
+                func_body.append('    struct_xgl%s* pPacket = NULL;' % proto.name)
+                # functions that have non-standard sequence of  packet creation and calling real function
+                # NOTE: Anytime we call the function before CREATE_TRACE_PACKET, need to add custom code for correctly tracking API call time
+                if 'CreateInstance' == proto.name:
+                    func_body.append('    uint64_t startTime;')
+                    func_body.append('    glv_platform_thread_once(&gInitOnce, InitTracer);')
+                    func_body.append('    SEND_ENTRYPOINT_ID(xgl%s);' % proto.name)
+                    func_body.append('    if (real_xglCreateInstance == xglCreateInstance)')
+                    func_body.append('    {')
+                    func_body.append('        glv_platform_get_next_lib_sym((void **) &real_xglCreateInstance,"xglCreateInstance");')
+                    func_body.append('    }')
+                    func_body.append('    startTime = glv_get_time();')
+                    func_body.append('    %sreal_xgl%s;' % (return_txt, proto.c_call()))
+                    func_body.append('    CREATE_TRACE_PACKET(xgl%s, sizeof(XGL_INSTANCE) + get_struct_chain_size((void*)pAppInfo) + ((pAllocCb == NULL) ? 0 :sizeof(XGL_ALLOC_CALLBACKS)));' % (proto.name))
+                    func_body.append('    pHeader->entrypoint_begin_time = startTime;')
+                    func_body.append('    if (isHooked == FALSE) {')
+                    func_body.append('        AttachHooks();')
+                    func_body.append('        AttachHooks_xgldbg();')
+                    func_body.append('        AttachHooks_xglwsix11ext();')
+                    func_body.append('    }')
+                elif 'EnumerateGpus' == proto.name:
+                    func_body.append('    uint64_t startTime;')
+                    func_body.append('    SEND_ENTRYPOINT_ID(xgl%s);' % proto.name)
+                    func_body.append('    startTime = glv_get_time();')
+                    func_body.append('    %sreal_xgl%s;' % (return_txt, proto.c_call()))
+                    func_body.append('    CREATE_TRACE_PACKET(xglEnumerateGpus, sizeof(uint32_t) + ((pGpus && pGpuCount) ? *pGpuCount * sizeof(XGL_PHYSICAL_GPU) : 0));')
+                    func_body.append('    pHeader->entrypoint_begin_time = startTime;')
+                elif 'EnumerateLayers' == proto.name:
+                    func_body.append('    uint64_t startTime;')
+                    func_body.append('    SEND_ENTRYPOINT_ID(xgl%s);' % proto.name)
+                    func_body.append('    startTime = glv_get_time();')
+                    func_body.append('    %sreal_xgl%s;' % (return_txt, proto.c_call()))
+                    func_body.append('    size_t totStringSize = 0;')
+                    func_body.append('    uint32_t i = 0;')
+                    func_body.append('    for (i = 0; i < *pOutLayerCount; i++)')
+                    func_body.append('        totStringSize += (pOutLayers[i] != NULL) ? strlen(pOutLayers[i]) + 1: 0;')
+                    func_body.append('    CREATE_TRACE_PACKET(xgl%s, totStringSize + sizeof(size_t));' % (proto.name))
+                    func_body.append('    pHeader->entrypoint_begin_time = startTime;')
+                elif 'AllocDescriptorSets' == proto.name:
+                    func_body.append('    uint64_t startTime;')
+                    func_body.append('    SEND_ENTRYPOINT_ID(xgl%s);' % proto.name)
+                    func_body.append('    startTime = glv_get_time();')
+                    func_body.append('    %sreal_xgl%s;' % (return_txt, proto.c_call()))
+                    func_body.append('    size_t customSize = (*pCount <= 0) ? (sizeof(XGL_DESCRIPTOR_SET)) : (*pCount * sizeof(XGL_DESCRIPTOR_SET));')
+                    func_body.append('    CREATE_TRACE_PACKET(xglAllocDescriptorSets, sizeof(XGL_DESCRIPTOR_SET_LAYOUT) + customSize + sizeof(uint32_t));')
+                    func_body.append('    pHeader->entrypoint_begin_time = startTime;')
+                elif proto.name in ['CreateFramebuffer', 'CreateRenderPass', 'CreateDynamicViewportState', 
+                                    'CreateDescriptorRegion', 'CmdWaitEvents', 'CmdPipelineBarrier']:
+                    # these are regular case as far as sequence of tracing but have some custom size element
+                    if 'CreateFramebuffer' == proto.name:
+                        func_body.append('    int dsSize = (pCreateInfo != NULL && pCreateInfo->pDepthStencilAttachment != NULL) ? sizeof(XGL_DEPTH_STENCIL_BIND_INFO) : 0;')
+                        func_body.append('    uint32_t colorCount = (pCreateInfo != NULL && pCreateInfo->pColorAttachments != NULL) ? pCreateInfo->colorAttachmentCount : 0;')
+                        func_body.append('    CREATE_TRACE_PACKET(xglCreateFramebuffer, get_struct_chain_size((void*)pCreateInfo) + sizeof(XGL_FRAMEBUFFER));')
+                    elif 'CreateRenderPass' == proto.name:
+                        func_body.append('    uint32_t colorCount = (pCreateInfo != NULL && (pCreateInfo->pColorLoadOps != NULL || pCreateInfo->pColorStoreOps != NULL || pCreateInfo->pColorLoadClearValues != NULL)) ? pCreateInfo->colorAttachmentCount : 0;')
+                        func_body.append('    CREATE_TRACE_PACKET(xglCreateRenderPass, get_struct_chain_size((void*)pCreateInfo) + sizeof(XGL_RENDER_PASS));')
+                    elif 'CreateDynamicViewportState' == proto.name:
+                        func_body.append('    uint32_t vpsCount = (pCreateInfo != NULL && pCreateInfo->pViewports != NULL) ? pCreateInfo->viewportAndScissorCount : 0;')
+                        func_body.append('    CREATE_TRACE_PACKET(xglCreateDynamicViewportState,  get_struct_chain_size((void*)pCreateInfo) + sizeof(XGL_DYNAMIC_VP_STATE_OBJECT));')
+                    elif 'CreateDescriptorRegion' == proto.name:
+                        func_body.append('    uint32_t rgCount = (pCreateInfo != NULL && pCreateInfo->pTypeCount != NULL) ? pCreateInfo->count : 0;')
+                        func_body.append('    CREATE_TRACE_PACKET(xglCreateDescriptorRegion,  get_struct_chain_size((void*)pCreateInfo) + sizeof(XGL_DESCRIPTOR_REGION));')
+                    else: # ['CmdWaitEvents', 'CmdPipelineBarrier']:
+                        func_body.append('    size_t customSize;')
+                        event_array_type = 'XGL_EVENT'
+                        if 'CmdPipelineBarrier' == proto.name:
+                            event_array_type = 'XGL_SET_EVENT'
+                        func_body.append('    uint32_t eventCount = (%s != NULL && %s->pEvents != NULL) ? %s->eventCount : 0;' % (proto.params[-1].name, proto.params[-1].name, proto.params[-1].name))
+                        func_body.append('    uint32_t mbCount = (%s != NULL && %s->ppMemBarriers != NULL) ? %s->memBarrierCount : 0;' % (proto.params[-1].name, proto.params[-1].name, proto.params[-1].name))
+                        func_body.append('    customSize = (eventCount * sizeof(%s)) + mbCount * sizeof(void*) + calculate_memory_barrier_size(mbCount, %s->ppMemBarriers);' % (event_array_type, proto.params[-1].name))
+                        func_body.append('    CREATE_TRACE_PACKET(xgl%s, sizeof(%s) + customSize);' % (proto.name, proto.params[-1].ty.strip('*').replace('const ', '')))
+                    func_body.append('    %sreal_xgl%s;' % (return_txt, proto.c_call()))
+                else:
+                    if (0 == len(packet_size)):
+                        func_body.append('    CREATE_TRACE_PACKET(xgl%s, 0);' % (proto.name))
+                    else:
+                        func_body.append('    CREATE_TRACE_PACKET(xgl%s, %s);' % (proto.name, ' + '.join(packet_size)))
+                    func_body.append('    %sreal_xgl%s;' % (return_txt, proto.c_call()))
+                if in_data_size:
+                    func_body.append('    _dataSize = (pDataSize == NULL || pData == NULL) ? 0 : *pDataSize;')
+                func_body.append('    pPacket = interpret_body_as_xgl%s(pHeader);' % proto.name)
+                func_body.append('\n'.join(raw_packet_update_list))
+                if 'MapMemory' == proto.name: # Custom code for MapMem case
+                    func_body.append('    if (ppData != NULL)')
+                    func_body.append('    {')
+                    func_body.append('        glv_add_buffer_to_trace_packet(pHeader, (void**)&(pPacket->ppData), sizeof(void*), *ppData);')
+                    func_body.append('        glv_finalize_buffer_address(pHeader, (void**)&(pPacket->ppData));')
+                    func_body.append('        add_data_to_mem_info(mem, *ppData);')
+                    func_body.append('    }')
+                    func_body.append('    pPacket->result = result;')
+                    func_body.append('    FINISH_TRACE_PACKET();')
+                elif 'EnumerateLayers' == proto.name: #custom code for EnumerateLayers case
+                    func_body.append('    pPacket->gpu = gpu;')
+                    func_body.append('    pPacket->maxLayerCount = maxLayerCount;')
+                    func_body.append('    pPacket->maxStringSize = maxStringSize;')
+                    func_body.append('    glv_add_buffer_to_trace_packet(pHeader, (void**)&(pPacket->pOutLayerCount), sizeof(size_t), pOutLayerCount);')
+                    func_body.append('    glv_finalize_buffer_address(pHeader, (void**)&(pPacket->pOutLayerCount));')
+                    func_body.append('    for (i = 0; i < *pOutLayerCount; i++) {')
+                    func_body.append('        glv_add_buffer_to_trace_packet(pHeader, (void**)&(pPacket->pOutLayers[i]), ((pOutLayers[i] != NULL) ? strlen(pOutLayers[i]) + 1 : 0), pOutLayers[i]);')
+                    func_body.append('        glv_finalize_buffer_address(pHeader, (void**)&(pPacket->pOutLayers[i]));')
+                    func_body.append('    }')
+
+                    func_body.append('    pPacket->pReserved = pReserved;')
+                    func_body.append('    pPacket->result = result;')
+                    func_body.append('    FINISH_TRACE_PACKET();')
+                else:
+                    for pp_dict in ptr_packet_update_list: #buff_ptr_indices:
+                        func_body.append('    %s;' % (pp_dict['add_txt']))
+                    # Some custom add_* and finalize_* function calls for Create* API calls
+                    if proto.name in ['CmdWaitEvents', 'CmdPipelineBarrier']:
+                        event_array_type = 'XGL_EVENT'
+                        if 'CmdPipelineBarrier' == proto.name:
+                            event_array_type = 'XGL_SET_EVENT'
+                        func_body.append('    glv_add_buffer_to_trace_packet(pHeader, (void**)&(pPacket->%s->pEvents), eventCount * sizeof(%s), %s->pEvents);' % (proto.params[-1].name, event_array_type, proto.params[-1].name))
+                        func_body.append('    glv_finalize_buffer_address(pHeader, (void**)&(pPacket->%s->pEvents));' % (proto.params[-1].name))
+                        func_body.append('    glv_add_buffer_to_trace_packet(pHeader, (void**)&(pPacket->%s->ppMemBarriers), mbCount * sizeof(void*), %s->ppMemBarriers);' % (proto.params[-1].name, proto.params[-1].name))
+                        func_body.append('    uint32_t i, siz;')
+                        func_body.append('    for (i = 0; i < mbCount; i++) {')
+                        func_body.append('        XGL_MEMORY_BARRIER *pNext = (XGL_MEMORY_BARRIER *) %s->ppMemBarriers[i];' % proto.params[-1].name)
+                        func_body.append('        switch (pNext->sType) {')
+                        func_body.append('            case XGL_STRUCTURE_TYPE_MEMORY_BARRIER:')
+                        func_body.append('                siz = sizeof(XGL_MEMORY_BARRIER);')
+                        func_body.append('                break;')
+                        func_body.append('            case XGL_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER:')
+                        func_body.append('                siz = sizeof(XGL_BUFFER_MEMORY_BARRIER);')
+                        func_body.append('                break;')
+                        func_body.append('            case XGL_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER:')
+                        func_body.append('                siz = sizeof(XGL_IMAGE_MEMORY_BARRIER);')
+                        func_body.append('                break;')
+                        func_body.append('            default:')
+                        func_body.append('                assert(0);')
+                        func_body.append('                siz = 0;')
+                        func_body.append('                break;')
+                        func_body.append('        }')
+                        func_body.append('        glv_add_buffer_to_trace_packet(pHeader, (void**)&(pPacket->%s->ppMemBarriers[i]), siz, %s->ppMemBarriers[i]);' % (proto.params[-1].name, proto.params[-1].name))
+                        func_body.append('        glv_finalize_buffer_address(pHeader, (void**)&(pPacket->%s->ppMemBarriers[i]));' % (proto.params[-1].name))
+                        func_body.append('    }')
+                        func_body.append('    glv_finalize_buffer_address(pHeader, (void**)&(pPacket->%s->ppMemBarriers));' % (proto.params[-1].name))
+                    if 'void' not in proto.ret or '*' in proto.ret:
+                        func_body.append('    pPacket->result = result;')
+                    for pp_dict in ptr_packet_update_list:
+                        if ('DEVICE_CREATE_INFO' not in proto.params[pp_dict['index']].ty) and ('APPLICATION_INFO' not in proto.params[pp_dict['index']].ty) and ('pUpdateChain' != proto.params[pp_dict['index']].name):
+                            func_body.append('    %s;' % (pp_dict['finalize_txt']))
+                    func_body.append('    FINISH_TRACE_PACKET();')
+                    if 'AllocMemory' in proto.name:
+                        func_body.append('    add_new_handle_to_mem_info(*pMem, pAllocInfo->allocationSize, NULL);')
+                    elif 'FreeMemory' in proto.name:
+                        func_body.append('    rm_handle_from_mem_info(mem);')
+                if 'void' not in proto.ret or '*' in proto.ret:
+                    func_body.append('    return result;')
+                func_body.append('}\n')
+        return "\n".join(func_body)
+
+    def _generate_trace_funcs_ext(self, func_class='Wsi'):
+        thread_once_funcs = ['DbgRegisterMsgCallback', 'DbgUnregisterMsgCallback', 'DbgSetGlobalOption']
+        func_body = []
+        for proto in self.protos:
+            if func_class in proto.name:
+                packet_update_txt = ''
+                return_txt = ''
+                packet_size = ''
+                buff_ptr_indices = []
+                func_body.append('GLVTRACER_EXPORT %s XGLAPI __HOOKED_xgl%s(' % (proto.ret, proto.name))
+                for p in proto.params: # TODO : For all of the ptr types, check them for NULL and return 0 is NULL
+                    func_body.append('    %s %s,' % (p.ty, p.name))
+                    if 'Size' in p.name:
+                        packet_size += p.name
+                    if '*' in p.ty and 'pSysMem' != p.name:
+                        if 'char' in p.ty:
+                            packet_size += '((%s != NULL) ? strlen(%s) + 1 : 0) + ' % (p.name, p.name)
+                        elif 'Size' not in packet_size:
+                            packet_size += 'sizeof(%s) + ' % p.ty.strip('*').replace('const ', '')
+                        buff_ptr_indices.append(proto.params.index(p))
+                        if 'pConnectionInfo' in p.name:
+                            packet_size += '((pConnectionInfo->pConnection != NULL) ? sizeof(void *) : 0)'
+                    else:
+                        packet_update_txt += '    pPacket->%s = %s;\n' % (p.name, p.name)
+                if '' == packet_size:
+                    packet_size = '0'
+                else:
+                    packet_size = packet_size.strip(' + ')
+                func_body[-1] = func_body[-1].replace(',', ')')
+                func_body.append('{\n    glv_trace_packet_header* pHeader;')
+                if 'void' not in proto.ret or '*' in proto.ret:
+                    func_body.append('    %s result;' % proto.ret)
+                    return_txt = 'result = '
+                func_body.append('    struct_xgl%s* pPacket = NULL;' % proto.name)
+                if proto.name in thread_once_funcs:
+                    func_body.append('    glv_platform_thread_once(&gInitOnce, InitTracer);')
+                func_body.append('    SEND_ENTRYPOINT_ID(xgl%s);' % proto.name)
+                if 'DbgRegisterMsgCallback' in proto.name:
+                    func_body.append('    CREATE_TRACE_PACKET(xgl%s, sizeof(char));' % proto.name)
+                else:
+                    func_body.append('    CREATE_TRACE_PACKET(xgl%s, %s);' % (proto.name, packet_size))
+                func_body.append('    %sreal_xgl%s;' % (return_txt, proto.c_call()))
+                func_body.append('    pPacket = interpret_body_as_xgl%s(pHeader);' % proto.name)
+                func_body.append(packet_update_txt.strip('\n'))
+                for idx in buff_ptr_indices:
+                    if 'char' in proto.params[idx].ty:
+                            func_body.append('    glv_add_buffer_to_trace_packet(pHeader, (void**)&(pPacket->%s), ((%s != NULL) ? strlen(%s) + 1 : 0), %s);' % (proto.params[idx].name, proto.params[idx].name, proto.params[idx].name, proto.params[idx].name))
+                    elif 'Size' in proto.params[idx-1].name:
+                        func_body.append('    glv_add_buffer_to_trace_packet(pHeader, (void**)&(pPacket->%s), %s, %s);' % (proto.params[idx].name, proto.params[idx-1].name, proto.params[idx].name))
+                    elif 'DbgRegisterMsgCallback' in proto.name:
+                        func_body.append('    glv_add_buffer_to_trace_packet(pHeader, (void**)&(pPacket->%s), sizeof(%s), %s);' % (proto.params[idx].name, 'char', proto.params[idx].name))
+                    else:
+                        func_body.append('    glv_add_buffer_to_trace_packet(pHeader, (void**)&(pPacket->%s), sizeof(%s), %s);' % (proto.params[idx].name, proto.params[idx].ty.strip('*').replace('const ', ''), proto.params[idx].name))
+                if 'WsiX11AssociateConnection' in proto.name:
+                    func_body.append('    if (pConnectionInfo->pConnection != NULL) {')
+                    func_body.append('        glv_add_buffer_to_trace_packet(pHeader, (void**) &(pPacket->pConnectionInfo->pConnection), sizeof(void *), pConnectionInfo->pConnection);')
+                    func_body.append('        glv_finalize_buffer_address(pHeader, (void**) &(pPacket->pConnectionInfo->pConnection));')
+                    func_body.append('    }')
+                if 'void' not in proto.ret or '*' in proto.ret:
+                    func_body.append('    pPacket->result = result;')
+                for idx in buff_ptr_indices:
+                    func_body.append('    glv_finalize_buffer_address(pHeader, (void**)&(pPacket->%s));' % (proto.params[idx].name))
+                func_body.append('    FINISH_TRACE_PACKET();')
+                if 'void' not in proto.ret or '*' in proto.ret:
+                    func_body.append('    return result;')
+                func_body.append('}\n')
+        return "\n".join(func_body)
+
+    def _generate_helper_funcs(self):
+        hf_body = []
+        hf_body.append('// Support for shadowing CPU mapped memory')
+        hf_body.append('typedef struct _XGLAllocInfo {')
+        hf_body.append('    XGL_GPU_SIZE   size;')
+        hf_body.append('    XGL_GPU_MEMORY handle;')
+        hf_body.append('    void           *pData;')
+        hf_body.append('    BOOL           valid;')
+        hf_body.append('} XGLAllocInfo;')
+        hf_body.append('typedef struct _XGLMemInfo {')
+        hf_body.append('    unsigned int numEntrys;')
+        hf_body.append('    XGLAllocInfo *pEntrys;')
+        hf_body.append('    XGLAllocInfo *pLastMapped;')
+        hf_body.append('    unsigned int capacity;')
+        hf_body.append('} XGLMemInfo;')
+        hf_body.append('')
+        hf_body.append('static XGLMemInfo g_memInfo = {0, NULL, NULL, 0};')
+        hf_body.append('')
+        hf_body.append('static void init_mem_info_entrys(XGLAllocInfo *ptr, const unsigned int num)')
+        hf_body.append('{')
+        hf_body.append('    unsigned int i;')
+        hf_body.append('    for (i = 0; i < num; i++)')
+        hf_body.append('    {')
+        hf_body.append('        XGLAllocInfo *entry = ptr + i;')
+        hf_body.append('        entry->pData = NULL;')
+        hf_body.append('        entry->size  = 0;')
+        hf_body.append('        entry->handle = NULL;')
+        hf_body.append('        entry->valid = FALSE;')
+        hf_body.append('    }')
+        hf_body.append('}')
+        hf_body.append('')
+        hf_body.append('// caller must hold the g_memInfoLock')
+        hf_body.append('static void init_mem_info()')
+        hf_body.append('{')
+        hf_body.append('    g_memInfo.numEntrys = 0;')
+        hf_body.append('    g_memInfo.capacity = 4096;')
+        hf_body.append('    g_memInfo.pLastMapped = NULL;')
+        hf_body.append('')
+        hf_body.append('    g_memInfo.pEntrys = GLV_NEW_ARRAY(XGLAllocInfo, g_memInfo.capacity);')
+        hf_body.append('')
+        hf_body.append('    if (g_memInfo.pEntrys == NULL)')
+        hf_body.append('        glv_LogError("init_mem_info()  malloc failed\\n");')
+        hf_body.append('    else')
+        hf_body.append('        init_mem_info_entrys(g_memInfo.pEntrys, g_memInfo.capacity);')
+        hf_body.append('}')
+        hf_body.append('')
+        hf_body.append('// caller must hold the g_memInfoLock')
+        hf_body.append('static void delete_mem_info()')
+        hf_body.append('{')
+        hf_body.append('    GLV_DELETE(g_memInfo.pEntrys);')
+        hf_body.append('    g_memInfo.pEntrys = NULL;')
+        hf_body.append('    g_memInfo.numEntrys = 0;')
+        hf_body.append('    g_memInfo.capacity = 0;')
+        hf_body.append('    g_memInfo.pLastMapped = NULL;')
+        hf_body.append('}')
+        hf_body.append('')
+        hf_body.append('// caller must hold the g_memInfoLock')
+        hf_body.append('static XGLAllocInfo * get_mem_info_entry()')
+        hf_body.append('{')
+        hf_body.append('    unsigned int i;')
+        hf_body.append('    XGLAllocInfo *entry;')
+        hf_body.append('    if (g_memInfo.numEntrys > g_memInfo.capacity)')
+        hf_body.append('    {')
+        hf_body.append('        glv_LogError("get_mem_info_entry() bad internal state numEntrys %u\\n", g_memInfo.numEntrys);')
+        hf_body.append('        return NULL;')
+        hf_body.append('    }')
+        hf_body.append('')
+        hf_body.append('    entry = g_memInfo.pEntrys;')
+        hf_body.append('    for (i = 0; i < g_memInfo.numEntrys; i++)')
+        hf_body.append('    {')
+        hf_body.append('        if ((entry + i)->valid == FALSE)')
+        hf_body.append('            return entry + i;')
+        hf_body.append('    }')
+        hf_body.append('    if (g_memInfo.numEntrys == g_memInfo.capacity)')
+        hf_body.append('    {  // grow the array 2x')
+        hf_body.append('        g_memInfo.capacity *= 2;')
+        hf_body.append('        g_memInfo.pEntrys = (XGLAllocInfo *) GLV_REALLOC(g_memInfo.pEntrys, g_memInfo.capacity * sizeof(XGLAllocInfo));')
+        hf_body.append('        if (g_memInfo.pEntrys == NULL)')
+        hf_body.append('            glv_LogError("get_mem_info_entry() realloc failed\\n");')
+        hf_body.append('        //glv_LogInfo("realloc memInfo from %u to %u\\n", g_memInfo.capacity /2, g_memInfo.capacity);')
+        hf_body.append('        //init the newly added entrys')
+        hf_body.append('        init_mem_info_entrys(g_memInfo.pEntrys + g_memInfo.capacity / 2, g_memInfo.capacity / 2);')
+        hf_body.append('    }')
+        hf_body.append('')
+        hf_body.append('    assert(g_memInfo.numEntrys < g_memInfo.capacity);')
+        hf_body.append('    entry = g_memInfo.pEntrys + g_memInfo.numEntrys;')
+        hf_body.append('    g_memInfo.numEntrys++;')
+        hf_body.append('    assert(entry->valid == FALSE);')
+        hf_body.append('    return entry;')
+        hf_body.append('}')
+        hf_body.append('')
+        hf_body.append('// caller must hold the g_memInfoLock')
+        hf_body.append('static XGLAllocInfo * find_mem_info_entry(const XGL_GPU_MEMORY handle)')
+        hf_body.append('{')
+        hf_body.append('    XGLAllocInfo *entry;')
+        hf_body.append('    unsigned int i;')
+        hf_body.append('    entry = g_memInfo.pEntrys;')
+        hf_body.append('    if (g_memInfo.pLastMapped && g_memInfo.pLastMapped->handle == handle && g_memInfo.pLastMapped->valid)')
+        hf_body.append('    {')
+        hf_body.append('        return g_memInfo.pLastMapped;')
+        hf_body.append('    }')
+        hf_body.append('    for (i = 0; i < g_memInfo.numEntrys; i++)')
+        hf_body.append('    {')
+        hf_body.append('        if ((entry + i)->valid && (handle == (entry + i)->handle))')
+        hf_body.append('        {')
+        hf_body.append('            return entry + i;')
+        hf_body.append('        }')
+        hf_body.append('    }')
+        hf_body.append('')
+        hf_body.append('    return NULL;')
+        hf_body.append('}')
+        hf_body.append('')
+        hf_body.append('static XGLAllocInfo * find_mem_info_entry_lock(const XGL_GPU_MEMORY handle)')
+        hf_body.append('{')
+        hf_body.append('    XGLAllocInfo *res;')
+        hf_body.append('    glv_enter_critical_section(&g_memInfoLock);')
+        hf_body.append('    res = find_mem_info_entry(handle);')
+        hf_body.append('    glv_leave_critical_section(&g_memInfoLock);')
+        hf_body.append('    return res;')
+        hf_body.append('}')
+        hf_body.append('')
+        hf_body.append('static void add_new_handle_to_mem_info(const XGL_GPU_MEMORY handle, XGL_GPU_SIZE size, void *pData)')
+        hf_body.append('{')
+        hf_body.append('    XGLAllocInfo *entry;')
+        hf_body.append('')
+        hf_body.append('    glv_enter_critical_section(&g_memInfoLock);')
+        hf_body.append('    if (g_memInfo.capacity == 0)')
+        hf_body.append('        init_mem_info();')
+        hf_body.append('')
+        hf_body.append('    entry = get_mem_info_entry();')
+        hf_body.append('    if (entry)')
+        hf_body.append('    {')
+        hf_body.append('        entry->valid = TRUE;')
+        hf_body.append('        entry->handle = handle;')
+        hf_body.append('        entry->size = size;')
+        hf_body.append('        entry->pData = pData;   // NOTE: xglFreeMemory will free this mem, so no malloc()')
+        hf_body.append('    }')
+        hf_body.append('    glv_leave_critical_section(&g_memInfoLock);')
+        hf_body.append('}')
+        hf_body.append('')
+        hf_body.append('static void add_data_to_mem_info(const XGL_GPU_MEMORY handle, void *pData)')
+        hf_body.append('{')
+        hf_body.append('    XGLAllocInfo *entry;')
+        hf_body.append('')
+        hf_body.append('    glv_enter_critical_section(&g_memInfoLock);')
+        hf_body.append('    entry = find_mem_info_entry(handle);')
+        hf_body.append('    if (entry)')
+        hf_body.append('    {')
+        hf_body.append('        entry->pData = pData;')
+        hf_body.append('    }')
+        hf_body.append('    g_memInfo.pLastMapped = entry;')
+        hf_body.append('    glv_leave_critical_section(&g_memInfoLock);')
+        hf_body.append('}')
+        hf_body.append('')
+        hf_body.append('static void rm_handle_from_mem_info(const XGL_GPU_MEMORY handle)')
+        hf_body.append('{')
+        hf_body.append('    XGLAllocInfo *entry;')
+        hf_body.append('')
+        hf_body.append('    glv_enter_critical_section(&g_memInfoLock);')
+        hf_body.append('    entry = find_mem_info_entry(handle);')
+        hf_body.append('    if (entry)')
+        hf_body.append('    {')
+        hf_body.append('        entry->valid = FALSE;')
+        hf_body.append('        entry->pData = NULL;')
+        hf_body.append('        entry->size = 0;')
+        hf_body.append('        entry->handle = NULL;')
+        hf_body.append('')
+        hf_body.append('        if (entry == g_memInfo.pLastMapped)')
+        hf_body.append('            g_memInfo.pLastMapped = NULL;')
+        hf_body.append('        // adjust numEntrys to be last valid entry in list')
+        hf_body.append('        do {')
+        hf_body.append('            entry =  g_memInfo.pEntrys + g_memInfo.numEntrys - 1;')
+        hf_body.append('            if (entry->valid == FALSE)')
+        hf_body.append('                g_memInfo.numEntrys--;')
+        hf_body.append('        } while ((entry->valid == FALSE) && (g_memInfo.numEntrys > 0));')
+        hf_body.append('        if (g_memInfo.numEntrys == 0)')
+        hf_body.append('            delete_mem_info();')
+        hf_body.append('    }')
+        hf_body.append('    glv_leave_critical_section(&g_memInfoLock);')
+        hf_body.append('}')
+        hf_body.append('')
+        hf_body.append('static void add_begin_cmdbuf_to_trace_packet(glv_trace_packet_header* pHeader, void** ppOut, const void* pIn)')
+        hf_body.append('{')
+        hf_body.append('    const XGL_CMD_BUFFER_BEGIN_INFO* pInNow = pIn;')
+        hf_body.append('    XGL_CMD_BUFFER_BEGIN_INFO** ppOutNext = (XGL_CMD_BUFFER_BEGIN_INFO**)ppOut;')
+        hf_body.append('    while (pInNow != NULL)')
+        hf_body.append('    {')
+        hf_body.append('        XGL_CMD_BUFFER_BEGIN_INFO** ppOutNow = ppOutNext;')
+        hf_body.append('        ppOutNext = NULL;')
+        hf_body.append('')
+        hf_body.append('        switch (pInNow->sType)')
+        hf_body.append('        {')
+        hf_body.append('            case XGL_STRUCTURE_TYPE_CMD_BUFFER_GRAPHICS_BEGIN_INFO:')
+        hf_body.append('            {')
+        hf_body.append('                glv_add_buffer_to_trace_packet(pHeader, (void**)(ppOutNow), sizeof(XGL_CMD_BUFFER_GRAPHICS_BEGIN_INFO), pInNow);')
+        hf_body.append('                ppOutNext = (XGL_CMD_BUFFER_BEGIN_INFO**)&(*ppOutNow)->pNext;')
+        hf_body.append('                glv_finalize_buffer_address(pHeader, (void**)(ppOutNow));')
+        hf_body.append('                break;')
+        hf_body.append('            }')
+        hf_body.append('            default:')
+        hf_body.append('                assert(!"Encountered an unexpected type in cmdbuffer_begin_info list");')
+        hf_body.append('        }')
+        hf_body.append('        pInNow = (XGL_CMD_BUFFER_BEGIN_INFO*)pInNow->pNext;')
+        hf_body.append('    }')
+        hf_body.append('    return;')
+        hf_body.append('}')
+        hf_body.append('')
+        hf_body.append('static void add_alloc_memory_to_trace_packet(glv_trace_packet_header* pHeader, void** ppOut, const void* pIn)')
+        hf_body.append('{')
+        hf_body.append('    const XGL_MEMORY_ALLOC_INFO* pInNow = pIn;')
+        hf_body.append('    XGL_MEMORY_ALLOC_INFO** ppOutNext = (XGL_MEMORY_ALLOC_INFO**)ppOut;')
+        hf_body.append('    while (pInNow != NULL)')
+        hf_body.append('    {')
+        hf_body.append('        XGL_MEMORY_ALLOC_INFO** ppOutNow = ppOutNext;')
+        hf_body.append('        ppOutNext = NULL;')
+        hf_body.append('')
+        hf_body.append('        switch (pInNow->sType)')
+        hf_body.append('        {')
+        hf_body.append('        case XGL_STRUCTURE_TYPE_MEMORY_ALLOC_BUFFER_INFO:')
+        hf_body.append('        {')
+        hf_body.append('            glv_add_buffer_to_trace_packet(pHeader, (void**)(ppOutNow), sizeof(XGL_MEMORY_ALLOC_BUFFER_INFO), pInNow);')
+        hf_body.append('            ppOutNext = (XGL_MEMORY_ALLOC_INFO**)&(*ppOutNow)->pNext;')
+        hf_body.append('            glv_finalize_buffer_address(pHeader, (void**)(ppOutNow));')
+        hf_body.append('            break;')
+        hf_body.append('        }')
+        hf_body.append('        case XGL_STRUCTURE_TYPE_MEMORY_ALLOC_IMAGE_INFO:')
+        hf_body.append('        {')
+        hf_body.append('            glv_add_buffer_to_trace_packet(pHeader, (void**)(ppOutNow), sizeof(XGL_MEMORY_ALLOC_IMAGE_INFO), pInNow);')
+        hf_body.append('            ppOutNext = (XGL_MEMORY_ALLOC_INFO**)&(*ppOutNow)->pNext;')
+        hf_body.append('            glv_finalize_buffer_address(pHeader, (void**)(ppOutNow));')
+        hf_body.append('            break;')
+        hf_body.append('        }')
+        hf_body.append('        default:')
+        hf_body.append('            assert(!"Encountered an unexpected type in memory_alloc_info list");')
+        hf_body.append('        }')
+        hf_body.append('        pInNow = (XGL_MEMORY_ALLOC_INFO*)pInNow->pNext;')
+        hf_body.append('    }')
+        hf_body.append('    return;')
+        hf_body.append('}')
+        hf_body.append('')
+        hf_body.append('static size_t calculate_memory_barrier_size(uint32_t mbCount, const void** ppMemBarriers)')
+        hf_body.append('{')
+        hf_body.append('    uint32_t i, siz=0;')
+        hf_body.append('    for (i = 0; i < mbCount; i++) {')
+        hf_body.append('        XGL_MEMORY_BARRIER *pNext = (XGL_MEMORY_BARRIER *) ppMemBarriers[i];')
+        hf_body.append('        switch (pNext->sType) {')
+        hf_body.append('            case XGL_STRUCTURE_TYPE_MEMORY_BARRIER:')
+        hf_body.append('                siz += sizeof(XGL_MEMORY_BARRIER);')
+        hf_body.append('                break;')
+        hf_body.append('            case XGL_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER:')
+        hf_body.append('                siz += sizeof(XGL_BUFFER_MEMORY_BARRIER);')
+        hf_body.append('                break;')
+        hf_body.append('            case XGL_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER:')
+        hf_body.append('                siz += sizeof(XGL_IMAGE_MEMORY_BARRIER);')
+        hf_body.append('                break;')
+        hf_body.append('            default:')
+        hf_body.append('                assert(0);')
+        hf_body.append('                break;')
+        hf_body.append('        }')
+        hf_body.append('    }')
+        hf_body.append('    return siz;')
+        hf_body.append('}')
+        hf_body.append('')
+        hf_body.append('static void add_pipeline_shader_to_trace_packet(glv_trace_packet_header* pHeader, XGL_PIPELINE_SHADER* packetShader, const XGL_PIPELINE_SHADER* paramShader)')
+        hf_body.append('{')
+        hf_body.append('    uint32_t i;')
+        hf_body.append('    // constant buffers')
+        hf_body.append('    if (paramShader->linkConstBufferCount > 0 && paramShader->pLinkConstBufferInfo != NULL)')
+        hf_body.append('    {')
+        hf_body.append('        glv_add_buffer_to_trace_packet(pHeader, (void**)&(packetShader->pLinkConstBufferInfo), sizeof(XGL_LINK_CONST_BUFFER) * paramShader->linkConstBufferCount, paramShader->pLinkConstBufferInfo);')
+        hf_body.append('        for (i = 0; i < paramShader->linkConstBufferCount; i++)')
+        hf_body.append('        {')
+        hf_body.append('            glv_add_buffer_to_trace_packet(pHeader, (void**)&(packetShader->pLinkConstBufferInfo[i].pBufferData), packetShader->pLinkConstBufferInfo[i].bufferSize, paramShader->pLinkConstBufferInfo[i].pBufferData);')
+        hf_body.append('        }')
+        hf_body.append('    }')
+        hf_body.append('}')
+        hf_body.append('')
+        hf_body.append('static void finalize_pipeline_shader_address(glv_trace_packet_header* pHeader, const XGL_PIPELINE_SHADER* packetShader)')
+        hf_body.append('{')
+        hf_body.append('    uint32_t i;')
+        hf_body.append('    // constant buffers')
+        hf_body.append('    if (packetShader->linkConstBufferCount > 0 && packetShader->pLinkConstBufferInfo != NULL)')
+        hf_body.append('    {')
+        hf_body.append('        for (i = 0; i < packetShader->linkConstBufferCount; i++)')
+        hf_body.append('        {')
+        hf_body.append('            glv_finalize_buffer_address(pHeader, (void**)&(packetShader->pLinkConstBufferInfo[i].pBufferData));')
+        hf_body.append('        }')
+        hf_body.append('        glv_finalize_buffer_address(pHeader, (void**)&(packetShader->pLinkConstBufferInfo));')
+        hf_body.append('    }')
+        hf_body.append('}')
+        hf_body.append('')
+        hf_body.append('static void add_create_ds_layout_to_trace_packet(glv_trace_packet_header* pHeader, void** ppOut, const void* pIn)')
+        hf_body.append('{')
+        hf_body.append('    const XGL_DESCRIPTOR_SET_LAYOUT_CREATE_INFO* pInNow = pIn;')
+        hf_body.append('    XGL_DESCRIPTOR_SET_LAYOUT_CREATE_INFO** ppOutNext = (XGL_DESCRIPTOR_SET_LAYOUT_CREATE_INFO**)ppOut;')
+        hf_body.append('    while (pInNow != NULL)')
+        hf_body.append('    {')
+        hf_body.append('        XGL_DESCRIPTOR_SET_LAYOUT_CREATE_INFO** ppOutNow = ppOutNext;')
+        hf_body.append('        ppOutNext = NULL;')
+        hf_body.append('        glv_add_buffer_to_trace_packet(pHeader, (void**)(ppOutNow), sizeof(XGL_DESCRIPTOR_SET_LAYOUT_CREATE_INFO), pInNow);')
+        hf_body.append('        ppOutNext = (XGL_DESCRIPTOR_SET_LAYOUT_CREATE_INFO**)&(*ppOutNow)->pNext;')
+        hf_body.append('        glv_finalize_buffer_address(pHeader, (void**)(ppOutNow));')
+        hf_body.append('        pInNow = (XGL_DESCRIPTOR_SET_LAYOUT_CREATE_INFO*)pInNow->pNext;')
+        hf_body.append('    }')
+        hf_body.append('    return;')
+        hf_body.append('}')
+        hf_body.append('')
+        hf_body.append('static void add_update_descriptors_to_trace_packet(glv_trace_packet_header* pHeader, void** ppOut, const void* pIn)')
+        hf_body.append('{')
+        hf_body.append('    const XGL_UPDATE_SAMPLERS* pInNow = pIn;')
+        hf_body.append('    XGL_UPDATE_SAMPLERS** ppOutNext = (XGL_UPDATE_SAMPLERS**)ppOut;')
+        hf_body.append('    while (pInNow != NULL)')
+        hf_body.append('    {')
+        hf_body.append('        XGL_UPDATE_SAMPLERS** ppOutNow = ppOutNext;')
+        hf_body.append('        ppOutNext = NULL;')
+        hf_body.append('        switch (pInNow->sType)')
+        hf_body.append('        {')
+        hf_body.append('        case XGL_STRUCTURE_TYPE_UPDATE_SAMPLERS:')
+        hf_body.append('        {')
+        hf_body.append('            glv_add_buffer_to_trace_packet(pHeader, (void**)(ppOutNow), sizeof(XGL_UPDATE_SAMPLERS), pInNow);')
+        hf_body.append('            XGL_UPDATE_SAMPLERS* pPacket = (XGL_UPDATE_SAMPLERS*)*ppOutNow;')
+        hf_body.append('            glv_add_buffer_to_trace_packet(pHeader, (void **) &pPacket->pSamplers, ((XGL_UPDATE_SAMPLERS*)pInNow)->count * sizeof(XGL_SAMPLER), ((XGL_UPDATE_SAMPLERS*)pInNow)->pSamplers);')
+        hf_body.append('            glv_finalize_buffer_address(pHeader, (void**)&(pPacket->pSamplers));')
+        hf_body.append('            ppOutNext = (XGL_UPDATE_SAMPLERS**)&(*ppOutNow)->pNext;')
+        hf_body.append('            glv_finalize_buffer_address(pHeader, (void**)(ppOutNow));')
+        hf_body.append('            break;')
+        hf_body.append('        }')
+        hf_body.append('        case XGL_STRUCTURE_TYPE_UPDATE_SAMPLER_TEXTURES:')
+        hf_body.append('        {')
+        #hf_body.append('            totalUpdateSize += sizeof(XGL_UPDATE_SAMPLER_TEXTURES) + ((XGL_UPDATE_SAMPLER_TEXTURES*)pNext)->count * (sizeof(XGL_SAMPLER_IMAGE_VIEW_INFO) + sizeof(XGL_IMAGE_VIEW_ATTACH_INFO));')
+        hf_body.append('            glv_add_buffer_to_trace_packet(pHeader, (void**)(ppOutNow), sizeof(XGL_UPDATE_SAMPLER_TEXTURES), pInNow);')
+        hf_body.append('            XGL_UPDATE_SAMPLER_TEXTURES* pPacket = (XGL_UPDATE_SAMPLER_TEXTURES*)*ppOutNow;')
+        hf_body.append('            glv_add_buffer_to_trace_packet(pHeader, (void **) &pPacket->pSamplerImageViews, ((XGL_UPDATE_SAMPLER_TEXTURES*)pInNow)->count * sizeof(XGL_SAMPLER_IMAGE_VIEW_INFO), ((XGL_UPDATE_SAMPLER_TEXTURES*)pInNow)->pSamplerImageViews);')
+        # TODO : This is still broken. How to update the original XGL_SAMPLER_IMAGE_VIEW_INFO struct ptrs to have correct address for newly added XGL_IMAGE_VIEW_ATTACH_INFO blocks below?
+        hf_body.append('            uint32_t i;')
+        hf_body.append('            for (i = 0; i < ((XGL_UPDATE_SAMPLER_TEXTURES*)pInNow)->count; i++) {')
+        hf_body.append('                glv_add_buffer_to_trace_packet(pHeader, (void **) &pPacket->pSamplerImageViews[i].pImageView, sizeof(XGL_IMAGE_VIEW_ATTACH_INFO), ((XGL_UPDATE_SAMPLER_TEXTURES*)pInNow)->pSamplerImageViews[i].pImageView);')
+        hf_body.append('                glv_finalize_buffer_address(pHeader, (void**)&(pPacket->pSamplerImageViews[i].pImageView));')
+        hf_body.append('            }')
+        hf_body.append('            glv_finalize_buffer_address(pHeader, (void**)&(pPacket->pSamplerImageViews));')
+        hf_body.append('            ppOutNext = (XGL_UPDATE_SAMPLERS**)&(*ppOutNow)->pNext;')
+        hf_body.append('            glv_finalize_buffer_address(pHeader, (void**)(ppOutNow));')
+        hf_body.append('            break;')
+        hf_body.append('        }')
+        hf_body.append('        case XGL_STRUCTURE_TYPE_UPDATE_IMAGES:')
+        hf_body.append('        {')
+        hf_body.append('            glv_add_buffer_to_trace_packet(pHeader, (void**)(ppOutNow), sizeof(XGL_UPDATE_IMAGES), pInNow);')
+        hf_body.append('            XGL_UPDATE_IMAGES* pPacket = (XGL_UPDATE_IMAGES*)*ppOutNow;')
+        hf_body.append('            uint32_t i;')
+        hf_body.append('            glv_add_buffer_to_trace_packet(pHeader, (void **) &pPacket->pImageViews, ((XGL_UPDATE_IMAGES*)pInNow)->count * sizeof(XGL_IMAGE_VIEW_ATTACH_INFO *), ((XGL_UPDATE_IMAGES*)pInNow)->pImageViews);')
+        hf_body.append('            for (i = 0; i < ((XGL_UPDATE_IMAGES*)pInNow)->count; i++) {')
+        hf_body.append('                glv_add_buffer_to_trace_packet(pHeader, (void **) &pPacket->pImageViews[i], sizeof(XGL_IMAGE_VIEW_ATTACH_INFO), ((XGL_UPDATE_IMAGES*)pInNow)->pImageViews[i]);')
+        hf_body.append('                glv_finalize_buffer_address(pHeader, (void**)&(pPacket->pImageViews[i]));')
+        hf_body.append('            }')
+        hf_body.append('            glv_finalize_buffer_address(pHeader, (void**)&(pPacket->pImageViews));')
+        hf_body.append('            ppOutNext = (XGL_UPDATE_SAMPLERS**)&(*ppOutNow)->pNext;')
+        hf_body.append('            glv_finalize_buffer_address(pHeader, (void**)(ppOutNow));')
+        hf_body.append('            break;')
+        hf_body.append('        }')
+        hf_body.append('        case XGL_STRUCTURE_TYPE_UPDATE_BUFFERS:')
+        hf_body.append('        {')
+        hf_body.append('            glv_add_buffer_to_trace_packet(pHeader, (void**)(ppOutNow), sizeof(XGL_UPDATE_BUFFERS), pInNow);')
+        hf_body.append('            XGL_UPDATE_BUFFERS* pPacket = (XGL_UPDATE_BUFFERS*)*ppOutNow;')
+        hf_body.append('            glv_add_buffer_to_trace_packet(pHeader, (void **) &pPacket->pBufferViews, ((XGL_UPDATE_BUFFERS*)pInNow)->count * sizeof(XGL_BUFFER_VIEW_ATTACH_INFO *), ((XGL_UPDATE_BUFFERS*)pInNow)->pBufferViews);')
+        hf_body.append('            uint32_t i;')
+        hf_body.append('            for (i = 0; i < ((XGL_UPDATE_BUFFERS*)pInNow)->count; i++) {')
+        hf_body.append('                glv_add_buffer_to_trace_packet(pHeader, (void **) &pPacket->pBufferViews[i], sizeof(XGL_BUFFER_VIEW_ATTACH_INFO), ((XGL_UPDATE_BUFFERS*)pInNow)->pBufferViews[i]);')
+        hf_body.append('                glv_finalize_buffer_address(pHeader, (void**)&(pPacket->pBufferViews[i]));')
+        hf_body.append('            }')
+        hf_body.append('            glv_finalize_buffer_address(pHeader, (void**)&(pPacket->pBufferViews));')
+        hf_body.append('            ppOutNext = (XGL_UPDATE_SAMPLERS**)&(*ppOutNow)->pNext;')
+        hf_body.append('            glv_finalize_buffer_address(pHeader, (void**)(ppOutNow));')
+        hf_body.append('            break;')
+        hf_body.append('        }')
+        hf_body.append('        case XGL_STRUCTURE_TYPE_UPDATE_AS_COPY:')
+        hf_body.append('        {')
+        hf_body.append('            glv_add_buffer_to_trace_packet(pHeader, (void**)(ppOutNow), sizeof(XGL_UPDATE_AS_COPY), pInNow);')
+        hf_body.append('            ppOutNext = (XGL_UPDATE_SAMPLERS**)&(*ppOutNow)->pNext;')
+        hf_body.append('            glv_finalize_buffer_address(pHeader, (void**)(ppOutNow));')
+        hf_body.append('            break;')
+        hf_body.append('        }')
+        hf_body.append('            default:')
+        hf_body.append('                assert(0);')
+        hf_body.append('        }')
+        hf_body.append('        pInNow = (XGL_UPDATE_SAMPLERS*)pInNow->pNext;')
+        hf_body.append('    }')
+        hf_body.append('    return;')
+        hf_body.append('}')
+        hf_body.append('')
+        pipe_state_list = ['IA_STATE_CREATE_INFO',
+                           'TESS_STATE_CREATE_INFO',
+                           'RS_STATE_CREATE_INFO',
+                           'DS_STATE_CREATE_INFO',
+                           'VP_STATE_CREATE_INFO',
+                           'MS_STATE_CREATE_INFO'
+                           ]
+        hf_body.append('static void add_pipeline_state_to_trace_packet(glv_trace_packet_header* pHeader, void** ppOut, const void* pIn)')
+        hf_body.append('{')
+        hf_body.append('    const XGL_GRAPHICS_PIPELINE_CREATE_INFO* pInNow = pIn;')
+        hf_body.append('    XGL_GRAPHICS_PIPELINE_CREATE_INFO** ppOutNext = (XGL_GRAPHICS_PIPELINE_CREATE_INFO**)ppOut;')
+        hf_body.append('    while (pInNow != NULL)')
+        hf_body.append('    {')
+        hf_body.append('        XGL_GRAPHICS_PIPELINE_CREATE_INFO** ppOutNow = ppOutNext;')
+        hf_body.append('        ppOutNext = NULL;')
+        hf_body.append('')
+        hf_body.append('        switch (pInNow->sType)')
+        hf_body.append('        {')
+        for pipe_state in pipe_state_list:
+            hf_body.append('            case XGL_STRUCTURE_TYPE_PIPELINE_%s:' % pipe_state)
+            hf_body.append('            {')
+            hf_body.append('                glv_add_buffer_to_trace_packet(pHeader, (void**)(ppOutNow), sizeof(XGL_PIPELINE_%s), pInNow);' % pipe_state)
+            hf_body.append('                ppOutNext = (XGL_GRAPHICS_PIPELINE_CREATE_INFO**)&(*ppOutNow)->pNext;')
+            hf_body.append('                glv_finalize_buffer_address(pHeader, (void**)(ppOutNow));')
+            hf_body.append('                break;')
+            hf_body.append('            }')
+        hf_body.append('            case XGL_STRUCTURE_TYPE_PIPELINE_CB_STATE_CREATE_INFO:')
+        hf_body.append('            {')
+        hf_body.append('                XGL_PIPELINE_CB_STATE_CREATE_INFO *pPacket = NULL;')
+        hf_body.append('                XGL_PIPELINE_CB_STATE_CREATE_INFO *pIn = NULL;')
+        hf_body.append('                glv_add_buffer_to_trace_packet(pHeader, (void**)(ppOutNow), sizeof(XGL_PIPELINE_CB_STATE_CREATE_INFO), pInNow);')
+        hf_body.append('                pPacket = (XGL_PIPELINE_CB_STATE_CREATE_INFO*) *ppOutNow;')
+        hf_body.append('                pIn = (XGL_PIPELINE_CB_STATE_CREATE_INFO*) pInNow;')
+        hf_body.append('                glv_add_buffer_to_trace_packet(pHeader, (void **) &pPacket->pAttachments, pIn->attachmentCount * sizeof(XGL_PIPELINE_CB_ATTACHMENT_STATE), pIn->pAttachments);')
+        hf_body.append('                glv_finalize_buffer_address(pHeader, (void**)&(pPacket->pAttachments));')
+        hf_body.append('                ppOutNext = (XGL_GRAPHICS_PIPELINE_CREATE_INFO**)&(*ppOutNow)->pNext;')
+        hf_body.append('                glv_finalize_buffer_address(pHeader, (void**)(ppOutNow));')
+        hf_body.append('                break;')
+        hf_body.append('            }')
+        hf_body.append('            case XGL_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO:')
+        hf_body.append('            {')
+        hf_body.append('                XGL_PIPELINE_SHADER_STAGE_CREATE_INFO* pPacket = NULL;')
+        hf_body.append('                XGL_PIPELINE_SHADER_STAGE_CREATE_INFO* pInPacket = NULL;')
+        hf_body.append('                glv_add_buffer_to_trace_packet(pHeader, (void**)(ppOutNow), sizeof(XGL_PIPELINE_SHADER_STAGE_CREATE_INFO), pInNow);')
+        hf_body.append('                pPacket = (XGL_PIPELINE_SHADER_STAGE_CREATE_INFO*) *ppOutNow;')
+        hf_body.append('                pInPacket = (XGL_PIPELINE_SHADER_STAGE_CREATE_INFO*) pInNow;')
+        hf_body.append('                add_pipeline_shader_to_trace_packet(pHeader, &pPacket->shader, &pInPacket->shader);')
+        hf_body.append('                finalize_pipeline_shader_address(pHeader, &pPacket->shader);')
+        hf_body.append('                ppOutNext = (XGL_GRAPHICS_PIPELINE_CREATE_INFO**)&(*ppOutNow)->pNext;')
+        hf_body.append('                glv_finalize_buffer_address(pHeader, (void**)(ppOutNow));')
+        hf_body.append('                break;')
+        hf_body.append('            }')
+        hf_body.append('            case XGL_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_CREATE_INFO:')
+        hf_body.append('            {')
+        hf_body.append('                XGL_PIPELINE_VERTEX_INPUT_CREATE_INFO *pPacket = NULL;')
+        hf_body.append('                XGL_PIPELINE_VERTEX_INPUT_CREATE_INFO *pIn = NULL;')
+        hf_body.append('                glv_add_buffer_to_trace_packet(pHeader, (void**)(ppOutNow), sizeof(XGL_PIPELINE_VERTEX_INPUT_CREATE_INFO), pInNow);')
+        hf_body.append('                pPacket = (XGL_PIPELINE_VERTEX_INPUT_CREATE_INFO*) *ppOutNow;')
+        hf_body.append('                pIn = (XGL_PIPELINE_VERTEX_INPUT_CREATE_INFO*) pInNow;')
+        hf_body.append('                glv_add_buffer_to_trace_packet(pHeader, (void **) &pPacket->pVertexBindingDescriptions, pIn->bindingCount * sizeof(XGL_VERTEX_INPUT_BINDING_DESCRIPTION), pIn->pVertexBindingDescriptions);')
+        hf_body.append('                glv_finalize_buffer_address(pHeader, (void**)&(pPacket->pVertexBindingDescriptions));')
+        hf_body.append('                glv_add_buffer_to_trace_packet(pHeader, (void **) &pPacket->pVertexAttributeDescriptions, pIn->attributeCount * sizeof(XGL_VERTEX_INPUT_ATTRIBUTE_DESCRIPTION), pIn->pVertexAttributeDescriptions);')
+        hf_body.append('                glv_finalize_buffer_address(pHeader, (void**)&(pPacket->pVertexAttributeDescriptions));')
+        hf_body.append('                ppOutNext = (XGL_GRAPHICS_PIPELINE_CREATE_INFO**)&(*ppOutNow)->pNext;')
+        hf_body.append('                glv_finalize_buffer_address(pHeader, (void**)(ppOutNow));')
+        hf_body.append('                break;')
+        hf_body.append('            }')
+        hf_body.append('            default:')
+        hf_body.append('                assert(!"Encountered an unexpected type in pipeline state list");')
+        hf_body.append('        }')
+        hf_body.append('        pInNow = (XGL_GRAPHICS_PIPELINE_CREATE_INFO*)pInNow->pNext;')
+        hf_body.append('    }')
+        hf_body.append('    return;')
+        hf_body.append('}')
+        return "\n".join(hf_body)
+
+    def _generate_packet_id_enum(self):
+        pid_enum = []
+        pid_enum.append('enum GLV_TRACE_PACKET_ID_XGL')
+        pid_enum.append('{')
+        first_func = True
+        for proto in self.protos:
+            if first_func:
+                first_func = False
+                pid_enum.append('    GLV_TPI_XGL_xglApiVersion = GLV_TPI_BEGIN_API_HERE,')
+                pid_enum.append('    GLV_TPI_XGL_xgl%s,' % proto.name)
+            else:
+                pid_enum.append('    GLV_TPI_XGL_xgl%s,' % proto.name)
+        pid_enum.append('};\n')
+        return "\n".join(pid_enum)
+
+    def _generate_stringify_func(self):
+        func_body = []
+        func_body.append('static const char *stringify_xgl_packet_id(const enum GLV_TRACE_PACKET_ID_XGL id, const glv_trace_packet_header* pHeader)')
+        func_body.append('{')
+        func_body.append('    static char str[1024];')
+        func_body.append('    switch(id) {')
+        func_body.append('    case GLV_TPI_XGL_xglApiVersion:')
+        func_body.append('    {')
+        func_body.append('        struct_xglApiVersion* pPacket = (struct_xglApiVersion*)(pHeader->pBody);')
+        func_body.append('        snprintf(str, 1024, "xglApiVersion = 0x%x", pPacket->version);')
+        func_body.append('        return str;')
+        func_body.append('    }')
+        for proto in self.protos:
+            func_body.append('    case GLV_TPI_XGL_xgl%s:' % proto.name)
+            func_body.append('    {')
+            func_str = 'xgl%s(' % proto.name
+            print_vals = ''
+            create_func = False
+            if 'Create' in proto.name or 'Alloc' in proto.name or 'MapMemory' in proto.name:
+                create_func = True
+            for p in proto.params:
+                last_param = False
+                if (p.name == proto.params[-1].name):
+                    last_param = True
+                if last_param and create_func: # last param of create func
+                    (pft, pfi, ptr) = self._get_printf_params(p.ty,'pPacket->%s' % p.name, True)
+                else:
+                    (pft, pfi, ptr) = self._get_printf_params(p.ty, 'pPacket->%s' % p.name, False)
+                if last_param == True:
+                    func_str += '%s%s = %s)' % (ptr, p.name, pft)
+                    print_vals += ', %s' % (pfi)
+                else:
+                    func_str += '%s%s = %s, ' % (ptr, p.name, pft)
+                    print_vals += ', %s' % (pfi)
+            func_body.append('        struct_xgl%s* pPacket = (struct_xgl%s*)(pHeader->pBody);' % (proto.name, proto.name))
+            func_body.append('        snprintf(str, 1024, "%s"%s);' % (func_str, print_vals))
+            func_body.append('        return str;')
+            func_body.append('    }')
+        func_body.append('    default:')
+        func_body.append('        return NULL;')
+        func_body.append('    }')
+        func_body.append('};\n')
+        return "\n".join(func_body)
+
+    def _generate_interp_func(self):
+        interp_func_body = []
+        interp_func_body.append('static glv_trace_packet_header* interpret_trace_packet_xgl(glv_trace_packet_header* pHeader)')
+        interp_func_body.append('{')
+        interp_func_body.append('    if (pHeader == NULL)')
+        interp_func_body.append('    {')
+        interp_func_body.append('        return NULL;')
+        interp_func_body.append('    }')
+        interp_func_body.append('    switch (pHeader->packet_id)')
+        interp_func_body.append('    {')
+        interp_func_body.append('        case GLV_TPI_XGL_xglApiVersion:\n        {')
+        interp_func_body.append('            return interpret_body_as_xglApiVersion(pHeader, TRUE)->header;\n        }')
+        for proto in self.protos:
+            interp_func_body.append('        case GLV_TPI_XGL_xgl%s:\n        {' % proto.name)
+            header_prefix = 'h'
+            if 'Wsi' in proto.name or 'Dbg' in proto.name:
+                header_prefix = 'pH'
+            interp_func_body.append('            return interpret_body_as_xgl%s(pHeader)->%seader;\n        }' % (proto.name, header_prefix))
+        interp_func_body.append('        default:')
+        interp_func_body.append('            return NULL;')
+        interp_func_body.append('    }')
+        interp_func_body.append('    return NULL;')
+        interp_func_body.append('}')
+        return "\n".join(interp_func_body)
+
+    def _generate_struct_util_funcs(self):
+        pid_enum = []
+        pid_enum.append('//=============================================================================')
+        pid_enum.append('static void add_XGL_APPLICATION_INFO_to_packet(glv_trace_packet_header*  pHeader, XGL_APPLICATION_INFO** ppStruct, const XGL_APPLICATION_INFO *pInStruct)')
+        pid_enum.append('{')
+        pid_enum.append('    glv_add_buffer_to_trace_packet(pHeader, (void**)ppStruct, sizeof(XGL_APPLICATION_INFO), pInStruct);')
+        pid_enum.append('    glv_add_buffer_to_trace_packet(pHeader, (void**)&((*ppStruct)->pAppName), strlen(pInStruct->pAppName) + 1, pInStruct->pAppName);')
+        pid_enum.append('    glv_add_buffer_to_trace_packet(pHeader, (void**)&((*ppStruct)->pEngineName), strlen(pInStruct->pEngineName) + 1, pInStruct->pEngineName);')
+        pid_enum.append('    glv_finalize_buffer_address(pHeader, (void**)&((*ppStruct)->pAppName));')
+        pid_enum.append('    glv_finalize_buffer_address(pHeader, (void**)&((*ppStruct)->pEngineName));')
+        pid_enum.append('    glv_finalize_buffer_address(pHeader, (void**)&*ppStruct);')
+        pid_enum.append('};\n')
+        pid_enum.append('//=============================================================================\n')
+        pid_enum.append('static void add_XGL_DEVICE_CREATE_INFO_to_packet(glv_trace_packet_header*  pHeader, XGL_DEVICE_CREATE_INFO** ppStruct, const XGL_DEVICE_CREATE_INFO *pInStruct)')
+        pid_enum.append('{')
+        pid_enum.append('    uint32_t i;')
+        pid_enum.append('    glv_add_buffer_to_trace_packet(pHeader, (void**)ppStruct, sizeof(XGL_DEVICE_CREATE_INFO), pInStruct);')
+        pid_enum.append('    glv_add_buffer_to_trace_packet(pHeader, (void**)&(*ppStruct)->pRequestedQueues, pInStruct->queueRecordCount*sizeof(XGL_DEVICE_QUEUE_CREATE_INFO), pInStruct->pRequestedQueues);')
+        pid_enum.append('    glv_finalize_buffer_address(pHeader, (void**)&(*ppStruct)->pRequestedQueues);')
+        pid_enum.append('    if (pInStruct->extensionCount > 0) ')
+        pid_enum.append('    {')
+        pid_enum.append('        glv_add_buffer_to_trace_packet(pHeader, (void**)(&(*ppStruct)->ppEnabledExtensionNames), pInStruct->extensionCount * sizeof(char *), pInStruct->ppEnabledExtensionNames);')
+        pid_enum.append('        for (i = 0; i < pInStruct->extensionCount; i++)')
+        pid_enum.append('        {')
+        pid_enum.append('            glv_add_buffer_to_trace_packet(pHeader, (void**)(&((*ppStruct)->ppEnabledExtensionNames[i])), strlen(pInStruct->ppEnabledExtensionNames[i]) + 1, pInStruct->ppEnabledExtensionNames[i]);')
+        pid_enum.append('            glv_finalize_buffer_address(pHeader, (void**)(&((*ppStruct)->ppEnabledExtensionNames[i])));')
+        pid_enum.append('        }')
+        pid_enum.append('        glv_finalize_buffer_address(pHeader, (void **)&(*ppStruct)->ppEnabledExtensionNames);')
+        pid_enum.append('    }')
+        pid_enum.append('    XGL_LAYER_CREATE_INFO *pNext = ( XGL_LAYER_CREATE_INFO *) pInStruct->pNext;')
+        pid_enum.append('    while (pNext != NULL)')
+        pid_enum.append('    {')
+        pid_enum.append('        if ((pNext->sType == XGL_STRUCTURE_TYPE_LAYER_CREATE_INFO) && pNext->layerCount > 0)')
+        pid_enum.append('        {')
+        pid_enum.append('            glv_add_buffer_to_trace_packet(pHeader, (void**)(&((*ppStruct)->pNext)), sizeof(XGL_LAYER_CREATE_INFO), pNext);')
+        pid_enum.append('            glv_finalize_buffer_address(pHeader, (void**)(&((*ppStruct)->pNext)));')
+        pid_enum.append('            XGL_LAYER_CREATE_INFO **ppOutStruct = (XGL_LAYER_CREATE_INFO **) &((*ppStruct)->pNext);')
+        pid_enum.append('            glv_add_buffer_to_trace_packet(pHeader, (void**)(&(*ppOutStruct)->ppActiveLayerNames), pNext->layerCount * sizeof(char *), pNext->ppActiveLayerNames);')
+        pid_enum.append('            for (i = 0; i < pNext->layerCount; i++)')
+        pid_enum.append('            {')
+        pid_enum.append('                glv_add_buffer_to_trace_packet(pHeader, (void**)(&((*ppOutStruct)->ppActiveLayerNames[i])), strlen(pNext->ppActiveLayerNames[i]) + 1, pNext->ppActiveLayerNames[i]);')
+        pid_enum.append('                glv_finalize_buffer_address(pHeader, (void**)(&((*ppOutStruct)->ppActiveLayerNames[i])));')
+        pid_enum.append('            }')
+        pid_enum.append('            glv_finalize_buffer_address(pHeader, (void **)&(*ppOutStruct)->ppActiveLayerNames);')
+        pid_enum.append('        }')
+        pid_enum.append('        pNext = ( XGL_LAYER_CREATE_INFO *) pNext->pNext;')
+        pid_enum.append('    }')
+        pid_enum.append('    glv_finalize_buffer_address(pHeader, (void**)ppStruct);')
+        pid_enum.append('}\n')
+        pid_enum.append('static XGL_DEVICE_CREATE_INFO* interpret_XGL_DEVICE_CREATE_INFO(glv_trace_packet_header*  pHeader, intptr_t ptr_variable)')
+        pid_enum.append('{')
+        pid_enum.append('    XGL_DEVICE_CREATE_INFO* pXGL_DEVICE_CREATE_INFO = (XGL_DEVICE_CREATE_INFO*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)ptr_variable);\n')
+        pid_enum.append('    if (pXGL_DEVICE_CREATE_INFO != NULL)')
+        pid_enum.append('    {')
+        pid_enum.append('            uint32_t i;')
+        pid_enum.append('            const char** pNames;')
+        pid_enum.append('        pXGL_DEVICE_CREATE_INFO->pRequestedQueues = (const XGL_DEVICE_QUEUE_CREATE_INFO*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pXGL_DEVICE_CREATE_INFO->pRequestedQueues);\n')
+        pid_enum.append('        if (pXGL_DEVICE_CREATE_INFO->extensionCount > 0)')
+        pid_enum.append('        {')
+        pid_enum.append('            pXGL_DEVICE_CREATE_INFO->ppEnabledExtensionNames = (const char *const*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pXGL_DEVICE_CREATE_INFO->ppEnabledExtensionNames);')
+        pid_enum.append('            pNames = (const char**)pXGL_DEVICE_CREATE_INFO->ppEnabledExtensionNames;')
+        pid_enum.append('            for (i = 0; i < pXGL_DEVICE_CREATE_INFO->extensionCount; i++)')
+        pid_enum.append('            {')
+        pid_enum.append('                pNames[i] = (const char*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)(pXGL_DEVICE_CREATE_INFO->ppEnabledExtensionNames[i]));')
+        pid_enum.append('            }')
+        pid_enum.append('        }')
+        pid_enum.append('        XGL_LAYER_CREATE_INFO *pNext = ( XGL_LAYER_CREATE_INFO *) glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pXGL_DEVICE_CREATE_INFO->pNext);')
+        pid_enum.append('        while (pNext != NULL)')
+        pid_enum.append('        {')
+        pid_enum.append('            if ((pNext->sType == XGL_STRUCTURE_TYPE_LAYER_CREATE_INFO) && pNext->layerCount > 0)')
+        pid_enum.append('            {')
+        pid_enum.append('                pNext->ppActiveLayerNames = (const char**) glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)(pNext->ppActiveLayerNames));')
+        pid_enum.append('                pNames = (const char**)pNext->ppActiveLayerNames;')
+        pid_enum.append('                for (i = 0; i < pNext->layerCount; i++)')
+        pid_enum.append('                {')
+        pid_enum.append('                    pNames[i] = (const char*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)(pNext->ppActiveLayerNames[i]));')
+        pid_enum.append('                }')
+        pid_enum.append('            }')
+        pid_enum.append('            pNext = ( XGL_LAYER_CREATE_INFO *) glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pNext->pNext);')
+        pid_enum.append('        }')
+        pid_enum.append('    }\n')
+        pid_enum.append('    return pXGL_DEVICE_CREATE_INFO;')
+        pid_enum.append('}\n')
+        pid_enum.append('static void interpret_pipeline_shader(glv_trace_packet_header*  pHeader, XGL_PIPELINE_SHADER* pShader)')
+        pid_enum.append('{')
+        pid_enum.append('    if (pShader != NULL)')
+        pid_enum.append('    {')
+        pid_enum.append('        // constant buffers')
+        pid_enum.append('        if (pShader->linkConstBufferCount > 0)')
+        pid_enum.append('        {')
+        pid_enum.append('            uint32_t i;')
+        pid_enum.append('            pShader->pLinkConstBufferInfo = (const XGL_LINK_CONST_BUFFER*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pShader->pLinkConstBufferInfo);')
+        pid_enum.append('            for (i = 0; i < pShader->linkConstBufferCount; i++)')
+        pid_enum.append('            {')
+        pid_enum.append('                XGL_LINK_CONST_BUFFER* pBuffer = (XGL_LINK_CONST_BUFFER*)pShader->pLinkConstBufferInfo;')
+        pid_enum.append('                pBuffer[i].pBufferData = (const void*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pShader->pLinkConstBufferInfo[i].pBufferData);')
+        pid_enum.append('            }')
+        pid_enum.append('        }')
+        pid_enum.append('    }')
+        pid_enum.append('}\n')
+        pid_enum.append('//=============================================================================')
+        return "\n".join(pid_enum)
+
+    # Interpret functions used on replay to read in packets and interpret their contents
+    #  This code gets generated into glvtrace_xgl_xgl_structs.h file
+    def _generate_interp_funcs(self):
+        # Custom txt for given function and parameter.  First check if param is NULL, then insert txt if not
+        # TODO : This code is now too large and complex, need to make codegen smarter for pointers embedded in struct params to handle those cases automatically
+        custom_case_dict = { 'CreateInstance' : {'param': 'pAppInfo', 'txt': ['XGL_APPLICATION_INFO* pInfo = (XGL_APPLICATION_INFO*)pPacket->pAppInfo;\n',
+                                                       'pInfo->pAppName = (const char*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pAppInfo->pAppName);\n',
+                                                       'pInfo->pEngineName = (const char*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pAppInfo->pEngineName);']},
+                             'CreateShader' : {'param': 'pCreateInfo', 'txt': ['XGL_SHADER_CREATE_INFO* pInfo = (XGL_SHADER_CREATE_INFO*)pPacket->pCreateInfo;\n',
+                                               'pInfo->pCode = glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pCreateInfo->pCode);']},
+                             'CreateDynamicViewportState' : {'param': 'pCreateInfo', 'txt': ['XGL_DYNAMIC_VP_STATE_CREATE_INFO* pInfo = (XGL_DYNAMIC_VP_STATE_CREATE_INFO*)pPacket->pCreateInfo;\n',
+                                                                                             'pInfo->pViewports = (XGL_VIEWPORT*) glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pCreateInfo->pViewports);\n',
+                                                                                             'pInfo->pScissors = (XGL_RECT*) glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pCreateInfo->pScissors);']},
+                             'CreateFramebuffer' : {'param': 'pCreateInfo', 'txt': ['XGL_FRAMEBUFFER_CREATE_INFO* pInfo = (XGL_FRAMEBUFFER_CREATE_INFO*)pPacket->pCreateInfo;\n',
+                                                    'pInfo->pColorAttachments = (XGL_COLOR_ATTACHMENT_BIND_INFO*) glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pCreateInfo->pColorAttachments);\n',
+                                                    'pInfo->pDepthStencilAttachment = (XGL_DEPTH_STENCIL_BIND_INFO*) glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pCreateInfo->pDepthStencilAttachment);\n']},
+                             'CreateRenderPass' : {'param': 'pCreateInfo', 'txt': ['XGL_RENDER_PASS_CREATE_INFO* pInfo = (XGL_RENDER_PASS_CREATE_INFO*)pPacket->pCreateInfo;\n',
+                                                   'pInfo->pColorLoadOps = (XGL_ATTACHMENT_LOAD_OP*) glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pCreateInfo->pColorLoadOps);\n',
+                                                   'pInfo->pColorStoreOps = (XGL_ATTACHMENT_STORE_OP*) glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pCreateInfo->pColorStoreOps);\n',
+                                                   'pInfo->pColorLoadClearValues = (XGL_CLEAR_COLOR*) glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pCreateInfo->pColorLoadClearValues);\n']},
+                             'CreateDescriptorRegion' : {'param': 'pCreateInfo', 'txt': ['XGL_DESCRIPTOR_REGION_CREATE_INFO* pInfo = (XGL_DESCRIPTOR_REGION_CREATE_INFO*)pPacket->pCreateInfo;\n',
+                                                                                             'pInfo->pTypeCount = (XGL_DESCRIPTOR_TYPE_COUNT*) glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pCreateInfo->pTypeCount);\n']},
+                             'CmdWaitEvents' : {'param': 'pWaitInfo', 'txt': ['XGL_EVENT_WAIT_INFO* pInfo = (XGL_EVENT_WAIT_INFO*)pPacket->pWaitInfo;\n',
+                                                                          'pInfo->pEvents = (XGL_EVENT*) glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pWaitInfo->pEvents);\n',
+                                                                          'pInfo->ppMemBarriers = (const void**) glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pWaitInfo->ppMemBarriers);\n',
+                                                                          'uint32_t i;\n',
+                                                                          'for (i = 0; i < pInfo->memBarrierCount; i++) {\n',
+                                                                          '    void** ppLocalMemBarriers = (void**)&pInfo->ppMemBarriers[i];\n',
+                                                                          '    *ppLocalMemBarriers = (void*) glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pInfo->ppMemBarriers[i]);\n',
+                                                                          '}']},
+                             'CmdPipelineBarrier' : {'param': 'pBarrier', 'txt': ['XGL_PIPELINE_BARRIER* pBarrier = (XGL_PIPELINE_BARRIER*)pPacket->pBarrier;\n',
+                                                                          'pBarrier->pEvents = (XGL_SET_EVENT*) glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pBarrier->pEvents);\n',
+                                                                          'pBarrier->ppMemBarriers = (const void**) glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pBarrier->ppMemBarriers);\n',
+                                                                          'uint32_t i;\n',
+                                                                          'for (i = 0; i < pBarrier->memBarrierCount; i++) {\n',
+                                                                          '    void** ppLocalMemBarriers = (void**)&pBarrier->ppMemBarriers[i];\n',
+                                                                          '    *ppLocalMemBarriers = (void*) glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pBarrier->ppMemBarriers[i]);\n',
+                                                                          '}']},
+                             'CreateDescriptorSetLayout' : {'param': 'pSetLayoutInfoList', 'txt': ['if (pPacket->pSetLayoutInfoList->sType == XGL_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO) {\n',
+                                                                                         '    // need to make a non-const pointer to the pointer so that we can properly change the original pointer to the interpretted one\n',
+                                                                                         '    void** ppNextVoidPtr = (void**)&(pPacket->pSetLayoutInfoList->pNext);\n',
+                                                                                         '    *ppNextVoidPtr = (void*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pSetLayoutInfoList->pNext);\n',
+                                                                                         '    XGL_DESCRIPTOR_SET_LAYOUT_CREATE_INFO* pNext = (XGL_DESCRIPTOR_SET_LAYOUT_CREATE_INFO*)pPacket->pSetLayoutInfoList->pNext;\n',
+                                                                                         '    while (NULL != pNext)\n', '    {\n',
+                                                                                         '        switch(pNext->sType)\n', '        {\n',
+                                                                                         '            case XGL_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO:\n',
+                                                                                         '            {\n' ,
+                                                                                         '                void** ppNextVoidPtr = (void**)&pNext->pNext;\n',
+                                                                                         '                *ppNextVoidPtr = (void*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pNext->pNext);\n',
+                                                                                         '                break;\n',
+                                                                                         '            }\n',
+                                                                                         '            default:\n',
+                                                                                         '            {\n',
+                                                                                         '                glv_LogError("Encountered an unexpected type in descriptor set layout create list.\\n");\n',
+                                                                                         '                pPacket->header = NULL;\n',
+                                                                                         '                pNext->pNext = NULL;\n',
+                                                                                         '            }\n',
+                                                                                         '        }\n',
+                                                                                         '        pNext = (XGL_DESCRIPTOR_SET_LAYOUT_CREATE_INFO*)pNext->pNext;\n',
+                                                                                         '     }\n',
+                                                                                         '} else {\n',
+                                                                                         '     // This is unexpected.\n',
+                                                                                         '     glv_LogError("CreateDescriptorSetLayout must have LayoutInfoList stype of XGL_STRCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO\\n");\n',
+                                                                                         '     pPacket->header = NULL;\n',
+                                                                                         '}']},
+                             'BeginCommandBuffer' : {'param': 'pBeginInfo', 'txt': ['if (pPacket->pBeginInfo->sType == XGL_STRUCTURE_TYPE_CMD_BUFFER_BEGIN_INFO) {\n',
+                                                                                         '    // need to make a non-const pointer to the pointer so that we can properly change the original pointer to the interpretted one\n',
+                                                                                         '    XGL_CMD_BUFFER_GRAPHICS_BEGIN_INFO** ppNext = (XGL_CMD_BUFFER_GRAPHICS_BEGIN_INFO**)&(pPacket->pBeginInfo->pNext);\n',
+                                                                                         '    *ppNext = (XGL_CMD_BUFFER_GRAPHICS_BEGIN_INFO*) glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pBeginInfo->pNext);\n',
+                                                                                         '    XGL_CMD_BUFFER_GRAPHICS_BEGIN_INFO* pNext = *ppNext;\n',
+                                                                                         '    while (NULL != pNext)\n', '    {\n',
+                                                                                         '        switch(pNext->sType)\n', '        {\n',
+                                                                                         '            case XGL_STRUCTURE_TYPE_CMD_BUFFER_GRAPHICS_BEGIN_INFO:\n',
+                                                                                         '            {\n',
+                                                                                         '                ppNext = (XGL_CMD_BUFFER_GRAPHICS_BEGIN_INFO**) &pNext->pNext;\n',
+                                                                                         '                *ppNext = (XGL_CMD_BUFFER_GRAPHICS_BEGIN_INFO*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pNext->pNext);\n',
+                                                                                         '                break;\n',
+                                                                                         '            }\n',
+                                                                                         '            default:\n',
+                                                                                         '            {\n',
+                                                                                         '                glv_LogError("Encountered an unexpected type in begin command buffer list.\\n");\n',
+                                                                                         '                pPacket->header = NULL;\n',
+                                                                                         '                pNext->pNext = NULL;\n',
+                                                                                         '            }\n',
+                                                                                         '        }\n',
+                                                                                         '        pNext = (XGL_CMD_BUFFER_GRAPHICS_BEGIN_INFO*)pNext->pNext;\n',
+                                                                                         '    }\n',
+                                                                                         '} else {\n',
+                                                                                         '    // This is unexpected.\n',
+                                                                                         '    glv_LogError("BeginCommandBuffer must have BeginInfo stype of XGL_STRUCTURE_TYPE_CMD_BUFFER_BEGIN_INFO.\\n");\n',
+                                                                                         '    pPacket->header = NULL;\n',
+                                                                                         '}']},
+                             'AllocMemory' : {'param': 'pAllocInfo', 'txt': ['if (pPacket->pAllocInfo->sType == XGL_STRUCTURE_TYPE_MEMORY_ALLOC_INFO) {\n',
+                                                                                         '    XGL_MEMORY_ALLOC_INFO** ppNext = (XGL_MEMORY_ALLOC_INFO**) &(pPacket->pAllocInfo->pNext);\n',
+                                                                                         '    *ppNext = (XGL_MEMORY_ALLOC_INFO*) glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pAllocInfo->pNext);\n',
+                                                                                         '    XGL_MEMORY_ALLOC_INFO* pNext = (XGL_MEMORY_ALLOC_INFO*) *ppNext;\n',
+                                                                                         '    while (NULL != pNext)\n', '    {\n',
+                                                                                         '        switch(pNext->sType)\n', '        {\n',
+                                                                                         '            case XGL_STRUCTURE_TYPE_MEMORY_ALLOC_BUFFER_INFO:\n',
+                                                                                         '            case XGL_STRUCTURE_TYPE_MEMORY_ALLOC_IMAGE_INFO:\n',
+                                                                                         '            {\n',
+                                                                                         '                ppNext = (XGL_MEMORY_ALLOC_INFO **) &(pNext->pNext);\n',
+                                                                                         '                *ppNext = (XGL_MEMORY_ALLOC_INFO*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pNext->pNext);\n',
+                                                                                         '                break;\n',
+                                                                                         '            }\n',
+                                                                                         '            default:\n',
+                                                                                         '            {\n',
+                                                                                         '               glv_LogError("Encountered an unexpected type alloc memory list.\\n");\n',
+                                                                                         '               pPacket->header = NULL;\n',
+                                                                                         '               pNext->pNext = NULL;\n',
+                                                                                         '            }\n',
+                                                                                         '        }\n',
+                                                                                         '        pNext = (XGL_MEMORY_ALLOC_INFO*)pNext->pNext;\n',
+                                                                                         '    }\n',
+                                                                                         '} else {\n',
+                                                                                         '    // This is unexpected.\n',
+                                                                                         '    glv_LogError("AllocMemory must have AllocInfo stype of XGL_STRUCTURE_TYPE_MEMORY_ALLOC_INFO.\\n");\n',
+                                                                                         '    pPacket->header = NULL;\n',
+                                                                                         '}']},
+                             'UpdateDescriptors' : {'param': 'pUpdateChain', 'txt': ['XGL_UPDATE_SAMPLERS* pNext = (XGL_UPDATE_SAMPLERS*)pPacket->pUpdateChain;\n',
+                                                                                         'while ((NULL != pNext) && (XGL_NULL_HANDLE != pNext))\n', '{\n',
+                                                                                         '    switch(pNext->sType)\n', '    {\n',
+                                                                                         '        case XGL_STRUCTURE_TYPE_UPDATE_AS_COPY:\n',
+                                                                                         '        {\n',
+                                                                                         '            void** ppNextVoidPtr = (void**)&pNext->pNext;\n',
+                                                                                         '            *ppNextVoidPtr = (void*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pNext->pNext);\n',
+                                                                                         '            break;\n',
+                                                                                         '        }\n',
+                                                                                         '        case XGL_STRUCTURE_TYPE_UPDATE_SAMPLERS:\n',
+                                                                                         '        {\n',
+                                                                                         '            void** ppNextVoidPtr = (void**)&pNext->pNext;\n',
+                                                                                         '            XGL_UPDATE_SAMPLERS* pUS = (XGL_UPDATE_SAMPLERS*)pNext;\n',
+                                                                                         '            *ppNextVoidPtr = (void*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pNext->pNext);\n',
+                                                                                         '            pUS->pSamplers = (XGL_SAMPLER*) glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pUS->pSamplers);\n',
+                                                                                         '            break;\n',
+                                                                                         '        }\n',
+                                                                                         '        case XGL_STRUCTURE_TYPE_UPDATE_SAMPLER_TEXTURES:\n',
+                                                                                         '        {\n',
+                                                                                         '            void** ppNextVoidPtr = (void**)&pNext->pNext;\n',
+                                                                                         '            XGL_UPDATE_SAMPLER_TEXTURES* pUST = (XGL_UPDATE_SAMPLER_TEXTURES*)pNext;\n',
+                                                                                         '            *ppNextVoidPtr = (void*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pNext->pNext);\n',
+                                                                                         '            pUST->pSamplerImageViews = (XGL_SAMPLER_IMAGE_VIEW_INFO*) glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pUST->pSamplerImageViews);\n',
+                                                                                         '            uint32_t i;\n',
+                                                                                         '            for (i = 0; i < pUST->count; i++) {\n',
+                                                                                         '                XGL_IMAGE_VIEW_ATTACH_INFO** ppLocalImageView = (XGL_IMAGE_VIEW_ATTACH_INFO**)&pUST->pSamplerImageViews[i].pImageView;\n',
+                                                                                         '                *ppLocalImageView = (XGL_IMAGE_VIEW_ATTACH_INFO*) glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pUST->pSamplerImageViews[i].pImageView);\n',
+                                                                                         '            }\n',
+                                                                                         '            break;\n',
+                                                                                         '        }\n',
+                                                                                         '        case XGL_STRUCTURE_TYPE_UPDATE_IMAGES:\n',
+                                                                                         '        {\n',
+                                                                                         '            void** ppNextVoidPtr = (void**)&pNext->pNext;\n',
+                                                                                         '            XGL_UPDATE_IMAGES* pUI = (XGL_UPDATE_IMAGES*)pNext;\n',
+                                                                                         '            *ppNextVoidPtr = (void*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pNext->pNext);\n',
+                                                                                         '            XGL_IMAGE_VIEW_ATTACH_INFO** ppLocalImageView = (XGL_IMAGE_VIEW_ATTACH_INFO**)&pUI->pImageViews;\n',
+                                                                                         '            *ppLocalImageView = (XGL_IMAGE_VIEW_ATTACH_INFO*) glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pUI->pImageViews);\n',
+                                                                                         '            uint32_t i;\n',
+                                                                                         '            for (i = 0; i < pUI->count; i++) {\n',
+                                                                                         '                XGL_IMAGE_VIEW_ATTACH_INFO** ppLocalImageViews = (XGL_IMAGE_VIEW_ATTACH_INFO**)&pUI->pImageViews[i];\n',
+                                                                                         '                *ppLocalImageViews = (XGL_IMAGE_VIEW_ATTACH_INFO*) glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pUI->pImageViews[i]);\n',
+                                                                                         '            }\n',
+                                                                                         '            break;\n',
+                                                                                         '        }\n',
+                                                                                         '        case XGL_STRUCTURE_TYPE_UPDATE_BUFFERS:\n',
+                                                                                         '        {\n',
+                                                                                         '            void** ppNextVoidPtr = (void**)&pNext->pNext;\n',
+                                                                                         '            XGL_UPDATE_BUFFERS* pUB = (XGL_UPDATE_BUFFERS*)pNext;\n',
+                                                                                         '            *ppNextVoidPtr = (void*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pNext->pNext);\n',
+                                                                                         '            XGL_BUFFER_VIEW_ATTACH_INFO** ppLocalBufferView = (XGL_BUFFER_VIEW_ATTACH_INFO**)&pUB->pBufferViews;\n',
+                                                                                         '            *ppLocalBufferView = (XGL_BUFFER_VIEW_ATTACH_INFO*) glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pUB->pBufferViews);\n',
+                                                                                         '            uint32_t i;\n',
+                                                                                         '            for (i = 0; i < pUB->count; i++) {\n',
+                                                                                         '                XGL_BUFFER_VIEW_ATTACH_INFO** ppLocalBufferViews = (XGL_BUFFER_VIEW_ATTACH_INFO**)&pUB->pBufferViews[i];\n',
+                                                                                         '                *ppLocalBufferViews = (XGL_BUFFER_VIEW_ATTACH_INFO*) glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pUB->pBufferViews[i]);\n',
+                                                                                         '            }\n',
+                                                                                         '            break;\n',
+                                                                                         '        }\n',
+                                                                                         '        default:\n',
+                                                                                         '        {\n',
+                                                                                         '           glv_LogError("Encountered an unexpected type in update descriptors pUpdateChain.\\n");\n',
+                                                                                         '           pPacket->header = NULL;\n',
+                                                                                         '           pNext->pNext = NULL;\n',
+                                                                                         '        }\n',
+                                                                                         '    }\n',
+                                                                                         '    pNext = (XGL_UPDATE_SAMPLERS*)pNext->pNext;\n',
+                                                                                         '}']},
+                             'CreateGraphicsPipeline' : {'param': 'pCreateInfo', 'txt': ['if (pPacket->pCreateInfo->sType == XGL_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO) {\n',
+                                                                                         '    // need to make a non-const pointer to the pointer so that we can properly change the original pointer to the interpretted one\n',
+                                                                                         '    void** ppNextVoidPtr = (void**)&pPacket->pCreateInfo->pNext;\n',
+                                                                                         '    *ppNextVoidPtr = (void*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pCreateInfo->pNext);\n',
+                                                                                         '    XGL_PIPELINE_SHADER_STAGE_CREATE_INFO* pNext = (XGL_PIPELINE_SHADER_STAGE_CREATE_INFO*)pPacket->pCreateInfo->pNext;\n',
+                                                                                         '    while ((NULL != pNext) && (XGL_NULL_HANDLE != pNext))\n', '{\n',
+                                                                                         '        switch(pNext->sType)\n', '    {\n',
+                                                                                         '            case XGL_STRUCTURE_TYPE_PIPELINE_IA_STATE_CREATE_INFO:\n',
+                                                                                         '            case XGL_STRUCTURE_TYPE_PIPELINE_TESS_STATE_CREATE_INFO:\n',
+                                                                                         '            case XGL_STRUCTURE_TYPE_PIPELINE_RS_STATE_CREATE_INFO:\n',
+                                                                                         '            case XGL_STRUCTURE_TYPE_PIPELINE_VP_STATE_CREATE_INFO:\n',
+                                                                                         '            case XGL_STRUCTURE_TYPE_PIPELINE_MS_STATE_CREATE_INFO:\n',
+                                                                                         '            case XGL_STRUCTURE_TYPE_PIPELINE_DS_STATE_CREATE_INFO:\n',
+                                                                                         '            {\n',
+                                                                                         '                void** ppNextVoidPtr = (void**)&pNext->pNext;\n',
+                                                                                         '                *ppNextVoidPtr = (void*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pNext->pNext);\n',
+                                                                                         '                break;\n',
+                                                                                         '            }\n',
+                                                                                         '            case XGL_STRUCTURE_TYPE_PIPELINE_CB_STATE_CREATE_INFO:\n',
+                                                                                         '            {\n',
+                                                                                         '                void** ppNextVoidPtr = (void**)&pNext->pNext;\n',
+                                                                                         '                XGL_PIPELINE_CB_STATE_CREATE_INFO *pCb = (XGL_PIPELINE_CB_STATE_CREATE_INFO *) pNext;\n',
+                                                                                         '                *ppNextVoidPtr = (void*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pNext->pNext);\n',
+                                                                                         '                pCb->pAttachments = (XGL_PIPELINE_CB_ATTACHMENT_STATE*) glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pCb->pAttachments);\n',
+                                                                                         '                break;\n',
+                                                                                         '            }\n',
+                                                                                         '            case XGL_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO:\n',
+                                                                                         '            {\n',
+                                                                                         '                void** ppNextVoidPtr = (void**)&pNext->pNext;\n',
+                                                                                         '                *ppNextVoidPtr = (void*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pNext->pNext);\n',
+                                                                                         '                interpret_pipeline_shader(pHeader, &pNext->shader);\n',
+                                                                                         '                break;\n',
+                                                                                         '            }\n',
+                                                                                         '            case XGL_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_CREATE_INFO:\n',
+                                                                                         '            {\n',
+                                                                                         '                void** ppNextVoidPtr = (void**)&pNext->pNext;\n',
+                                                                                         '                XGL_PIPELINE_VERTEX_INPUT_CREATE_INFO *pVi = (XGL_PIPELINE_VERTEX_INPUT_CREATE_INFO *) pNext;\n',
+                                                                                         '                *ppNextVoidPtr = (void*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pNext->pNext);\n',
+                                                                                         '                pVi->pVertexBindingDescriptions = (XGL_VERTEX_INPUT_BINDING_DESCRIPTION*) glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pVi->pVertexBindingDescriptions);\n',
+                                                                                         '                pVi->pVertexAttributeDescriptions = (XGL_VERTEX_INPUT_ATTRIBUTE_DESCRIPTION*) glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pVi->pVertexAttributeDescriptions);\n',
+                                                                                         '                break;\n',
+                                                                                         '            }\n',
+                                                                                         '            default:\n',
+                                                                                         '            {\n',
+                                                                                         '               glv_LogError("Encountered an unexpected type in pipeline state list.\\n");\n',
+                                                                                         '               pPacket->header = NULL;\n',
+                                                                                         '               pNext->pNext = NULL;\n',
+                                                                                         '            }\n',
+                                                                                         '        }\n',
+                                                                                         '        pNext = (XGL_PIPELINE_SHADER_STAGE_CREATE_INFO*)pNext->pNext;\n',
+                                                                                         '    }\n',
+                                                                                         '} else {\n',
+                                                                                         '    // This is unexpected.\n',
+                                                                                         '    glv_LogError("CreateGraphicsPipeline must have CreateInfo stype of XGL_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO.\\n");\n',
+                                                                                         '    pPacket->header = NULL;\n',
+                                                                                         '}']},
+                             'CreateComputePipeline' : {'param': 'pCreateInfo', 'txt': ['interpret_pipeline_shader(pHeader, (XGL_PIPELINE_SHADER*)(&pPacket->pCreateInfo->cs));']}}
+        if_body = []
+        if_body.append('typedef struct struct_xglApiVersion {')
+        if_body.append('    glv_trace_packet_header* header;')
+        if_body.append('    uint32_t version;')
+        if_body.append('} struct_xglApiVersion;\n')
+        if_body.append('static struct_xglApiVersion* interpret_body_as_xglApiVersion(glv_trace_packet_header* pHeader, BOOL check_version)')
+        if_body.append('{')
+        if_body.append('    struct_xglApiVersion* pPacket = (struct_xglApiVersion*)pHeader->pBody;')
+        if_body.append('    pPacket->header = pHeader;')
+        if_body.append('    if (check_version && pPacket->version != XGL_API_VERSION)')
+        if_body.append('        glv_LogError("Trace file from older XGL version 0x%x, xgl replayer built from version 0x%x, replayer may fail\\n", pPacket->version, XGL_API_VERSION);')
+        if_body.append('    return pPacket;')
+        if_body.append('}\n')
+        for proto in self.protos:
+            if 'Wsi' not in proto.name and 'Dbg' not in proto.name:
+                if 'UnmapMemory' == proto.name:
+                    proto.params.append(xgl.Param("void*", "pData"))
+                if_body.append('typedef struct struct_xgl%s {' % proto.name)
+                if_body.append('    glv_trace_packet_header* header;')
+                for p in proto.params:
+                    if '[4]' in p.ty:
+                        if_body.append('    %s %s[4];' % (p.ty.strip('[4]'), p.name))
+                    else:
+                        if_body.append('    %s %s;' % (p.ty, p.name))
+                if 'void' != proto.ret:
+                    if_body.append('    %s result;' % proto.ret)
+                if_body.append('} struct_xgl%s;\n' % proto.name)
+                if_body.append('static struct_xgl%s* interpret_body_as_xgl%s(glv_trace_packet_header* pHeader)' % (proto.name, proto.name))
+                if_body.append('{')
+                if_body.append('    struct_xgl%s* pPacket = (struct_xgl%s*)pHeader->pBody;' % (proto.name, proto.name))
+                if_body.append('    pPacket->header = pHeader;')
+                for p in proto.params:
+                    if '*' in p.ty:
+                        if 'DEVICE_CREATE_INFO' in p.ty:
+                            if_body.append('    pPacket->%s = interpret_XGL_DEVICE_CREATE_INFO(pHeader, (intptr_t)pPacket->%s);' % (p.name, p.name))
+                        else:
+                            if_body.append('    pPacket->%s = (%s)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->%s);' % (p.name, p.ty, p.name))
+                        # TODO : Generalize this custom code to kill dict data struct above.
+                        #  Really the point of this block is to catch params w/ embedded ptrs to structs and chains of structs
+                        if proto.name in custom_case_dict and p.name == custom_case_dict[proto.name]['param']:
+                            if_body.append('    if (pPacket->%s != NULL)' % custom_case_dict[proto.name]['param'])
+                            if_body.append('    {')
+                            if_body.append('        %s' % "        ".join(custom_case_dict[proto.name]['txt']))
+                            if_body.append('    }')
+                if_body.append('    return pPacket;')
+                if_body.append('}\n')
+        return "\n".join(if_body)
+
+    def _generate_interp_funcs_ext(self, func_class='Wsi'):
+        if_body = []
+        for proto in self.protos:
+            if func_class in proto.name:
+                if_body.append('typedef struct struct_xgl%s {' % proto.name)
+                if_body.append('    glv_trace_packet_header* pHeader;')
+                for p in proto.params:
+                    if_body.append('    %s %s;' % (p.ty, p.name))
+                if 'void' != proto.ret:
+                    if_body.append('    %s result;' % proto.ret)
+                if_body.append('} struct_xgl%s;\n' % proto.name)
+                if_body.append('static struct_xgl%s* interpret_body_as_xgl%s(glv_trace_packet_header* pHeader)' % (proto.name, proto.name))
+                if_body.append('{')
+                if_body.append('    struct_xgl%s* pPacket = (struct_xgl%s*)pHeader->pBody;' % (proto.name, proto.name))
+                if_body.append('    pPacket->pHeader = pHeader;')
+                for p in proto.params:
+                    if '*' in p.ty:
+                        if_body.append('    pPacket->%s = (%s)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->%s);' % (p.name, p.ty, p.name))
+                if_body.append('    return pPacket;')
+                if_body.append('}\n')
+        return "\n".join(if_body)
+
+    def _generate_replay_class_decls(self):
+        cd_body = []
+        cd_body.append('class ApiReplay {')
+        cd_body.append('public:')
+        cd_body.append('    virtual ~ApiReplay() { }')
+        cd_body.append('    virtual enum glv_replay::GLV_REPLAY_RESULT replay(glv_trace_packet_header * packet) = 0;')
+        cd_body.append('    virtual int init(glv_replay::Display & disp) = 0;')
+        cd_body.append('    virtual void push_validation_msg(XGL_VALIDATION_LEVEL validationLevel, XGL_BASE_OBJECT srcObject, size_t location, int32_t msgCode, const char* pMsg) = 0;')
+        cd_body.append('    virtual glv_replay::GLV_REPLAY_RESULT pop_validation_msgs() = 0;')
+        cd_body.append('    virtual int dump_validation_data() = 0;')
+        cd_body.append('};\n')
+        cd_body.append('class xglDisplay: public glv_replay::DisplayImp {')
+        cd_body.append('friend class xglReplay;')
+        cd_body.append('public:')
+        cd_body.append('    xglDisplay();')
+        cd_body.append('    ~xglDisplay();')
+        cd_body.append('    int init(const unsigned int gpu_idx);')
+        cd_body.append('    int set_window(glv_window_handle hWindow, unsigned int width, unsigned int height);')
+        cd_body.append('    int create_window(const unsigned int width, const unsigned int height);')
+        cd_body.append('    void resize_window(const unsigned int width, const unsigned int height);')
+        cd_body.append('    void process_event();')
+        cd_body.append('    // XGL_DEVICE get_device() { return m_dev[m_gpuIdx];}')
+        cd_body.append('#if defined(PLATFORM_LINUX) || defined(XCB_NVIDIA)')
+        cd_body.append('    xcb_window_t get_window_handle() { return m_XcbWindow; }')
+        cd_body.append('#elif defined(WIN32)')
+        cd_body.append('    HWND get_window_handle() { return m_windowHandle; }')
+        cd_body.append('#endif')
+        cd_body.append('private:')
+        cd_body.append('    XGL_RESULT init_xgl(const unsigned int gpu_idx);')
+        cd_body.append('    bool m_initedXGL;')
+        cd_body.append('#if defined(PLATFORM_LINUX) || defined(XCB_NVIDIA)')
+        cd_body.append('    XGL_WSI_X11_CONNECTION_INFO m_WsiConnection;')
+        cd_body.append('    xcb_screen_t *m_pXcbScreen;')
+        cd_body.append('    xcb_window_t m_XcbWindow;')
+        cd_body.append('#elif defined(WIN32)')
+        cd_body.append('    HWND m_windowHandle;')
+        cd_body.append('#endif')
+        cd_body.append('    unsigned int m_windowWidth;')
+        cd_body.append('    unsigned int m_windowHeight;')
+        cd_body.append('    unsigned int m_frameNumber;')
+        cd_body.append('    std::vector<uint32_t> imageWidth;')
+        cd_body.append('    std::vector<uint32_t> imageHeight;')
+        cd_body.append('    std::vector<XGL_IMAGE> imageHandles;')
+        cd_body.append('    std::vector<XGL_GPU_MEMORY> imageMemory;')
+        cd_body.append('#if 0')
+        cd_body.append('    XGL_DEVICE m_dev[XGL_MAX_PHYSICAL_GPUS];')
+        cd_body.append('    uint32_t m_gpuCount;')
+        cd_body.append('    unsigned int m_gpuIdx;')
+        cd_body.append('    XGL_PHYSICAL_GPU m_gpus[XGL_MAX_PHYSICAL_GPUS];')
+        cd_body.append('    XGL_PHYSICAL_GPU_PROPERTIES m_gpuProps[XGL_MAX_PHYSICAL_GPUS];')
+        cd_body.append('#endif')
+        cd_body.append('    std::vector<char *>m_extensions;')
+        cd_body.append('};\n')
+        cd_body.append('class objMemory {')
+        cd_body.append('public:')
+        cd_body.append('    objMemory() : m_numAllocations(0), m_pMemReqs(NULL) {}')
+        cd_body.append('    ~objMemory() { free(m_pMemReqs);}')
+        cd_body.append('    void setCount(const uint32_t num);')
+        cd_body.append('    void setReqs(const XGL_MEMORY_REQUIREMENTS *pReqs, const uint32_t num);')
+        cd_body.append('private:')
+        cd_body.append('    uint32_t m_numAllocations;')
+        cd_body.append('    XGL_MEMORY_REQUIREMENTS *m_pMemReqs;')
+        cd_body.append('};\n')
+        cd_body.append('class gpuMemory {')
+        cd_body.append('public:')
+        cd_body.append('    gpuMemory() : m_pendingAlloc(false) {m_allocInfo.allocationSize = 0;}')
+        cd_body.append('    ~gpuMemory() {}')
+        cd_body.append('    bool isPendingAlloc();')
+        cd_body.append('    void setAllocInfo(const XGL_MEMORY_ALLOC_INFO *info, const bool pending);')
+        cd_body.append('    void setMemoryDataAddr(void *pBuf);')
+        cd_body.append('    void setMemoryMapRange(void *pBuf, const size_t size, const size_t offset, const bool pending);')
+        cd_body.append('    void copyMappingData(const void *pSrcData);')
+        cd_body.append('    size_t getMemoryMapSize();')
+        cd_body.append('private:')
+        cd_body.append('    bool m_pendingAlloc;')
+        cd_body.append('    struct mapRange {')
+        cd_body.append('        bool pending;')
+        cd_body.append('        size_t size;')
+        cd_body.append('        size_t offset;')
+        cd_body.append('        void *pData;')
+        cd_body.append('    };')
+        cd_body.append('    std::vector<struct mapRange> m_mapRange;')
+        cd_body.append('    XGL_MEMORY_ALLOC_INFO m_allocInfo;')
+        cd_body.append('};\n')
+        return "\n".join(cd_body)
+
+    def _generate_replay_func_ptrs(self):
+        xf_body = []
+        xf_body.append('struct xglFuncs {')
+        xf_body.append('    void init_funcs(void * libHandle);')
+        xf_body.append('    void *m_libHandle;\n')
+        for proto in self.protos:
+            xf_body.append('    typedef %s( XGLAPI * type_xgl%s)(' % (proto.ret, proto.name))
+            for p in proto.params:
+                if '[4]' in p.ty:
+                    xf_body.append('        %s %s[4],' % (p.ty.strip('[4]'), p.name))
+                else:
+                    xf_body.append('        %s %s,' % (p.ty, p.name))
+            xf_body[-1] = xf_body[-1].replace(',', ');')
+            xf_body.append('    type_xgl%s real_xgl%s;' % (proto.name, proto.name))
+        xf_body.append('};')
+        return "\n".join(xf_body)
+
+    def _map_decl(self, type1, type2, name):
+        return '    std::map<%s, %s> %s;' % (type1, type2, name)
+
+    def _add_to_map_decl(self, type1, type2, name):
+        txt = '    void add_to_map(%s* pTraceVal, %s* pReplayVal)\n    {\n' % (type1, type2)
+        txt += '        assert(pTraceVal != NULL);\n'
+        txt += '        assert(pReplayVal != NULL);\n'
+        txt += '        %s[*pTraceVal] = *pReplayVal;\n    }\n' % name
+        return txt
+
+    def _rm_from_map_decl(self, ty, name):
+        txt = '    void rm_from_map(const %s& key)\n    {\n' % (ty)
+        txt += '        %s.erase(key);\n    }\n' % name
+        return txt
+
+    def _remap_decl(self, ty, name):
+        txt = '    %s remap(const %s& value)\n    {\n' % (ty, ty)
+        txt += '        std::map<%s, %s>::const_iterator q = %s.find(value);\n' % (ty, ty, name)
+        txt += '        return (q == %s.end()) ? XGL_NULL_HANDLE : q->second;\n    }\n' % name
+        return txt
+
+    def _generate_replay_class(self):
+        # Create dict mapping member var names to XGL type (i.e. 'm_imageViews' : 'XGL_IMAGE_VIEW')
+        obj_map_dict = {}
+        for ty in xgl.object_type_list:
+            if ty in xgl.object_parent_list:
+                continue
+            mem_var = ty.replace('XGL_', '').lower()
+            mem_var_list = mem_var.split('_')
+            mem_var = 'm_%s%ss' % (mem_var_list[0], "".join([m.title() for m in mem_var_list[1:]]))
+            obj_map_dict[mem_var] = ty
+        rc_body = []
+        rc_body.append('class xglReplay : public ApiReplay {')
+        rc_body.append('public:')
+        rc_body.append('    ~xglReplay();')
+        rc_body.append('    xglReplay(glvreplay_settings *pReplaySettings);\n')
+        rc_body.append('    int init(glv_replay::Display & disp);')
+        rc_body.append('    xglDisplay * get_display() {return m_display;}')
+        rc_body.append('    glv_replay::GLV_REPLAY_RESULT replay(glv_trace_packet_header *packet);')
+        rc_body.append('    glv_replay::GLV_REPLAY_RESULT handle_replay_errors(const char* entrypointName, const XGL_RESULT resCall, const XGL_RESULT resTrace, const glv_replay::GLV_REPLAY_RESULT resIn);\n')
+        rc_body.append('    void push_validation_msg(XGL_VALIDATION_LEVEL validationLevel, XGL_BASE_OBJECT srcObject, size_t location, int32_t msgCode, const char* pMsg);')
+        rc_body.append('    glv_replay::GLV_REPLAY_RESULT pop_validation_msgs();')
+        rc_body.append('    int dump_validation_data();')
+        rc_body.append('private:')
+        rc_body.append('    struct xglFuncs m_xglFuncs;')
+        rc_body.append('    DRAW_STATE_DUMP_DOT_FILE m_pDSDump;')
+        rc_body.append('    DRAW_STATE_DUMP_COMMAND_BUFFER_DOT_FILE m_pCBDump;')
+        rc_body.append('    xglDisplay *m_display;')
+        rc_body.append('    struct shaderPair {')
+        rc_body.append('        XGL_SHADER *addr;')
+        rc_body.append('        XGL_SHADER val;')
+        rc_body.append('    };')
+        rc_body.append('    struct validationMsg {')
+        rc_body.append('        XGL_VALIDATION_LEVEL validationLevel;')
+        rc_body.append('        XGL_BASE_OBJECT srcObject;')
+        rc_body.append('        size_t location;')
+        rc_body.append('        int32_t msgCode;')
+        rc_body.append('        char msg[256];')
+        rc_body.append('    };')
+        rc_body.append('    std::vector<struct validationMsg> m_validationMsgs;')
+        rc_body.append('    std::vector<int> m_screenshotFrames;')
+        rc_body.append('    bool m_adjustForGPU; // true if replay adjusts behavior based on GPU')
+        # Code for memory objects for handling replay GPU != trace GPU object memory requirements
+        rc_body.append('    struct imageObj {')
+        rc_body.append('       objMemory imageMem;')
+        rc_body.append('       XGL_IMAGE replayImage;')
+        rc_body.append('    };\n')
+        rc_body.append('    struct bufferObj {')
+        rc_body.append('       objMemory bufferMem;')
+        rc_body.append('       XGL_BUFFER replayBuffer;')
+        rc_body.append('    };\n')
+        rc_body.append('    struct gpuMemObj {')
+        rc_body.append('       gpuMemory *pGpuMem;')
+        rc_body.append('       XGL_GPU_MEMORY replayGpuMem;')
+        rc_body.append('    };\n')
+        rc_body.append('    void init_objMemCount(const XGL_BASE_OBJECT& object, const uint32_t &num)\n    {')
+        rc_body.append('        XGL_IMAGE img = static_cast <XGL_IMAGE> (object);')
+        rc_body.append('        std::map<XGL_IMAGE, struct imageObj>::const_iterator it = m_images.find(img);')
+        rc_body.append('        if (it != m_images.end())')
+        rc_body.append('        {')
+        rc_body.append('            objMemory obj = it->second.imageMem;')
+        rc_body.append('            obj.setCount(num);')
+        rc_body.append('            return;')
+        rc_body.append('        }')
+        rc_body.append('        XGL_BUFFER buf = static_cast <XGL_BUFFER> (object);')
+        rc_body.append('        std::map<XGL_BUFFER, struct bufferObj>::const_iterator itb = m_buffers.find(buf);')
+        rc_body.append('        if (itb != m_buffers.end())')
+        rc_body.append('        {')
+        rc_body.append('            objMemory obj = itb->second.bufferMem;')
+        rc_body.append('            obj.setCount(num);')
+        rc_body.append('            return;')
+        rc_body.append('        }')
+        rc_body.append('        return;')
+        rc_body.append('    }\n')
+        rc_body.append('    void init_objMemReqs(const XGL_BASE_OBJECT& object, const XGL_MEMORY_REQUIREMENTS *pMemReqs, const unsigned int num)\n    {')
+        rc_body.append('        XGL_IMAGE img = static_cast <XGL_IMAGE> (object);')
+        rc_body.append('        std::map<XGL_IMAGE, struct imageObj>::const_iterator it = m_images.find(img);')
+        rc_body.append('        if (it != m_images.end())')
+        rc_body.append('        {')
+        rc_body.append('            objMemory obj = it->second.imageMem;')
+        rc_body.append('            obj.setReqs(pMemReqs, num);')
+        rc_body.append('            return;')
+        rc_body.append('        }')
+        rc_body.append('        XGL_BUFFER buf = static_cast <XGL_BUFFER> (object);')
+        rc_body.append('        std::map<XGL_BUFFER, struct bufferObj>::const_iterator itb = m_buffers.find(buf);')
+        rc_body.append('        if (itb != m_buffers.end())')
+        rc_body.append('        {')
+        rc_body.append('            objMemory obj = itb->second.bufferMem;')
+        rc_body.append('            obj.setReqs(pMemReqs, num);')
+        rc_body.append('            return;')
+        rc_body.append('        }')
+        rc_body.append('        return;')
+        rc_body.append('    }\n')
+        rc_body.append('    void clear_all_map_handles()\n    {')
+        for var in sorted(obj_map_dict):
+            rc_body.append('        %s.clear();' % var)
+        rc_body.append('    }\n')
+        for var in sorted(obj_map_dict):
+            if obj_map_dict[var] == 'XGL_IMAGE':
+                rc_body.append(self._map_decl(obj_map_dict[var], 'struct imageObj', var))
+                rc_body.append(self._add_to_map_decl(obj_map_dict[var], 'struct imageObj', var))
+                rc_body.append(self._rm_from_map_decl(obj_map_dict[var], var))
+                rc_body.append('    XGL_IMAGE remap(const XGL_IMAGE& value)')
+                rc_body.append('    {')
+                rc_body.append('        std::map<XGL_IMAGE, struct imageObj>::const_iterator q = m_images.find(value);')
+                rc_body.append('        return (q == m_images.end()) ? XGL_NULL_HANDLE : q->second.replayImage;')
+                rc_body.append('    }\n')
+            elif obj_map_dict[var] == 'XGL_BUFFER':
+                rc_body.append(self._map_decl(obj_map_dict[var], 'struct bufferObj', var))
+                rc_body.append(self._add_to_map_decl(obj_map_dict[var], 'struct bufferObj', var))
+                rc_body.append(self._rm_from_map_decl(obj_map_dict[var], var))
+                rc_body.append('    XGL_BUFFER remap(const XGL_BUFFER& value)')
+                rc_body.append('    {')
+                rc_body.append('        std::map<XGL_BUFFER, struct bufferObj>::const_iterator q = m_buffers.find(value);')
+                rc_body.append('        return (q == m_buffers.end()) ? XGL_NULL_HANDLE : q->second.replayBuffer;')
+                rc_body.append('    }\n')
+            elif obj_map_dict[var] == 'XGL_GPU_MEMORY':
+                rc_body.append(self._map_decl(obj_map_dict[var], 'struct gpuMemObj', var))
+                rc_body.append(self._add_to_map_decl(obj_map_dict[var], 'struct gpuMemObj', var))
+                rc_body.append(self._rm_from_map_decl(obj_map_dict[var], var))
+                rc_body.append('    XGL_GPU_MEMORY remap(const XGL_GPU_MEMORY& value)')
+                rc_body.append('    {')
+                rc_body.append('        std::map<XGL_GPU_MEMORY, struct gpuMemObj>::const_iterator q = m_gpuMemorys.find(value);')
+                rc_body.append('        return (q == m_gpuMemorys.end()) ? XGL_NULL_HANDLE : q->second.replayGpuMem;')
+                rc_body.append('    }\n')
+            else:
+                rc_body.append(self._map_decl(obj_map_dict[var], obj_map_dict[var], var))
+                rc_body.append(self._add_to_map_decl(obj_map_dict[var], obj_map_dict[var], var))
+                rc_body.append(self._rm_from_map_decl(obj_map_dict[var], var))
+                rc_body.append(self._remap_decl(obj_map_dict[var], var))
+        # XGL_DYNAMIC_STATE_OBJECT code
+        state_obj_remap_types = xgl.object_dynamic_state_list
+        rc_body.append('    XGL_DYNAMIC_STATE_OBJECT remap(const XGL_DYNAMIC_STATE_OBJECT& state)\n    {')
+        rc_body.append('        XGL_DYNAMIC_STATE_OBJECT obj;')
+        for t in state_obj_remap_types:
+            rc_body.append('        if ((obj = remap(static_cast <%s> (state))) != XGL_NULL_HANDLE)' % t)
+            rc_body.append('            return obj;')
+        rc_body.append('        return XGL_NULL_HANDLE;\n    }')
+        rc_body.append('    void rm_from_map(const XGL_DYNAMIC_STATE_OBJECT& state)\n    {')
+        for t in state_obj_remap_types:
+            rc_body.append('        rm_from_map(static_cast <%s> (state));' % t)
+        rc_body.append('    }\n')
+        # OBJECT code
+        rc_body.append('    XGL_OBJECT remap(const XGL_OBJECT& object)\n    {')
+        rc_body.append('        XGL_OBJECT obj;')
+        obj_remap_types = xgl.object_list
+        for var in obj_remap_types:
+            rc_body.append('        if ((obj = remap(static_cast <%s> (object))) != XGL_NULL_HANDLE)' % (var))
+            rc_body.append('            return obj;')
+        rc_body.append('        return XGL_NULL_HANDLE;\n    }')
+        rc_body.append('    void rm_from_map(const XGL_OBJECT & objKey)\n    {')
+        for var in obj_remap_types:
+            rc_body.append('        rm_from_map(static_cast <%s> (objKey));' % (var))
+        rc_body.append('    }')
+        rc_body.append('    XGL_BASE_OBJECT remap(const XGL_BASE_OBJECT& object)\n    {')
+        rc_body.append('        XGL_BASE_OBJECT obj;')
+        base_obj_remap_types = ['XGL_DEVICE', 'XGL_QUEUE', 'XGL_GPU_MEMORY', 'XGL_OBJECT']
+        for t in base_obj_remap_types:
+            rc_body.append('        if ((obj = remap(static_cast <%s> (object))) != XGL_NULL_HANDLE)' % t)
+            rc_body.append('            return obj;')
+        rc_body.append('        return XGL_NULL_HANDLE;\n    }')
+        rc_body.append('void process_screenshot_list(const char *list)')
+        rc_body.append('{')
+        rc_body.append('    std::string spec(list), word;')
+        rc_body.append('    size_t start = 0, comma = 0;\n')
+        rc_body.append('    while (start < spec.size()) {')
+        rc_body.append('        comma = spec.find(\',\', start);\n')
+        rc_body.append('        if (comma == std::string::npos)')
+        rc_body.append('            word = std::string(spec, start);')
+        rc_body.append('        else')
+        rc_body.append('            word = std::string(spec, start, comma - start);\n')
+        rc_body.append('        m_screenshotFrames.push_back(atoi(word.c_str()));')
+        rc_body.append('        if (comma == std::string::npos)')
+        rc_body.append('            break;\n')
+        rc_body.append('        start = comma + 1;\n')
+        rc_body.append('    }')
+        rc_body.append('}')
+        rc_body.append('};')
+        return "\n".join(rc_body)
+
+    def _generate_replay_display_init_xgl(self):
+        dix_body = []
+        dix_body.append('XGL_RESULT xglDisplay::init_xgl(unsigned int gpu_idx)')
+        dix_body.append('{')
+        dix_body.append('#if 0')
+        dix_body.append('    XGL_APPLICATION_INFO appInfo = {};')
+        dix_body.append('    appInfo.pAppName = APP_NAME;')
+        dix_body.append('    appInfo.pEngineName = "";')
+        dix_body.append('    appInfo.apiVersion = XGL_API_VERSION;')
+        dix_body.append('    XGL_RESULT res = xglInitAndEnumerateGpus(&appInfo, NULL, XGL_MAX_PHYSICAL_GPUS, &m_gpuCount, m_gpus);')
+        dix_body.append('    if ( res == XGL_SUCCESS ) {')
+        dix_body.append('        // retrieve the GPU information for all GPUs')
+        dix_body.append('        for( uint32_t gpu = 0; gpu < m_gpuCount; gpu++)')
+        dix_body.append('        {')
+        dix_body.append('            size_t gpuInfoSize = sizeof(m_gpuProps[0]);\n')
+        dix_body.append('            // get the GPU physical properties:')
+        dix_body.append('            res = xglGetGpuInfo( m_gpus[gpu], XGL_INFO_TYPE_PHYSICAL_GPU_PROPERTIES, &gpuInfoSize, &m_gpuProps[gpu]);')
+        dix_body.append('            if (res != XGL_SUCCESS)')
+        dix_body.append('                glv_LogWarn("Failed to retrieve properties for gpu[%d] result %d\\n", gpu, res);')
+        dix_body.append('        }')
+        dix_body.append('        res = XGL_SUCCESS;')
+        dix_body.append('    } else if ((gpu_idx + 1) > m_gpuCount) {')
+        dix_body.append('        glv_LogError("xglInitAndEnumerate number of gpus does not include requested index: num %d, requested %d\\n", m_gpuCount, gpu_idx);')
+        dix_body.append('        return -1;')
+        dix_body.append('    } else {')
+        dix_body.append('        glv_LogError("xglInitAndEnumerate failed\\n");')
+        dix_body.append('        return res;')
+        dix_body.append('    }')
+        dix_body.append('    // TODO add multi-gpu support always use gpu[gpu_idx] for now')
+        dix_body.append('    // get all extensions supported by this device gpu[gpu_idx]')
+        dix_body.append('    // first check if extensions are available and save a list of them')
+        dix_body.append('    bool foundWSIExt = false;')
+        dix_body.append('    for( int ext = 0; ext < sizeof( extensions ) / sizeof( extensions[0] ); ext++)')
+        dix_body.append('    {')
+        dix_body.append('        res = xglGetExtensionSupport( m_gpus[gpu_idx], extensions[ext] );')
+        dix_body.append('        if (res == XGL_SUCCESS) {')
+        dix_body.append('            m_extensions.push_back((char *) extensions[ext]);')
+        dix_body.append('            if (!strcmp(extensions[ext], "XGL_WSI_WINDOWS"))')
+        dix_body.append('                foundWSIExt = true;')
+        dix_body.append('        }')
+        dix_body.append('    }')
+        dix_body.append('    if (!foundWSIExt) {')
+        dix_body.append('        glv_LogError("XGL_WSI_WINDOWS extension not supported by gpu[%d]\\n", gpu_idx);')
+        dix_body.append('        return XGL_ERROR_INCOMPATIBLE_DEVICE;')
+        dix_body.append('    }')
+        dix_body.append('    // TODO generalize this: use one universal queue for now')
+        dix_body.append('    XGL_DEVICE_QUEUE_CREATE_INFO dqci = {};')
+        dix_body.append('    dqci.queueCount = 1;')
+        dix_body.append('    dqci.queueType = XGL_QUEUE_UNIVERSAL;')
+        dix_body.append('    // create the device enabling validation level 4')
+        dix_body.append('    const char * const * extNames = &m_extensions[0];')
+        dix_body.append('    XGL_DEVICE_CREATE_INFO info = {};')
+        dix_body.append('    info.queueRecordCount = 1;')
+        dix_body.append('    info.pRequestedQueues = &dqci;')
+        dix_body.append('    info.extensionCount = static_cast <uint32_t> (m_extensions.size());')
+        dix_body.append('    info.ppEnabledExtensionNames = extNames;')
+        dix_body.append('    info.flags = XGL_DEVICE_CREATE_VALIDATION;')
+        dix_body.append('    info.maxValidationLevel = XGL_VALIDATION_LEVEL_4;')
+        dix_body.append('    bool32_t xglTrue = XGL_TRUE;')
+        dix_body.append('    res = xglDbgSetGlobalOption( XGL_DBG_OPTION_BREAK_ON_ERROR, sizeof( xglTrue ), &xglTrue );')
+        dix_body.append('    if (res != XGL_SUCCESS)')
+        dix_body.append('        glv_LogWarn("Could not set debug option break on error\\n");')
+        dix_body.append('    res = xglCreateDevice( m_gpus[0], &info, &m_dev[gpu_idx]);')
+        dix_body.append('    return res;')
+        dix_body.append('#else')
+        dix_body.append('    return XGL_ERROR_INITIALIZATION_FAILED;')
+        dix_body.append('#endif')
+        dix_body.append('}')
+        return "\n".join(dix_body)
+
+    def _generate_replay_display_init(self):
+        di_body = []
+        di_body.append('int xglDisplay::init(const unsigned int gpu_idx)')
+        di_body.append('{')
+        di_body.append('    //m_gpuIdx = gpu_idx;')
+        di_body.append('#if 0')
+        di_body.append('    XGL_RESULT result = init_xgl(gpu_idx);')
+        di_body.append('    if (result != XGL_SUCCESS) {')
+        di_body.append('        glv_LogError("could not init xgl library");')
+        di_body.append('        return -1;')
+        di_body.append('    } else {')
+        di_body.append('        m_initedXGL = true;')
+        di_body.append('    }')
+        di_body.append('#endif')
+        di_body.append('#if defined(PLATFORM_LINUX) || defined(XCB_NVIDIA)')
+        di_body.append('    const xcb_setup_t *setup;')
+        di_body.append('    xcb_screen_iterator_t iter;')
+        di_body.append('    int scr;')
+        di_body.append('    xcb_connection_t *pConnection;')
+        di_body.append('    pConnection = xcb_connect(NULL, &scr);')
+        di_body.append('    setup = xcb_get_setup(pConnection);')
+        di_body.append('    iter = xcb_setup_roots_iterator(setup);')
+        di_body.append('    while (scr-- > 0)')
+        di_body.append('        xcb_screen_next(&iter);')
+        di_body.append('    m_pXcbScreen = iter.data;')
+        di_body.append('    m_WsiConnection.pConnection = pConnection;')
+        di_body.append('    m_WsiConnection.root = m_pXcbScreen->root;')
+        di_body.append('#endif')
+        di_body.append('    return 0;')
+        di_body.append('}')
+        return "\n".join(di_body)
+
+    def _generate_replay_display_structors(self):
+        ds_body = []
+        ds_body.append('xglDisplay::xglDisplay()')
+        ds_body.append('    : m_initedXGL(false),')
+        ds_body.append('    m_windowWidth(0),')
+        ds_body.append('    m_windowHeight(0)')
+        ds_body.append('{')
+        ds_body.append('#if defined(PLATFORM_LINUX) || defined(XCB_NVIDIA)')
+        ds_body.append('    m_WsiConnection.pConnection = NULL;')
+        ds_body.append('    m_WsiConnection.root = 0;')
+        ds_body.append('    m_WsiConnection.provider = 0;')
+        ds_body.append('    m_pXcbScreen = NULL;')
+        ds_body.append('    m_XcbWindow = 0;')
+        ds_body.append('#elif defined(WIN32)')
+        ds_body.append('    m_windowHandle = NULL;')
+        ds_body.append('#endif')
+        ds_body.append('}')
+        ds_body.append('xglDisplay::~xglDisplay()')
+        ds_body.append('{')
+        ds_body.append('#if defined(PLATFORM_LINUX) || defined(XCB_NVIDIA)')
+        ds_body.append('    if (m_XcbWindow != 0)')
+        ds_body.append('    {')
+        ds_body.append('        xcb_destroy_window(m_WsiConnection.pConnection, m_XcbWindow);')
+        ds_body.append('    }')
+        ds_body.append('    if (m_WsiConnection.pConnection != NULL)')
+        ds_body.append('    {')
+        ds_body.append('        xcb_disconnect(m_WsiConnection.pConnection);')
+        ds_body.append('    }')
+        ds_body.append('#endif')
+        ds_body.append('}')
+        return "\n".join(ds_body)
+
+    def _generate_replay_display_window(self):
+        dw_body = []
+        dw_body.append('#if defined(WIN32)')
+        dw_body.append('LRESULT WINAPI WindowProcXgl( HWND window, unsigned int msg, WPARAM wp, LPARAM lp)')
+        dw_body.append('{')
+        dw_body.append('    switch(msg)')
+        dw_body.append('    {')
+        dw_body.append('        case WM_CLOSE:')
+        dw_body.append('            DestroyWindow( window);')
+        dw_body.append('            // fall-thru')
+        dw_body.append('        case WM_DESTROY:')
+        dw_body.append('            PostQuitMessage(0) ;')
+        dw_body.append('            return 0L ;')
+        dw_body.append('        default:')
+        dw_body.append('            return DefWindowProc( window, msg, wp, lp ) ;')
+        dw_body.append('    }')
+        dw_body.append('}')
+        dw_body.append('#endif')
+        dw_body.append('int xglDisplay::set_window(glv_window_handle hWindow, unsigned int width, unsigned int height)')
+        dw_body.append('{')
+        dw_body.append('#if defined(PLATFORM_LINUX) || defined(XCB_NVIDIA)')
+        dw_body.append('    m_XcbWindow = hWindow;')
+        dw_body.append('#elif defined(WIN32)')
+        dw_body.append('    m_windowHandle = hWindow;')
+        dw_body.append('#endif')
+        dw_body.append('    m_windowWidth = width;')
+        dw_body.append('    m_windowHeight = height;')
+        dw_body.append('    return 0;')
+        dw_body.append('}\n')
+        dw_body.append('int xglDisplay::create_window(const unsigned int width, const unsigned int height)')
+        dw_body.append('{')
+        dw_body.append('#if defined(PLATFORM_LINUX) || defined(XCB_NVIDIA)\n')
+        dw_body.append('    uint32_t value_mask, value_list[32];')
+        dw_body.append('    m_XcbWindow = xcb_generate_id(m_WsiConnection.pConnection);\n')
+        dw_body.append('    value_mask = XCB_CW_BACK_PIXEL | XCB_CW_EVENT_MASK;')
+        dw_body.append('    value_list[0] = m_pXcbScreen->black_pixel;')
+        dw_body.append('    value_list[1] = XCB_EVENT_MASK_KEY_RELEASE |')
+        dw_body.append('                    XCB_EVENT_MASK_EXPOSURE;\n')
+        dw_body.append('    xcb_create_window(m_WsiConnection.pConnection,')
+        dw_body.append('            XCB_COPY_FROM_PARENT,')
+        dw_body.append('            m_XcbWindow, m_WsiConnection.root,')
+        dw_body.append('            0, 0, width, height, 0,')
+        dw_body.append('            XCB_WINDOW_CLASS_INPUT_OUTPUT,')
+        dw_body.append('            m_pXcbScreen->root_visual,')
+        dw_body.append('            value_mask, value_list);\n')
+        dw_body.append('    xcb_map_window(m_WsiConnection.pConnection, m_XcbWindow);')
+        dw_body.append('    xcb_flush(m_WsiConnection.pConnection);')
+        dw_body.append('    return 0;')
+        dw_body.append('#elif defined(WIN32)')
+        dw_body.append('    // Register Window class')
+        dw_body.append('    WNDCLASSEX wcex = {};')
+        dw_body.append('    wcex.cbSize = sizeof( WNDCLASSEX);')
+        dw_body.append('    wcex.style = CS_HREDRAW | CS_VREDRAW;')
+        dw_body.append('    wcex.lpfnWndProc = WindowProcXgl;')
+        dw_body.append('    wcex.cbClsExtra = 0;')
+        dw_body.append('    wcex.cbWndExtra = 0;')
+        dw_body.append('    wcex.hInstance = GetModuleHandle(0);')
+        dw_body.append('    wcex.hIcon = LoadIcon(wcex.hInstance, MAKEINTRESOURCE( IDI_ICON));')
+        dw_body.append('    wcex.hCursor = LoadCursor( NULL, IDC_ARROW);')
+        dw_body.append('    wcex.hbrBackground = ( HBRUSH )( COLOR_WINDOW + 1);')
+        dw_body.append('    wcex.lpszMenuName = NULL;')
+        dw_body.append('    wcex.lpszClassName = APP_NAME;')
+        dw_body.append('    wcex.hIconSm = LoadIcon( wcex.hInstance, MAKEINTRESOURCE( IDI_ICON));')
+        dw_body.append('    if( !RegisterClassEx( &wcex))')
+        dw_body.append('    {')
+        dw_body.append('        glv_LogError("Failed to register windows class\\n");')
+        dw_body.append('        return -1;')
+        dw_body.append('    }\n')
+        dw_body.append('    // create the window')
+        dw_body.append('    m_windowHandle = CreateWindow(APP_NAME, APP_NAME, WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU, 0, 0,')
+        dw_body.append('                          width, height, NULL, NULL, wcex.hInstance, NULL);\n')
+        dw_body.append('    if (m_windowHandle)')
+        dw_body.append('    {')
+        dw_body.append('        ShowWindow( m_windowHandle, SW_SHOWDEFAULT);')
+        dw_body.append('        m_windowWidth = width;')
+        dw_body.append('        m_windowHeight = height;')
+        dw_body.append('    } else {')
+        dw_body.append('        glv_LogError("Failed to create window\\n");')
+        dw_body.append('        return -1;')
+        dw_body.append('    }')
+        dw_body.append('    return 0;')
+        dw_body.append('#endif')
+        dw_body.append('}\n')
+        dw_body.append('void xglDisplay::resize_window(const unsigned int width, const unsigned int height)')
+        dw_body.append('{')
+        dw_body.append('#if defined(PLATFORM_LINUX) || defined(XCB_NVIDIA)')
+        dw_body.append('    if (width != m_windowWidth || height != m_windowHeight)')
+        dw_body.append('    {')
+        dw_body.append('        uint32_t values[2];')
+        dw_body.append('        values[0] = width;')
+        dw_body.append('        values[1] = height;')
+        dw_body.append('        xcb_configure_window(m_WsiConnection.pConnection, m_XcbWindow, XCB_CONFIG_WINDOW_WIDTH | XCB_CONFIG_WINDOW_HEIGHT, values);')
+        dw_body.append('        m_windowWidth = width;')
+        dw_body.append('        m_windowHeight = height;')
+        dw_body.append('    }')
+        dw_body.append('#elif defined(WIN32)')
+        dw_body.append('    if (width != m_windowWidth || height != m_windowHeight)')
+        dw_body.append('    {')
+        dw_body.append('        SetWindowPos(get_window_handle(), HWND_TOP, 0, 0, width, height, SWP_NOMOVE);')
+        dw_body.append('        m_windowWidth = width;')
+        dw_body.append('        m_windowHeight = height;')
+        dw_body.append('    }')
+        dw_body.append('#endif')
+        dw_body.append('}\n')
+        dw_body.append('void xglDisplay::process_event()')
+        dw_body.append('{')
+        dw_body.append('}\n')
+        return "\n".join(dw_body)
+
+    def _generate_replay_objMemory_funcs(self):
+        rof_body = []
+        rof_body.append('void objMemory::setCount(const uint32_t num)')
+        rof_body.append('{')
+        rof_body.append('    m_numAllocations = num;')
+        rof_body.append('}\n')
+        rof_body.append('void objMemory::setReqs(const XGL_MEMORY_REQUIREMENTS *pReqs, const uint32_t num)')
+        rof_body.append('{')
+        rof_body.append('    if (m_numAllocations != num && m_numAllocations != 0)')
+        rof_body.append('        glv_LogError("objMemory::setReqs, internal mismatch on number of allocations");')
+        rof_body.append('    if (m_pMemReqs == NULL && pReqs != NULL)')
+        rof_body.append('    {')
+        rof_body.append('        m_pMemReqs = (XGL_MEMORY_REQUIREMENTS *) glv_malloc(num * sizeof(XGL_MEMORY_REQUIREMENTS));')
+        rof_body.append('        if (m_pMemReqs == NULL)')
+        rof_body.append('        {')
+        rof_body.append('            glv_LogError("objMemory::setReqs out of memory");')
+        rof_body.append('            return;')
+        rof_body.append('        }')
+        rof_body.append('        memcpy(m_pMemReqs, pReqs, num);')
+        rof_body.append('    }')
+        rof_body.append('}\n')
+        # Custom code for memory mapping functions for app writes into mapped memory
+        rof_body.append('    // memory mapping functions for app writes into mapped memory')
+        rof_body.append('    bool gpuMemory::isPendingAlloc()')
+        rof_body.append('    {')
+        rof_body.append('        return m_pendingAlloc;')
+        rof_body.append('    }\n')
+        rof_body.append('    void gpuMemory::setAllocInfo(const XGL_MEMORY_ALLOC_INFO *info, const bool pending)')
+        rof_body.append('    {')
+        rof_body.append('        m_pendingAlloc = pending;')
+        rof_body.append('        m_allocInfo = *info;')
+        rof_body.append('    }\n')
+        rof_body.append('    void gpuMemory::setMemoryDataAddr(void *pBuf)')
+        rof_body.append('    {')
+        rof_body.append('        if (m_mapRange.empty())')
+        rof_body.append('        {')
+        rof_body.append('            glv_LogError("gpuMemory::setMemoryDataAddr() m_mapRange is empty\\n");')
+        rof_body.append('            return;')
+        rof_body.append('        }')
+        rof_body.append('        struct mapRange mr = m_mapRange.back();')
+        rof_body.append('        if (mr.pData != NULL)')
+        rof_body.append('            glv_LogWarn("gpuMemory::setMemoryDataAddr() data already mapped overwrite old mapping\\n");')
+        rof_body.append('        else if (pBuf == NULL)')
+        rof_body.append('            glv_LogWarn("gpuMemory::setMemoryDataAddr() adding NULL pointer\\n");')
+        rof_body.append('        mr.pData = pBuf;')
+        rof_body.append('    }\n')
+        rof_body.append('    void gpuMemory::setMemoryMapRange(void *pBuf, const size_t size, const size_t offset, const bool pending)')
+        rof_body.append('    {')
+        rof_body.append('        struct mapRange mr;')
+        rof_body.append('        mr.pData = pBuf;')
+        rof_body.append('        mr.size = size;')
+        rof_body.append('        mr.offset = offset;')
+        rof_body.append('        mr.pending = pending;')
+        rof_body.append('        m_mapRange.push_back(mr);')
+        rof_body.append('    }\n')
+        rof_body.append('    void gpuMemory::copyMappingData(const void* pSrcData)')
+        rof_body.append('    {')
+        rof_body.append('        if (m_mapRange.empty())')
+        rof_body.append('        {')
+        rof_body.append('            glv_LogError("gpuMemory::copyMappingData() m_mapRange is empty\\n");')
+        rof_body.append('            return;')
+        rof_body.append('        }')
+        rof_body.append('        struct mapRange mr = m_mapRange.back();')
+        rof_body.append('        if (!pSrcData || !mr.pData)')
+        rof_body.append('        {')
+        rof_body.append('            if (!pSrcData)')
+        rof_body.append('                glv_LogError("gpuMemory::copyMappingData() null src pointer\\n");')
+        rof_body.append('            else')
+        rof_body.append('                glv_LogError("gpuMemory::copyMappingData() null dest pointer size=%u\\n", m_allocInfo.allocationSize);')
+        rof_body.append('            m_mapRange.pop_back();')
+        rof_body.append('            return;')
+        rof_body.append('        }')
+        rof_body.append('        memcpy(mr.pData, pSrcData, m_allocInfo.allocationSize);')
+        rof_body.append('        if (!mr.pending)')
+        rof_body.append('          m_mapRange.pop_back();')
+        rof_body.append('    }\n')
+        rof_body.append('    size_t gpuMemory::getMemoryMapSize()')
+        rof_body.append('    {')
+        rof_body.append('        return (!m_mapRange.empty()) ? m_mapRange.back().size : 0;')
+        rof_body.append('    }\n')
+        return "\n".join(rof_body)
+
+    def _generate_replay_structors(self):
+        rs_body = []
+        rs_body.append('xglReplay::xglReplay(glvreplay_settings *pReplaySettings)')
+        rs_body.append('{')
+        rs_body.append('    g_pReplaySettings = pReplaySettings;')
+        rs_body.append('    m_display = new xglDisplay();')
+        rs_body.append('    m_pDSDump = NULL;')
+        rs_body.append('    m_pCBDump = NULL;')
+        rs_body.append('    m_adjustForGPU = false;')
+        rs_body.append('    if (g_pReplaySettings && g_pReplaySettings->screenshotList) {')
+        rs_body.append('        process_screenshot_list(g_pReplaySettings->screenshotList);')
+        rs_body.append('    }')
+        rs_body.append('}\n')
+        rs_body.append('xglReplay::~xglReplay()')
+        rs_body.append('{')
+        rs_body.append('    delete m_display;')
+        rs_body.append('    glv_platform_close_library(m_xglFuncs.m_libHandle);')
+        rs_body.append('}')
+        return "\n".join(rs_body)
+
+    def _generate_replay_init(self):
+        ri_body = []
+        ri_body.append('int xglReplay::init(glv_replay::Display & disp)')
+        ri_body.append('{')
+        ri_body.append('    int err;')
+        ri_body.append('#if defined PLATFORM_LINUX')
+        ri_body.append('    void * handle = dlopen("libXGL.so", RTLD_LAZY);')
+        ri_body.append('#else')
+        ri_body.append('    HMODULE handle = LoadLibrary("xgl.dll" );')
+        ri_body.append('#endif\n')
+        ri_body.append('    if (handle == NULL) {')
+        ri_body.append('        glv_LogError("Failed to open xgl library.\\n");')
+        ri_body.append('        return -1;')
+        ri_body.append('    }')
+        ri_body.append('    m_xglFuncs.init_funcs(handle);')
+        ri_body.append('    disp.set_implementation(m_display);')
+        ri_body.append('    if ((err = m_display->init(disp.get_gpu())) != 0) {')
+        ri_body.append('        glv_LogError("Failed to init XGL display.\\n");')
+        ri_body.append('        return err;')
+        ri_body.append('    }')
+        ri_body.append('    if (disp.get_window_handle() == 0)')
+        ri_body.append('    {')
+        ri_body.append('        if ((err = m_display->create_window(disp.get_width(), disp.get_height())) != 0) {')
+        ri_body.append('            glv_LogError("Failed to create Window\\n");')
+        ri_body.append('            return err;')
+        ri_body.append('        }')
+        ri_body.append('    }')
+        ri_body.append('    else')
+        ri_body.append('    {')
+        ri_body.append('        if ((err = m_display->set_window(disp.get_window_handle(), disp.get_width(), disp.get_height())) != 0)')
+        ri_body.append('        {')
+        ri_body.append('            glv_LogError("Failed to set Window\\n");')
+        ri_body.append('            return err;')
+        ri_body.append('        }')
+        ri_body.append('    }')
+        ri_body.append('    return 0;')
+        ri_body.append('}')
+        return "\n".join(ri_body)
+
+    def _generate_replay_errors(self):
+        re_body = []
+        re_body.append('glv_replay::GLV_REPLAY_RESULT xglReplay::handle_replay_errors(const char* entrypointName, const XGL_RESULT resCall, const XGL_RESULT resTrace, const glv_replay::GLV_REPLAY_RESULT resIn)')
+        re_body.append('{')
+        re_body.append('    glv_replay::GLV_REPLAY_RESULT res = resIn;')
+        re_body.append('    if (resCall != resTrace) {')
+        re_body.append('        glv_LogWarn("Mismatched return from API call (%s) traced result %s, replay result %s\\n", entrypointName,')
+        re_body.append('                string_XGL_RESULT((XGL_RESULT)resTrace), string_XGL_RESULT((XGL_RESULT)resCall));')
+        re_body.append('        res = glv_replay::GLV_REPLAY_BAD_RETURN;')
+        re_body.append('    }')
+        re_body.append('#if 0')
+        re_body.append('    if (resCall != XGL_SUCCESS) {')
+        re_body.append('        glv_LogWarn("API call (%s) returned failed result %s\\n", entrypointName, string_XGL_RESULT(resCall));')
+        re_body.append('    }')
+        re_body.append('#endif')
+        re_body.append('    return res;')
+        re_body.append('}')
+        return "\n".join(re_body)
+
+    def _generate_replay_validation_funcs(self):
+        rvf_body = []
+        rvf_body.append('void xglReplay::push_validation_msg(XGL_VALIDATION_LEVEL validationLevel, XGL_BASE_OBJECT srcObject, size_t location, int32_t msgCode, const char * pMsg)')
+        rvf_body.append('{')
+        rvf_body.append('    struct validationMsg msgObj;')
+        rvf_body.append('    msgObj.validationLevel = validationLevel;')
+        rvf_body.append('    msgObj.srcObject = srcObject;')
+        rvf_body.append('    msgObj.location = location;')
+        rvf_body.append('    msgObj.msgCode = msgCode;')
+        rvf_body.append('    strncpy(msgObj.msg, pMsg, 256);')
+        rvf_body.append("    msgObj.msg[255] = '\\0';")
+        rvf_body.append('    m_validationMsgs.push_back(msgObj);')
+        rvf_body.append('}\n')
+        rvf_body.append('glv_replay::GLV_REPLAY_RESULT xglReplay::pop_validation_msgs()')
+        rvf_body.append('{')
+        rvf_body.append('    if (m_validationMsgs.size() == 0)')
+        rvf_body.append('        return glv_replay::GLV_REPLAY_SUCCESS;')
+        rvf_body.append('    m_validationMsgs.clear();')
+        rvf_body.append('    return glv_replay::GLV_REPLAY_VALIDATION_ERROR;')
+        rvf_body.append('}')
+        rvf_body.append('int xglReplay::dump_validation_data()')
+        rvf_body.append('{')
+        rvf_body.append('   if  (!m_pDSDump || !m_pCBDump)')
+        rvf_body.append('   {')
+        rvf_body.append('       return -1;')
+        rvf_body.append('   }')
+        rvf_body.append('   m_pDSDump((char *) "pipeline_dump.dot");')
+        rvf_body.append('   m_pCBDump((char *) "cb_dump.dot");')
+        rvf_body.append('   return 0;')
+        rvf_body.append('}')
+        return "\n".join(rvf_body)
+
+    def _generate_replay_init_funcs(self):
+        rif_body = []
+        rif_body.append('void xglFuncs::init_funcs(void * handle)\n{\n    m_libHandle = handle;')
+        for proto in self.protos:
+            rif_body.append('    real_xgl%s = (type_xgl%s)(glv_platform_get_library_entrypoint(handle, "xgl%s"));' % (proto.name, proto.name, proto.name))
+        rif_body.append('}')
+        return "\n".join(rif_body)
+
+    def _get_packet_param(self, t, n):
+        # list of types that require remapping
+        remap_list = xgl.object_type_list
+        param_exclude_list = ['p1', 'p2', 'pGpus', 'pDescriptorSets']
+        if t.strip('*').replace('const ', '') in remap_list and n not in param_exclude_list:
+            if '*' in t:
+                if 'const ' not in t:
+                    return 'remap(*pPacket->%s)' % (n)
+                else: # TODO : Don't remap array ptrs?
+                    return 'pPacket->%s' % (n)
+            return 'remap(pPacket->%s)' % (n)
+        return 'pPacket->%s' % (n)
+
+    def _gen_replay_enum_gpus(self):
+        ieg_body = []
+        ieg_body.append('            if (!m_display->m_initedXGL)')
+        ieg_body.append('            {')
+        ieg_body.append('                uint32_t gpuCount;')
+        ieg_body.append('                XGL_PHYSICAL_GPU gpus[XGL_MAX_PHYSICAL_GPUS];')
+        ieg_body.append('                uint32_t maxGpus = (pPacket->maxGpus < XGL_MAX_PHYSICAL_GPUS) ? pPacket->maxGpus : XGL_MAX_PHYSICAL_GPUS;')
+        ieg_body.append('                replayResult = m_xglFuncs.real_xglEnumerateGpus(remap(pPacket->instance), maxGpus, &gpuCount, &gpus[0]);')
+        ieg_body.append('                CHECK_RETURN_VALUE(xglEnumerateGpus);')
+        ieg_body.append('                //TODO handle different number of gpus in trace versus replay')
+        ieg_body.append('                if (gpuCount != *(pPacket->pGpuCount))')
+        ieg_body.append('                {')
+        ieg_body.append('                    glv_LogWarn("number of gpus mismatched in replay %u versus trace %u\\n", gpuCount, *(pPacket->pGpuCount));')
+        ieg_body.append('                }')
+        ieg_body.append('                else if (gpuCount == 0)')
+        ieg_body.append('                {')
+        ieg_body.append('                     glv_LogError("xglEnumerateGpus number of gpus is zero\\n");')
+        ieg_body.append('                }')
+        ieg_body.append('                else')
+        ieg_body.append('                {')
+        ieg_body.append('                    glv_LogInfo("Enumerated %d GPUs in the system\\n", gpuCount);')
+        ieg_body.append('                }')
+        ieg_body.append('                // TODO handle enumeration results in a different order from trace to replay')
+        ieg_body.append('                for (uint32_t i = 0; i < gpuCount; i++)')
+        ieg_body.append('                {')
+        ieg_body.append('                    if (pPacket->pGpus)')
+        ieg_body.append('                        add_to_map(&(pPacket->pGpus[i]), &(gpus[i]));')
+        ieg_body.append('                }')
+        ieg_body.append('            }')
+        return "\n".join(ieg_body)
+
+    def _gen_replay_get_gpu_info(self):
+        ggi_body = []
+        ggi_body.append('            if (!m_display->m_initedXGL)')
+        ggi_body.append('            {')
+        ggi_body.append('                switch (pPacket->infoType) {')
+        ggi_body.append('                case XGL_INFO_TYPE_PHYSICAL_GPU_PROPERTIES:')
+        ggi_body.append('                {')
+        ggi_body.append('                    XGL_PHYSICAL_GPU_PROPERTIES gpuProps;')
+        ggi_body.append('                    size_t dataSize = sizeof(XGL_PHYSICAL_GPU_PROPERTIES);')
+        ggi_body.append('                    replayResult = m_xglFuncs.real_xglGetGpuInfo(remap(pPacket->gpu), pPacket->infoType, &dataSize,')
+        ggi_body.append('                                    (pPacket->pData == NULL) ? NULL : &gpuProps);')
+        ggi_body.append('                    if (pPacket->pData != NULL)')
+        ggi_body.append('                    {')
+        ggi_body.append('                        glv_LogInfo("Replay Gpu Properties\\n");')
+        ggi_body.append('                        glv_LogInfo("Vendor ID %x, Device ID %x, name %s\\n",gpuProps.vendorId, gpuProps.deviceId, gpuProps.gpuName);')
+        ggi_body.append('                        glv_LogInfo("API version %u, Driver version %u, gpu Type %u\\n",gpuProps.apiVersion, gpuProps.driverVersion, gpuProps.gpuType);')
+        ggi_body.append('                    }')
+        ggi_body.append('                    break;')
+        ggi_body.append('                }')
+        ggi_body.append('                case XGL_INFO_TYPE_PHYSICAL_GPU_PERFORMANCE:')
+        ggi_body.append('                {')
+        ggi_body.append('                    XGL_PHYSICAL_GPU_PERFORMANCE gpuPerfs;')
+        ggi_body.append('                    size_t dataSize = sizeof(XGL_PHYSICAL_GPU_PERFORMANCE);')
+        ggi_body.append('                    replayResult = m_xglFuncs.real_xglGetGpuInfo(remap(pPacket->gpu), pPacket->infoType, &dataSize,')
+        ggi_body.append('                                    (pPacket->pData == NULL) ? NULL : &gpuPerfs);')
+        ggi_body.append('                    if (pPacket->pData != NULL)')
+        ggi_body.append('                    {')
+        ggi_body.append('                        glv_LogInfo("Replay Gpu Performance\\n");')
+        ggi_body.append('                        glv_LogInfo("Max GPU clock %f, max shader ALUs/clock %f, max texel fetches/clock %f\\n",gpuPerfs.maxGpuClock, gpuPerfs.aluPerClock, gpuPerfs.texPerClock);')
+        ggi_body.append('                        glv_LogInfo("Max primitives/clock %f, Max pixels/clock %f\\n",gpuPerfs.primsPerClock, gpuPerfs.pixelsPerClock);')
+        ggi_body.append('                    }')
+        ggi_body.append('                    break;')
+        ggi_body.append('                }')
+        ggi_body.append('                case XGL_INFO_TYPE_PHYSICAL_GPU_QUEUE_PROPERTIES:')
+        ggi_body.append('                {')
+        ggi_body.append('                    XGL_PHYSICAL_GPU_QUEUE_PROPERTIES *pGpuQueue, *pQ;')
+        ggi_body.append('                    size_t dataSize = sizeof(XGL_PHYSICAL_GPU_QUEUE_PROPERTIES);')
+        ggi_body.append('                    size_t numQueues = 1;')
+        ggi_body.append('                    assert(pPacket->pDataSize);')
+        ggi_body.append('                    if ((*(pPacket->pDataSize) % dataSize) != 0)')
+        ggi_body.append('                        glv_LogWarn("xglGetGpuInfo() for GPU_QUEUE_PROPERTIES not an integral data size assuming 1\\n");')
+        ggi_body.append('                    else')
+        ggi_body.append('                        numQueues = *(pPacket->pDataSize) / dataSize;')
+        ggi_body.append('                    dataSize = numQueues * dataSize;')
+        ggi_body.append('                    pQ = static_cast < XGL_PHYSICAL_GPU_QUEUE_PROPERTIES *> (glv_malloc(dataSize));')
+        ggi_body.append('                    pGpuQueue = pQ;')
+        ggi_body.append('                    replayResult = m_xglFuncs.real_xglGetGpuInfo(remap(pPacket->gpu), pPacket->infoType, &dataSize,')
+        ggi_body.append('                                    (pPacket->pData == NULL) ? NULL : pGpuQueue);')
+        ggi_body.append('                    if (pPacket->pData != NULL)')
+        ggi_body.append('                    {')
+        ggi_body.append('                        for (unsigned int i = 0; i < numQueues; i++)')
+        ggi_body.append('                        {')
+        ggi_body.append('                            glv_LogInfo("Replay Gpu Queue Property for index %d, flags %u\\n", i, pGpuQueue->queueFlags);')
+        ggi_body.append('                            glv_LogInfo("Max available count %u, max atomic counters %u, supports timestamps %u\\n",pGpuQueue->queueCount, pGpuQueue->maxAtomicCounters, pGpuQueue->supportsTimestamps);')
+        ggi_body.append('                            pGpuQueue++;')
+        ggi_body.append('                        }')
+        ggi_body.append('                    }')
+        ggi_body.append('                    glv_free(pQ);')
+        ggi_body.append('                    break;')
+        ggi_body.append('                }')
+        ggi_body.append('                default:')
+        ggi_body.append('                {')
+        ggi_body.append('                    size_t size = 0;')
+        ggi_body.append('                    void* pData = NULL;')
+        ggi_body.append('                    if (pPacket->pData != NULL && pPacket->pDataSize != NULL)')
+        ggi_body.append('                    {')
+        ggi_body.append('                        size = *pPacket->pDataSize;')
+        ggi_body.append('                        pData = glv_malloc(*pPacket->pDataSize);')
+        ggi_body.append('                    }')
+        ggi_body.append('                    replayResult = m_xglFuncs.real_xglGetGpuInfo(remap(pPacket->gpu), pPacket->infoType, &size, pData);')
+        ggi_body.append('                    if (replayResult == XGL_SUCCESS)')
+        ggi_body.append('                    {')
+        ggi_body.append('                        if (size != *pPacket->pDataSize && pData != NULL)')
+        ggi_body.append('                        {')
+        ggi_body.append('                            glv_LogWarn("xglGetGpuInfo returned a differing data size: replay (%d bytes) vs trace (%d bytes)\\n", size, *pPacket->pDataSize);')
+        ggi_body.append('                        }')
+        ggi_body.append('                        else if (pData != NULL && memcmp(pData, pPacket->pData, size) != 0)')
+        ggi_body.append('                        {')
+        ggi_body.append('                            glv_LogWarn("xglGetGpuInfo returned differing data contents than the trace file contained.\\n");')
+        ggi_body.append('                        }')
+        ggi_body.append('                    }')
+        ggi_body.append('                    glv_free(pData);')
+        ggi_body.append('                    break;')
+        ggi_body.append('                }')
+        ggi_body.append('                };')
+        ggi_body.append('                CHECK_RETURN_VALUE(xglGetGpuInfo);')
+        ggi_body.append('            }')
+        return "\n".join(ggi_body)
+
+    def _gen_replay_create_device(self):
+        cd_body = []
+        cd_body.append('            if (!m_display->m_initedXGL)')
+        cd_body.append('            {')
+        cd_body.append('                XGL_DEVICE device;')
+        cd_body.append('                if (g_xglReplaySettings.debugLevel > 0)')
+        cd_body.append('                {')
+        cd_body.append('                    XGL_DEVICE_CREATE_INFO cInfo, *ci, *pCreateInfoSaved;')
+        cd_body.append('                    unsigned int numLayers = 0;')
+        cd_body.append('                    char ** layersStr = get_enableLayers_list(&numLayers);')
+        cd_body.append('                    apply_layerSettings_overrides();')
+        cd_body.append('                    XGL_LAYER_CREATE_INFO layerInfo;')
+        cd_body.append('                    pCreateInfoSaved = (XGL_DEVICE_CREATE_INFO *) pPacket->pCreateInfo;')
+        cd_body.append('                    ci = (XGL_DEVICE_CREATE_INFO *) pPacket->pCreateInfo;')
+
+        cd_body.append('                    if (layersStr != NULL && numLayers > 0)')
+        cd_body.append('                    {')
+        cd_body.append('                        while (ci->pNext != NULL)')
+        cd_body.append('                            ci = (XGL_DEVICE_CREATE_INFO *) ci->pNext;')
+        cd_body.append('                        ci->pNext = &layerInfo;')
+        cd_body.append('                        layerInfo.sType = XGL_STRUCTURE_TYPE_LAYER_CREATE_INFO;')
+        cd_body.append('                        layerInfo.pNext = 0;')
+        cd_body.append('                        layerInfo.layerCount = numLayers;')
+        cd_body.append('                        layerInfo.ppActiveLayerNames = layersStr;')
+        cd_body.append('                    }')
+
+        cd_body.append('                    memcpy(&cInfo, pPacket->pCreateInfo, sizeof(XGL_DEVICE_CREATE_INFO));')
+        cd_body.append('                    cInfo.flags = pPacket->pCreateInfo->flags | XGL_DEVICE_CREATE_VALIDATION_BIT;')
+        cd_body.append('                    cInfo.maxValidationLevel = (XGL_VALIDATION_LEVEL)((g_xglReplaySettings.debugLevel <= 4) ? (unsigned int) XGL_VALIDATION_LEVEL_0 + g_xglReplaySettings.debugLevel : (unsigned int) XGL_VALIDATION_LEVEL_0);')
+        cd_body.append('                    pPacket->pCreateInfo = &cInfo;')
+        cd_body.append('                    replayResult = m_xglFuncs.real_xglCreateDevice(remap(pPacket->gpu), pPacket->pCreateInfo, &device);')
+        cd_body.append('                    // restore the packet for next replay')
+        cd_body.append('                    ci->pNext = NULL;')
+        cd_body.append('                    pPacket->pCreateInfo = pCreateInfoSaved;')
+        cd_body.append('                    release_enableLayer_list(layersStr);')
+        cd_body.append('                    if (xglDbgRegisterMsgCallback(g_fpDbgMsgCallback, NULL) != XGL_SUCCESS)')
+        cd_body.append('                        glv_LogError("Failed to register xgl callback for replayer error handling\\n");')
+        cd_body.append('#if !defined(_WIN32)')
+        cd_body.append('                    m_pDSDump = (DRAW_STATE_DUMP_DOT_FILE) m_xglFuncs.real_xglGetProcAddr(remap(pPacket->gpu), "drawStateDumpDotFile");')
+        cd_body.append('                    m_pCBDump = (DRAW_STATE_DUMP_COMMAND_BUFFER_DOT_FILE) m_xglFuncs.real_xglGetProcAddr(remap(pPacket->gpu), "drawStateDumpCommandBufferDotFile");')
+        cd_body.append('#endif')
+        cd_body.append('                }')
+        cd_body.append('                else ')
+        cd_body.append('                    replayResult = m_xglFuncs.real_xglCreateDevice(remap(pPacket->gpu), pPacket->pCreateInfo, &device);')
+        cd_body.append('                CHECK_RETURN_VALUE(xglCreateDevice);')
+        cd_body.append('                if (replayResult == XGL_SUCCESS)')
+        cd_body.append('                {')
+        cd_body.append('                    add_to_map(pPacket->pDevice, &device);')
+        cd_body.append('                }')
+        cd_body.append('            }')
+        return "\n".join(cd_body)
+
+    def _gen_replay_get_extension_support(self):
+        ges_body = []
+        ges_body.append('            if (!m_display->m_initedXGL) {')
+        ges_body.append('                replayResult = m_xglFuncs.real_xglGetExtensionSupport(remap(pPacket->gpu), pPacket->pExtName);')
+        ges_body.append('                CHECK_RETURN_VALUE(xglGetExtensionSupport);')
+        ges_body.append('                if (replayResult == XGL_SUCCESS) {')
+        ges_body.append('                    for (unsigned int ext = 0; ext < sizeof(g_extensions) / sizeof(g_extensions[0]); ext++)')
+        ges_body.append('                    {')
+        ges_body.append('                        if (!strncmp(g_extensions[ext], pPacket->pExtName, strlen(g_extensions[ext]))) {')
+        ges_body.append('                            bool extInList = false;')
+        ges_body.append('                            for (unsigned int j = 0; j < m_display->m_extensions.size(); ++j) {')
+        ges_body.append('                                if (!strncmp(m_display->m_extensions[j], g_extensions[ext], strlen(g_extensions[ext])))')
+        ges_body.append('                                    extInList = true;')
+        ges_body.append('                                break;')
+        ges_body.append('                            }')
+        ges_body.append('                            if (!extInList)')
+        ges_body.append('                                m_display->m_extensions.push_back((char *) g_extensions[ext]);')
+        ges_body.append('                            break;')
+        ges_body.append('                        }')
+        ges_body.append('                    }')
+        ges_body.append('                }')
+        ges_body.append('            }')
+        return "\n".join(ges_body)
+
+    def _gen_replay_queue_submit(self):
+        qs_body = []
+        qs_body.append('            XGL_CMD_BUFFER *remappedBuffers = NULL;')
+        qs_body.append('            if (pPacket->pCmdBuffers != NULL)')
+        qs_body.append('            {')
+        qs_body.append('                remappedBuffers = GLV_NEW_ARRAY( XGL_CMD_BUFFER, pPacket->cmdBufferCount);')
+        qs_body.append('                for (uint32_t i = 0; i < pPacket->cmdBufferCount; i++)')
+        qs_body.append('                {')
+        qs_body.append('                    *(remappedBuffers + i) = remap(*(pPacket->pCmdBuffers + i));')
+        qs_body.append('                }')
+        qs_body.append('            }')
+        qs_body.append('            XGL_MEMORY_REF* memRefs = NULL;')
+        qs_body.append('            if (pPacket->pMemRefs != NULL)')
+        qs_body.append('            {')
+        qs_body.append('                memRefs = GLV_NEW_ARRAY(XGL_MEMORY_REF, pPacket->memRefCount);')
+        qs_body.append('                memcpy(memRefs, pPacket->pMemRefs, sizeof(XGL_MEMORY_REF) * pPacket->memRefCount);')
+        qs_body.append('                for (uint32_t i = 0; i < pPacket->memRefCount; i++)')
+        qs_body.append('                {')
+        qs_body.append('                    memRefs[i].mem = remap(pPacket->pMemRefs[i].mem);')
+        qs_body.append('                }')
+        qs_body.append('            }')
+        qs_body.append('            replayResult = m_xglFuncs.real_xglQueueSubmit(remap(pPacket->queue), pPacket->cmdBufferCount, remappedBuffers, pPacket->memRefCount,')
+        qs_body.append('                memRefs, remap(pPacket->fence));')
+        qs_body.append('            GLV_DELETE(remappedBuffers);')
+        qs_body.append('            GLV_DELETE(memRefs);')
+        return "\n".join(qs_body)
+
+    def _gen_replay_get_object_info(self):
+        goi_body = []
+        goi_body.append('            size_t size = 0;')
+        goi_body.append('            void* pData = NULL;')
+        goi_body.append('            if (pPacket->pData != NULL && pPacket->pDataSize != NULL)')
+        goi_body.append('            {')
+        goi_body.append('                size = *pPacket->pDataSize;')
+        goi_body.append('                pData = glv_malloc(*pPacket->pDataSize);')
+        goi_body.append('                memcpy(pData, pPacket->pData, *pPacket->pDataSize);')
+        goi_body.append('            }')
+        goi_body.append('            // TODO only search for object once rather than at remap() and init_objMemXXX()')
+        goi_body.append('            replayResult = m_xglFuncs.real_xglGetObjectInfo(remap(pPacket->object), pPacket->infoType, &size, pData);')
+        goi_body.append('            if (replayResult == XGL_SUCCESS)')
+        goi_body.append('            {')
+        goi_body.append('                if (size != *pPacket->pDataSize && pData != NULL)')
+        goi_body.append('                {')
+        goi_body.append('                    glv_LogWarn("xglGetObjectInfo returned a differing data size: replay (%d bytes) vs trace (%d bytes)\\n", size, *pPacket->pDataSize);')
+        goi_body.append('                } else if (pData != NULL)')
+        goi_body.append('                {')
+        goi_body.append('                    switch (pPacket->infoType)')
+        goi_body.append('                    {')
+        goi_body.append('                        case XGL_INFO_TYPE_MEMORY_ALLOCATION_COUNT:')
+        goi_body.append('                        {')
+        goi_body.append('                            uint32_t traceCount = *((uint32_t *) pPacket->pData);')
+        goi_body.append('                            uint32_t replayCount = *((uint32_t *) pData);')
+        goi_body.append('                            if (traceCount != replayCount)')
+        goi_body.append('                                glv_LogWarn("xglGetObjectInfo(INFO_TYPE_MEMORY_ALLOCATION_COUNT) mismatch: trace count %u, replay count %u\\n", traceCount, replayCount);')
+        goi_body.append('                            if (m_adjustForGPU)')
+        goi_body.append('                                init_objMemCount(pPacket->object, replayCount);')
+        goi_body.append('                            break;')
+        goi_body.append('                        }')
+        goi_body.append('                        case XGL_INFO_TYPE_MEMORY_REQUIREMENTS:')
+        goi_body.append('                        {')
+        goi_body.append('                            XGL_MEMORY_REQUIREMENTS *traceReqs = (XGL_MEMORY_REQUIREMENTS *) pPacket->pData;')
+        goi_body.append('                            XGL_MEMORY_REQUIREMENTS *replayReqs = (XGL_MEMORY_REQUIREMENTS *) pData;')
+        goi_body.append('                            unsigned int num = size / sizeof(XGL_MEMORY_REQUIREMENTS);')
+        goi_body.append('                            for (unsigned int i = 0; i < num; i++)')
+        goi_body.append('                            {')
+        goi_body.append('                                if (traceReqs->size != replayReqs->size)')
+        goi_body.append('                                    glv_LogWarn("xglGetObjectInfo(INFO_TYPE_MEMORY_REQUIREMENTS) mismatch: trace size %u, replay size %u\\n", traceReqs->size, replayReqs->size);')
+        goi_body.append('                                if (traceReqs->alignment != replayReqs->alignment)')
+        goi_body.append('                                    glv_LogWarn("xglGetObjectInfo(INFO_TYPE_MEMORY_REQUIREMENTS) mismatch: trace alignment %u, replay aligmnent %u\\n", traceReqs->alignment, replayReqs->alignment);')
+        goi_body.append('                                if (traceReqs->granularity != replayReqs->granularity)')
+        goi_body.append('                                    glv_LogWarn("xglGetObjectInfo(INFO_TYPE_MEMORY_REQUIREMENTS) mismatch: trace granularity %u, replay granularity %u\\n", traceReqs->granularity, replayReqs->granularity);')
+        goi_body.append('                                if (traceReqs->memProps != replayReqs->memProps)')
+        goi_body.append('                                    glv_LogWarn("xglGetObjectInfo(INFO_TYPE_MEMORY_REQUIREMENTS) mismatch: trace memProps %u, replay memProps %u\\n", traceReqs->memProps, replayReqs->memProps);')
+        goi_body.append('                                if (traceReqs->memType != replayReqs->memType)')
+        goi_body.append('                                    glv_LogWarn("xglGetObjectInfo(INFO_TYPE_MEMORY_REQUIREMENTS) mismatch: trace memType %u, replay memType %u\\n", traceReqs->memType, replayReqs->memType);')
+        goi_body.append('                                traceReqs++;')
+        goi_body.append('                                replayReqs++;')
+        goi_body.append('                            }')
+        goi_body.append('                            if (m_adjustForGPU)')
+        goi_body.append('                                init_objMemReqs(pPacket->object, replayReqs - num, num);')
+        goi_body.append('                            break;')
+        goi_body.append('                        }')
+        goi_body.append('                        default:')
+        goi_body.append('                            if (memcmp(pData, pPacket->pData, size) != 0)')
+        goi_body.append('                                glv_LogWarn("xglGetObjectInfo() mismatch on *pData: between trace and replay *pDataSize %u\\n", size);')
+        goi_body.append('                    }')
+        goi_body.append('                }')
+        goi_body.append('            }')
+        goi_body.append('            glv_free(pData);')
+        return "\n".join(goi_body)
+
+    def _gen_replay_get_format_info(self):
+        gfi_body = []
+        gfi_body.append('            size_t size = 0;')
+        gfi_body.append('            void* pData = NULL;')
+        gfi_body.append('            if (pPacket->pData != NULL && pPacket->pDataSize != NULL)')
+        gfi_body.append('            {')
+        gfi_body.append('                size = *pPacket->pDataSize;')
+        gfi_body.append('                pData = glv_malloc(*pPacket->pDataSize);')
+        gfi_body.append('            }')
+        gfi_body.append('            replayResult = m_xglFuncs.real_xglGetFormatInfo(remap(pPacket->device), pPacket->format, pPacket->infoType, &size, pData);')
+        gfi_body.append('            if (replayResult == XGL_SUCCESS)')
+        gfi_body.append('            {')
+        gfi_body.append('                if (size != *pPacket->pDataSize && pData != NULL)')
+        gfi_body.append('                {')
+        gfi_body.append('                    glv_LogWarn("xglGetFormatInfo returned a differing data size: replay (%d bytes) vs trace (%d bytes)\\n", size, *pPacket->pDataSize);')
+        gfi_body.append('                }')
+        gfi_body.append('                else if (pData != NULL && memcmp(pData, pPacket->pData, size) != 0)')
+        gfi_body.append('                {')
+        gfi_body.append('                    glv_LogWarn("xglGetFormatInfo returned differing data contents than the trace file contained.\\n");')
+        gfi_body.append('                }')
+        gfi_body.append('            }')
+        gfi_body.append('            glv_free(pData);')
+        return "\n".join(gfi_body)
+
+    def _gen_replay_create_image(self):
+        ci_body = []
+        ci_body.append('            struct imageObj local_imageObj;')
+        ci_body.append('            replayResult = m_xglFuncs.real_xglCreateImage(remap(pPacket->device), pPacket->pCreateInfo, &local_imageObj.replayImage);')
+        ci_body.append('            if (replayResult == XGL_SUCCESS)')
+        ci_body.append('            {')
+        ci_body.append('                add_to_map(pPacket->pImage, &local_imageObj);')
+        ci_body.append('            }')
+        return "\n".join(ci_body)
+
+    def _gen_replay_create_buffer(self):
+        cb_body = []
+        cb_body.append('            struct bufferObj local_bufferObj;')
+        cb_body.append('            replayResult = m_xglFuncs.real_xglCreateBuffer(remap(pPacket->device), pPacket->pCreateInfo, &local_bufferObj.replayBuffer);')
+        cb_body.append('            if (replayResult == XGL_SUCCESS)')
+        cb_body.append('            {')
+        cb_body.append('                add_to_map(pPacket->pBuffer, &local_bufferObj);')
+        cb_body.append('            }')
+        return "\n".join(cb_body)
+
+    def _gen_replay_get_image_subresource_info(self):
+        isi_body = []
+        isi_body.append('            size_t size = 0;')
+        isi_body.append('            void* pData = NULL;')
+        isi_body.append('            if (pPacket->pData != NULL && pPacket->pDataSize != NULL)')
+        isi_body.append('            {')
+        isi_body.append('                size = *pPacket->pDataSize;')
+        isi_body.append('                pData = glv_malloc(*pPacket->pDataSize);')
+        isi_body.append('            }')
+        isi_body.append('            replayResult = m_xglFuncs.real_xglGetImageSubresourceInfo(remap(pPacket->image), pPacket->pSubresource, pPacket->infoType, &size, pData);')
+        isi_body.append('            if (replayResult == XGL_SUCCESS)')
+        isi_body.append('            {')
+        isi_body.append('                if (size != *pPacket->pDataSize && pData != NULL)')
+        isi_body.append('                {')
+        isi_body.append('                    glv_LogWarn("xglGetImageSubresourceInfo returned a differing data size: replay (%d bytes) vs trace (%d bytes)\\n", size, *pPacket->pDataSize);')
+        isi_body.append('                }')
+        isi_body.append('                else if (pData != NULL && memcmp(pData, pPacket->pData, size) != 0)')
+        isi_body.append('                {')
+        isi_body.append('                    glv_LogWarn("xglGetImageSubresourceInfo returned differing data contents than the trace file contained.\\n");')
+        isi_body.append('                }')
+        isi_body.append('            }')
+        isi_body.append('            glv_free(pData);')
+        return "\n".join(isi_body)
+
+    def _gen_replay_update_descriptors(self):
+        ud_body = []
+        # We have to remap handles internal to the structures so save the handles prior to remap and then restore
+        # Rather than doing a deep memcpy of the entire struct and fixing any intermediate pointers, do save and restores via STL queue
+        ud_body.append('            XGL_UPDATE_SAMPLERS* pUpdateChain = (XGL_UPDATE_SAMPLERS*)pPacket->pUpdateChain;')
+        ud_body.append('            std::queue<XGL_SAMPLER> saveSamplers;')
+        ud_body.append('            std::queue<XGL_BUFFER_VIEW> saveBufferViews;')
+        ud_body.append('            std::queue<XGL_IMAGE_VIEW> saveImageViews;')
+        ud_body.append('            std::queue<XGL_DESCRIPTOR_SET> saveDescSets;')
+        ud_body.append('            while (pUpdateChain) {')
+        ud_body.append('                switch(pUpdateChain->sType)')
+        ud_body.append('                {')
+        ud_body.append('                    case XGL_STRUCTURE_TYPE_UPDATE_SAMPLERS:')
+        ud_body.append('                        for (uint32_t i = 0; i < ((XGL_UPDATE_SAMPLERS*)pUpdateChain)->count; i++) {')
+        ud_body.append('                            XGL_SAMPLER* pLocalSampler = (XGL_SAMPLER*) &((XGL_UPDATE_SAMPLERS*)pUpdateChain)->pSamplers[i];')
+        ud_body.append('                            saveSamplers.push(*pLocalSampler);')
+        ud_body.append('                            *pLocalSampler = remap(((XGL_UPDATE_SAMPLERS*)pUpdateChain)->pSamplers[i]);')
+        ud_body.append('                        }')
+        ud_body.append('                        break;')
+        ud_body.append('                    case XGL_STRUCTURE_TYPE_UPDATE_SAMPLER_TEXTURES:')
+        ud_body.append('                    {')
+        ud_body.append('                        XGL_UPDATE_SAMPLER_TEXTURES *pUST = (XGL_UPDATE_SAMPLER_TEXTURES *) pUpdateChain;')
+        ud_body.append('                        for (uint32_t i = 0; i < pUST->count; i++) {')
+        ud_body.append('                            XGL_SAMPLER *pLocalSampler = (XGL_SAMPLER *) &pUST->pSamplerImageViews[i].pSampler;')
+        ud_body.append('                            saveSamplers.push(*pLocalSampler);')
+        ud_body.append('                            *pLocalSampler = remap(pUST->pSamplerImageViews[i].pSampler);')
+        ud_body.append('                            XGL_IMAGE_VIEW *pLocalView = (XGL_IMAGE_VIEW *) &pUST->pSamplerImageViews[i].pImageView->view;')
+        ud_body.append('                            saveImageViews.push(*pLocalView);')
+        ud_body.append('                            *pLocalView = remap(pUST->pSamplerImageViews[i].pImageView->view);')
+        ud_body.append('                        }')
+        ud_body.append('                        break;')
+        ud_body.append('                    }')
+        ud_body.append('                    case XGL_STRUCTURE_TYPE_UPDATE_IMAGES:')
+        ud_body.append('                    {')
+        ud_body.append('                        XGL_UPDATE_IMAGES *pUI = (XGL_UPDATE_IMAGES*) pUpdateChain;')
+        ud_body.append('                        for (uint32_t i = 0; i < pUI->count; i++) {')
+        ud_body.append('                            XGL_IMAGE_VIEW* pLocalView = (XGL_IMAGE_VIEW*) &pUI->pImageViews[i]->view;')
+        ud_body.append('                            saveImageViews.push(*pLocalView);')
+        ud_body.append('                            *pLocalView = remap(pUI->pImageViews[i]->view);')
+        ud_body.append('                        }')
+        ud_body.append('                        break;')
+        ud_body.append('                    }')
+        ud_body.append('                    case XGL_STRUCTURE_TYPE_UPDATE_BUFFERS:')
+        ud_body.append('                    {')
+        ud_body.append('                        XGL_UPDATE_BUFFERS *pUB = (XGL_UPDATE_BUFFERS *) pUpdateChain;')
+        ud_body.append('                        for (uint32_t i = 0; i < pUB->count; i++) {')
+        ud_body.append('                            XGL_BUFFER_VIEW* pLocalView = (XGL_BUFFER_VIEW*) &pUB->pBufferViews[i]->view;')
+        ud_body.append('                            saveBufferViews.push(*pLocalView);')
+        ud_body.append('                            *pLocalView = remap(pUB->pBufferViews[i]->view);')
+        ud_body.append('                        }')
+        ud_body.append('                        break;')
+        ud_body.append('                    }')
+        ud_body.append('                    case XGL_STRUCTURE_TYPE_UPDATE_AS_COPY:')
+        ud_body.append('                        saveDescSets.push(((XGL_UPDATE_AS_COPY*)pUpdateChain)->descriptorSet);')
+        ud_body.append('                        ((XGL_UPDATE_AS_COPY*)pUpdateChain)->descriptorSet = remap(((XGL_UPDATE_AS_COPY*)pUpdateChain)->descriptorSet);')
+        ud_body.append('                        break;')
+        ud_body.append('                    default:')
+        ud_body.append('                        assert(0);')
+        ud_body.append('                        break;')
+        ud_body.append('                }')
+        ud_body.append('                pUpdateChain = (XGL_UPDATE_SAMPLERS*) pUpdateChain->pNext;')
+        ud_body.append('            }')
+        ud_body.append('            m_xglFuncs.real_xglUpdateDescriptors(remap(pPacket->descriptorSet), pPacket->pUpdateChain);')
+        ud_body.append('            pUpdateChain = (XGL_UPDATE_SAMPLERS*) pPacket->pUpdateChain;')
+        ud_body.append('            while (pUpdateChain) {')
+        ud_body.append('                switch(pUpdateChain->sType)')
+        ud_body.append('                {')
+        ud_body.append('                    case XGL_STRUCTURE_TYPE_UPDATE_SAMPLERS:')
+        ud_body.append('                        for (uint32_t i = 0; i < ((XGL_UPDATE_SAMPLERS*)pUpdateChain)->count; i++) {')
+        ud_body.append('                            XGL_SAMPLER* pLocalSampler = (XGL_SAMPLER*) &((XGL_UPDATE_SAMPLERS*)pUpdateChain)->pSamplers[i];')
+        ud_body.append('                            *pLocalSampler = saveSamplers.front();')
+        ud_body.append('                            saveSamplers.pop();')
+        ud_body.append('                        }')
+        ud_body.append('                        break;')
+        ud_body.append('                    case XGL_STRUCTURE_TYPE_UPDATE_SAMPLER_TEXTURES:')
+        ud_body.append('                    {')
+        ud_body.append('                        XGL_UPDATE_SAMPLER_TEXTURES *pUST = (XGL_UPDATE_SAMPLER_TEXTURES *) pUpdateChain;')
+        ud_body.append('                        for (uint32_t i = 0; i < pUST->count; i++) {')
+        ud_body.append('                            XGL_SAMPLER *plocalSampler = (XGL_SAMPLER *) &pUST->pSamplerImageViews[i].pSampler;')
+        ud_body.append('                            *plocalSampler = saveSamplers.front();')
+        ud_body.append('                            saveSamplers.pop();')
+        ud_body.append('                            XGL_IMAGE_VIEW *pLocalView = (XGL_IMAGE_VIEW *) &pUST->pSamplerImageViews[i].pImageView->view;')
+        ud_body.append('                            *pLocalView = saveImageViews.front();')
+        ud_body.append('                            saveImageViews.pop();')
+        ud_body.append('                        }')
+        ud_body.append('                        break;')
+        ud_body.append('                    }')
+        ud_body.append('                    case XGL_STRUCTURE_TYPE_UPDATE_IMAGES:')
+        ud_body.append('                    {')
+        ud_body.append('                        XGL_UPDATE_IMAGES *pUI = (XGL_UPDATE_IMAGES*) pUpdateChain;')
+        ud_body.append('                        for (uint32_t i = 0; i < pUI->count; i++) {')
+        ud_body.append('                            XGL_IMAGE_VIEW* pLocalView = (XGL_IMAGE_VIEW*) &pUI->pImageViews[i]->view;')
+        ud_body.append('                            *pLocalView = saveImageViews.front();')
+        ud_body.append('                            saveImageViews.pop();')
+        ud_body.append('                        }')
+        ud_body.append('                        break;')
+        ud_body.append('                    }')
+        ud_body.append('                    case XGL_STRUCTURE_TYPE_UPDATE_BUFFERS:')
+        ud_body.append('                    {')
+        ud_body.append('                        XGL_UPDATE_BUFFERS *pUB = (XGL_UPDATE_BUFFERS *) pUpdateChain;')
+        ud_body.append('                        for (uint32_t i = 0; i < pUB->count; i++) {')
+        ud_body.append('                            XGL_BUFFER_VIEW* pLocalView = (XGL_BUFFER_VIEW*) &pUB->pBufferViews[i]->view;')
+        ud_body.append('                            *pLocalView = saveBufferViews.front();')
+        ud_body.append('                            saveBufferViews.pop();')
+        ud_body.append('                        }')
+        ud_body.append('                        break;')
+        ud_body.append('                    }')
+        ud_body.append('                    case XGL_STRUCTURE_TYPE_UPDATE_AS_COPY:')
+        ud_body.append('                        ((XGL_UPDATE_AS_COPY*)pUpdateChain)->descriptorSet = saveDescSets.front();')
+        ud_body.append('                        saveDescSets.pop();')
+        ud_body.append('                        //pFreeMe = (XGL_UPDATE_SAMPLERS*)pLocalUpdateChain;')
+        ud_body.append('                        //pLocalUpdateChain = (void*)((XGL_UPDATE_SAMPLERS*)pLocalUpdateChain)->pNext;')
+        ud_body.append('                        //free(pFreeMe);')
+        ud_body.append('                        break;')
+        ud_body.append('                    default:')
+        ud_body.append('                        assert(0);')
+        ud_body.append('                        break;')
+        ud_body.append('                }')
+        ud_body.append('                pUpdateChain = (XGL_UPDATE_SAMPLERS*) pUpdateChain->pNext;')
+        ud_body.append('            }')
+        return "\n".join(ud_body)
+
+    def _gen_replay_create_descriptor_set_layout(self):
+        cdsl_body = []
+        cdsl_body.append('            XGL_SAMPLER saveSampler;')
+        cdsl_body.append('            if (pPacket->pSetLayoutInfoList != NULL) {')
+        cdsl_body.append('                XGL_SAMPLER *pSampler = (XGL_SAMPLER *) &pPacket->pSetLayoutInfoList->immutableSampler;')
+        cdsl_body.append('                saveSampler = pPacket->pSetLayoutInfoList->immutableSampler;')
+        cdsl_body.append('                *pSampler = remap(saveSampler);')
+        cdsl_body.append('            }')
+        cdsl_body.append('            XGL_DESCRIPTOR_SET_LAYOUT setLayout;')
+        cdsl_body.append('            replayResult = m_xglFuncs.real_xglCreateDescriptorSetLayout(remap(pPacket->device), pPacket->stageFlags, pPacket->pSetBindPoints, remap(pPacket->priorSetLayout), pPacket->pSetLayoutInfoList, &setLayout);')
+        cdsl_body.append('            if (replayResult == XGL_SUCCESS)')
+        cdsl_body.append('            {')
+        cdsl_body.append('                add_to_map(pPacket->pSetLayout, &setLayout);')
+        cdsl_body.append('            }')
+        cdsl_body.append('            if (pPacket->pSetLayoutInfoList != NULL) {')
+        cdsl_body.append('                XGL_SAMPLER *pSampler = (XGL_SAMPLER *) &pPacket->pSetLayoutInfoList->immutableSampler;')
+        cdsl_body.append('                *pSampler = saveSampler;')
+        cdsl_body.append('            }')
+        return "\n".join(cdsl_body)
+
+    def _gen_replay_create_graphics_pipeline(self):
+        cgp_body = []
+        cgp_body.append('            XGL_GRAPHICS_PIPELINE_CREATE_INFO createInfo;')
+        cgp_body.append('            struct shaderPair saveShader[10];')
+        cgp_body.append('            unsigned int idx = 0;')
+        cgp_body.append('            memcpy(&createInfo, pPacket->pCreateInfo, sizeof(XGL_GRAPHICS_PIPELINE_CREATE_INFO));')
+        cgp_body.append('            createInfo.lastSetLayout = remap(createInfo.lastSetLayout);')
+        cgp_body.append('            // Cast to shader type, as those are of primariy interest and all structs in LL have same header w/ sType & pNext')
+        cgp_body.append('            XGL_PIPELINE_SHADER_STAGE_CREATE_INFO* pPacketNext = (XGL_PIPELINE_SHADER_STAGE_CREATE_INFO*)pPacket->pCreateInfo->pNext;')
+        cgp_body.append('            XGL_PIPELINE_SHADER_STAGE_CREATE_INFO* pNext = (XGL_PIPELINE_SHADER_STAGE_CREATE_INFO*)createInfo.pNext;')
+        cgp_body.append('            while (XGL_NULL_HANDLE != pPacketNext)')
+        cgp_body.append('            {')
+        cgp_body.append('                if (XGL_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO == pNext->sType)')
+        cgp_body.append('                {')
+        cgp_body.append('                    saveShader[idx].val = pNext->shader.shader;')
+        cgp_body.append('                    saveShader[idx++].addr = &(pNext->shader.shader);')
+        cgp_body.append('                    pNext->shader.shader = remap(pPacketNext->shader.shader);')
+        cgp_body.append('                }')
+        cgp_body.append('                pPacketNext = (XGL_PIPELINE_SHADER_STAGE_CREATE_INFO*)pPacketNext->pNext;')
+        cgp_body.append('                pNext = (XGL_PIPELINE_SHADER_STAGE_CREATE_INFO*)pNext->pNext;')
+        cgp_body.append('            }')
+        cgp_body.append('            XGL_PIPELINE pipeline;')
+        cgp_body.append('            replayResult = m_xglFuncs.real_xglCreateGraphicsPipeline(remap(pPacket->device), &createInfo, &pipeline);')
+        cgp_body.append('            if (replayResult == XGL_SUCCESS)')
+        cgp_body.append('            {')
+        cgp_body.append('                add_to_map(pPacket->pPipeline, &pipeline);')
+        cgp_body.append('            }')
+        cgp_body.append('            for (unsigned int i = 0; i < idx; i++)')
+        cgp_body.append('                *(saveShader[i].addr) = saveShader[i].val;')
+        return "\n".join(cgp_body)
+
+    def _gen_replay_cmd_wait_events(self):
+        cwe_body = []
+        cwe_body.append('            XGL_EVENT saveEvent[100];')
+        cwe_body.append('            uint32_t idx, numRemapBuf=0, numRemapImg=0;')
+        cwe_body.append('            assert(pPacket->pWaitInfo && pPacket->pWaitInfo->eventCount <= 100);')
+        cwe_body.append('            for (idx = 0; idx < pPacket->pWaitInfo->eventCount; idx++)')
+        cwe_body.append('            {')
+        cwe_body.append('                XGL_EVENT *pEvent = (XGL_EVENT *) &(pPacket->pWaitInfo->pEvents[idx]);')
+        cwe_body.append('                saveEvent[idx] = pPacket->pWaitInfo->pEvents[idx];')
+        cwe_body.append('                *pEvent = remap(pPacket->pWaitInfo->pEvents[idx]);')
+        cwe_body.append('            }')
+        cwe_body.append('')
+        cwe_body.append('            XGL_BUFFER saveBuf[100];')
+        cwe_body.append('            XGL_IMAGE saveImg[100];')
+        cwe_body.append('            for (idx = 0; idx < pPacket->pWaitInfo->memBarrierCount; idx++)')
+        cwe_body.append('            {')
+        cwe_body.append('                XGL_MEMORY_BARRIER *pNext = (XGL_MEMORY_BARRIER *) pPacket->pWaitInfo->ppMemBarriers[idx];')
+        cwe_body.append('                assert(pNext);')
+        cwe_body.append('                if (pNext->sType == XGL_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER) {')
+        cwe_body.append('                    XGL_BUFFER_MEMORY_BARRIER *pNextBuf = (XGL_BUFFER_MEMORY_BARRIER *) pPacket->pWaitInfo->ppMemBarriers[idx];')
+        cwe_body.append('                    assert(numRemapBuf < 100);')
+        cwe_body.append('                    saveBuf[numRemapBuf++] = pNextBuf->buffer;')
+        cwe_body.append('                    pNextBuf->buffer = remap(pNextBuf->buffer);')
+        cwe_body.append('                } else if (pNext->sType == XGL_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER) {')
+        cwe_body.append('                    XGL_IMAGE_MEMORY_BARRIER *pNextImg = (XGL_IMAGE_MEMORY_BARRIER *) pPacket->pWaitInfo->ppMemBarriers[idx];')
+        cwe_body.append('                    assert(numRemapImg < 100);')
+        cwe_body.append('                    saveImg[numRemapImg++] = pNextImg->image;')
+        cwe_body.append('                    pNextImg->image = remap(pNextImg->image);')
+        cwe_body.append('                }')
+        cwe_body.append('            }')
+        cwe_body.append('            m_xglFuncs.real_xglCmdWaitEvents(remap(pPacket->cmdBuffer), pPacket->pWaitInfo);')
+        cwe_body.append('            for (idx = 0; idx < pPacket->pWaitInfo->memBarrierCount; idx++) {')
+        cwe_body.append('                XGL_MEMORY_BARRIER *pNext = (XGL_MEMORY_BARRIER *) pPacket->pWaitInfo->ppMemBarriers[idx];')
+        cwe_body.append('                if (pNext->sType == XGL_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER) {')
+        cwe_body.append('                    XGL_BUFFER_MEMORY_BARRIER *pNextBuf = (XGL_BUFFER_MEMORY_BARRIER *) pPacket->pWaitInfo->ppMemBarriers[idx];')
+        cwe_body.append('                    pNextBuf->buffer = saveBuf[idx];')
+        cwe_body.append('                } else if (pNext->sType == XGL_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER) {')
+        cwe_body.append('                    XGL_IMAGE_MEMORY_BARRIER *pNextImg = (XGL_IMAGE_MEMORY_BARRIER *) pPacket->pWaitInfo->ppMemBarriers[idx];')
+        cwe_body.append('                    pNextImg->image = saveImg[idx];')
+        cwe_body.append('                }')
+        cwe_body.append('            }')
+        cwe_body.append('            for (idx = 0; idx < pPacket->pWaitInfo->eventCount; idx++) {')
+        cwe_body.append('                XGL_EVENT *pEvent = (XGL_EVENT *) &(pPacket->pWaitInfo->pEvents[idx]);')
+        cwe_body.append('                *pEvent = saveEvent[idx];')
+        cwe_body.append('            }')
+        return "\n".join(cwe_body)
+
+    def _gen_replay_cmd_pipeline_barrier(self):
+        cpb_body = []
+        cpb_body.append('            uint32_t idx, numRemapBuf=0, numRemapImg=0;')
+        cpb_body.append('            XGL_BUFFER saveBuf[100];')
+        cpb_body.append('            XGL_IMAGE saveImg[100];')
+        cpb_body.append('            for (idx = 0; idx < pPacket->pBarrier->memBarrierCount; idx++)')
+        cpb_body.append('            {')
+        cpb_body.append('                XGL_MEMORY_BARRIER *pNext = (XGL_MEMORY_BARRIER *) pPacket->pBarrier->ppMemBarriers[idx];')
+        cpb_body.append('                assert(pNext);')
+        cpb_body.append('                if (pNext->sType == XGL_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER) {')
+        cpb_body.append('                    XGL_BUFFER_MEMORY_BARRIER *pNextBuf = (XGL_BUFFER_MEMORY_BARRIER *) pPacket->pBarrier->ppMemBarriers[idx];')
+        cpb_body.append('                    assert(numRemapBuf < 100);')
+        cpb_body.append('                    saveBuf[numRemapBuf++] = pNextBuf->buffer;')
+        cpb_body.append('                    pNextBuf->buffer = remap(pNextBuf->buffer);')
+        cpb_body.append('                } else if (pNext->sType == XGL_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER) {')
+        cpb_body.append('                    XGL_IMAGE_MEMORY_BARRIER *pNextImg = (XGL_IMAGE_MEMORY_BARRIER *) pPacket->pBarrier->ppMemBarriers[idx];')
+        cpb_body.append('                    assert(numRemapImg < 100);')
+        cpb_body.append('                    saveImg[numRemapImg++] = pNextImg->image;')
+        cpb_body.append('                    pNextImg->image = remap(pNextImg->image);')
+        cpb_body.append('                }')
+        cpb_body.append('            }')
+        cpb_body.append('            m_xglFuncs.real_xglCmdPipelineBarrier(remap(pPacket->cmdBuffer), pPacket->pBarrier);')
+        cpb_body.append('            for (idx = 0; idx < pPacket->pBarrier->memBarrierCount; idx++) {')
+        cpb_body.append('                XGL_MEMORY_BARRIER *pNext = (XGL_MEMORY_BARRIER *) pPacket->pBarrier->ppMemBarriers[idx];')
+        cpb_body.append('                if (pNext->sType == XGL_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER) {')
+        cpb_body.append('                    XGL_BUFFER_MEMORY_BARRIER *pNextBuf = (XGL_BUFFER_MEMORY_BARRIER *) pPacket->pBarrier->ppMemBarriers[idx];')
+        cpb_body.append('                    pNextBuf->buffer = saveBuf[idx];')
+        cpb_body.append('                } else if (pNext->sType == XGL_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER) {')
+        cpb_body.append('                    XGL_IMAGE_MEMORY_BARRIER *pNextImg = (XGL_IMAGE_MEMORY_BARRIER *) pPacket->pBarrier->ppMemBarriers[idx];')
+        cpb_body.append('                    pNextImg->image = saveImg[idx];')
+        cpb_body.append('                }')
+        cpb_body.append('            }')
+        return "\n".join(cpb_body)
+
+    def _gen_replay_create_framebuffer(self):
+        cf_body = []
+        cf_body.append('            XGL_FRAMEBUFFER_CREATE_INFO *pInfo = (XGL_FRAMEBUFFER_CREATE_INFO *) pPacket->pCreateInfo;')
+        cf_body.append('            XGL_COLOR_ATTACHMENT_BIND_INFO *pColorAttachments, *pSavedColor = (XGL_COLOR_ATTACHMENT_BIND_INFO*)pInfo->pColorAttachments;')
+        cf_body.append('            bool allocatedColorAttachments = false;')
+        cf_body.append('            if (pSavedColor != NULL)')
+        cf_body.append('            {')
+        cf_body.append('                allocatedColorAttachments = true;')
+        cf_body.append('                pColorAttachments = GLV_NEW_ARRAY(XGL_COLOR_ATTACHMENT_BIND_INFO, pInfo->colorAttachmentCount);')
+        cf_body.append('                memcpy(pColorAttachments, pSavedColor, sizeof(XGL_COLOR_ATTACHMENT_BIND_INFO) * pInfo->colorAttachmentCount);')
+        cf_body.append('                for (uint32_t i = 0; i < pInfo->colorAttachmentCount; i++)')
+        cf_body.append('                {')
+        cf_body.append('                    pColorAttachments[i].view = remap(pInfo->pColorAttachments[i].view);')
+        cf_body.append('                }')
+        cf_body.append('                pInfo->pColorAttachments = pColorAttachments;')
+        cf_body.append('            }')
+        cf_body.append('            // remap depth stencil target')
+        cf_body.append('            const XGL_DEPTH_STENCIL_BIND_INFO *pSavedDS = pInfo->pDepthStencilAttachment;')
+        cf_body.append('            XGL_DEPTH_STENCIL_BIND_INFO depthTarget;')
+        cf_body.append('            if (pSavedDS != NULL)')
+        cf_body.append('            {')
+        cf_body.append('                memcpy(&depthTarget, pSavedDS, sizeof(XGL_DEPTH_STENCIL_BIND_INFO));')
+        cf_body.append('                depthTarget.view = remap(pSavedDS->view);')
+        cf_body.append('                pInfo->pDepthStencilAttachment = &depthTarget;')
+        cf_body.append('            }')
+        cf_body.append('            XGL_FRAMEBUFFER local_framebuffer;')
+        cf_body.append('            replayResult = m_xglFuncs.real_xglCreateFramebuffer(remap(pPacket->device), pPacket->pCreateInfo, &local_framebuffer);')
+        cf_body.append('            pInfo->pColorAttachments = pSavedColor;')
+        cf_body.append('            pInfo->pDepthStencilAttachment = pSavedDS;')
+        cf_body.append('            if (replayResult == XGL_SUCCESS)')
+        cf_body.append('            {')
+        cf_body.append('                add_to_map(pPacket->pFramebuffer, &local_framebuffer);')
+        cf_body.append('            }')
+        cf_body.append('            if (allocatedColorAttachments)')
+        cf_body.append('            {')
+        cf_body.append('                GLV_DELETE((void*)pColorAttachments);')
+        cf_body.append('            }')
+        return "\n".join(cf_body)
+
+    def _gen_replay_create_renderpass(self):
+        cr_body = []
+        cr_body.append('            XGL_RENDER_PASS_CREATE_INFO *pInfo = (XGL_RENDER_PASS_CREATE_INFO *) pPacket->pCreateInfo;')
+        cr_body.append('            // remap framebuffer')
+        cr_body.append('            XGL_FRAMEBUFFER savedFB = 0, *pFB = &(pInfo->framebuffer);')
+        cr_body.append('            if (*pFB != NULL)')
+        cr_body.append('            {')
+        cr_body.append('                savedFB = pInfo->framebuffer;')
+        cr_body.append('                *pFB = remap(pInfo->framebuffer);')
+        cr_body.append('            }')
+        cr_body.append('            XGL_RENDER_PASS local_renderpass;')
+        cr_body.append('            replayResult = m_xglFuncs.real_xglCreateRenderPass(remap(pPacket->device), pPacket->pCreateInfo, &local_renderpass);')
+        cr_body.append('            if (*pFB != NULL)')
+        cr_body.append('                pInfo->framebuffer = savedFB;')
+        cr_body.append('            if (replayResult == XGL_SUCCESS)')
+        cr_body.append('            {')
+        cr_body.append('                add_to_map(pPacket->pRenderPass, &local_renderpass);')
+        cr_body.append('            }')
+        return "\n".join(cr_body)
+
+    def _gen_replay_begin_command_buffer(self):
+        bcb_body = []
+        bcb_body.append('            XGL_CMD_BUFFER_BEGIN_INFO* pInfo = (XGL_CMD_BUFFER_BEGIN_INFO*)pPacket->pBeginInfo;')
+        bcb_body.append('            // assume only zero or one graphics_begin_info in the chain')
+        bcb_body.append('            XGL_RENDER_PASS savedRP, *pRP;')
+        bcb_body.append('            XGL_CMD_BUFFER_GRAPHICS_BEGIN_INFO *pGInfo = NULL;')
+        bcb_body.append('            while (pInfo != NULL)')
+        bcb_body.append('            {')
+        bcb_body.append('')
+        bcb_body.append('                if (pInfo->sType == XGL_STRUCTURE_TYPE_CMD_BUFFER_GRAPHICS_BEGIN_INFO)')
+        bcb_body.append('                {')
+        bcb_body.append('                    pGInfo = (XGL_CMD_BUFFER_GRAPHICS_BEGIN_INFO *) pInfo;')
+        bcb_body.append('                    savedRP = pGInfo->renderPass;')
+        bcb_body.append('                    pRP = &(pGInfo->renderPass);')
+        bcb_body.append('                    *pRP = remap(pGInfo->renderPass);')
+        bcb_body.append('                    break;')
+        bcb_body.append('                }')
+        bcb_body.append('                pInfo = (XGL_CMD_BUFFER_BEGIN_INFO*) pInfo->pNext;')
+        bcb_body.append('            }')
+        bcb_body.append('            replayResult = m_xglFuncs.real_xglBeginCommandBuffer(remap(pPacket->cmdBuffer), pPacket->pBeginInfo);')
+        bcb_body.append('            if (pGInfo != NULL)')
+        bcb_body.append('                pGInfo->renderPass = savedRP;')
+        return "\n".join(bcb_body)
+
+    def _gen_replay_store_pipeline(self):
+        sp_body = []
+        sp_body.append('            size_t size = 0;')
+        sp_body.append('            void* pData = NULL;')
+        sp_body.append('            if (pPacket->pData != NULL && pPacket->pDataSize != NULL)')
+        sp_body.append('            {')
+        sp_body.append('                size = *pPacket->pDataSize;')
+        sp_body.append('                pData = glv_malloc(*pPacket->pDataSize);')
+        sp_body.append('            }')
+        sp_body.append('            replayResult = m_xglFuncs.real_xglStorePipeline(remap(pPacket->pipeline), &size, pData);')
+        sp_body.append('            if (replayResult == XGL_SUCCESS)')
+        sp_body.append('            {')
+        sp_body.append('                if (size != *pPacket->pDataSize && pData != NULL)')
+        sp_body.append('                {')
+        sp_body.append('                    glv_LogWarn("xglStorePipeline returned a differing data size: replay (%d bytes) vs trace (%d bytes)\\n", size, *pPacket->pDataSize);')
+        sp_body.append('                }')
+        sp_body.append('                else if (pData != NULL && memcmp(pData, pPacket->pData, size) != 0)')
+        sp_body.append('                {')
+        sp_body.append('                    glv_LogWarn("xglStorePipeline returned differing data contents than the trace file contained.\\n");')
+        sp_body.append('                }')
+        sp_body.append('            }')
+        sp_body.append('            glv_free(pData);')
+        return "\n".join(sp_body)
+
+    def _gen_replay_get_multi_gpu_compatibility(self):
+        gmgc_body = []
+        gmgc_body.append('            XGL_GPU_COMPATIBILITY_INFO cInfo;')
+        gmgc_body.append('            XGL_PHYSICAL_GPU handle0, handle1;')
+        gmgc_body.append('            handle0 = remap(pPacket->gpu0);')
+        gmgc_body.append('            handle1 = remap(pPacket->gpu1);')
+        gmgc_body.append('            replayResult = m_xglFuncs.real_xglGetMultiGpuCompatibility(handle0, handle1, &cInfo);')
+        return "\n".join(gmgc_body)
+
+    def _gen_replay_destroy_object(self):
+        do_body = []
+        do_body.append('            XGL_OBJECT object = remap(pPacket->object);')
+        do_body.append('            if (object != XGL_NULL_HANDLE)')
+        do_body.append('                replayResult = m_xglFuncs.real_xglDestroyObject(object);')
+        do_body.append('            if (replayResult == XGL_SUCCESS)')
+        do_body.append('                rm_from_map(pPacket->object);')
+        return "\n".join(do_body)
+
+    def _gen_replay_wait_for_fences(self):
+        wf_body = []
+        wf_body.append('            XGL_FENCE *pFence = GLV_NEW_ARRAY(XGL_FENCE, pPacket->fenceCount);')
+        wf_body.append('            for (uint32_t i = 0; i < pPacket->fenceCount; i++)')
+        wf_body.append('            {')
+        wf_body.append('                *(pFence + i) = remap(*(pPacket->pFences + i));')
+        wf_body.append('            }')
+        wf_body.append('            replayResult = m_xglFuncs.real_xglWaitForFences(remap(pPacket->device), pPacket->fenceCount, pFence, pPacket->waitAll, pPacket->timeout);')
+        wf_body.append('            GLV_DELETE(pFence);')
+        return "\n".join(wf_body)
+
+    def _gen_replay_wsi_associate_connection(self):
+        wac_body = []
+        wac_body.append('#if defined(PLATFORM_LINUX) || defined(XCB_NVIDIA)')
+        wac_body.append('            //associate with the replayers Wsi connection rather than tracers')
+        wac_body.append('            replayResult = m_xglFuncs.real_xglWsiX11AssociateConnection(remap(pPacket->gpu), &(m_display->m_WsiConnection));')
+        wac_body.append('#elif defined(WIN32)')
+        wac_body.append('            //TBD')
+        wac_body.append('            replayResult = XGL_SUCCESS;')
+        wac_body.append('#endif')
+        return "\n".join(wac_body)
+
+    def _gen_replay_wsi_get_msc(self):
+        wgm_body = []
+        wgm_body.append('#if defined(PLATFORM_LINUX) || defined(XCB_NVIDIA)')
+        wgm_body.append('            xcb_window_t window = m_display->m_XcbWindow;')
+        wgm_body.append('            replayResult = m_xglFuncs.real_xglWsiX11GetMSC(remap(pPacket->device), window, pPacket->crtc, pPacket->pMsc);')
+        wgm_body.append('#elif defined(WIN32)')
+        wgm_body.append('            //TBD')
+        wgm_body.append('            replayResult = XGL_SUCCESS;')
+        wgm_body.append('#else')
+        
+        wgm_body.append('#endif')
+        return "\n".join(wgm_body)
+
+    def _gen_replay_wsi_create_presentable_image(self):
+        cpi_body = []
+        cpi_body.append('#if defined(PLATFORM_LINUX) || defined(XCB_NVIDIA)')
+        cpi_body.append('            struct imageObj local_imgObj;')
+        cpi_body.append('            struct gpuMemObj local_mem;')
+        cpi_body.append('            m_display->imageHeight.push_back(pPacket->pCreateInfo->extent.height);')
+        cpi_body.append('            m_display->imageWidth.push_back(pPacket->pCreateInfo->extent.width);')
+        cpi_body.append('            replayResult = m_xglFuncs.real_xglWsiX11CreatePresentableImage(remap(pPacket->device), pPacket->pCreateInfo, &local_imgObj.replayImage, &local_mem.replayGpuMem);')
+        cpi_body.append('            if (replayResult == XGL_SUCCESS)')
+        cpi_body.append('            {')
+        cpi_body.append('                if (pPacket->pImage != NULL)')
+        cpi_body.append('                    add_to_map(pPacket->pImage, &local_imgObj);')
+        cpi_body.append('                if(pPacket->pMem != NULL)')
+        cpi_body.append('                    add_to_map(pPacket->pMem, &local_mem);')
+        cpi_body.append('                m_display->imageHandles.push_back(local_imgObj.replayImage);')
+        cpi_body.append('                m_display->imageMemory.push_back(local_mem.replayGpuMem);')
+        cpi_body.append('            }')
+        cpi_body.append('#elif defined(WIN32)')
+        cpi_body.append('            //TBD')
+        cpi_body.append('            replayResult = XGL_SUCCESS;')
+        cpi_body.append('#endif')
+        return "\n".join(cpi_body)
+
+    def _gen_replay_wsi_queue_present(self):
+        wqp_body = []
+        wqp_body.append('#if defined(PLATFORM_LINUX) || defined(XCB_NVIDIA)')
+        wqp_body.append('            XGL_WSI_X11_PRESENT_INFO pInfo;')
+        wqp_body.append('            std::vector<int>::iterator it;')
+        wqp_body.append('            memcpy(&pInfo, pPacket->pPresentInfo, sizeof(XGL_WSI_X11_PRESENT_INFO));')
+        wqp_body.append('            pInfo.srcImage = remap(pPacket->pPresentInfo->srcImage);')
+        wqp_body.append('            // use replayers Xcb window')
+        wqp_body.append('            pInfo.destWindow = m_display->m_XcbWindow;')
+        wqp_body.append('            replayResult = m_xglFuncs.real_xglWsiX11QueuePresent(remap(pPacket->queue), &pInfo, remap(pPacket->fence));')
+        wqp_body.append('            it = std::find(m_screenshotFrames.begin(), m_screenshotFrames.end(), m_display->m_frameNumber);')
+        wqp_body.append('            if (it != m_screenshotFrames.end())')
+        wqp_body.append('            {')
+        wqp_body.append('                for(unsigned int i=0; i<m_display->imageHandles.size(); i++)')
+        wqp_body.append('                {')
+        wqp_body.append('                    if (m_display->imageHandles[i] == pInfo.srcImage)')
+        wqp_body.append('                    {')
+        wqp_body.append('                        char frameName[32];')
+        wqp_body.append('                        sprintf(frameName, "%d",m_display->m_frameNumber);')
+        wqp_body.append('                        glvWritePPM(frameName, m_display->imageWidth[i], m_display->imageHeight[i],')
+        wqp_body.append('                            m_display->imageHandles[i], m_display->imageMemory[i], &m_xglFuncs);')
+        wqp_body.append('                        break;')
+        wqp_body.append('                    }')
+        wqp_body.append('                }')
+        wqp_body.append('            }')
+        wqp_body.append('#elif defined(WIN32)')
+        wqp_body.append('            //TBD')
+        wqp_body.append('            replayResult = XGL_SUCCESS;')
+        wqp_body.append('#endif')
+        wqp_body.append('            m_display->m_frameNumber++;')
+        return "\n".join(wqp_body)
+
+    def _gen_replay_alloc_memory(self):
+        am_body = []
+        am_body.append('            struct gpuMemObj local_mem;')
+        am_body.append('            if (!m_adjustForGPU)')
+        am_body.append('                replayResult = m_xglFuncs.real_xglAllocMemory(remap(pPacket->device), pPacket->pAllocInfo, &local_mem.replayGpuMem);')
+        am_body.append('            if (replayResult == XGL_SUCCESS || m_adjustForGPU)')
+        am_body.append('            {')
+        am_body.append('                local_mem.pGpuMem = new (gpuMemory);')
+        am_body.append('                if (local_mem.pGpuMem)')
+        am_body.append('                    local_mem.pGpuMem->setAllocInfo(pPacket->pAllocInfo, m_adjustForGPU);')
+        am_body.append('                add_to_map(pPacket->pMem, &local_mem);')
+        am_body.append('            }')
+        return "\n".join(am_body)
+
+    def _gen_replay_free_memory(self):
+        fm_body = []
+        fm_body.append('            struct gpuMemObj local_mem;')
+        fm_body.append('            local_mem = m_gpuMemorys.find(pPacket->mem)->second;')
+        fm_body.append('            // TODO how/when to free pendingAlloc that did not use and existing gpuMemObj')
+        fm_body.append('            replayResult = m_xglFuncs.real_xglFreeMemory(local_mem.replayGpuMem);')
+        fm_body.append('            if (replayResult == XGL_SUCCESS) ')
+        fm_body.append('            {')
+        fm_body.append('                delete local_mem.pGpuMem;')
+        fm_body.append('                rm_from_map(pPacket->mem);')
+        fm_body.append('            }')
+        return "\n".join(fm_body)
+
+    def _gen_replay_map_memory(self):
+        mm_body = []
+        mm_body.append('            struct gpuMemObj local_mem = m_gpuMemorys.find(pPacket->mem)->second;')
+        mm_body.append('            void* pData;')
+        mm_body.append('            if (!local_mem.pGpuMem->isPendingAlloc())')
+        mm_body.append('            {')
+        mm_body.append('                replayResult = m_xglFuncs.real_xglMapMemory(local_mem.replayGpuMem, pPacket->flags, &pData);')
+        mm_body.append('                if (replayResult == XGL_SUCCESS)')
+        mm_body.append('                {')
+        mm_body.append('                    if (local_mem.pGpuMem)')
+        mm_body.append('                        local_mem.pGpuMem->setMemoryMapRange(pData, 0, 0, false);')
+        mm_body.append('                }')
+        mm_body.append('            } else')
+        mm_body.append('            {')
+        mm_body.append('                if (local_mem.pGpuMem)')
+        mm_body.append('                        local_mem.pGpuMem->setMemoryMapRange(NULL, 0, 0, true);')
+        mm_body.append('            }')
+        return "\n".join(mm_body)
+        
+    def _gen_replay_unmap_memory(self):
+        um_body = []
+        um_body.append('            struct gpuMemObj local_mem = m_gpuMemorys.find(pPacket->mem)->second;')
+        um_body.append('            if (!local_mem.pGpuMem->isPendingAlloc())')
+        um_body.append('            {')
+        um_body.append('                if (local_mem.pGpuMem)')
+        um_body.append('                    local_mem.pGpuMem->copyMappingData(pPacket->pData);  // copies data from packet into memory buffer')
+        um_body.append('                replayResult = m_xglFuncs.real_xglUnmapMemory(local_mem.replayGpuMem);')
+        um_body.append('            } else')
+        um_body.append('            {')
+        um_body.append('                if (local_mem.pGpuMem)')
+        um_body.append('                {')
+        um_body.append('                    unsigned char *pBuf = (unsigned char *) glv_malloc(local_mem.pGpuMem->getMemoryMapSize());')
+        um_body.append('                    if (!pBuf)')
+        um_body.append('                        glv_LogError("vkUnmapMemory() malloc failed");')
+        um_body.append('                    local_mem.pGpuMem->setMemoryDataAddr(pBuf);')
+        um_body.append('                    local_mem.pGpuMem->copyMappingData(pPacket->pData);')
+        um_body.append('                }')
+        um_body.append('            }')
+        return "\n".join(um_body)
+
+    def _gen_replay_pin_system_memory(self):
+        psm_body = []
+        psm_body.append('            struct gpuMemObj local_mem;')
+        psm_body.append('            /* TODO do we need to skip (make pending) this call for m_adjustForGPU */')
+        psm_body.append('            replayResult = m_xglFuncs.real_xglPinSystemMemory(remap(pPacket->device), pPacket->pSysMem, pPacket->memSize, &local_mem.replayGpuMem);')
+        psm_body.append('            if (replayResult == XGL_SUCCESS)')
+        psm_body.append('                add_to_map(pPacket->pMem, &local_mem);')
+        return "\n".join(psm_body)
+
+    def _gen_replay_bind_dynamic_memory_view(self):
+        bdmv_body = []
+        bdmv_body.append('            XGL_MEMORY_VIEW_ATTACH_INFO memView;')
+        bdmv_body.append('            memcpy(&memView, pPacket->pMemView, sizeof(XGL_MEMORY_VIEW_ATTACH_INFO));')
+        bdmv_body.append('            memView.mem = remap(pPacket->pMemView->mem);')
+        bdmv_body.append('            m_xglFuncs.real_xglCmdBindDynamicMemoryView(remap(pPacket->cmdBuffer), pPacket->pipelineBindPoint, &memView);')
+        return "\n".join(bdmv_body)
+
+    # Generate main replay case statements where actual replay API call is dispatched based on input packet data
+    def _generate_replay(self):
+        # map protos to custom functions if body is fully custom
+        custom_body_dict = {'EnumerateGpus': self._gen_replay_enum_gpus,
+                            'GetGpuInfo': self._gen_replay_get_gpu_info,
+                            'CreateDevice': self._gen_replay_create_device,
+                            'GetExtensionSupport': self._gen_replay_get_extension_support,
+                            'QueueSubmit': self._gen_replay_queue_submit,
+                            'GetObjectInfo': self._gen_replay_get_object_info,
+                            'GetFormatInfo': self._gen_replay_get_format_info,
+                            'CreateImage': self._gen_replay_create_image,
+                            'CreateBuffer': self._gen_replay_create_buffer,
+                            'GetImageSubresourceInfo': self._gen_replay_get_image_subresource_info,
+                            'CreateGraphicsPipeline': self._gen_replay_create_graphics_pipeline,
+                            'CreateFramebuffer': self._gen_replay_create_framebuffer,
+                            'CreateRenderPass': self._gen_replay_create_renderpass,
+                            'BeginCommandBuffer': self._gen_replay_begin_command_buffer,
+                            'StorePipeline': self._gen_replay_store_pipeline,
+                            'GetMultiGpuCompatibility': self._gen_replay_get_multi_gpu_compatibility,
+                            'DestroyObject': self._gen_replay_destroy_object,
+                            'WaitForFences': self._gen_replay_wait_for_fences,
+                            'WsiX11AssociateConnection': self._gen_replay_wsi_associate_connection,
+                            'WsiX11GetMSC': self._gen_replay_wsi_get_msc,
+                            'WsiX11CreatePresentableImage': self._gen_replay_wsi_create_presentable_image,
+                            'WsiX11QueuePresent': self._gen_replay_wsi_queue_present,
+                            'AllocMemory': self._gen_replay_alloc_memory,
+                            'FreeMemory': self._gen_replay_free_memory,
+                            'MapMemory': self._gen_replay_map_memory,
+                            'UnmapMemory': self._gen_replay_unmap_memory,
+                            'PinSystemMemory': self._gen_replay_pin_system_memory,
+                            'CmdBindDynamicMemoryView': self._gen_replay_bind_dynamic_memory_view,
+                            'UpdateDescriptors': self._gen_replay_update_descriptors,
+                            'CreateDescriptorSetLayout': self._gen_replay_create_descriptor_set_layout,
+                            'CmdWaitEvents': self._gen_replay_cmd_wait_events,
+                            'CmdPipelineBarrier': self._gen_replay_cmd_pipeline_barrier}
+        # TODO : Need to guard CreateInstance with "if (!m_display->m_initedXGL)" check
+        # Despite returning a value, don't check these funcs b/c custom code includes check already
+        custom_check_ret_val = ['EnumerateGpus', 'GetGpuInfo', 'CreateDevice', 'GetExtensionSupport']
+        # multi-gpu Open funcs w/ list of local params to create
+        custom_open_params = {'OpenSharedMemory': (-1,),
+                              'OpenSharedQueueSemaphore': (-1,),
+                              'OpenPeerMemory': (-1,),
+                              'OpenPeerImage': (-1, -2,)}
+        # Functions that create views are unique from other create functions
+        create_view_list = ['CreateBufferView', 'CreateImageView', 'CreateColorAttachmentView', 'CreateDepthStencilView', 'CreateComputePipeline']
+        # Functions to treat as "Create' that don't have 'Create' in the name
+        special_create_list = ['LoadPipeline', 'AllocMemory', 'GetDeviceQueue', 'PinSystemMemory', 'AllocDescriptorSets']
+        # A couple funcs use do while loops
+        do_while_dict = {'GetFenceStatus': 'replayResult != pPacket->result  && pPacket->result == XGL_SUCCESS', 'GetEventStatus': '(pPacket->result == XGL_EVENT_SET || pPacket->result == XGL_EVENT_RESET) && replayResult != pPacket->result'}
+        rbody = []
+        rbody.append('#define CHECK_RETURN_VALUE(entrypoint) returnValue = handle_replay_errors(#entrypoint, replayResult, pPacket->result, returnValue);\n')
+        rbody.append('glv_replay::GLV_REPLAY_RESULT xglReplay::replay(glv_trace_packet_header *packet)')
+        rbody.append('{')
+        rbody.append('    glv_replay::GLV_REPLAY_RESULT returnValue = glv_replay::GLV_REPLAY_SUCCESS;')
+        rbody.append('    XGL_RESULT replayResult = XGL_ERROR_UNKNOWN;')
+        rbody.append('    switch (packet->packet_id)')
+        rbody.append('    {')
+        rbody.append('        case GLV_TPI_XGL_xglApiVersion:')
+        rbody.append('            break;  // nothing to replay on the version packet')
+        for proto in self.protos:
+            ret_value = False
+            create_view = False
+            create_func = False
+            # TODO : How to handle void* return of GetProcAddr?
+            if ('void' not in proto.ret) and (proto.name not in custom_check_ret_val):
+                ret_value = True
+            if proto.name in create_view_list:
+                create_view = True
+            elif 'Create' in proto.name or proto.name in special_create_list:
+                create_func = True
+            rbody.append('        case GLV_TPI_XGL_xgl%s:' % proto.name)
+            rbody.append('        {')
+            rbody.append('            struct_xgl%s* pPacket = (struct_xgl%s*)(packet->pBody);' % (proto.name, proto.name))
+            if proto.name in custom_body_dict:
+                rbody.append(custom_body_dict[proto.name]())
+            else:
+                if proto.name in custom_open_params:
+                    rbody.append('            XGL_DEVICE handle;')
+                    for pidx in custom_open_params[proto.name]:
+                        rbody.append('            %s local_%s;' % (proto.params[pidx].ty.replace('const ', '').strip('*'), proto.params[pidx].name))
+                    rbody.append('            handle = remap(pPacket->device);')
+                elif create_view:
+                    rbody.append('            %s createInfo;' % (proto.params[1].ty.strip('*').replace('const ', '')))
+                    rbody.append('            memcpy(&createInfo, pPacket->pCreateInfo, sizeof(%s));' % (proto.params[1].ty.strip('*').replace('const ', '')))
+                    if 'CreateComputePipeline' == proto.name:
+                        rbody.append('            createInfo.cs.shader = remap(pPacket->pCreateInfo->cs.shader);')
+                    elif 'CreateBufferView' == proto.name:
+                        rbody.append('            createInfo.buffer = remap(pPacket->pCreateInfo->buffer);')
+                    else:
+                        rbody.append('            createInfo.image = remap(pPacket->pCreateInfo->image);')
+                    rbody.append('            %s local_%s;' % (proto.params[-1].ty.strip('*').replace('const ', ''), proto.params[-1].name))
+                elif create_func: # Declare local var to store created handle into
+                    rbody.append('            %s local_%s;' % (proto.params[-1].ty.strip('*').replace('const ', ''), proto.params[-1].name))
+                    if 'AllocDescriptorSets' == proto.name:
+                        rbody.append('            %s local_%s[100];' % (proto.params[-2].ty.strip('*').replace('const ', ''), proto.params[-2].name))
+                        rbody.append('            XGL_DESCRIPTOR_SET_LAYOUT localDescSets[100];')
+                        rbody.append('            assert(pPacket->count <= 100);')
+                        rbody.append('            for (uint32_t i = 0; i < pPacket->count; i++)')
+                        rbody.append('            {')
+                        rbody.append('                localDescSets[i] = remap(pPacket->%s[i]);' % (proto.params[-3].name))
+                        rbody.append('            }')
+                elif proto.name == 'ClearDescriptorSets':
+                    rbody.append('            XGL_DESCRIPTOR_SET localDescSets[100];')
+                    rbody.append('            assert(pPacket->count <= 100);')
+                    rbody.append('            for (uint32_t i = 0; i < pPacket->count; i++)')
+                    rbody.append('            {')
+                    rbody.append('                localDescSets[i] = remap(pPacket->%s[i]);' % (proto.params[-1].name))
+                    rbody.append('            }')
+                elif proto.name in do_while_dict:
+                    rbody.append('            do {')
+                elif proto.name == 'EnumerateLayers':
+                    rbody.append('            char **bufptr = GLV_NEW_ARRAY(char *, pPacket->maxLayerCount);')
+                    rbody.append('            char **ptrLayers = (pPacket->pOutLayers == NULL) ? bufptr : (char **) pPacket->pOutLayers;')
+                    rbody.append('            for (unsigned int i = 0; i < pPacket->maxLayerCount; i++)')
+                    rbody.append('                bufptr[i] = GLV_NEW_ARRAY(char, pPacket->maxStringSize);')
+                elif proto.name == 'DestroyInstance':
+                    rbody.append('            xglDbgUnregisterMsgCallback(g_fpDbgMsgCallback);')
+                rr_string = '            '
+                if ret_value:
+                    rr_string = '            replayResult = '
+                rr_string += 'm_xglFuncs.real_xgl%s(' % proto.name
+                for p in proto.params:
+                    # For last param of Create funcs, pass address of param
+                    if create_func:
+                        if p.name == proto.params[-1].name:
+                            rr_string += '&local_%s, ' % p.name
+                        elif proto.name == 'AllocDescriptorSets' and p.name == proto.params[-2].name:
+                            rr_string += 'local_%s, ' % p.name
+                        else:
+                            rr_string += '%s, ' % self._get_packet_param(p.ty, p.name)
+                    else:
+                        rr_string += '%s, ' % self._get_packet_param(p.ty, p.name)
+                rr_string = '%s);' % rr_string[:-2]
+                if proto.name in custom_open_params:
+                    rr_list = rr_string.split(', ')
+                    rr_list[0] = rr_list[0].replace('remap(pPacket->device)', 'handle')
+                    for pidx in custom_open_params[proto.name]:
+                        rr_list[pidx] = '&local_%s' % proto.params[pidx].name
+                    rr_string = ', '.join(rr_list)
+                    rr_string += ');'
+                elif create_view:
+                    rr_list = rr_string.split(', ')
+                    rr_list[-2] = '&createInfo'
+                    rr_list[-1] = '&local_%s);' % proto.params[-1].name
+                    rr_string = ', '.join(rr_list)
+                    # this is a sneaky shortcut to use generic create code below to add_to_map
+                    create_func = True
+                elif proto.name == 'EnumerateLayers':
+                    rr_string = rr_string.replace('pPacket->pOutLayers', 'ptrLayers')
+                elif proto.name == 'ClearDescriptorSets':
+                    rr_string = rr_string.replace('pPacket->pDescriptorSets', 'localDescSets')
+                elif proto.name == 'AllocDescriptorSets':
+                    rr_string = rr_string.replace('pPacket->pSetLayouts', 'localDescSets')
+                rbody.append(rr_string)
+                if 'DestroyDevice' in proto.name:
+                    rbody.append('            if (replayResult == XGL_SUCCESS)')
+                    rbody.append('            {')
+                    rbody.append('                m_pCBDump = NULL;')
+                    rbody.append('                m_pDSDump = NULL;')
+                    rbody.append('                rm_from_map(pPacket->device);')
+                    rbody.append('                m_display->m_initedXGL = false;')
+                    rbody.append('            }')
+                if 'DestroyInstance' in proto.name:
+                    rbody.append('            if (replayResult == XGL_SUCCESS)')
+                    rbody.append('            {')
+                    rbody.append('                // TODO need to handle multiple instances and only clearing maps within an instance.')
+                    rbody.append('                // TODO this only works with a single instance used at any given time.')
+                    rbody.append('                clear_all_map_handles();')
+                    rbody.append('            }')
+                elif 'AllocDescriptorSets' in proto.name:
+                    rbody.append('            if (replayResult == XGL_SUCCESS)')
+                    rbody.append('            {')
+                    rbody.append('                for (uint32_t i = 0; i < local_pCount; i++) {')
+                    rbody.append('                    add_to_map(&pPacket->%s[i], &local_%s[i]);' % (proto.params[-2].name, proto.params[-2].name))
+                    rbody.append('                }')
+                    rbody.append('            }')
+                elif create_func: # save handle mapping if create successful
+                    rbody.append('            if (replayResult == XGL_SUCCESS)')
+                    rbody.append('            {')
+                    rbody.append('                add_to_map(pPacket->%s, &local_%s);' % (proto.params[-1].name, proto.params[-1].name))
+                    rbody.append('            }')
+                elif proto.name in do_while_dict:
+                    rbody[-1] = '    %s' % rbody[-1]
+                    rbody.append('            } while (%s);' % do_while_dict[proto.name])
+                    rbody.append('            if (pPacket->result != XGL_NOT_READY || replayResult != XGL_SUCCESS)')
+                elif proto.name == 'EnumerateLayers':
+                    rbody.append('            for (unsigned int i = 0; i < pPacket->maxLayerCount; i++)')
+                    rbody.append('                GLV_DELETE(bufptr[i]);')
+            if ret_value:
+                rbody.append('            CHECK_RETURN_VALUE(xgl%s);' % proto.name)
+            if 'MsgCallback' in proto.name:
+                rbody.pop()
+                rbody.pop()
+                rbody.pop()
+                rbody.append('            // Just eating these calls as no way to restore dbg func ptr.')
+            rbody.append('            break;')
+            rbody.append('        }')
+        rbody.append('        default:')
+        rbody.append('            glv_LogWarn("Unrecognized packet_id %u, skipping\\n", packet->packet_id);')
+        rbody.append('            returnValue = glv_replay::GLV_REPLAY_INVALID_ID;')
+        rbody.append('            break;')
+        rbody.append('    }')
+        rbody.append('    return returnValue;')
+        rbody.append('}')
+        return "\n".join(rbody)
+
+class GlaveTraceHeader(Subcommand):
+    def generate_header(self):
+        header_txt = []
+        header_txt.append('#include "glvtrace_xgl_xgl_structs.h"')
+        header_txt.append('#include "glvtrace_xgl_packet_id.h"\n')
+        header_txt.append('void AttachHooks();')
+        header_txt.append('void DetachHooks();')
+        header_txt.append('void InitTracer(void);\n')
+        return "\n".join(header_txt)
+
+    def generate_body(self):
+        body = [self._generate_trace_func_ptrs(),
+                self._generate_trace_func_protos()]
+
+        return "\n".join(body)
+
+class GlaveTraceC(Subcommand):
+    def generate_header(self):
+        header_txt = []
+        header_txt.append('#include "glv_platform.h"')
+        header_txt.append('#include "glv_common.h"')
+        header_txt.append('#include "glvtrace_xgl_xgl.h"')
+        header_txt.append('#include "glvtrace_xgl_xgldbg.h"')
+        header_txt.append('#include "glvtrace_xgl_xglwsix11ext.h"')
+        header_txt.append('#include "glv_interconnect.h"')
+        header_txt.append('#include "glv_filelike.h"')
+        header_txt.append('#include "xgl_struct_size_helper.h"')
+        header_txt.append('#ifdef WIN32')
+        header_txt.append('#include "mhook/mhook-lib/mhook.h"')
+        header_txt.append('#endif')
+        header_txt.append('#include "glv_trace_packet_utils.h"')
+        header_txt.append('#include <stdio.h>\n')
+        return "\n".join(header_txt)
+
+    def generate_body(self):
+        body = [self._generate_func_ptr_assignments(),
+                self._generate_attach_hooks(),
+                self._generate_detach_hooks(),
+                self._generate_init_funcs(),
+                self._generate_helper_funcs(),
+                self._generate_trace_funcs()]
+
+        return "\n".join(body)
+
+class GlavePacketID(Subcommand):
+    def generate_header(self):
+        header_txt = []
+        header_txt.append('#pragma once\n')
+        header_txt.append('#include "glv_trace_packet_utils.h"')
+        header_txt.append('#include "glv_trace_packet_identifiers.h"')
+        header_txt.append('#include "glv_interconnect.h"')
+        header_txt.append('#include "glvtrace_xgl_xgl_structs.h"')
+        header_txt.append('#include "glvtrace_xgl_xgldbg_structs.h"')
+        header_txt.append('#include "glvtrace_xgl_xglwsix11ext_structs.h"')
+        header_txt.append('#include "xgl_enum_string_helper.h"')
+        header_txt.append('#if defined(WIN32)')
+        header_txt.append('#define snprintf _snprintf')
+        header_txt.append('#endif')
+        header_txt.append('#define SEND_ENTRYPOINT_ID(entrypoint) ;')
+        header_txt.append('//#define SEND_ENTRYPOINT_ID(entrypoint) glv_TraceInfo(#entrypoint "\\n");\n')
+        header_txt.append('#define SEND_ENTRYPOINT_PARAMS(entrypoint, ...) ;')
+        header_txt.append('//#define SEND_ENTRYPOINT_PARAMS(entrypoint, ...) glv_TraceInfo(entrypoint, __VA_ARGS__);\n')
+        header_txt.append('#define CREATE_TRACE_PACKET(entrypoint, buffer_bytes_needed) \\')
+        header_txt.append('    pHeader = glv_create_trace_packet(GLV_TID_XGL, GLV_TPI_XGL_##entrypoint, sizeof(struct_##entrypoint), buffer_bytes_needed);\n')
+        header_txt.append('#define FINISH_TRACE_PACKET() \\')
+        header_txt.append('    glv_finalize_trace_packet(pHeader); \\')
+        header_txt.append('    glv_write_trace_packet(pHeader, glv_trace_get_trace_file()); \\')
+        header_txt.append('    glv_delete_trace_packet(&pHeader);')
+        return "\n".join(header_txt)
+
+    def generate_body(self):
+        body = [self._generate_packet_id_enum(),
+                self._generate_stringify_func(),
+                self._generate_interp_func()]
+
+        return "\n".join(body)
+
+class GlaveCoreStructs(Subcommand):
+    def generate_header(self):
+        header_txt = []
+        header_txt.append('#pragma once\n')
+        header_txt.append('#include "xgl.h"')
+        header_txt.append('#include "glv_trace_packet_utils.h"\n')
+        return "\n".join(header_txt)
+
+    def generate_body(self):
+        body = [self._generate_struct_util_funcs(),
+                self._generate_interp_funcs()]
+
+        return "\n".join(body)
+
+class GlaveWsiHeader(Subcommand):
+    def generate_header(self):
+        header_txt = []
+        header_txt.append('#pragma once\n')
+        header_txt.append('#include "xgl.h"')
+        header_txt.append('#if defined(PLATFORM_LINUX) || defined(XCB_NVIDIA)')
+        header_txt.append('#include "xglWsiX11Ext.h"\n')
+        header_txt.append('#else')
+        header_txt.append('#include "xglWsiWinExt.h"')
+        header_txt.append('#endif')
+        header_txt.append('void AttachHooks_xglwsix11ext();')
+        header_txt.append('void DetachHooks_xglwsix11ext();')
+        return "\n".join(header_txt)
+
+    def generate_body(self):
+        body = [self._generate_trace_func_ptrs_ext(),
+                self._generate_trace_func_protos_ext()]
+
+        return "\n".join(body)
+
+class GlaveWsiC(Subcommand):
+    def generate_header(self):
+        header_txt = []
+        header_txt.append('#include "glv_platform.h"')
+        header_txt.append('#include "glv_common.h"')
+        header_txt.append('#include "glvtrace_xgl_xglwsix11ext.h"')
+        header_txt.append('#include "glvtrace_xgl_xglwsix11ext_structs.h"')
+        header_txt.append('#include "glvtrace_xgl_packet_id.h"')
+        header_txt.append('#ifdef WIN32')
+        header_txt.append('#include "mhook/mhook-lib/mhook.h"')
+        header_txt.append('#endif')
+        return "\n".join(header_txt)
+
+    def generate_body(self):
+        body = [self._generate_func_ptr_assignments_ext(),
+                self._generate_attach_hooks_ext(),
+                self._generate_detach_hooks_ext(),
+                self._generate_trace_funcs_ext()]
+
+        return "\n".join(body)
+
+class GlaveWsiStructs(Subcommand):
+    def generate_header(self):
+        header_txt = []
+        header_txt.append('#pragma once\n')
+        header_txt.append('#if defined(PLATFORM_LINUX) || defined(XCB_NVIDIA)')
+        header_txt.append('#include "xglWsiX11Ext.h"')
+        header_txt.append('#else')
+        header_txt.append('#include "xglWsiWinExt.h"')
+        header_txt.append('#endif')
+        header_txt.append('#include "glv_trace_packet_utils.h"\n')
+        return "\n".join(header_txt)
+
+    def generate_body(self):
+        body = [self._generate_interp_funcs_ext()]
+
+        return "\n".join(body)
+
+class GlaveDbgHeader(Subcommand):
+    def generate_header(self):
+        header_txt = []
+        header_txt.append('#pragma once\n')
+        header_txt.append('#include "xgl.h"')
+        header_txt.append('#include "xglDbg.h"\n')
+        header_txt.append('void AttachHooks_xgldbg();')
+        header_txt.append('void DetachHooks_xgldbg();')
+        return "\n".join(header_txt)
+
+    def generate_body(self):
+        body = [self._generate_trace_func_ptrs_ext('Dbg'),
+                self._generate_trace_func_protos_ext('Dbg')]
+
+        return "\n".join(body)
+
+class GlaveDbgC(Subcommand):
+    def generate_header(self):
+        header_txt = []
+        header_txt.append('#include "glv_platform.h"')
+        header_txt.append('#include "glv_common.h"')
+        header_txt.append('#include "glvtrace_xgl_xgl.h"')
+        header_txt.append('#include "glvtrace_xgl_xgldbg.h"')
+        header_txt.append('#include "glvtrace_xgl_xgldbg_structs.h"')
+        header_txt.append('#include "glvtrace_xgl_packet_id.h"')
+        header_txt.append('#ifdef WIN32')
+        header_txt.append('#include "mhook/mhook-lib/mhook.h"')
+        header_txt.append('#endif')
+        return "\n".join(header_txt)
+
+    def generate_body(self):
+        body = [self._generate_func_ptr_assignments_ext('Dbg'),
+                self._generate_attach_hooks_ext('Dbg'),
+                self._generate_detach_hooks_ext('Dbg'),
+                self._generate_trace_funcs_ext('Dbg')]
+
+        return "\n".join(body)
+
+class GlaveDbgStructs(Subcommand):
+    def generate_header(self):
+        header_txt = []
+        header_txt.append('#pragma once\n')
+        header_txt.append('#include "xglDbg.h"')
+        header_txt.append('#include "glv_trace_packet_utils.h"\n')
+        return "\n".join(header_txt)
+
+    def generate_body(self):
+        body = [self._generate_interp_funcs_ext('Dbg')]
+
+        return "\n".join(body)
+
+class GlaveReplayHeader(Subcommand):
+    def generate_header(self):
+        header_txt = []
+        header_txt.append('#pragma once\n')
+        header_txt.append('#include <set>')
+        header_txt.append('#include <map>')
+        header_txt.append('#include <vector>')
+        header_txt.append('#include <string>')
+        header_txt.append('#if defined(PLATFORM_LINUX) || defined(XCB_NVIDIA)')
+        header_txt.append('#include <xcb/xcb.h>\n')
+        header_txt.append('#endif')
+        header_txt.append('#include "glvreplay_window.h"')
+        header_txt.append('#include "glvreplay_factory.h"')
+        header_txt.append('#include "glv_trace_packet_identifiers.h"\n')
+        header_txt.append('#include "xgl.h"')
+        header_txt.append('#include "xglDbg.h"')
+        header_txt.append('#if defined(PLATFORM_LINUX) || defined(XCB_NVIDIA)')
+        header_txt.append('#include "xglWsiX11Ext.h"')
+        header_txt.append('#else')
+        header_txt.append('#include "xglWsiWinExt.h"')
+        header_txt.append('#endif')
+        header_txt.append('#include "draw_state.h"')
+        return "\n".join(header_txt)
+
+    def generate_body(self):
+        body = [self._generate_replay_class_decls(),
+                self._generate_replay_func_ptrs(),
+                self._generate_replay_class()]
+
+        return "\n".join(body)
+
+class GlaveReplayC(Subcommand):
+    def generate_header(self):
+        header_txt = []
+        header_txt.append('#include "glvreplay_xgl_replay.h"\n')
+        header_txt.append('#include "glvreplay_xgl.h"\n')
+        header_txt.append('#include "glvreplay_xgl_write_ppm.h"\n')
+        header_txt.append('#include "glvreplay_main.h"\n')
+        header_txt.append('#include <algorithm>')
+        header_txt.append('#include <queue>')
+        header_txt.append('glvreplay_settings *g_pReplaySettings;')
+        header_txt.append('extern "C" {')
+        header_txt.append('#include "glvtrace_xgl_xgl_structs.h"')
+        header_txt.append('#include "glvtrace_xgl_xgldbg_structs.h"')
+        header_txt.append('#include "glvtrace_xgl_xglwsix11ext_structs.h"')
+        header_txt.append('#include "glvtrace_xgl_packet_id.h"')
+        header_txt.append('#include "xgl_enum_string_helper.h"\n}\n')
+        header_txt.append('#define APP_NAME "glvreplay_xgl"')
+        header_txt.append('#define IDI_ICON 101\n')
+        header_txt.append('static const char* g_extensions[] =')
+        header_txt.append('{')
+        header_txt.append('        "XGL_WSI_WINDOWS",')
+        header_txt.append('        "XGL_TIMER_QUEUE",')
+        header_txt.append('        "XGL_GPU_TIMESTAMP_CALIBRATION",')
+        header_txt.append('        "XGL_DMA_QUEUE",')
+        header_txt.append('        "XGL_COMMAND_BUFFER_CONTROL_FLOW",')
+        header_txt.append('        "XGL_COPY_OCCLUSION_QUERY_DATA",')
+        header_txt.append('        "XGL_ADVANCED_MULTISAMPLING",')
+        header_txt.append('        "XGL_BORDER_COLOR_PALETTE"')
+        header_txt.append('};')
+        return "\n".join(header_txt)
+
+    def generate_body(self):
+        body = [self._generate_replay_display_init_xgl(),
+                self._generate_replay_display_init(),
+                self._generate_replay_display_structors(),
+                self._generate_replay_display_window(),
+                self._generate_replay_objMemory_funcs(),
+                self._generate_replay_structors(),
+                self._generate_replay_init(),
+                self._generate_replay_errors(),
+                self._generate_replay_validation_funcs(),
+                self._generate_replay_init_funcs(),
+                self._generate_replay()]
+
+        return "\n".join(body)
+
+def main():
+    subcommands = {
+            "glave-trace-h" : GlaveTraceHeader,
+            "glave-trace-c" : GlaveTraceC,
+            "glave-packet-id" : GlavePacketID,
+            "glave-core-structs" : GlaveCoreStructs,
+            "glave-wsi-trace-h" : GlaveWsiHeader,
+            "glave-wsi-trace-c" : GlaveWsiC,
+            "glave-wsi-trace-structs" : GlaveWsiStructs,
+            "glave-dbg-trace-h" : GlaveDbgHeader,
+            "glave-dbg-trace-c" : GlaveDbgC,
+            "glave-dbg-trace-structs" : GlaveDbgStructs,
+            "glave-replay-h" : GlaveReplayHeader,
+            "glave-replay-c" : GlaveReplayC,
+    }
+
+    if len(sys.argv) < 2 or sys.argv[1] not in subcommands:
+        print("Usage: %s <subcommand> [options]" % sys.argv[0])
+        print
+        print("Available sucommands are: %s" % " ".join(subcommands))
+        exit(1)
+
+    subcmd = subcommands[sys.argv[1]](sys.argv[2:])
+    subcmd.run()
+
+if __name__ == "__main__":
+    main()
diff --git a/tools/glave/src/glv_extensions/glvdebug_xgl/CMakeLists.txt b/tools/glave/src/glv_extensions/glvdebug_xgl/CMakeLists.txt
index 32a66dd..589cf66 100644
--- a/tools/glave/src/glv_extensions/glvdebug_xgl/CMakeLists.txt
+++ b/tools/glave/src/glv_extensions/glvdebug_xgl/CMakeLists.txt
@@ -17,15 +17,22 @@
 else()
 
 include_directories(${CMAKE_CURRENT_BINARY_DIR} ${SRC_DIR}/../../../include)
-# This file is shared between replayer and tracer and are generated to each dir.  Should generate them to common area
-add_custom_command(OUTPUT glvtrace_xgl_packet_id.h glvtrace_xgl_xgl_structs.h glvtrace_xgl_xglwsix11ext_structs.h glvtrace_xgl_xgldbg_structs.h xgl_enum_string_helper.h
-        COMMAND ${PYTHON_CMD} ${SRC_DIR}/../../../glave-generate.py glave-packet-id > glvtrace_xgl_packet_id.h
-        COMMAND ${PYTHON_CMD} ${SRC_DIR}/../../../glave-generate.py glave-core-structs > glvtrace_xgl_xgl_structs.h
-        COMMAND ${PYTHON_CMD} ${SRC_DIR}/../../../glave-generate.py glave-wsi-trace-structs > glvtrace_xgl_xglwsix11ext_structs.h
-        COMMAND ${PYTHON_CMD} ${SRC_DIR}/../../../glave-generate.py glave-dbg-trace-structs > glvtrace_xgl_xgldbg_structs.h
-        COMMAND ${PYTHON_CMD} ${SRC_DIR}/../../../xgl_helper.py --gen_enum_string_helper ${SRC_DIR}/../../../include/xgl.h --abs_out_dir ./
-	           DEPENDS ${SRC_DIR}/../../../glave-generate.py
-                           ${SRC_DIR}/../../../xgl_helper.py)
+
+file(MAKE_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/codegen)
+
+add_custom_command(OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/codegen/glvtrace_xgl_packet_id.h
+                          ${CMAKE_CURRENT_SOURCE_DIR}/codegen/glvtrace_xgl_xgl_structs.h
+                          ${CMAKE_CURRENT_SOURCE_DIR}/codegen/glvtrace_xgl_xglwsix11ext_structs.h
+                          ${CMAKE_CURRENT_SOURCE_DIR}/codegen/glvtrace_xgl_xgldbg_structs.h
+                          ${CMAKE_CURRENT_SOURCE_DIR}/codegen/xgl_enum_string_helper.h
+        COMMAND ${PYTHON_CMD} ${SRC_DIR}/../scripts/vk_generate.py glave-packet-id > glvtrace_xgl_packet_id.h
+        COMMAND ${PYTHON_CMD} ${SRC_DIR}/../scripts/vk_generate.py glave-core-structs > glvtrace_xgl_xgl_structs.h
+        COMMAND ${PYTHON_CMD} ${SRC_DIR}/../scripts/vk_generate.py glave-wsi-trace-structs > glvtrace_xgl_xglwsix11ext_structs.h
+        COMMAND ${PYTHON_CMD} ${SRC_DIR}/../scripts/vk_generate.py glave-dbg-trace-structs > glvtrace_xgl_xgldbg_structs.h
+        COMMAND ${PYTHON_CMD} ${SRC_DIR}/../../../xgl_helper.py --gen_enum_string_helper ${SRC_DIR}/../../../include/xgl.h --abs_out_dir ${CMAKE_CURRENT_SOURCE_DIR}/codegen
+                   DEPENDS ${SRC_DIR}/../scripts/vk_generate.py
+                           ${SRC_DIR}/../../../xgl_helper.py
+                   WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/codegen)
 
 if (${CMAKE_SYSTEM_NAME} MATCHES "Windows")
     set(PATH_TO_WIN_XGL ${CMAKE_CURRENT_BINARY_DIR}/../../../../../loader/${CMAKE_CFG_INTDIR})
@@ -66,22 +73,22 @@
 )
 
 set(HDR_LIST
-    glvtrace_xgl_packet_id.h
     glvdebug_xgl_settings.h
     glvdebug_xgl_qgroupframesproxymodel.h
-    glvtrace_xgl_xgl_structs.h
-    glvtrace_xgl_xglwsix11ext_structs.h
-    glvtrace_xgl_xgldbg_structs.h
+    codegen/glvtrace_xgl_packet_id.h
+    codegen/glvtrace_xgl_xgl_structs.h
+    codegen/glvtrace_xgl_xglwsix11ext_structs.h
+    codegen/glvtrace_xgl_xgldbg_structs.h
     ${SRC_DIR}/glvdebug/glvdebug_qgroupthreadsproxymodel.h
     ${SRC_DIR}/glvdebug/glvdebug_controller.h
     ${SRC_DIR}/glvreplay/glvreplay_factory.h
 )
 
 include_directories(
+    codegen
     ${SRC_DIR}/glvcommon
     ${SRC_DIR}/glvdebug
     ${SRC_DIR}/glvreplay
-    ${SRC_DIR}/glv_extensions/glvtrace_xgl
     ${SRC_DIR}/thirdparty
     ${Qt5Widgets_INCLUDE_DIRS}
 )
diff --git a/tools/glave/src/glv_extensions/glvdebug_xgl/codegen/glvtrace_xgl_packet_id.h b/tools/glave/src/glv_extensions/glvdebug_xgl/codegen/glvtrace_xgl_packet_id.h
new file mode 100644
index 0000000..d1dded3
--- /dev/null
+++ b/tools/glave/src/glv_extensions/glvdebug_xgl/codegen/glvtrace_xgl_packet_id.h
@@ -0,0 +1,1475 @@
+/* THIS FILE IS GENERATED.  DO NOT EDIT. */
+
+/*
+ * XGL
+ *
+ * Copyright (C) 2014 LunarG, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+#pragma once
+
+#include "glv_trace_packet_utils.h"
+#include "glv_trace_packet_identifiers.h"
+#include "glv_interconnect.h"
+#include "glvtrace_xgl_xgl_structs.h"
+#include "glvtrace_xgl_xgldbg_structs.h"
+#include "glvtrace_xgl_xglwsix11ext_structs.h"
+#include "xgl_enum_string_helper.h"
+#if defined(WIN32)
+#define snprintf _snprintf
+#endif
+#define SEND_ENTRYPOINT_ID(entrypoint) ;
+//#define SEND_ENTRYPOINT_ID(entrypoint) glv_TraceInfo(#entrypoint "\n");
+
+#define SEND_ENTRYPOINT_PARAMS(entrypoint, ...) ;
+//#define SEND_ENTRYPOINT_PARAMS(entrypoint, ...) glv_TraceInfo(entrypoint, __VA_ARGS__);
+
+#define CREATE_TRACE_PACKET(entrypoint, buffer_bytes_needed) \
+    pHeader = glv_create_trace_packet(GLV_TID_XGL, GLV_TPI_XGL_##entrypoint, sizeof(struct_##entrypoint), buffer_bytes_needed);
+
+#define FINISH_TRACE_PACKET() \
+    glv_finalize_trace_packet(pHeader); \
+    glv_write_trace_packet(pHeader, glv_trace_get_trace_file()); \
+    glv_delete_trace_packet(&pHeader);
+
+enum GLV_TRACE_PACKET_ID_XGL
+{
+    GLV_TPI_XGL_xglApiVersion = GLV_TPI_BEGIN_API_HERE,
+    GLV_TPI_XGL_xglCreateInstance,
+    GLV_TPI_XGL_xglDestroyInstance,
+    GLV_TPI_XGL_xglEnumerateGpus,
+    GLV_TPI_XGL_xglGetGpuInfo,
+    GLV_TPI_XGL_xglGetProcAddr,
+    GLV_TPI_XGL_xglCreateDevice,
+    GLV_TPI_XGL_xglDestroyDevice,
+    GLV_TPI_XGL_xglGetExtensionSupport,
+    GLV_TPI_XGL_xglEnumerateLayers,
+    GLV_TPI_XGL_xglGetDeviceQueue,
+    GLV_TPI_XGL_xglQueueSubmit,
+    GLV_TPI_XGL_xglQueueSetGlobalMemReferences,
+    GLV_TPI_XGL_xglQueueWaitIdle,
+    GLV_TPI_XGL_xglDeviceWaitIdle,
+    GLV_TPI_XGL_xglAllocMemory,
+    GLV_TPI_XGL_xglFreeMemory,
+    GLV_TPI_XGL_xglSetMemoryPriority,
+    GLV_TPI_XGL_xglMapMemory,
+    GLV_TPI_XGL_xglUnmapMemory,
+    GLV_TPI_XGL_xglPinSystemMemory,
+    GLV_TPI_XGL_xglGetMultiGpuCompatibility,
+    GLV_TPI_XGL_xglOpenSharedMemory,
+    GLV_TPI_XGL_xglOpenSharedQueueSemaphore,
+    GLV_TPI_XGL_xglOpenPeerMemory,
+    GLV_TPI_XGL_xglOpenPeerImage,
+    GLV_TPI_XGL_xglDestroyObject,
+    GLV_TPI_XGL_xglGetObjectInfo,
+    GLV_TPI_XGL_xglBindObjectMemory,
+    GLV_TPI_XGL_xglBindObjectMemoryRange,
+    GLV_TPI_XGL_xglBindImageMemoryRange,
+    GLV_TPI_XGL_xglCreateFence,
+    GLV_TPI_XGL_xglGetFenceStatus,
+    GLV_TPI_XGL_xglWaitForFences,
+    GLV_TPI_XGL_xglCreateQueueSemaphore,
+    GLV_TPI_XGL_xglSignalQueueSemaphore,
+    GLV_TPI_XGL_xglWaitQueueSemaphore,
+    GLV_TPI_XGL_xglCreateEvent,
+    GLV_TPI_XGL_xglGetEventStatus,
+    GLV_TPI_XGL_xglSetEvent,
+    GLV_TPI_XGL_xglResetEvent,
+    GLV_TPI_XGL_xglCreateQueryPool,
+    GLV_TPI_XGL_xglGetQueryPoolResults,
+    GLV_TPI_XGL_xglGetFormatInfo,
+    GLV_TPI_XGL_xglCreateBuffer,
+    GLV_TPI_XGL_xglCreateBufferView,
+    GLV_TPI_XGL_xglCreateImage,
+    GLV_TPI_XGL_xglSetFastClearColor,
+    GLV_TPI_XGL_xglSetFastClearDepth,
+    GLV_TPI_XGL_xglGetImageSubresourceInfo,
+    GLV_TPI_XGL_xglCreateImageView,
+    GLV_TPI_XGL_xglCreateColorAttachmentView,
+    GLV_TPI_XGL_xglCreateDepthStencilView,
+    GLV_TPI_XGL_xglCreateShader,
+    GLV_TPI_XGL_xglCreateGraphicsPipeline,
+    GLV_TPI_XGL_xglCreateComputePipeline,
+    GLV_TPI_XGL_xglStorePipeline,
+    GLV_TPI_XGL_xglLoadPipeline,
+    GLV_TPI_XGL_xglCreatePipelineDelta,
+    GLV_TPI_XGL_xglCreateSampler,
+    GLV_TPI_XGL_xglCreateDescriptorSetLayout,
+    GLV_TPI_XGL_xglBeginDescriptorRegionUpdate,
+    GLV_TPI_XGL_xglEndDescriptorRegionUpdate,
+    GLV_TPI_XGL_xglCreateDescriptorRegion,
+    GLV_TPI_XGL_xglClearDescriptorRegion,
+    GLV_TPI_XGL_xglAllocDescriptorSets,
+    GLV_TPI_XGL_xglClearDescriptorSets,
+    GLV_TPI_XGL_xglUpdateDescriptors,
+    GLV_TPI_XGL_xglCreateDynamicViewportState,
+    GLV_TPI_XGL_xglCreateDynamicRasterState,
+    GLV_TPI_XGL_xglCreateDynamicColorBlendState,
+    GLV_TPI_XGL_xglCreateDynamicDepthStencilState,
+    GLV_TPI_XGL_xglCreateCommandBuffer,
+    GLV_TPI_XGL_xglBeginCommandBuffer,
+    GLV_TPI_XGL_xglEndCommandBuffer,
+    GLV_TPI_XGL_xglResetCommandBuffer,
+    GLV_TPI_XGL_xglCmdBindPipeline,
+    GLV_TPI_XGL_xglCmdBindPipelineDelta,
+    GLV_TPI_XGL_xglCmdBindDynamicStateObject,
+    GLV_TPI_XGL_xglCmdBindDescriptorSet,
+    GLV_TPI_XGL_xglCmdBindVertexBuffer,
+    GLV_TPI_XGL_xglCmdBindIndexBuffer,
+    GLV_TPI_XGL_xglCmdDraw,
+    GLV_TPI_XGL_xglCmdDrawIndexed,
+    GLV_TPI_XGL_xglCmdDrawIndirect,
+    GLV_TPI_XGL_xglCmdDrawIndexedIndirect,
+    GLV_TPI_XGL_xglCmdDispatch,
+    GLV_TPI_XGL_xglCmdDispatchIndirect,
+    GLV_TPI_XGL_xglCmdCopyBuffer,
+    GLV_TPI_XGL_xglCmdCopyImage,
+    GLV_TPI_XGL_xglCmdCopyBufferToImage,
+    GLV_TPI_XGL_xglCmdCopyImageToBuffer,
+    GLV_TPI_XGL_xglCmdCloneImageData,
+    GLV_TPI_XGL_xglCmdUpdateBuffer,
+    GLV_TPI_XGL_xglCmdFillBuffer,
+    GLV_TPI_XGL_xglCmdClearColorImage,
+    GLV_TPI_XGL_xglCmdClearColorImageRaw,
+    GLV_TPI_XGL_xglCmdClearDepthStencil,
+    GLV_TPI_XGL_xglCmdResolveImage,
+    GLV_TPI_XGL_xglCmdSetEvent,
+    GLV_TPI_XGL_xglCmdResetEvent,
+    GLV_TPI_XGL_xglCmdWaitEvents,
+    GLV_TPI_XGL_xglCmdPipelineBarrier,
+    GLV_TPI_XGL_xglCmdBeginQuery,
+    GLV_TPI_XGL_xglCmdEndQuery,
+    GLV_TPI_XGL_xglCmdResetQueryPool,
+    GLV_TPI_XGL_xglCmdWriteTimestamp,
+    GLV_TPI_XGL_xglCmdInitAtomicCounters,
+    GLV_TPI_XGL_xglCmdLoadAtomicCounters,
+    GLV_TPI_XGL_xglCmdSaveAtomicCounters,
+    GLV_TPI_XGL_xglCreateFramebuffer,
+    GLV_TPI_XGL_xglCreateRenderPass,
+    GLV_TPI_XGL_xglCmdBeginRenderPass,
+    GLV_TPI_XGL_xglCmdEndRenderPass,
+    GLV_TPI_XGL_xglDbgSetValidationLevel,
+    GLV_TPI_XGL_xglDbgRegisterMsgCallback,
+    GLV_TPI_XGL_xglDbgUnregisterMsgCallback,
+    GLV_TPI_XGL_xglDbgSetMessageFilter,
+    GLV_TPI_XGL_xglDbgSetObjectTag,
+    GLV_TPI_XGL_xglDbgSetGlobalOption,
+    GLV_TPI_XGL_xglDbgSetDeviceOption,
+    GLV_TPI_XGL_xglCmdDbgMarkerBegin,
+    GLV_TPI_XGL_xglCmdDbgMarkerEnd,
+    GLV_TPI_XGL_xglWsiX11AssociateConnection,
+    GLV_TPI_XGL_xglWsiX11GetMSC,
+    GLV_TPI_XGL_xglWsiX11CreatePresentableImage,
+    GLV_TPI_XGL_xglWsiX11QueuePresent,
+};
+
+static const char *stringify_xgl_packet_id(const enum GLV_TRACE_PACKET_ID_XGL id, const glv_trace_packet_header* pHeader)
+{
+    static char str[1024];
+    switch(id) {
+    case GLV_TPI_XGL_xglApiVersion:
+    {
+        struct_xglApiVersion* pPacket = (struct_xglApiVersion*)(pHeader->pBody);
+        snprintf(str, 1024, "xglApiVersion = 0x%x", pPacket->version);
+        return str;
+    }
+    case GLV_TPI_XGL_xglCreateInstance:
+    {
+        struct_xglCreateInstance* pPacket = (struct_xglCreateInstance*)(pHeader->pBody);
+        snprintf(str, 1024, "xglCreateInstance(pAppInfo = %p, pAllocCb = %p, pInstance = %p)", (void*)(pPacket->pAppInfo), (void*)(pPacket->pAllocCb), (void*)pPacket->pInstance);
+        return str;
+    }
+    case GLV_TPI_XGL_xglDestroyInstance:
+    {
+        struct_xglDestroyInstance* pPacket = (struct_xglDestroyInstance*)(pHeader->pBody);
+        snprintf(str, 1024, "xglDestroyInstance(instance = %p)", (void*)(pPacket->instance));
+        return str;
+    }
+    case GLV_TPI_XGL_xglEnumerateGpus:
+    {
+        struct_xglEnumerateGpus* pPacket = (struct_xglEnumerateGpus*)(pHeader->pBody);
+        snprintf(str, 1024, "xglEnumerateGpus(instance = %p, maxGpus = %i, *pGpuCount = %i, pGpus = %p)", (void*)(pPacket->instance), pPacket->maxGpus, (pPacket->pGpuCount == NULL) ? 0 : *(pPacket->pGpuCount), (void*)(pPacket->pGpus));
+        return str;
+    }
+    case GLV_TPI_XGL_xglGetGpuInfo:
+    {
+        struct_xglGetGpuInfo* pPacket = (struct_xglGetGpuInfo*)(pHeader->pBody);
+        snprintf(str, 1024, "xglGetGpuInfo(gpu = %p, infoType = %s, *pDataSize = %zu, pData = %p)", (void*)(pPacket->gpu), string_XGL_PHYSICAL_GPU_INFO_TYPE(pPacket->infoType), (pPacket->pDataSize == NULL) ? 0 : *(pPacket->pDataSize), (void*)(pPacket->pData));
+        return str;
+    }
+    case GLV_TPI_XGL_xglGetProcAddr:
+    {
+        struct_xglGetProcAddr* pPacket = (struct_xglGetProcAddr*)(pHeader->pBody);
+        snprintf(str, 1024, "xglGetProcAddr(gpu = %p, pName = %p)", (void*)(pPacket->gpu), (void*)(pPacket->pName));
+        return str;
+    }
+    case GLV_TPI_XGL_xglCreateDevice:
+    {
+        struct_xglCreateDevice* pPacket = (struct_xglCreateDevice*)(pHeader->pBody);
+        snprintf(str, 1024, "xglCreateDevice(gpu = %p, pCreateInfo = %p, pDevice = %p)", (void*)(pPacket->gpu), (void*)(pPacket->pCreateInfo), (void*)pPacket->pDevice);
+        return str;
+    }
+    case GLV_TPI_XGL_xglDestroyDevice:
+    {
+        struct_xglDestroyDevice* pPacket = (struct_xglDestroyDevice*)(pHeader->pBody);
+        snprintf(str, 1024, "xglDestroyDevice(device = %p)", (void*)(pPacket->device));
+        return str;
+    }
+    case GLV_TPI_XGL_xglGetExtensionSupport:
+    {
+        struct_xglGetExtensionSupport* pPacket = (struct_xglGetExtensionSupport*)(pHeader->pBody);
+        snprintf(str, 1024, "xglGetExtensionSupport(gpu = %p, pExtName = %p)", (void*)(pPacket->gpu), (void*)(pPacket->pExtName));
+        return str;
+    }
+    case GLV_TPI_XGL_xglEnumerateLayers:
+    {
+        struct_xglEnumerateLayers* pPacket = (struct_xglEnumerateLayers*)(pHeader->pBody);
+        snprintf(str, 1024, "xglEnumerateLayers(gpu = %p, maxLayerCount = %zu, maxStringSize = %zu, *pOutLayerCount = %zu, pOutLayers = %p, pReserved = %p)", (void*)(pPacket->gpu), pPacket->maxLayerCount, pPacket->maxStringSize, (pPacket->pOutLayerCount == NULL) ? 0 : *(pPacket->pOutLayerCount), (void*)(pPacket->pOutLayers), (void*)(pPacket->pReserved));
+        return str;
+    }
+    case GLV_TPI_XGL_xglGetDeviceQueue:
+    {
+        struct_xglGetDeviceQueue* pPacket = (struct_xglGetDeviceQueue*)(pHeader->pBody);
+        snprintf(str, 1024, "xglGetDeviceQueue(device = %p, queueType = %s, queueIndex = %i, pQueue = %p)", (void*)(pPacket->device), string_XGL_QUEUE_TYPE(pPacket->queueType), pPacket->queueIndex, (void*)(pPacket->pQueue));
+        return str;
+    }
+    case GLV_TPI_XGL_xglQueueSubmit:
+    {
+        struct_xglQueueSubmit* pPacket = (struct_xglQueueSubmit*)(pHeader->pBody);
+        snprintf(str, 1024, "xglQueueSubmit(queue = %p, cmdBufferCount = %i, pCmdBuffers = %p, memRefCount = %i, pMemRefs = %p, fence = %p)", (void*)(pPacket->queue), pPacket->cmdBufferCount, (void*)(pPacket->pCmdBuffers), pPacket->memRefCount, (void*)(pPacket->pMemRefs), (void*)(pPacket->fence));
+        return str;
+    }
+    case GLV_TPI_XGL_xglQueueSetGlobalMemReferences:
+    {
+        struct_xglQueueSetGlobalMemReferences* pPacket = (struct_xglQueueSetGlobalMemReferences*)(pHeader->pBody);
+        snprintf(str, 1024, "xglQueueSetGlobalMemReferences(queue = %p, memRefCount = %i, pMemRefs = %p)", (void*)(pPacket->queue), pPacket->memRefCount, (void*)(pPacket->pMemRefs));
+        return str;
+    }
+    case GLV_TPI_XGL_xglQueueWaitIdle:
+    {
+        struct_xglQueueWaitIdle* pPacket = (struct_xglQueueWaitIdle*)(pHeader->pBody);
+        snprintf(str, 1024, "xglQueueWaitIdle(queue = %p)", (void*)(pPacket->queue));
+        return str;
+    }
+    case GLV_TPI_XGL_xglDeviceWaitIdle:
+    {
+        struct_xglDeviceWaitIdle* pPacket = (struct_xglDeviceWaitIdle*)(pHeader->pBody);
+        snprintf(str, 1024, "xglDeviceWaitIdle(device = %p)", (void*)(pPacket->device));
+        return str;
+    }
+    case GLV_TPI_XGL_xglAllocMemory:
+    {
+        struct_xglAllocMemory* pPacket = (struct_xglAllocMemory*)(pHeader->pBody);
+        snprintf(str, 1024, "xglAllocMemory(device = %p, pAllocInfo = %p, pMem = %p)", (void*)(pPacket->device), (void*)(pPacket->pAllocInfo), (void*)pPacket->pMem);
+        return str;
+    }
+    case GLV_TPI_XGL_xglFreeMemory:
+    {
+        struct_xglFreeMemory* pPacket = (struct_xglFreeMemory*)(pHeader->pBody);
+        snprintf(str, 1024, "xglFreeMemory(mem = %p)", (void*)(pPacket->mem));
+        return str;
+    }
+    case GLV_TPI_XGL_xglSetMemoryPriority:
+    {
+        struct_xglSetMemoryPriority* pPacket = (struct_xglSetMemoryPriority*)(pHeader->pBody);
+        snprintf(str, 1024, "xglSetMemoryPriority(mem = %p, priority = %p)", (void*)(pPacket->mem), (void*)(pPacket->priority));
+        return str;
+    }
+    case GLV_TPI_XGL_xglMapMemory:
+    {
+        struct_xglMapMemory* pPacket = (struct_xglMapMemory*)(pHeader->pBody);
+        snprintf(str, 1024, "xglMapMemory(mem = %p, flags = %i, ppData = %p)", (void*)(pPacket->mem), pPacket->flags, (void*)pPacket->ppData);
+        return str;
+    }
+    case GLV_TPI_XGL_xglUnmapMemory:
+    {
+        struct_xglUnmapMemory* pPacket = (struct_xglUnmapMemory*)(pHeader->pBody);
+        snprintf(str, 1024, "xglUnmapMemory(mem = %p)", (void*)(pPacket->mem));
+        return str;
+    }
+    case GLV_TPI_XGL_xglPinSystemMemory:
+    {
+        struct_xglPinSystemMemory* pPacket = (struct_xglPinSystemMemory*)(pHeader->pBody);
+        snprintf(str, 1024, "xglPinSystemMemory(device = %p, pSysMem = %p, memSize = %zu, pMem = %p)", (void*)(pPacket->device), (void*)(pPacket->pSysMem), pPacket->memSize, (void*)(pPacket->pMem));
+        return str;
+    }
+    case GLV_TPI_XGL_xglGetMultiGpuCompatibility:
+    {
+        struct_xglGetMultiGpuCompatibility* pPacket = (struct_xglGetMultiGpuCompatibility*)(pHeader->pBody);
+        snprintf(str, 1024, "xglGetMultiGpuCompatibility(gpu0 = %p, gpu1 = %p, pInfo = %p)", (void*)(pPacket->gpu0), (void*)(pPacket->gpu1), (void*)(pPacket->pInfo));
+        return str;
+    }
+    case GLV_TPI_XGL_xglOpenSharedMemory:
+    {
+        struct_xglOpenSharedMemory* pPacket = (struct_xglOpenSharedMemory*)(pHeader->pBody);
+        snprintf(str, 1024, "xglOpenSharedMemory(device = %p, pOpenInfo = %p, pMem = %p)", (void*)(pPacket->device), (void*)(pPacket->pOpenInfo), (void*)(pPacket->pMem));
+        return str;
+    }
+    case GLV_TPI_XGL_xglOpenSharedQueueSemaphore:
+    {
+        struct_xglOpenSharedQueueSemaphore* pPacket = (struct_xglOpenSharedQueueSemaphore*)(pHeader->pBody);
+        snprintf(str, 1024, "xglOpenSharedQueueSemaphore(device = %p, pOpenInfo = %p, pSemaphore = %p)", (void*)(pPacket->device), (void*)(pPacket->pOpenInfo), (void*)(pPacket->pSemaphore));
+        return str;
+    }
+    case GLV_TPI_XGL_xglOpenPeerMemory:
+    {
+        struct_xglOpenPeerMemory* pPacket = (struct_xglOpenPeerMemory*)(pHeader->pBody);
+        snprintf(str, 1024, "xglOpenPeerMemory(device = %p, pOpenInfo = %p, pMem = %p)", (void*)(pPacket->device), (void*)(pPacket->pOpenInfo), (void*)(pPacket->pMem));
+        return str;
+    }
+    case GLV_TPI_XGL_xglOpenPeerImage:
+    {
+        struct_xglOpenPeerImage* pPacket = (struct_xglOpenPeerImage*)(pHeader->pBody);
+        snprintf(str, 1024, "xglOpenPeerImage(device = %p, pOpenInfo = %p, pImage = %p, pMem = %p)", (void*)(pPacket->device), (void*)(pPacket->pOpenInfo), (void*)(pPacket->pImage), (void*)(pPacket->pMem));
+        return str;
+    }
+    case GLV_TPI_XGL_xglDestroyObject:
+    {
+        struct_xglDestroyObject* pPacket = (struct_xglDestroyObject*)(pHeader->pBody);
+        snprintf(str, 1024, "xglDestroyObject(object = %p)", (void*)(pPacket->object));
+        return str;
+    }
+    case GLV_TPI_XGL_xglGetObjectInfo:
+    {
+        struct_xglGetObjectInfo* pPacket = (struct_xglGetObjectInfo*)(pHeader->pBody);
+        snprintf(str, 1024, "xglGetObjectInfo(object = %p, infoType = %s, *pDataSize = %zu, pData = %p)", (void*)(pPacket->object), string_XGL_OBJECT_INFO_TYPE(pPacket->infoType), (pPacket->pDataSize == NULL) ? 0 : *(pPacket->pDataSize), (void*)(pPacket->pData));
+        return str;
+    }
+    case GLV_TPI_XGL_xglBindObjectMemory:
+    {
+        struct_xglBindObjectMemory* pPacket = (struct_xglBindObjectMemory*)(pHeader->pBody);
+        snprintf(str, 1024, "xglBindObjectMemory(object = %p, allocationIdx = %i, mem = %p, offset = %p)", (void*)(pPacket->object), pPacket->allocationIdx, (void*)(pPacket->mem), (void*)(pPacket->offset));
+        return str;
+    }
+    case GLV_TPI_XGL_xglBindObjectMemoryRange:
+    {
+        struct_xglBindObjectMemoryRange* pPacket = (struct_xglBindObjectMemoryRange*)(pHeader->pBody);
+        snprintf(str, 1024, "xglBindObjectMemoryRange(object = %p, allocationIdx = %i, rangeOffset = %p, rangeSize = %p, mem = %p, memOffset = %p)", (void*)(pPacket->object), pPacket->allocationIdx, (void*)(pPacket->rangeOffset), (void*)(pPacket->rangeSize), (void*)(pPacket->mem), (void*)(pPacket->memOffset));
+        return str;
+    }
+    case GLV_TPI_XGL_xglBindImageMemoryRange:
+    {
+        struct_xglBindImageMemoryRange* pPacket = (struct_xglBindImageMemoryRange*)(pHeader->pBody);
+        snprintf(str, 1024, "xglBindImageMemoryRange(image = %p, allocationIdx = %i, bindInfo = %p, mem = %p, memOffset = %p)", (void*)(pPacket->image), pPacket->allocationIdx, (void*)(pPacket->bindInfo), (void*)(pPacket->mem), (void*)(pPacket->memOffset));
+        return str;
+    }
+    case GLV_TPI_XGL_xglCreateFence:
+    {
+        struct_xglCreateFence* pPacket = (struct_xglCreateFence*)(pHeader->pBody);
+        snprintf(str, 1024, "xglCreateFence(device = %p, pCreateInfo = %p, pFence = %p)", (void*)(pPacket->device), (void*)(pPacket->pCreateInfo), (void*)pPacket->pFence);
+        return str;
+    }
+    case GLV_TPI_XGL_xglGetFenceStatus:
+    {
+        struct_xglGetFenceStatus* pPacket = (struct_xglGetFenceStatus*)(pHeader->pBody);
+        snprintf(str, 1024, "xglGetFenceStatus(fence = %p)", (void*)(pPacket->fence));
+        return str;
+    }
+    case GLV_TPI_XGL_xglWaitForFences:
+    {
+        struct_xglWaitForFences* pPacket = (struct_xglWaitForFences*)(pHeader->pBody);
+        snprintf(str, 1024, "xglWaitForFences(device = %p, fenceCount = %i, pFences = %p, waitAll = %u, timeout = %lu)", (void*)(pPacket->device), pPacket->fenceCount, (void*)(pPacket->pFences), pPacket->waitAll, pPacket->timeout);
+        return str;
+    }
+    case GLV_TPI_XGL_xglCreateQueueSemaphore:
+    {
+        struct_xglCreateQueueSemaphore* pPacket = (struct_xglCreateQueueSemaphore*)(pHeader->pBody);
+        snprintf(str, 1024, "xglCreateQueueSemaphore(device = %p, pCreateInfo = %p, pSemaphore = %p)", (void*)(pPacket->device), (void*)(pPacket->pCreateInfo), (void*)pPacket->pSemaphore);
+        return str;
+    }
+    case GLV_TPI_XGL_xglSignalQueueSemaphore:
+    {
+        struct_xglSignalQueueSemaphore* pPacket = (struct_xglSignalQueueSemaphore*)(pHeader->pBody);
+        snprintf(str, 1024, "xglSignalQueueSemaphore(queue = %p, semaphore = %p)", (void*)(pPacket->queue), (void*)(pPacket->semaphore));
+        return str;
+    }
+    case GLV_TPI_XGL_xglWaitQueueSemaphore:
+    {
+        struct_xglWaitQueueSemaphore* pPacket = (struct_xglWaitQueueSemaphore*)(pHeader->pBody);
+        snprintf(str, 1024, "xglWaitQueueSemaphore(queue = %p, semaphore = %p)", (void*)(pPacket->queue), (void*)(pPacket->semaphore));
+        return str;
+    }
+    case GLV_TPI_XGL_xglCreateEvent:
+    {
+        struct_xglCreateEvent* pPacket = (struct_xglCreateEvent*)(pHeader->pBody);
+        snprintf(str, 1024, "xglCreateEvent(device = %p, pCreateInfo = %p, pEvent = %p)", (void*)(pPacket->device), (void*)(pPacket->pCreateInfo), (void*)pPacket->pEvent);
+        return str;
+    }
+    case GLV_TPI_XGL_xglGetEventStatus:
+    {
+        struct_xglGetEventStatus* pPacket = (struct_xglGetEventStatus*)(pHeader->pBody);
+        snprintf(str, 1024, "xglGetEventStatus(event = %p)", (void*)(pPacket->event));
+        return str;
+    }
+    case GLV_TPI_XGL_xglSetEvent:
+    {
+        struct_xglSetEvent* pPacket = (struct_xglSetEvent*)(pHeader->pBody);
+        snprintf(str, 1024, "xglSetEvent(event = %p)", (void*)(pPacket->event));
+        return str;
+    }
+    case GLV_TPI_XGL_xglResetEvent:
+    {
+        struct_xglResetEvent* pPacket = (struct_xglResetEvent*)(pHeader->pBody);
+        snprintf(str, 1024, "xglResetEvent(event = %p)", (void*)(pPacket->event));
+        return str;
+    }
+    case GLV_TPI_XGL_xglCreateQueryPool:
+    {
+        struct_xglCreateQueryPool* pPacket = (struct_xglCreateQueryPool*)(pHeader->pBody);
+        snprintf(str, 1024, "xglCreateQueryPool(device = %p, pCreateInfo = %p, pQueryPool = %p)", (void*)(pPacket->device), (void*)(pPacket->pCreateInfo), (void*)pPacket->pQueryPool);
+        return str;
+    }
+    case GLV_TPI_XGL_xglGetQueryPoolResults:
+    {
+        struct_xglGetQueryPoolResults* pPacket = (struct_xglGetQueryPoolResults*)(pHeader->pBody);
+        snprintf(str, 1024, "xglGetQueryPoolResults(queryPool = %p, startQuery = %i, queryCount = %i, *pDataSize = %zu, pData = %p)", (void*)(pPacket->queryPool), pPacket->startQuery, pPacket->queryCount, (pPacket->pDataSize == NULL) ? 0 : *(pPacket->pDataSize), (void*)(pPacket->pData));
+        return str;
+    }
+    case GLV_TPI_XGL_xglGetFormatInfo:
+    {
+        struct_xglGetFormatInfo* pPacket = (struct_xglGetFormatInfo*)(pHeader->pBody);
+        snprintf(str, 1024, "xglGetFormatInfo(device = %p, format = %p, infoType = %s, *pDataSize = %zu, pData = %p)", (void*)(pPacket->device), (void*)(pPacket->format), string_XGL_FORMAT_INFO_TYPE(pPacket->infoType), (pPacket->pDataSize == NULL) ? 0 : *(pPacket->pDataSize), (void*)(pPacket->pData));
+        return str;
+    }
+    case GLV_TPI_XGL_xglCreateBuffer:
+    {
+        struct_xglCreateBuffer* pPacket = (struct_xglCreateBuffer*)(pHeader->pBody);
+        snprintf(str, 1024, "xglCreateBuffer(device = %p, pCreateInfo = %p, pBuffer = %p)", (void*)(pPacket->device), (void*)(pPacket->pCreateInfo), (void*)pPacket->pBuffer);
+        return str;
+    }
+    case GLV_TPI_XGL_xglCreateBufferView:
+    {
+        struct_xglCreateBufferView* pPacket = (struct_xglCreateBufferView*)(pHeader->pBody);
+        snprintf(str, 1024, "xglCreateBufferView(device = %p, pCreateInfo = %p, pView = %p)", (void*)(pPacket->device), (void*)(pPacket->pCreateInfo), (void*)pPacket->pView);
+        return str;
+    }
+    case GLV_TPI_XGL_xglCreateImage:
+    {
+        struct_xglCreateImage* pPacket = (struct_xglCreateImage*)(pHeader->pBody);
+        snprintf(str, 1024, "xglCreateImage(device = %p, pCreateInfo = %p, pImage = %p)", (void*)(pPacket->device), (void*)(pPacket->pCreateInfo), (void*)pPacket->pImage);
+        return str;
+    }
+    case GLV_TPI_XGL_xglSetFastClearColor:
+    {
+        struct_xglSetFastClearColor* pPacket = (struct_xglSetFastClearColor*)(pHeader->pBody);
+        snprintf(str, 1024, "xglSetFastClearColor(image = %p, color = [%f, %f, %f, %f])", (void*)(pPacket->image), pPacket->color[0], pPacket->color[1], pPacket->color[2], pPacket->color[3]);
+        return str;
+    }
+    case GLV_TPI_XGL_xglSetFastClearDepth:
+    {
+        struct_xglSetFastClearDepth* pPacket = (struct_xglSetFastClearDepth*)(pHeader->pBody);
+        snprintf(str, 1024, "xglSetFastClearDepth(image = %p, depth = %f)", (void*)(pPacket->image), pPacket->depth);
+        return str;
+    }
+    case GLV_TPI_XGL_xglGetImageSubresourceInfo:
+    {
+        struct_xglGetImageSubresourceInfo* pPacket = (struct_xglGetImageSubresourceInfo*)(pHeader->pBody);
+        snprintf(str, 1024, "xglGetImageSubresourceInfo(image = %p, pSubresource = %p, infoType = %s, *pDataSize = %zu, pData = %p)", (void*)(pPacket->image), (void*)(pPacket->pSubresource), string_XGL_SUBRESOURCE_INFO_TYPE(pPacket->infoType), (pPacket->pDataSize == NULL) ? 0 : *(pPacket->pDataSize), (void*)(pPacket->pData));
+        return str;
+    }
+    case GLV_TPI_XGL_xglCreateImageView:
+    {
+        struct_xglCreateImageView* pPacket = (struct_xglCreateImageView*)(pHeader->pBody);
+        snprintf(str, 1024, "xglCreateImageView(device = %p, pCreateInfo = %p, pView = %p)", (void*)(pPacket->device), (void*)(pPacket->pCreateInfo), (void*)pPacket->pView);
+        return str;
+    }
+    case GLV_TPI_XGL_xglCreateColorAttachmentView:
+    {
+        struct_xglCreateColorAttachmentView* pPacket = (struct_xglCreateColorAttachmentView*)(pHeader->pBody);
+        snprintf(str, 1024, "xglCreateColorAttachmentView(device = %p, pCreateInfo = %p, pView = %p)", (void*)(pPacket->device), (void*)(pPacket->pCreateInfo), (void*)pPacket->pView);
+        return str;
+    }
+    case GLV_TPI_XGL_xglCreateDepthStencilView:
+    {
+        struct_xglCreateDepthStencilView* pPacket = (struct_xglCreateDepthStencilView*)(pHeader->pBody);
+        snprintf(str, 1024, "xglCreateDepthStencilView(device = %p, pCreateInfo = %p, pView = %p)", (void*)(pPacket->device), (void*)(pPacket->pCreateInfo), (void*)pPacket->pView);
+        return str;
+    }
+    case GLV_TPI_XGL_xglCreateShader:
+    {
+        struct_xglCreateShader* pPacket = (struct_xglCreateShader*)(pHeader->pBody);
+        snprintf(str, 1024, "xglCreateShader(device = %p, pCreateInfo = %p, pShader = %p)", (void*)(pPacket->device), (void*)(pPacket->pCreateInfo), (void*)pPacket->pShader);
+        return str;
+    }
+    case GLV_TPI_XGL_xglCreateGraphicsPipeline:
+    {
+        struct_xglCreateGraphicsPipeline* pPacket = (struct_xglCreateGraphicsPipeline*)(pHeader->pBody);
+        snprintf(str, 1024, "xglCreateGraphicsPipeline(device = %p, pCreateInfo = %p, pPipeline = %p)", (void*)(pPacket->device), (void*)(pPacket->pCreateInfo), (void*)pPacket->pPipeline);
+        return str;
+    }
+    case GLV_TPI_XGL_xglCreateComputePipeline:
+    {
+        struct_xglCreateComputePipeline* pPacket = (struct_xglCreateComputePipeline*)(pHeader->pBody);
+        snprintf(str, 1024, "xglCreateComputePipeline(device = %p, pCreateInfo = %p, pPipeline = %p)", (void*)(pPacket->device), (void*)(pPacket->pCreateInfo), (void*)pPacket->pPipeline);
+        return str;
+    }
+    case GLV_TPI_XGL_xglStorePipeline:
+    {
+        struct_xglStorePipeline* pPacket = (struct_xglStorePipeline*)(pHeader->pBody);
+        snprintf(str, 1024, "xglStorePipeline(pipeline = %p, *pDataSize = %zu, pData = %p)", (void*)(pPacket->pipeline), (pPacket->pDataSize == NULL) ? 0 : *(pPacket->pDataSize), (void*)(pPacket->pData));
+        return str;
+    }
+    case GLV_TPI_XGL_xglLoadPipeline:
+    {
+        struct_xglLoadPipeline* pPacket = (struct_xglLoadPipeline*)(pHeader->pBody);
+        snprintf(str, 1024, "xglLoadPipeline(device = %p, dataSize = %zu, pData = %p, pPipeline = %p)", (void*)(pPacket->device), pPacket->dataSize, (void*)(pPacket->pData), (void*)(pPacket->pPipeline));
+        return str;
+    }
+    case GLV_TPI_XGL_xglCreatePipelineDelta:
+    {
+        struct_xglCreatePipelineDelta* pPacket = (struct_xglCreatePipelineDelta*)(pHeader->pBody);
+        snprintf(str, 1024, "xglCreatePipelineDelta(device = %p, p1 = %p, p2 = %p, delta = %p)", (void*)(pPacket->device), (void*)(pPacket->p1), (void*)(pPacket->p2), (void*)pPacket->delta);
+        return str;
+    }
+    case GLV_TPI_XGL_xglCreateSampler:
+    {
+        struct_xglCreateSampler* pPacket = (struct_xglCreateSampler*)(pHeader->pBody);
+        snprintf(str, 1024, "xglCreateSampler(device = %p, pCreateInfo = %p, pSampler = %p)", (void*)(pPacket->device), (void*)(pPacket->pCreateInfo), (void*)pPacket->pSampler);
+        return str;
+    }
+    case GLV_TPI_XGL_xglCreateDescriptorSetLayout:
+    {
+        struct_xglCreateDescriptorSetLayout* pPacket = (struct_xglCreateDescriptorSetLayout*)(pHeader->pBody);
+        snprintf(str, 1024, "xglCreateDescriptorSetLayout(device = %p, stageFlags = %i, *pSetBindPoints = %i, priorSetLayout = %p, pSetLayoutInfoList = %p, pSetLayout = %p)", (void*)(pPacket->device), pPacket->stageFlags, (pPacket->pSetBindPoints == NULL) ? 0 : *(pPacket->pSetBindPoints), (void*)(pPacket->priorSetLayout), (void*)(pPacket->pSetLayoutInfoList), (void*)pPacket->pSetLayout);
+        return str;
+    }
+    case GLV_TPI_XGL_xglBeginDescriptorRegionUpdate:
+    {
+        struct_xglBeginDescriptorRegionUpdate* pPacket = (struct_xglBeginDescriptorRegionUpdate*)(pHeader->pBody);
+        snprintf(str, 1024, "xglBeginDescriptorRegionUpdate(device = %p, updateMode = %p)", (void*)(pPacket->device), (void*)(pPacket->updateMode));
+        return str;
+    }
+    case GLV_TPI_XGL_xglEndDescriptorRegionUpdate:
+    {
+        struct_xglEndDescriptorRegionUpdate* pPacket = (struct_xglEndDescriptorRegionUpdate*)(pHeader->pBody);
+        snprintf(str, 1024, "xglEndDescriptorRegionUpdate(device = %p, cmd = %p)", (void*)(pPacket->device), (void*)(pPacket->cmd));
+        return str;
+    }
+    case GLV_TPI_XGL_xglCreateDescriptorRegion:
+    {
+        struct_xglCreateDescriptorRegion* pPacket = (struct_xglCreateDescriptorRegion*)(pHeader->pBody);
+        snprintf(str, 1024, "xglCreateDescriptorRegion(device = %p, regionUsage = %p, maxSets = %i, pCreateInfo = %p, pDescriptorRegion = %p)", (void*)(pPacket->device), (void*)(pPacket->regionUsage), pPacket->maxSets, (void*)(pPacket->pCreateInfo), (void*)pPacket->pDescriptorRegion);
+        return str;
+    }
+    case GLV_TPI_XGL_xglClearDescriptorRegion:
+    {
+        struct_xglClearDescriptorRegion* pPacket = (struct_xglClearDescriptorRegion*)(pHeader->pBody);
+        snprintf(str, 1024, "xglClearDescriptorRegion(descriptorRegion = %p)", (void*)(pPacket->descriptorRegion));
+        return str;
+    }
+    case GLV_TPI_XGL_xglAllocDescriptorSets:
+    {
+        struct_xglAllocDescriptorSets* pPacket = (struct_xglAllocDescriptorSets*)(pHeader->pBody);
+        snprintf(str, 1024, "xglAllocDescriptorSets(descriptorRegion = %p, setUsage = %p, count = %i, pSetLayouts = %p, pDescriptorSets = %p, *pCount = %i)", (void*)(pPacket->descriptorRegion), (void*)(pPacket->setUsage), pPacket->count, (void*)(pPacket->pSetLayouts), (void*)(pPacket->pDescriptorSets), (pPacket->pCount == NULL) ? 0 : *(pPacket->pCount));
+        return str;
+    }
+    case GLV_TPI_XGL_xglClearDescriptorSets:
+    {
+        struct_xglClearDescriptorSets* pPacket = (struct_xglClearDescriptorSets*)(pHeader->pBody);
+        snprintf(str, 1024, "xglClearDescriptorSets(descriptorRegion = %p, count = %i, pDescriptorSets = %p)", (void*)(pPacket->descriptorRegion), pPacket->count, (void*)(pPacket->pDescriptorSets));
+        return str;
+    }
+    case GLV_TPI_XGL_xglUpdateDescriptors:
+    {
+        struct_xglUpdateDescriptors* pPacket = (struct_xglUpdateDescriptors*)(pHeader->pBody);
+        snprintf(str, 1024, "xglUpdateDescriptors(descriptorSet = %p, pUpdateChain = %p)", (void*)(pPacket->descriptorSet), (void*)(pPacket->pUpdateChain));
+        return str;
+    }
+    case GLV_TPI_XGL_xglCreateDynamicViewportState:
+    {
+        struct_xglCreateDynamicViewportState* pPacket = (struct_xglCreateDynamicViewportState*)(pHeader->pBody);
+        snprintf(str, 1024, "xglCreateDynamicViewportState(device = %p, pCreateInfo = %p, pState = %p)", (void*)(pPacket->device), (void*)(pPacket->pCreateInfo), (void*)pPacket->pState);
+        return str;
+    }
+    case GLV_TPI_XGL_xglCreateDynamicRasterState:
+    {
+        struct_xglCreateDynamicRasterState* pPacket = (struct_xglCreateDynamicRasterState*)(pHeader->pBody);
+        snprintf(str, 1024, "xglCreateDynamicRasterState(device = %p, pCreateInfo = %p, pState = %p)", (void*)(pPacket->device), (void*)(pPacket->pCreateInfo), (void*)pPacket->pState);
+        return str;
+    }
+    case GLV_TPI_XGL_xglCreateDynamicColorBlendState:
+    {
+        struct_xglCreateDynamicColorBlendState* pPacket = (struct_xglCreateDynamicColorBlendState*)(pHeader->pBody);
+        snprintf(str, 1024, "xglCreateDynamicColorBlendState(device = %p, pCreateInfo = %p, pState = %p)", (void*)(pPacket->device), (void*)(pPacket->pCreateInfo), (void*)pPacket->pState);
+        return str;
+    }
+    case GLV_TPI_XGL_xglCreateDynamicDepthStencilState:
+    {
+        struct_xglCreateDynamicDepthStencilState* pPacket = (struct_xglCreateDynamicDepthStencilState*)(pHeader->pBody);
+        snprintf(str, 1024, "xglCreateDynamicDepthStencilState(device = %p, pCreateInfo = %p, pState = %p)", (void*)(pPacket->device), (void*)(pPacket->pCreateInfo), (void*)pPacket->pState);
+        return str;
+    }
+    case GLV_TPI_XGL_xglCreateCommandBuffer:
+    {
+        struct_xglCreateCommandBuffer* pPacket = (struct_xglCreateCommandBuffer*)(pHeader->pBody);
+        snprintf(str, 1024, "xglCreateCommandBuffer(device = %p, pCreateInfo = %p, pCmdBuffer = %p)", (void*)(pPacket->device), (void*)(pPacket->pCreateInfo), (void*)pPacket->pCmdBuffer);
+        return str;
+    }
+    case GLV_TPI_XGL_xglBeginCommandBuffer:
+    {
+        struct_xglBeginCommandBuffer* pPacket = (struct_xglBeginCommandBuffer*)(pHeader->pBody);
+        snprintf(str, 1024, "xglBeginCommandBuffer(cmdBuffer = %p, pBeginInfo = %p)", (void*)(pPacket->cmdBuffer), (void*)(pPacket->pBeginInfo));
+        return str;
+    }
+    case GLV_TPI_XGL_xglEndCommandBuffer:
+    {
+        struct_xglEndCommandBuffer* pPacket = (struct_xglEndCommandBuffer*)(pHeader->pBody);
+        snprintf(str, 1024, "xglEndCommandBuffer(cmdBuffer = %p)", (void*)(pPacket->cmdBuffer));
+        return str;
+    }
+    case GLV_TPI_XGL_xglResetCommandBuffer:
+    {
+        struct_xglResetCommandBuffer* pPacket = (struct_xglResetCommandBuffer*)(pHeader->pBody);
+        snprintf(str, 1024, "xglResetCommandBuffer(cmdBuffer = %p)", (void*)(pPacket->cmdBuffer));
+        return str;
+    }
+    case GLV_TPI_XGL_xglCmdBindPipeline:
+    {
+        struct_xglCmdBindPipeline* pPacket = (struct_xglCmdBindPipeline*)(pHeader->pBody);
+        snprintf(str, 1024, "xglCmdBindPipeline(cmdBuffer = %p, pipelineBindPoint = %p, pipeline = %p)", (void*)(pPacket->cmdBuffer), (void*)(pPacket->pipelineBindPoint), (void*)(pPacket->pipeline));
+        return str;
+    }
+    case GLV_TPI_XGL_xglCmdBindPipelineDelta:
+    {
+        struct_xglCmdBindPipelineDelta* pPacket = (struct_xglCmdBindPipelineDelta*)(pHeader->pBody);
+        snprintf(str, 1024, "xglCmdBindPipelineDelta(cmdBuffer = %p, pipelineBindPoint = %p, delta = %p)", (void*)(pPacket->cmdBuffer), (void*)(pPacket->pipelineBindPoint), (void*)(pPacket->delta));
+        return str;
+    }
+    case GLV_TPI_XGL_xglCmdBindDynamicStateObject:
+    {
+        struct_xglCmdBindDynamicStateObject* pPacket = (struct_xglCmdBindDynamicStateObject*)(pHeader->pBody);
+        snprintf(str, 1024, "xglCmdBindDynamicStateObject(cmdBuffer = %p, stateBindPoint = %p, state = %p)", (void*)(pPacket->cmdBuffer), (void*)(pPacket->stateBindPoint), (void*)(pPacket->state));
+        return str;
+    }
+    case GLV_TPI_XGL_xglCmdBindDescriptorSet:
+    {
+        struct_xglCmdBindDescriptorSet* pPacket = (struct_xglCmdBindDescriptorSet*)(pHeader->pBody);
+        snprintf(str, 1024, "xglCmdBindDescriptorSet(cmdBuffer = %p, pipelineBindPoint = %p, descriptorSet = %p, *pUserData = %i)", (void*)(pPacket->cmdBuffer), (void*)(pPacket->pipelineBindPoint), (void*)(pPacket->descriptorSet), (pPacket->pUserData == NULL) ? 0 : *(pPacket->pUserData));
+        return str;
+    }
+    case GLV_TPI_XGL_xglCmdBindVertexBuffer:
+    {
+        struct_xglCmdBindVertexBuffer* pPacket = (struct_xglCmdBindVertexBuffer*)(pHeader->pBody);
+        snprintf(str, 1024, "xglCmdBindVertexBuffer(cmdBuffer = %p, buffer = %p, offset = %p, binding = %i)", (void*)(pPacket->cmdBuffer), (void*)(pPacket->buffer), (void*)(pPacket->offset), pPacket->binding);
+        return str;
+    }
+    case GLV_TPI_XGL_xglCmdBindIndexBuffer:
+    {
+        struct_xglCmdBindIndexBuffer* pPacket = (struct_xglCmdBindIndexBuffer*)(pHeader->pBody);
+        snprintf(str, 1024, "xglCmdBindIndexBuffer(cmdBuffer = %p, buffer = %p, offset = %p, indexType = %s)", (void*)(pPacket->cmdBuffer), (void*)(pPacket->buffer), (void*)(pPacket->offset), string_XGL_INDEX_TYPE(pPacket->indexType));
+        return str;
+    }
+    case GLV_TPI_XGL_xglCmdDraw:
+    {
+        struct_xglCmdDraw* pPacket = (struct_xglCmdDraw*)(pHeader->pBody);
+        snprintf(str, 1024, "xglCmdDraw(cmdBuffer = %p, firstVertex = %i, vertexCount = %i, firstInstance = %i, instanceCount = %i)", (void*)(pPacket->cmdBuffer), pPacket->firstVertex, pPacket->vertexCount, pPacket->firstInstance, pPacket->instanceCount);
+        return str;
+    }
+    case GLV_TPI_XGL_xglCmdDrawIndexed:
+    {
+        struct_xglCmdDrawIndexed* pPacket = (struct_xglCmdDrawIndexed*)(pHeader->pBody);
+        snprintf(str, 1024, "xglCmdDrawIndexed(cmdBuffer = %p, firstIndex = %i, indexCount = %i, vertexOffset = %i, firstInstance = %i, instanceCount = %i)", (void*)(pPacket->cmdBuffer), pPacket->firstIndex, pPacket->indexCount, pPacket->vertexOffset, pPacket->firstInstance, pPacket->instanceCount);
+        return str;
+    }
+    case GLV_TPI_XGL_xglCmdDrawIndirect:
+    {
+        struct_xglCmdDrawIndirect* pPacket = (struct_xglCmdDrawIndirect*)(pHeader->pBody);
+        snprintf(str, 1024, "xglCmdDrawIndirect(cmdBuffer = %p, buffer = %p, offset = %p, count = %i, stride = %i)", (void*)(pPacket->cmdBuffer), (void*)(pPacket->buffer), (void*)(pPacket->offset), pPacket->count, pPacket->stride);
+        return str;
+    }
+    case GLV_TPI_XGL_xglCmdDrawIndexedIndirect:
+    {
+        struct_xglCmdDrawIndexedIndirect* pPacket = (struct_xglCmdDrawIndexedIndirect*)(pHeader->pBody);
+        snprintf(str, 1024, "xglCmdDrawIndexedIndirect(cmdBuffer = %p, buffer = %p, offset = %p, count = %i, stride = %i)", (void*)(pPacket->cmdBuffer), (void*)(pPacket->buffer), (void*)(pPacket->offset), pPacket->count, pPacket->stride);
+        return str;
+    }
+    case GLV_TPI_XGL_xglCmdDispatch:
+    {
+        struct_xglCmdDispatch* pPacket = (struct_xglCmdDispatch*)(pHeader->pBody);
+        snprintf(str, 1024, "xglCmdDispatch(cmdBuffer = %p, x = %i, y = %i, z = %i)", (void*)(pPacket->cmdBuffer), pPacket->x, pPacket->y, pPacket->z);
+        return str;
+    }
+    case GLV_TPI_XGL_xglCmdDispatchIndirect:
+    {
+        struct_xglCmdDispatchIndirect* pPacket = (struct_xglCmdDispatchIndirect*)(pHeader->pBody);
+        snprintf(str, 1024, "xglCmdDispatchIndirect(cmdBuffer = %p, buffer = %p, offset = %p)", (void*)(pPacket->cmdBuffer), (void*)(pPacket->buffer), (void*)(pPacket->offset));
+        return str;
+    }
+    case GLV_TPI_XGL_xglCmdCopyBuffer:
+    {
+        struct_xglCmdCopyBuffer* pPacket = (struct_xglCmdCopyBuffer*)(pHeader->pBody);
+        snprintf(str, 1024, "xglCmdCopyBuffer(cmdBuffer = %p, srcBuffer = %p, destBuffer = %p, regionCount = %i, pRegions = %p)", (void*)(pPacket->cmdBuffer), (void*)(pPacket->srcBuffer), (void*)(pPacket->destBuffer), pPacket->regionCount, (void*)(pPacket->pRegions));
+        return str;
+    }
+    case GLV_TPI_XGL_xglCmdCopyImage:
+    {
+        struct_xglCmdCopyImage* pPacket = (struct_xglCmdCopyImage*)(pHeader->pBody);
+        snprintf(str, 1024, "xglCmdCopyImage(cmdBuffer = %p, srcImage = %p, destImage = %p, regionCount = %i, pRegions = %p)", (void*)(pPacket->cmdBuffer), (void*)(pPacket->srcImage), (void*)(pPacket->destImage), pPacket->regionCount, (void*)(pPacket->pRegions));
+        return str;
+    }
+    case GLV_TPI_XGL_xglCmdCopyBufferToImage:
+    {
+        struct_xglCmdCopyBufferToImage* pPacket = (struct_xglCmdCopyBufferToImage*)(pHeader->pBody);
+        snprintf(str, 1024, "xglCmdCopyBufferToImage(cmdBuffer = %p, srcBuffer = %p, destImage = %p, regionCount = %i, pRegions = %p)", (void*)(pPacket->cmdBuffer), (void*)(pPacket->srcBuffer), (void*)(pPacket->destImage), pPacket->regionCount, (void*)(pPacket->pRegions));
+        return str;
+    }
+    case GLV_TPI_XGL_xglCmdCopyImageToBuffer:
+    {
+        struct_xglCmdCopyImageToBuffer* pPacket = (struct_xglCmdCopyImageToBuffer*)(pHeader->pBody);
+        snprintf(str, 1024, "xglCmdCopyImageToBuffer(cmdBuffer = %p, srcImage = %p, destBuffer = %p, regionCount = %i, pRegions = %p)", (void*)(pPacket->cmdBuffer), (void*)(pPacket->srcImage), (void*)(pPacket->destBuffer), pPacket->regionCount, (void*)(pPacket->pRegions));
+        return str;
+    }
+    case GLV_TPI_XGL_xglCmdCloneImageData:
+    {
+        struct_xglCmdCloneImageData* pPacket = (struct_xglCmdCloneImageData*)(pHeader->pBody);
+        snprintf(str, 1024, "xglCmdCloneImageData(cmdBuffer = %p, srcImage = %p, srcImageLayout = %p, destImage = %p, destImageLayout = %p)", (void*)(pPacket->cmdBuffer), (void*)(pPacket->srcImage), (void*)(pPacket->srcImageLayout), (void*)(pPacket->destImage), (void*)(pPacket->destImageLayout));
+        return str;
+    }
+    case GLV_TPI_XGL_xglCmdUpdateBuffer:
+    {
+        struct_xglCmdUpdateBuffer* pPacket = (struct_xglCmdUpdateBuffer*)(pHeader->pBody);
+        snprintf(str, 1024, "xglCmdUpdateBuffer(cmdBuffer = %p, destBuffer = %p, destOffset = %p, dataSize = %p, *pData = %i)", (void*)(pPacket->cmdBuffer), (void*)(pPacket->destBuffer), (void*)(pPacket->destOffset), (void*)(pPacket->dataSize), (pPacket->pData == NULL) ? 0 : *(pPacket->pData));
+        return str;
+    }
+    case GLV_TPI_XGL_xglCmdFillBuffer:
+    {
+        struct_xglCmdFillBuffer* pPacket = (struct_xglCmdFillBuffer*)(pHeader->pBody);
+        snprintf(str, 1024, "xglCmdFillBuffer(cmdBuffer = %p, destBuffer = %p, destOffset = %p, fillSize = %p, data = %i)", (void*)(pPacket->cmdBuffer), (void*)(pPacket->destBuffer), (void*)(pPacket->destOffset), (void*)(pPacket->fillSize), pPacket->data);
+        return str;
+    }
+    case GLV_TPI_XGL_xglCmdClearColorImage:
+    {
+        struct_xglCmdClearColorImage* pPacket = (struct_xglCmdClearColorImage*)(pHeader->pBody);
+        snprintf(str, 1024, "xglCmdClearColorImage(cmdBuffer = %p, image = %p, color = [%f, %f, %f, %f], rangeCount = %i, pRanges = %p)", (void*)(pPacket->cmdBuffer), (void*)(pPacket->image), pPacket->color[0], pPacket->color[1], pPacket->color[2], pPacket->color[3], pPacket->rangeCount, (void*)(pPacket->pRanges));
+        return str;
+    }
+    case GLV_TPI_XGL_xglCmdClearColorImageRaw:
+    {
+        struct_xglCmdClearColorImageRaw* pPacket = (struct_xglCmdClearColorImageRaw*)(pHeader->pBody);
+        snprintf(str, 1024, "xglCmdClearColorImageRaw(cmdBuffer = %p, image = %p, color = [%i, %i, %i, %i], rangeCount = %i, pRanges = %p)", (void*)(pPacket->cmdBuffer), (void*)(pPacket->image), pPacket->color[0], pPacket->color[1], pPacket->color[2], pPacket->color[3], pPacket->rangeCount, (void*)(pPacket->pRanges));
+        return str;
+    }
+    case GLV_TPI_XGL_xglCmdClearDepthStencil:
+    {
+        struct_xglCmdClearDepthStencil* pPacket = (struct_xglCmdClearDepthStencil*)(pHeader->pBody);
+        snprintf(str, 1024, "xglCmdClearDepthStencil(cmdBuffer = %p, image = %p, depth = %f, stencil = %i, rangeCount = %i, pRanges = %p)", (void*)(pPacket->cmdBuffer), (void*)(pPacket->image), pPacket->depth, pPacket->stencil, pPacket->rangeCount, (void*)(pPacket->pRanges));
+        return str;
+    }
+    case GLV_TPI_XGL_xglCmdResolveImage:
+    {
+        struct_xglCmdResolveImage* pPacket = (struct_xglCmdResolveImage*)(pHeader->pBody);
+        snprintf(str, 1024, "xglCmdResolveImage(cmdBuffer = %p, srcImage = %p, destImage = %p, rectCount = %i, pRects = %p)", (void*)(pPacket->cmdBuffer), (void*)(pPacket->srcImage), (void*)(pPacket->destImage), pPacket->rectCount, (void*)(pPacket->pRects));
+        return str;
+    }
+    case GLV_TPI_XGL_xglCmdSetEvent:
+    {
+        struct_xglCmdSetEvent* pPacket = (struct_xglCmdSetEvent*)(pHeader->pBody);
+        snprintf(str, 1024, "xglCmdSetEvent(cmdBuffer = %p, event = %p, pipeEvent = %p)", (void*)(pPacket->cmdBuffer), (void*)(pPacket->event), (void*)(pPacket->pipeEvent));
+        return str;
+    }
+    case GLV_TPI_XGL_xglCmdResetEvent:
+    {
+        struct_xglCmdResetEvent* pPacket = (struct_xglCmdResetEvent*)(pHeader->pBody);
+        snprintf(str, 1024, "xglCmdResetEvent(cmdBuffer = %p, event = %p)", (void*)(pPacket->cmdBuffer), (void*)(pPacket->event));
+        return str;
+    }
+    case GLV_TPI_XGL_xglCmdWaitEvents:
+    {
+        struct_xglCmdWaitEvents* pPacket = (struct_xglCmdWaitEvents*)(pHeader->pBody);
+        snprintf(str, 1024, "xglCmdWaitEvents(cmdBuffer = %p, pWaitInfo = %p)", (void*)(pPacket->cmdBuffer), (void*)(pPacket->pWaitInfo));
+        return str;
+    }
+    case GLV_TPI_XGL_xglCmdPipelineBarrier:
+    {
+        struct_xglCmdPipelineBarrier* pPacket = (struct_xglCmdPipelineBarrier*)(pHeader->pBody);
+        snprintf(str, 1024, "xglCmdPipelineBarrier(cmdBuffer = %p, pBarrier = %p)", (void*)(pPacket->cmdBuffer), (void*)(pPacket->pBarrier));
+        return str;
+    }
+    case GLV_TPI_XGL_xglCmdBeginQuery:
+    {
+        struct_xglCmdBeginQuery* pPacket = (struct_xglCmdBeginQuery*)(pHeader->pBody);
+        snprintf(str, 1024, "xglCmdBeginQuery(cmdBuffer = %p, queryPool = %p, slot = %i, flags = %i)", (void*)(pPacket->cmdBuffer), (void*)(pPacket->queryPool), pPacket->slot, pPacket->flags);
+        return str;
+    }
+    case GLV_TPI_XGL_xglCmdEndQuery:
+    {
+        struct_xglCmdEndQuery* pPacket = (struct_xglCmdEndQuery*)(pHeader->pBody);
+        snprintf(str, 1024, "xglCmdEndQuery(cmdBuffer = %p, queryPool = %p, slot = %i)", (void*)(pPacket->cmdBuffer), (void*)(pPacket->queryPool), pPacket->slot);
+        return str;
+    }
+    case GLV_TPI_XGL_xglCmdResetQueryPool:
+    {
+        struct_xglCmdResetQueryPool* pPacket = (struct_xglCmdResetQueryPool*)(pHeader->pBody);
+        snprintf(str, 1024, "xglCmdResetQueryPool(cmdBuffer = %p, queryPool = %p, startQuery = %i, queryCount = %i)", (void*)(pPacket->cmdBuffer), (void*)(pPacket->queryPool), pPacket->startQuery, pPacket->queryCount);
+        return str;
+    }
+    case GLV_TPI_XGL_xglCmdWriteTimestamp:
+    {
+        struct_xglCmdWriteTimestamp* pPacket = (struct_xglCmdWriteTimestamp*)(pHeader->pBody);
+        snprintf(str, 1024, "xglCmdWriteTimestamp(cmdBuffer = %p, timestampType = %s, destBuffer = %p, destOffset = %p)", (void*)(pPacket->cmdBuffer), string_XGL_TIMESTAMP_TYPE(pPacket->timestampType), (void*)(pPacket->destBuffer), (void*)(pPacket->destOffset));
+        return str;
+    }
+    case GLV_TPI_XGL_xglCmdInitAtomicCounters:
+    {
+        struct_xglCmdInitAtomicCounters* pPacket = (struct_xglCmdInitAtomicCounters*)(pHeader->pBody);
+        snprintf(str, 1024, "xglCmdInitAtomicCounters(cmdBuffer = %p, pipelineBindPoint = %p, startCounter = %i, counterCount = %i, *pData = %i)", (void*)(pPacket->cmdBuffer), (void*)(pPacket->pipelineBindPoint), pPacket->startCounter, pPacket->counterCount, (pPacket->pData == NULL) ? 0 : *(pPacket->pData));
+        return str;
+    }
+    case GLV_TPI_XGL_xglCmdLoadAtomicCounters:
+    {
+        struct_xglCmdLoadAtomicCounters* pPacket = (struct_xglCmdLoadAtomicCounters*)(pHeader->pBody);
+        snprintf(str, 1024, "xglCmdLoadAtomicCounters(cmdBuffer = %p, pipelineBindPoint = %p, startCounter = %i, counterCount = %i, srcBuffer = %p, srcOffset = %p)", (void*)(pPacket->cmdBuffer), (void*)(pPacket->pipelineBindPoint), pPacket->startCounter, pPacket->counterCount, (void*)(pPacket->srcBuffer), (void*)(pPacket->srcOffset));
+        return str;
+    }
+    case GLV_TPI_XGL_xglCmdSaveAtomicCounters:
+    {
+        struct_xglCmdSaveAtomicCounters* pPacket = (struct_xglCmdSaveAtomicCounters*)(pHeader->pBody);
+        snprintf(str, 1024, "xglCmdSaveAtomicCounters(cmdBuffer = %p, pipelineBindPoint = %p, startCounter = %i, counterCount = %i, destBuffer = %p, destOffset = %p)", (void*)(pPacket->cmdBuffer), (void*)(pPacket->pipelineBindPoint), pPacket->startCounter, pPacket->counterCount, (void*)(pPacket->destBuffer), (void*)(pPacket->destOffset));
+        return str;
+    }
+    case GLV_TPI_XGL_xglCreateFramebuffer:
+    {
+        struct_xglCreateFramebuffer* pPacket = (struct_xglCreateFramebuffer*)(pHeader->pBody);
+        snprintf(str, 1024, "xglCreateFramebuffer(device = %p, pCreateInfo = %p, pFramebuffer = %p)", (void*)(pPacket->device), (void*)(pPacket->pCreateInfo), (void*)pPacket->pFramebuffer);
+        return str;
+    }
+    case GLV_TPI_XGL_xglCreateRenderPass:
+    {
+        struct_xglCreateRenderPass* pPacket = (struct_xglCreateRenderPass*)(pHeader->pBody);
+        snprintf(str, 1024, "xglCreateRenderPass(device = %p, pCreateInfo = %p, pRenderPass = %p)", (void*)(pPacket->device), (void*)(pPacket->pCreateInfo), (void*)pPacket->pRenderPass);
+        return str;
+    }
+    case GLV_TPI_XGL_xglCmdBeginRenderPass:
+    {
+        struct_xglCmdBeginRenderPass* pPacket = (struct_xglCmdBeginRenderPass*)(pHeader->pBody);
+        snprintf(str, 1024, "xglCmdBeginRenderPass(cmdBuffer = %p, renderPass = %p)", (void*)(pPacket->cmdBuffer), (void*)(pPacket->renderPass));
+        return str;
+    }
+    case GLV_TPI_XGL_xglCmdEndRenderPass:
+    {
+        struct_xglCmdEndRenderPass* pPacket = (struct_xglCmdEndRenderPass*)(pHeader->pBody);
+        snprintf(str, 1024, "xglCmdEndRenderPass(cmdBuffer = %p, renderPass = %p)", (void*)(pPacket->cmdBuffer), (void*)(pPacket->renderPass));
+        return str;
+    }
+    case GLV_TPI_XGL_xglDbgSetValidationLevel:
+    {
+        struct_xglDbgSetValidationLevel* pPacket = (struct_xglDbgSetValidationLevel*)(pHeader->pBody);
+        snprintf(str, 1024, "xglDbgSetValidationLevel(device = %p, validationLevel = %p)", (void*)(pPacket->device), (void*)(pPacket->validationLevel));
+        return str;
+    }
+    case GLV_TPI_XGL_xglDbgRegisterMsgCallback:
+    {
+        struct_xglDbgRegisterMsgCallback* pPacket = (struct_xglDbgRegisterMsgCallback*)(pHeader->pBody);
+        snprintf(str, 1024, "xglDbgRegisterMsgCallback(pfnMsgCallback = %p, pUserData = %p)", (void*)(pPacket->pfnMsgCallback), (void*)(pPacket->pUserData));
+        return str;
+    }
+    case GLV_TPI_XGL_xglDbgUnregisterMsgCallback:
+    {
+        struct_xglDbgUnregisterMsgCallback* pPacket = (struct_xglDbgUnregisterMsgCallback*)(pHeader->pBody);
+        snprintf(str, 1024, "xglDbgUnregisterMsgCallback(pfnMsgCallback = %p)", (void*)(pPacket->pfnMsgCallback));
+        return str;
+    }
+    case GLV_TPI_XGL_xglDbgSetMessageFilter:
+    {
+        struct_xglDbgSetMessageFilter* pPacket = (struct_xglDbgSetMessageFilter*)(pHeader->pBody);
+        snprintf(str, 1024, "xglDbgSetMessageFilter(device = %p, msgCode = %i, filter = %p)", (void*)(pPacket->device), pPacket->msgCode, (void*)(pPacket->filter));
+        return str;
+    }
+    case GLV_TPI_XGL_xglDbgSetObjectTag:
+    {
+        struct_xglDbgSetObjectTag* pPacket = (struct_xglDbgSetObjectTag*)(pHeader->pBody);
+        snprintf(str, 1024, "xglDbgSetObjectTag(object = %p, tagSize = %zu, pTag = %p)", (void*)(pPacket->object), pPacket->tagSize, (void*)(pPacket->pTag));
+        return str;
+    }
+    case GLV_TPI_XGL_xglDbgSetGlobalOption:
+    {
+        struct_xglDbgSetGlobalOption* pPacket = (struct_xglDbgSetGlobalOption*)(pHeader->pBody);
+        snprintf(str, 1024, "xglDbgSetGlobalOption(dbgOption = %p, dataSize = %zu, pData = %p)", (void*)(pPacket->dbgOption), pPacket->dataSize, (void*)(pPacket->pData));
+        return str;
+    }
+    case GLV_TPI_XGL_xglDbgSetDeviceOption:
+    {
+        struct_xglDbgSetDeviceOption* pPacket = (struct_xglDbgSetDeviceOption*)(pHeader->pBody);
+        snprintf(str, 1024, "xglDbgSetDeviceOption(device = %p, dbgOption = %p, dataSize = %zu, pData = %p)", (void*)(pPacket->device), (void*)(pPacket->dbgOption), pPacket->dataSize, (void*)(pPacket->pData));
+        return str;
+    }
+    case GLV_TPI_XGL_xglCmdDbgMarkerBegin:
+    {
+        struct_xglCmdDbgMarkerBegin* pPacket = (struct_xglCmdDbgMarkerBegin*)(pHeader->pBody);
+        snprintf(str, 1024, "xglCmdDbgMarkerBegin(cmdBuffer = %p, pMarker = %p)", (void*)(pPacket->cmdBuffer), (void*)(pPacket->pMarker));
+        return str;
+    }
+    case GLV_TPI_XGL_xglCmdDbgMarkerEnd:
+    {
+        struct_xglCmdDbgMarkerEnd* pPacket = (struct_xglCmdDbgMarkerEnd*)(pHeader->pBody);
+        snprintf(str, 1024, "xglCmdDbgMarkerEnd(cmdBuffer = %p)", (void*)(pPacket->cmdBuffer));
+        return str;
+    }
+    case GLV_TPI_XGL_xglWsiX11AssociateConnection:
+    {
+        struct_xglWsiX11AssociateConnection* pPacket = (struct_xglWsiX11AssociateConnection*)(pHeader->pBody);
+        snprintf(str, 1024, "xglWsiX11AssociateConnection(gpu = %p, pConnectionInfo = %p)", (void*)(pPacket->gpu), (void*)(pPacket->pConnectionInfo));
+        return str;
+    }
+    case GLV_TPI_XGL_xglWsiX11GetMSC:
+    {
+        struct_xglWsiX11GetMSC* pPacket = (struct_xglWsiX11GetMSC*)(pHeader->pBody);
+        snprintf(str, 1024, "xglWsiX11GetMSC(device = %p, window = %i, crtc = %u, *pMsc = %lu)", (void*)(pPacket->device), pPacket->window, pPacket->crtc, (pPacket->pMsc == NULL) ? 0 : *(pPacket->pMsc));
+        return str;
+    }
+    case GLV_TPI_XGL_xglWsiX11CreatePresentableImage:
+    {
+        struct_xglWsiX11CreatePresentableImage* pPacket = (struct_xglWsiX11CreatePresentableImage*)(pHeader->pBody);
+        snprintf(str, 1024, "xglWsiX11CreatePresentableImage(device = %p, pCreateInfo = %p, pImage = %p, pMem = %p)", (void*)(pPacket->device), (void*)(pPacket->pCreateInfo), (void*)(pPacket->pImage), (void*)pPacket->pMem);
+        return str;
+    }
+    case GLV_TPI_XGL_xglWsiX11QueuePresent:
+    {
+        struct_xglWsiX11QueuePresent* pPacket = (struct_xglWsiX11QueuePresent*)(pHeader->pBody);
+        snprintf(str, 1024, "xglWsiX11QueuePresent(queue = %p, pPresentInfo = %p, fence = %p)", (void*)(pPacket->queue), (void*)(pPacket->pPresentInfo), (void*)(pPacket->fence));
+        return str;
+    }
+    default:
+        return NULL;
+    }
+};
+
+static glv_trace_packet_header* interpret_trace_packet_xgl(glv_trace_packet_header* pHeader)
+{
+    if (pHeader == NULL)
+    {
+        return NULL;
+    }
+    switch (pHeader->packet_id)
+    {
+        case GLV_TPI_XGL_xglApiVersion:
+        {
+            return interpret_body_as_xglApiVersion(pHeader, TRUE)->header;
+        }
+        case GLV_TPI_XGL_xglCreateInstance:
+        {
+            return interpret_body_as_xglCreateInstance(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglDestroyInstance:
+        {
+            return interpret_body_as_xglDestroyInstance(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglEnumerateGpus:
+        {
+            return interpret_body_as_xglEnumerateGpus(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglGetGpuInfo:
+        {
+            return interpret_body_as_xglGetGpuInfo(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglGetProcAddr:
+        {
+            return interpret_body_as_xglGetProcAddr(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglCreateDevice:
+        {
+            return interpret_body_as_xglCreateDevice(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglDestroyDevice:
+        {
+            return interpret_body_as_xglDestroyDevice(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglGetExtensionSupport:
+        {
+            return interpret_body_as_xglGetExtensionSupport(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglEnumerateLayers:
+        {
+            return interpret_body_as_xglEnumerateLayers(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglGetDeviceQueue:
+        {
+            return interpret_body_as_xglGetDeviceQueue(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglQueueSubmit:
+        {
+            return interpret_body_as_xglQueueSubmit(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglQueueSetGlobalMemReferences:
+        {
+            return interpret_body_as_xglQueueSetGlobalMemReferences(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglQueueWaitIdle:
+        {
+            return interpret_body_as_xglQueueWaitIdle(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglDeviceWaitIdle:
+        {
+            return interpret_body_as_xglDeviceWaitIdle(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglAllocMemory:
+        {
+            return interpret_body_as_xglAllocMemory(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglFreeMemory:
+        {
+            return interpret_body_as_xglFreeMemory(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglSetMemoryPriority:
+        {
+            return interpret_body_as_xglSetMemoryPriority(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglMapMemory:
+        {
+            return interpret_body_as_xglMapMemory(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglUnmapMemory:
+        {
+            return interpret_body_as_xglUnmapMemory(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglPinSystemMemory:
+        {
+            return interpret_body_as_xglPinSystemMemory(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglGetMultiGpuCompatibility:
+        {
+            return interpret_body_as_xglGetMultiGpuCompatibility(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglOpenSharedMemory:
+        {
+            return interpret_body_as_xglOpenSharedMemory(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglOpenSharedQueueSemaphore:
+        {
+            return interpret_body_as_xglOpenSharedQueueSemaphore(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglOpenPeerMemory:
+        {
+            return interpret_body_as_xglOpenPeerMemory(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglOpenPeerImage:
+        {
+            return interpret_body_as_xglOpenPeerImage(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglDestroyObject:
+        {
+            return interpret_body_as_xglDestroyObject(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglGetObjectInfo:
+        {
+            return interpret_body_as_xglGetObjectInfo(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglBindObjectMemory:
+        {
+            return interpret_body_as_xglBindObjectMemory(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglBindObjectMemoryRange:
+        {
+            return interpret_body_as_xglBindObjectMemoryRange(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglBindImageMemoryRange:
+        {
+            return interpret_body_as_xglBindImageMemoryRange(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglCreateFence:
+        {
+            return interpret_body_as_xglCreateFence(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglGetFenceStatus:
+        {
+            return interpret_body_as_xglGetFenceStatus(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglWaitForFences:
+        {
+            return interpret_body_as_xglWaitForFences(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglCreateQueueSemaphore:
+        {
+            return interpret_body_as_xglCreateQueueSemaphore(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglSignalQueueSemaphore:
+        {
+            return interpret_body_as_xglSignalQueueSemaphore(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglWaitQueueSemaphore:
+        {
+            return interpret_body_as_xglWaitQueueSemaphore(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglCreateEvent:
+        {
+            return interpret_body_as_xglCreateEvent(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglGetEventStatus:
+        {
+            return interpret_body_as_xglGetEventStatus(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglSetEvent:
+        {
+            return interpret_body_as_xglSetEvent(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglResetEvent:
+        {
+            return interpret_body_as_xglResetEvent(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglCreateQueryPool:
+        {
+            return interpret_body_as_xglCreateQueryPool(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglGetQueryPoolResults:
+        {
+            return interpret_body_as_xglGetQueryPoolResults(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglGetFormatInfo:
+        {
+            return interpret_body_as_xglGetFormatInfo(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglCreateBuffer:
+        {
+            return interpret_body_as_xglCreateBuffer(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglCreateBufferView:
+        {
+            return interpret_body_as_xglCreateBufferView(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglCreateImage:
+        {
+            return interpret_body_as_xglCreateImage(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglSetFastClearColor:
+        {
+            return interpret_body_as_xglSetFastClearColor(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglSetFastClearDepth:
+        {
+            return interpret_body_as_xglSetFastClearDepth(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglGetImageSubresourceInfo:
+        {
+            return interpret_body_as_xglGetImageSubresourceInfo(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglCreateImageView:
+        {
+            return interpret_body_as_xglCreateImageView(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglCreateColorAttachmentView:
+        {
+            return interpret_body_as_xglCreateColorAttachmentView(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglCreateDepthStencilView:
+        {
+            return interpret_body_as_xglCreateDepthStencilView(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglCreateShader:
+        {
+            return interpret_body_as_xglCreateShader(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglCreateGraphicsPipeline:
+        {
+            return interpret_body_as_xglCreateGraphicsPipeline(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglCreateComputePipeline:
+        {
+            return interpret_body_as_xglCreateComputePipeline(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglStorePipeline:
+        {
+            return interpret_body_as_xglStorePipeline(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglLoadPipeline:
+        {
+            return interpret_body_as_xglLoadPipeline(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglCreatePipelineDelta:
+        {
+            return interpret_body_as_xglCreatePipelineDelta(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglCreateSampler:
+        {
+            return interpret_body_as_xglCreateSampler(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglCreateDescriptorSetLayout:
+        {
+            return interpret_body_as_xglCreateDescriptorSetLayout(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglBeginDescriptorRegionUpdate:
+        {
+            return interpret_body_as_xglBeginDescriptorRegionUpdate(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglEndDescriptorRegionUpdate:
+        {
+            return interpret_body_as_xglEndDescriptorRegionUpdate(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglCreateDescriptorRegion:
+        {
+            return interpret_body_as_xglCreateDescriptorRegion(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglClearDescriptorRegion:
+        {
+            return interpret_body_as_xglClearDescriptorRegion(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglAllocDescriptorSets:
+        {
+            return interpret_body_as_xglAllocDescriptorSets(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglClearDescriptorSets:
+        {
+            return interpret_body_as_xglClearDescriptorSets(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglUpdateDescriptors:
+        {
+            return interpret_body_as_xglUpdateDescriptors(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglCreateDynamicViewportState:
+        {
+            return interpret_body_as_xglCreateDynamicViewportState(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglCreateDynamicRasterState:
+        {
+            return interpret_body_as_xglCreateDynamicRasterState(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglCreateDynamicColorBlendState:
+        {
+            return interpret_body_as_xglCreateDynamicColorBlendState(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglCreateDynamicDepthStencilState:
+        {
+            return interpret_body_as_xglCreateDynamicDepthStencilState(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglCreateCommandBuffer:
+        {
+            return interpret_body_as_xglCreateCommandBuffer(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglBeginCommandBuffer:
+        {
+            return interpret_body_as_xglBeginCommandBuffer(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglEndCommandBuffer:
+        {
+            return interpret_body_as_xglEndCommandBuffer(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglResetCommandBuffer:
+        {
+            return interpret_body_as_xglResetCommandBuffer(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglCmdBindPipeline:
+        {
+            return interpret_body_as_xglCmdBindPipeline(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglCmdBindPipelineDelta:
+        {
+            return interpret_body_as_xglCmdBindPipelineDelta(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglCmdBindDynamicStateObject:
+        {
+            return interpret_body_as_xglCmdBindDynamicStateObject(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglCmdBindDescriptorSet:
+        {
+            return interpret_body_as_xglCmdBindDescriptorSet(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglCmdBindVertexBuffer:
+        {
+            return interpret_body_as_xglCmdBindVertexBuffer(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglCmdBindIndexBuffer:
+        {
+            return interpret_body_as_xglCmdBindIndexBuffer(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglCmdDraw:
+        {
+            return interpret_body_as_xglCmdDraw(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglCmdDrawIndexed:
+        {
+            return interpret_body_as_xglCmdDrawIndexed(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglCmdDrawIndirect:
+        {
+            return interpret_body_as_xglCmdDrawIndirect(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglCmdDrawIndexedIndirect:
+        {
+            return interpret_body_as_xglCmdDrawIndexedIndirect(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglCmdDispatch:
+        {
+            return interpret_body_as_xglCmdDispatch(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglCmdDispatchIndirect:
+        {
+            return interpret_body_as_xglCmdDispatchIndirect(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglCmdCopyBuffer:
+        {
+            return interpret_body_as_xglCmdCopyBuffer(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglCmdCopyImage:
+        {
+            return interpret_body_as_xglCmdCopyImage(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglCmdCopyBufferToImage:
+        {
+            return interpret_body_as_xglCmdCopyBufferToImage(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglCmdCopyImageToBuffer:
+        {
+            return interpret_body_as_xglCmdCopyImageToBuffer(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglCmdCloneImageData:
+        {
+            return interpret_body_as_xglCmdCloneImageData(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglCmdUpdateBuffer:
+        {
+            return interpret_body_as_xglCmdUpdateBuffer(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglCmdFillBuffer:
+        {
+            return interpret_body_as_xglCmdFillBuffer(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglCmdClearColorImage:
+        {
+            return interpret_body_as_xglCmdClearColorImage(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglCmdClearColorImageRaw:
+        {
+            return interpret_body_as_xglCmdClearColorImageRaw(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglCmdClearDepthStencil:
+        {
+            return interpret_body_as_xglCmdClearDepthStencil(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglCmdResolveImage:
+        {
+            return interpret_body_as_xglCmdResolveImage(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglCmdSetEvent:
+        {
+            return interpret_body_as_xglCmdSetEvent(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglCmdResetEvent:
+        {
+            return interpret_body_as_xglCmdResetEvent(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglCmdWaitEvents:
+        {
+            return interpret_body_as_xglCmdWaitEvents(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglCmdPipelineBarrier:
+        {
+            return interpret_body_as_xglCmdPipelineBarrier(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglCmdBeginQuery:
+        {
+            return interpret_body_as_xglCmdBeginQuery(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglCmdEndQuery:
+        {
+            return interpret_body_as_xglCmdEndQuery(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglCmdResetQueryPool:
+        {
+            return interpret_body_as_xglCmdResetQueryPool(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglCmdWriteTimestamp:
+        {
+            return interpret_body_as_xglCmdWriteTimestamp(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglCmdInitAtomicCounters:
+        {
+            return interpret_body_as_xglCmdInitAtomicCounters(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglCmdLoadAtomicCounters:
+        {
+            return interpret_body_as_xglCmdLoadAtomicCounters(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglCmdSaveAtomicCounters:
+        {
+            return interpret_body_as_xglCmdSaveAtomicCounters(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglCreateFramebuffer:
+        {
+            return interpret_body_as_xglCreateFramebuffer(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglCreateRenderPass:
+        {
+            return interpret_body_as_xglCreateRenderPass(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglCmdBeginRenderPass:
+        {
+            return interpret_body_as_xglCmdBeginRenderPass(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglCmdEndRenderPass:
+        {
+            return interpret_body_as_xglCmdEndRenderPass(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglDbgSetValidationLevel:
+        {
+            return interpret_body_as_xglDbgSetValidationLevel(pHeader)->pHeader;
+        }
+        case GLV_TPI_XGL_xglDbgRegisterMsgCallback:
+        {
+            return interpret_body_as_xglDbgRegisterMsgCallback(pHeader)->pHeader;
+        }
+        case GLV_TPI_XGL_xglDbgUnregisterMsgCallback:
+        {
+            return interpret_body_as_xglDbgUnregisterMsgCallback(pHeader)->pHeader;
+        }
+        case GLV_TPI_XGL_xglDbgSetMessageFilter:
+        {
+            return interpret_body_as_xglDbgSetMessageFilter(pHeader)->pHeader;
+        }
+        case GLV_TPI_XGL_xglDbgSetObjectTag:
+        {
+            return interpret_body_as_xglDbgSetObjectTag(pHeader)->pHeader;
+        }
+        case GLV_TPI_XGL_xglDbgSetGlobalOption:
+        {
+            return interpret_body_as_xglDbgSetGlobalOption(pHeader)->pHeader;
+        }
+        case GLV_TPI_XGL_xglDbgSetDeviceOption:
+        {
+            return interpret_body_as_xglDbgSetDeviceOption(pHeader)->pHeader;
+        }
+        case GLV_TPI_XGL_xglCmdDbgMarkerBegin:
+        {
+            return interpret_body_as_xglCmdDbgMarkerBegin(pHeader)->pHeader;
+        }
+        case GLV_TPI_XGL_xglCmdDbgMarkerEnd:
+        {
+            return interpret_body_as_xglCmdDbgMarkerEnd(pHeader)->pHeader;
+        }
+        case GLV_TPI_XGL_xglWsiX11AssociateConnection:
+        {
+            return interpret_body_as_xglWsiX11AssociateConnection(pHeader)->pHeader;
+        }
+        case GLV_TPI_XGL_xglWsiX11GetMSC:
+        {
+            return interpret_body_as_xglWsiX11GetMSC(pHeader)->pHeader;
+        }
+        case GLV_TPI_XGL_xglWsiX11CreatePresentableImage:
+        {
+            return interpret_body_as_xglWsiX11CreatePresentableImage(pHeader)->pHeader;
+        }
+        case GLV_TPI_XGL_xglWsiX11QueuePresent:
+        {
+            return interpret_body_as_xglWsiX11QueuePresent(pHeader)->pHeader;
+        }
+        default:
+            return NULL;
+    }
+    return NULL;
+}
diff --git a/tools/glave/src/glv_extensions/glvdebug_xgl/codegen/glvtrace_xgl_xgl_structs.h b/tools/glave/src/glv_extensions/glvdebug_xgl/codegen/glvtrace_xgl_xgl_structs.h
new file mode 100644
index 0000000..c61f718
--- /dev/null
+++ b/tools/glave/src/glv_extensions/glvdebug_xgl/codegen/glvtrace_xgl_xgl_structs.h
@@ -0,0 +1,2259 @@
+/* THIS FILE IS GENERATED.  DO NOT EDIT. */
+
+/*
+ * XGL
+ *
+ * Copyright (C) 2014 LunarG, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+#pragma once
+
+#include "xgl.h"
+#include "glv_trace_packet_utils.h"
+
+
+//=============================================================================
+static void add_XGL_APPLICATION_INFO_to_packet(glv_trace_packet_header*  pHeader, XGL_APPLICATION_INFO** ppStruct, const XGL_APPLICATION_INFO *pInStruct)
+{
+    glv_add_buffer_to_trace_packet(pHeader, (void**)ppStruct, sizeof(XGL_APPLICATION_INFO), pInStruct);
+    glv_add_buffer_to_trace_packet(pHeader, (void**)&((*ppStruct)->pAppName), strlen(pInStruct->pAppName) + 1, pInStruct->pAppName);
+    glv_add_buffer_to_trace_packet(pHeader, (void**)&((*ppStruct)->pEngineName), strlen(pInStruct->pEngineName) + 1, pInStruct->pEngineName);
+    glv_finalize_buffer_address(pHeader, (void**)&((*ppStruct)->pAppName));
+    glv_finalize_buffer_address(pHeader, (void**)&((*ppStruct)->pEngineName));
+    glv_finalize_buffer_address(pHeader, (void**)&*ppStruct);
+};
+
+//=============================================================================
+
+static void add_XGL_DEVICE_CREATE_INFO_to_packet(glv_trace_packet_header*  pHeader, XGL_DEVICE_CREATE_INFO** ppStruct, const XGL_DEVICE_CREATE_INFO *pInStruct)
+{
+    uint32_t i;
+    glv_add_buffer_to_trace_packet(pHeader, (void**)ppStruct, sizeof(XGL_DEVICE_CREATE_INFO), pInStruct);
+    glv_add_buffer_to_trace_packet(pHeader, (void**)&(*ppStruct)->pRequestedQueues, pInStruct->queueRecordCount*sizeof(XGL_DEVICE_QUEUE_CREATE_INFO), pInStruct->pRequestedQueues);
+    glv_finalize_buffer_address(pHeader, (void**)&(*ppStruct)->pRequestedQueues);
+    if (pInStruct->extensionCount > 0) 
+    {
+        glv_add_buffer_to_trace_packet(pHeader, (void**)(&(*ppStruct)->ppEnabledExtensionNames), pInStruct->extensionCount * sizeof(char *), pInStruct->ppEnabledExtensionNames);
+        for (i = 0; i < pInStruct->extensionCount; i++)
+        {
+            glv_add_buffer_to_trace_packet(pHeader, (void**)(&((*ppStruct)->ppEnabledExtensionNames[i])), strlen(pInStruct->ppEnabledExtensionNames[i]) + 1, pInStruct->ppEnabledExtensionNames[i]);
+            glv_finalize_buffer_address(pHeader, (void**)(&((*ppStruct)->ppEnabledExtensionNames[i])));
+        }
+        glv_finalize_buffer_address(pHeader, (void **)&(*ppStruct)->ppEnabledExtensionNames);
+    }
+    XGL_LAYER_CREATE_INFO *pNext = ( XGL_LAYER_CREATE_INFO *) pInStruct->pNext;
+    while (pNext != NULL)
+    {
+        if ((pNext->sType == XGL_STRUCTURE_TYPE_LAYER_CREATE_INFO) && pNext->layerCount > 0)
+        {
+            glv_add_buffer_to_trace_packet(pHeader, (void**)(&((*ppStruct)->pNext)), sizeof(XGL_LAYER_CREATE_INFO), pNext);
+            glv_finalize_buffer_address(pHeader, (void**)(&((*ppStruct)->pNext)));
+            XGL_LAYER_CREATE_INFO **ppOutStruct = (XGL_LAYER_CREATE_INFO **) &((*ppStruct)->pNext);
+            glv_add_buffer_to_trace_packet(pHeader, (void**)(&(*ppOutStruct)->ppActiveLayerNames), pNext->layerCount * sizeof(char *), pNext->ppActiveLayerNames);
+            for (i = 0; i < pNext->layerCount; i++)
+            {
+                glv_add_buffer_to_trace_packet(pHeader, (void**)(&((*ppOutStruct)->ppActiveLayerNames[i])), strlen(pNext->ppActiveLayerNames[i]) + 1, pNext->ppActiveLayerNames[i]);
+                glv_finalize_buffer_address(pHeader, (void**)(&((*ppOutStruct)->ppActiveLayerNames[i])));
+            }
+            glv_finalize_buffer_address(pHeader, (void **)&(*ppOutStruct)->ppActiveLayerNames);
+        }
+        pNext = ( XGL_LAYER_CREATE_INFO *) pNext->pNext;
+    }
+    glv_finalize_buffer_address(pHeader, (void**)ppStruct);
+}
+
+static XGL_DEVICE_CREATE_INFO* interpret_XGL_DEVICE_CREATE_INFO(glv_trace_packet_header*  pHeader, intptr_t ptr_variable)
+{
+    XGL_DEVICE_CREATE_INFO* pXGL_DEVICE_CREATE_INFO = (XGL_DEVICE_CREATE_INFO*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)ptr_variable);
+
+    if (pXGL_DEVICE_CREATE_INFO != NULL)
+    {
+            uint32_t i;
+            const char** pNames;
+        pXGL_DEVICE_CREATE_INFO->pRequestedQueues = (const XGL_DEVICE_QUEUE_CREATE_INFO*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pXGL_DEVICE_CREATE_INFO->pRequestedQueues);
+
+        if (pXGL_DEVICE_CREATE_INFO->extensionCount > 0)
+        {
+            pXGL_DEVICE_CREATE_INFO->ppEnabledExtensionNames = (const char *const*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pXGL_DEVICE_CREATE_INFO->ppEnabledExtensionNames);
+            pNames = (const char**)pXGL_DEVICE_CREATE_INFO->ppEnabledExtensionNames;
+            for (i = 0; i < pXGL_DEVICE_CREATE_INFO->extensionCount; i++)
+            {
+                pNames[i] = (const char*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)(pXGL_DEVICE_CREATE_INFO->ppEnabledExtensionNames[i]));
+            }
+        }
+        XGL_LAYER_CREATE_INFO *pNext = ( XGL_LAYER_CREATE_INFO *) glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pXGL_DEVICE_CREATE_INFO->pNext);
+        while (pNext != NULL)
+        {
+            if ((pNext->sType == XGL_STRUCTURE_TYPE_LAYER_CREATE_INFO) && pNext->layerCount > 0)
+            {
+                pNext->ppActiveLayerNames = (const char**) glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)(pNext->ppActiveLayerNames));
+                pNames = (const char**)pNext->ppActiveLayerNames;
+                for (i = 0; i < pNext->layerCount; i++)
+                {
+                    pNames[i] = (const char*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)(pNext->ppActiveLayerNames[i]));
+                }
+            }
+            pNext = ( XGL_LAYER_CREATE_INFO *) glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pNext->pNext);
+        }
+    }
+
+    return pXGL_DEVICE_CREATE_INFO;
+}
+
+static void interpret_pipeline_shader(glv_trace_packet_header*  pHeader, XGL_PIPELINE_SHADER* pShader)
+{
+    if (pShader != NULL)
+    {
+        // constant buffers
+        if (pShader->linkConstBufferCount > 0)
+        {
+            uint32_t i;
+            pShader->pLinkConstBufferInfo = (const XGL_LINK_CONST_BUFFER*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pShader->pLinkConstBufferInfo);
+            for (i = 0; i < pShader->linkConstBufferCount; i++)
+            {
+                XGL_LINK_CONST_BUFFER* pBuffer = (XGL_LINK_CONST_BUFFER*)pShader->pLinkConstBufferInfo;
+                pBuffer[i].pBufferData = (const void*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pShader->pLinkConstBufferInfo[i].pBufferData);
+            }
+        }
+    }
+}
+
+//=============================================================================
+typedef struct struct_xglApiVersion {
+    glv_trace_packet_header* header;
+    uint32_t version;
+} struct_xglApiVersion;
+
+static struct_xglApiVersion* interpret_body_as_xglApiVersion(glv_trace_packet_header* pHeader, BOOL check_version)
+{
+    struct_xglApiVersion* pPacket = (struct_xglApiVersion*)pHeader->pBody;
+    pPacket->header = pHeader;
+    if (check_version && pPacket->version != XGL_API_VERSION)
+        glv_LogError("Trace file from older XGL version 0x%x, xgl replayer built from version 0x%x, replayer may fail\n", pPacket->version, XGL_API_VERSION);
+    return pPacket;
+}
+
+typedef struct struct_xglCreateInstance {
+    glv_trace_packet_header* header;
+    const XGL_APPLICATION_INFO* pAppInfo;
+    const XGL_ALLOC_CALLBACKS* pAllocCb;
+    XGL_INSTANCE* pInstance;
+    XGL_RESULT result;
+} struct_xglCreateInstance;
+
+static struct_xglCreateInstance* interpret_body_as_xglCreateInstance(glv_trace_packet_header* pHeader)
+{
+    struct_xglCreateInstance* pPacket = (struct_xglCreateInstance*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->pAppInfo = (const XGL_APPLICATION_INFO*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pAppInfo);
+    if (pPacket->pAppInfo != NULL)
+    {
+        XGL_APPLICATION_INFO* pInfo = (XGL_APPLICATION_INFO*)pPacket->pAppInfo;
+        pInfo->pAppName = (const char*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pAppInfo->pAppName);
+        pInfo->pEngineName = (const char*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pAppInfo->pEngineName);
+    }
+    pPacket->pAllocCb = (const XGL_ALLOC_CALLBACKS*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pAllocCb);
+    pPacket->pInstance = (XGL_INSTANCE*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pInstance);
+    return pPacket;
+}
+
+typedef struct struct_xglDestroyInstance {
+    glv_trace_packet_header* header;
+    XGL_INSTANCE instance;
+    XGL_RESULT result;
+} struct_xglDestroyInstance;
+
+static struct_xglDestroyInstance* interpret_body_as_xglDestroyInstance(glv_trace_packet_header* pHeader)
+{
+    struct_xglDestroyInstance* pPacket = (struct_xglDestroyInstance*)pHeader->pBody;
+    pPacket->header = pHeader;
+    return pPacket;
+}
+
+typedef struct struct_xglEnumerateGpus {
+    glv_trace_packet_header* header;
+    XGL_INSTANCE instance;
+    uint32_t maxGpus;
+    uint32_t* pGpuCount;
+    XGL_PHYSICAL_GPU* pGpus;
+    XGL_RESULT result;
+} struct_xglEnumerateGpus;
+
+static struct_xglEnumerateGpus* interpret_body_as_xglEnumerateGpus(glv_trace_packet_header* pHeader)
+{
+    struct_xglEnumerateGpus* pPacket = (struct_xglEnumerateGpus*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->pGpuCount = (uint32_t*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pGpuCount);
+    pPacket->pGpus = (XGL_PHYSICAL_GPU*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pGpus);
+    return pPacket;
+}
+
+typedef struct struct_xglGetGpuInfo {
+    glv_trace_packet_header* header;
+    XGL_PHYSICAL_GPU gpu;
+    XGL_PHYSICAL_GPU_INFO_TYPE infoType;
+    size_t* pDataSize;
+    void* pData;
+    XGL_RESULT result;
+} struct_xglGetGpuInfo;
+
+static struct_xglGetGpuInfo* interpret_body_as_xglGetGpuInfo(glv_trace_packet_header* pHeader)
+{
+    struct_xglGetGpuInfo* pPacket = (struct_xglGetGpuInfo*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->pDataSize = (size_t*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pDataSize);
+    pPacket->pData = (void*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pData);
+    return pPacket;
+}
+
+typedef struct struct_xglGetProcAddr {
+    glv_trace_packet_header* header;
+    XGL_PHYSICAL_GPU gpu;
+    const char* pName;
+    void* result;
+} struct_xglGetProcAddr;
+
+static struct_xglGetProcAddr* interpret_body_as_xglGetProcAddr(glv_trace_packet_header* pHeader)
+{
+    struct_xglGetProcAddr* pPacket = (struct_xglGetProcAddr*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->pName = (const char*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pName);
+    return pPacket;
+}
+
+typedef struct struct_xglCreateDevice {
+    glv_trace_packet_header* header;
+    XGL_PHYSICAL_GPU gpu;
+    const XGL_DEVICE_CREATE_INFO* pCreateInfo;
+    XGL_DEVICE* pDevice;
+    XGL_RESULT result;
+} struct_xglCreateDevice;
+
+static struct_xglCreateDevice* interpret_body_as_xglCreateDevice(glv_trace_packet_header* pHeader)
+{
+    struct_xglCreateDevice* pPacket = (struct_xglCreateDevice*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->pCreateInfo = interpret_XGL_DEVICE_CREATE_INFO(pHeader, (intptr_t)pPacket->pCreateInfo);
+    pPacket->pDevice = (XGL_DEVICE*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pDevice);
+    return pPacket;
+}
+
+typedef struct struct_xglDestroyDevice {
+    glv_trace_packet_header* header;
+    XGL_DEVICE device;
+    XGL_RESULT result;
+} struct_xglDestroyDevice;
+
+static struct_xglDestroyDevice* interpret_body_as_xglDestroyDevice(glv_trace_packet_header* pHeader)
+{
+    struct_xglDestroyDevice* pPacket = (struct_xglDestroyDevice*)pHeader->pBody;
+    pPacket->header = pHeader;
+    return pPacket;
+}
+
+typedef struct struct_xglGetExtensionSupport {
+    glv_trace_packet_header* header;
+    XGL_PHYSICAL_GPU gpu;
+    const char* pExtName;
+    XGL_RESULT result;
+} struct_xglGetExtensionSupport;
+
+static struct_xglGetExtensionSupport* interpret_body_as_xglGetExtensionSupport(glv_trace_packet_header* pHeader)
+{
+    struct_xglGetExtensionSupport* pPacket = (struct_xglGetExtensionSupport*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->pExtName = (const char*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pExtName);
+    return pPacket;
+}
+
+typedef struct struct_xglEnumerateLayers {
+    glv_trace_packet_header* header;
+    XGL_PHYSICAL_GPU gpu;
+    size_t maxLayerCount;
+    size_t maxStringSize;
+    size_t* pOutLayerCount;
+    char* const* pOutLayers;
+    void* pReserved;
+    XGL_RESULT result;
+} struct_xglEnumerateLayers;
+
+static struct_xglEnumerateLayers* interpret_body_as_xglEnumerateLayers(glv_trace_packet_header* pHeader)
+{
+    struct_xglEnumerateLayers* pPacket = (struct_xglEnumerateLayers*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->pOutLayerCount = (size_t*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pOutLayerCount);
+    pPacket->pOutLayers = (char* const*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pOutLayers);
+    pPacket->pReserved = (void*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pReserved);
+    return pPacket;
+}
+
+typedef struct struct_xglGetDeviceQueue {
+    glv_trace_packet_header* header;
+    XGL_DEVICE device;
+    XGL_QUEUE_TYPE queueType;
+    uint32_t queueIndex;
+    XGL_QUEUE* pQueue;
+    XGL_RESULT result;
+} struct_xglGetDeviceQueue;
+
+static struct_xglGetDeviceQueue* interpret_body_as_xglGetDeviceQueue(glv_trace_packet_header* pHeader)
+{
+    struct_xglGetDeviceQueue* pPacket = (struct_xglGetDeviceQueue*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->pQueue = (XGL_QUEUE*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pQueue);
+    return pPacket;
+}
+
+typedef struct struct_xglQueueSubmit {
+    glv_trace_packet_header* header;
+    XGL_QUEUE queue;
+    uint32_t cmdBufferCount;
+    const XGL_CMD_BUFFER* pCmdBuffers;
+    uint32_t memRefCount;
+    const XGL_MEMORY_REF* pMemRefs;
+    XGL_FENCE fence;
+    XGL_RESULT result;
+} struct_xglQueueSubmit;
+
+static struct_xglQueueSubmit* interpret_body_as_xglQueueSubmit(glv_trace_packet_header* pHeader)
+{
+    struct_xglQueueSubmit* pPacket = (struct_xglQueueSubmit*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->pCmdBuffers = (const XGL_CMD_BUFFER*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pCmdBuffers);
+    pPacket->pMemRefs = (const XGL_MEMORY_REF*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pMemRefs);
+    return pPacket;
+}
+
+typedef struct struct_xglQueueSetGlobalMemReferences {
+    glv_trace_packet_header* header;
+    XGL_QUEUE queue;
+    uint32_t memRefCount;
+    const XGL_MEMORY_REF* pMemRefs;
+    XGL_RESULT result;
+} struct_xglQueueSetGlobalMemReferences;
+
+static struct_xglQueueSetGlobalMemReferences* interpret_body_as_xglQueueSetGlobalMemReferences(glv_trace_packet_header* pHeader)
+{
+    struct_xglQueueSetGlobalMemReferences* pPacket = (struct_xglQueueSetGlobalMemReferences*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->pMemRefs = (const XGL_MEMORY_REF*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pMemRefs);
+    return pPacket;
+}
+
+typedef struct struct_xglQueueWaitIdle {
+    glv_trace_packet_header* header;
+    XGL_QUEUE queue;
+    XGL_RESULT result;
+} struct_xglQueueWaitIdle;
+
+static struct_xglQueueWaitIdle* interpret_body_as_xglQueueWaitIdle(glv_trace_packet_header* pHeader)
+{
+    struct_xglQueueWaitIdle* pPacket = (struct_xglQueueWaitIdle*)pHeader->pBody;
+    pPacket->header = pHeader;
+    return pPacket;
+}
+
+typedef struct struct_xglDeviceWaitIdle {
+    glv_trace_packet_header* header;
+    XGL_DEVICE device;
+    XGL_RESULT result;
+} struct_xglDeviceWaitIdle;
+
+static struct_xglDeviceWaitIdle* interpret_body_as_xglDeviceWaitIdle(glv_trace_packet_header* pHeader)
+{
+    struct_xglDeviceWaitIdle* pPacket = (struct_xglDeviceWaitIdle*)pHeader->pBody;
+    pPacket->header = pHeader;
+    return pPacket;
+}
+
+typedef struct struct_xglAllocMemory {
+    glv_trace_packet_header* header;
+    XGL_DEVICE device;
+    const XGL_MEMORY_ALLOC_INFO* pAllocInfo;
+    XGL_GPU_MEMORY* pMem;
+    XGL_RESULT result;
+} struct_xglAllocMemory;
+
+static struct_xglAllocMemory* interpret_body_as_xglAllocMemory(glv_trace_packet_header* pHeader)
+{
+    struct_xglAllocMemory* pPacket = (struct_xglAllocMemory*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->pAllocInfo = (const XGL_MEMORY_ALLOC_INFO*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pAllocInfo);
+    if (pPacket->pAllocInfo != NULL)
+    {
+        if (pPacket->pAllocInfo->sType == XGL_STRUCTURE_TYPE_MEMORY_ALLOC_INFO) {
+            XGL_MEMORY_ALLOC_INFO** ppNext = (XGL_MEMORY_ALLOC_INFO**) &(pPacket->pAllocInfo->pNext);
+            *ppNext = (XGL_MEMORY_ALLOC_INFO*) glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pAllocInfo->pNext);
+            XGL_MEMORY_ALLOC_INFO* pNext = (XGL_MEMORY_ALLOC_INFO*) *ppNext;
+            while (NULL != pNext)
+            {
+                switch(pNext->sType)
+                {
+                    case XGL_STRUCTURE_TYPE_MEMORY_ALLOC_BUFFER_INFO:
+                    case XGL_STRUCTURE_TYPE_MEMORY_ALLOC_IMAGE_INFO:
+                    {
+                        ppNext = (XGL_MEMORY_ALLOC_INFO **) &(pNext->pNext);
+                        *ppNext = (XGL_MEMORY_ALLOC_INFO*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pNext->pNext);
+                        break;
+                    }
+                    default:
+                    {
+                       glv_LogError("Encountered an unexpected type alloc memory list.\n");
+                       pPacket->header = NULL;
+                       pNext->pNext = NULL;
+                    }
+                }
+                pNext = (XGL_MEMORY_ALLOC_INFO*)pNext->pNext;
+            }
+        } else {
+            // This is unexpected.
+            glv_LogError("AllocMemory must have AllocInfo stype of XGL_STRUCTURE_TYPE_MEMORY_ALLOC_INFO.\n");
+            pPacket->header = NULL;
+        }
+    }
+    pPacket->pMem = (XGL_GPU_MEMORY*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pMem);
+    return pPacket;
+}
+
+typedef struct struct_xglFreeMemory {
+    glv_trace_packet_header* header;
+    XGL_GPU_MEMORY mem;
+    XGL_RESULT result;
+} struct_xglFreeMemory;
+
+static struct_xglFreeMemory* interpret_body_as_xglFreeMemory(glv_trace_packet_header* pHeader)
+{
+    struct_xglFreeMemory* pPacket = (struct_xglFreeMemory*)pHeader->pBody;
+    pPacket->header = pHeader;
+    return pPacket;
+}
+
+typedef struct struct_xglSetMemoryPriority {
+    glv_trace_packet_header* header;
+    XGL_GPU_MEMORY mem;
+    XGL_MEMORY_PRIORITY priority;
+    XGL_RESULT result;
+} struct_xglSetMemoryPriority;
+
+static struct_xglSetMemoryPriority* interpret_body_as_xglSetMemoryPriority(glv_trace_packet_header* pHeader)
+{
+    struct_xglSetMemoryPriority* pPacket = (struct_xglSetMemoryPriority*)pHeader->pBody;
+    pPacket->header = pHeader;
+    return pPacket;
+}
+
+typedef struct struct_xglMapMemory {
+    glv_trace_packet_header* header;
+    XGL_GPU_MEMORY mem;
+    XGL_FLAGS flags;
+    void** ppData;
+    XGL_RESULT result;
+} struct_xglMapMemory;
+
+static struct_xglMapMemory* interpret_body_as_xglMapMemory(glv_trace_packet_header* pHeader)
+{
+    struct_xglMapMemory* pPacket = (struct_xglMapMemory*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->ppData = (void**)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->ppData);
+    return pPacket;
+}
+
+typedef struct struct_xglUnmapMemory {
+    glv_trace_packet_header* header;
+    XGL_GPU_MEMORY mem;
+    void* pData;
+    XGL_RESULT result;
+} struct_xglUnmapMemory;
+
+static struct_xglUnmapMemory* interpret_body_as_xglUnmapMemory(glv_trace_packet_header* pHeader)
+{
+    struct_xglUnmapMemory* pPacket = (struct_xglUnmapMemory*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->pData = (void*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pData);
+    return pPacket;
+}
+
+typedef struct struct_xglPinSystemMemory {
+    glv_trace_packet_header* header;
+    XGL_DEVICE device;
+    const void* pSysMem;
+    size_t memSize;
+    XGL_GPU_MEMORY* pMem;
+    XGL_RESULT result;
+} struct_xglPinSystemMemory;
+
+static struct_xglPinSystemMemory* interpret_body_as_xglPinSystemMemory(glv_trace_packet_header* pHeader)
+{
+    struct_xglPinSystemMemory* pPacket = (struct_xglPinSystemMemory*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->pSysMem = (const void*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pSysMem);
+    pPacket->pMem = (XGL_GPU_MEMORY*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pMem);
+    return pPacket;
+}
+
+typedef struct struct_xglGetMultiGpuCompatibility {
+    glv_trace_packet_header* header;
+    XGL_PHYSICAL_GPU gpu0;
+    XGL_PHYSICAL_GPU gpu1;
+    XGL_GPU_COMPATIBILITY_INFO* pInfo;
+    XGL_RESULT result;
+} struct_xglGetMultiGpuCompatibility;
+
+static struct_xglGetMultiGpuCompatibility* interpret_body_as_xglGetMultiGpuCompatibility(glv_trace_packet_header* pHeader)
+{
+    struct_xglGetMultiGpuCompatibility* pPacket = (struct_xglGetMultiGpuCompatibility*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->pInfo = (XGL_GPU_COMPATIBILITY_INFO*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pInfo);
+    return pPacket;
+}
+
+typedef struct struct_xglOpenSharedMemory {
+    glv_trace_packet_header* header;
+    XGL_DEVICE device;
+    const XGL_MEMORY_OPEN_INFO* pOpenInfo;
+    XGL_GPU_MEMORY* pMem;
+    XGL_RESULT result;
+} struct_xglOpenSharedMemory;
+
+static struct_xglOpenSharedMemory* interpret_body_as_xglOpenSharedMemory(glv_trace_packet_header* pHeader)
+{
+    struct_xglOpenSharedMemory* pPacket = (struct_xglOpenSharedMemory*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->pOpenInfo = (const XGL_MEMORY_OPEN_INFO*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pOpenInfo);
+    pPacket->pMem = (XGL_GPU_MEMORY*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pMem);
+    return pPacket;
+}
+
+typedef struct struct_xglOpenSharedQueueSemaphore {
+    glv_trace_packet_header* header;
+    XGL_DEVICE device;
+    const XGL_QUEUE_SEMAPHORE_OPEN_INFO* pOpenInfo;
+    XGL_QUEUE_SEMAPHORE* pSemaphore;
+    XGL_RESULT result;
+} struct_xglOpenSharedQueueSemaphore;
+
+static struct_xglOpenSharedQueueSemaphore* interpret_body_as_xglOpenSharedQueueSemaphore(glv_trace_packet_header* pHeader)
+{
+    struct_xglOpenSharedQueueSemaphore* pPacket = (struct_xglOpenSharedQueueSemaphore*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->pOpenInfo = (const XGL_QUEUE_SEMAPHORE_OPEN_INFO*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pOpenInfo);
+    pPacket->pSemaphore = (XGL_QUEUE_SEMAPHORE*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pSemaphore);
+    return pPacket;
+}
+
+typedef struct struct_xglOpenPeerMemory {
+    glv_trace_packet_header* header;
+    XGL_DEVICE device;
+    const XGL_PEER_MEMORY_OPEN_INFO* pOpenInfo;
+    XGL_GPU_MEMORY* pMem;
+    XGL_RESULT result;
+} struct_xglOpenPeerMemory;
+
+static struct_xglOpenPeerMemory* interpret_body_as_xglOpenPeerMemory(glv_trace_packet_header* pHeader)
+{
+    struct_xglOpenPeerMemory* pPacket = (struct_xglOpenPeerMemory*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->pOpenInfo = (const XGL_PEER_MEMORY_OPEN_INFO*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pOpenInfo);
+    pPacket->pMem = (XGL_GPU_MEMORY*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pMem);
+    return pPacket;
+}
+
+typedef struct struct_xglOpenPeerImage {
+    glv_trace_packet_header* header;
+    XGL_DEVICE device;
+    const XGL_PEER_IMAGE_OPEN_INFO* pOpenInfo;
+    XGL_IMAGE* pImage;
+    XGL_GPU_MEMORY* pMem;
+    XGL_RESULT result;
+} struct_xglOpenPeerImage;
+
+static struct_xglOpenPeerImage* interpret_body_as_xglOpenPeerImage(glv_trace_packet_header* pHeader)
+{
+    struct_xglOpenPeerImage* pPacket = (struct_xglOpenPeerImage*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->pOpenInfo = (const XGL_PEER_IMAGE_OPEN_INFO*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pOpenInfo);
+    pPacket->pImage = (XGL_IMAGE*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pImage);
+    pPacket->pMem = (XGL_GPU_MEMORY*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pMem);
+    return pPacket;
+}
+
+typedef struct struct_xglDestroyObject {
+    glv_trace_packet_header* header;
+    XGL_OBJECT object;
+    XGL_RESULT result;
+} struct_xglDestroyObject;
+
+static struct_xglDestroyObject* interpret_body_as_xglDestroyObject(glv_trace_packet_header* pHeader)
+{
+    struct_xglDestroyObject* pPacket = (struct_xglDestroyObject*)pHeader->pBody;
+    pPacket->header = pHeader;
+    return pPacket;
+}
+
+typedef struct struct_xglGetObjectInfo {
+    glv_trace_packet_header* header;
+    XGL_BASE_OBJECT object;
+    XGL_OBJECT_INFO_TYPE infoType;
+    size_t* pDataSize;
+    void* pData;
+    XGL_RESULT result;
+} struct_xglGetObjectInfo;
+
+static struct_xglGetObjectInfo* interpret_body_as_xglGetObjectInfo(glv_trace_packet_header* pHeader)
+{
+    struct_xglGetObjectInfo* pPacket = (struct_xglGetObjectInfo*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->pDataSize = (size_t*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pDataSize);
+    pPacket->pData = (void*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pData);
+    return pPacket;
+}
+
+typedef struct struct_xglBindObjectMemory {
+    glv_trace_packet_header* header;
+    XGL_OBJECT object;
+    uint32_t allocationIdx;
+    XGL_GPU_MEMORY mem;
+    XGL_GPU_SIZE offset;
+    XGL_RESULT result;
+} struct_xglBindObjectMemory;
+
+static struct_xglBindObjectMemory* interpret_body_as_xglBindObjectMemory(glv_trace_packet_header* pHeader)
+{
+    struct_xglBindObjectMemory* pPacket = (struct_xglBindObjectMemory*)pHeader->pBody;
+    pPacket->header = pHeader;
+    return pPacket;
+}
+
+typedef struct struct_xglBindObjectMemoryRange {
+    glv_trace_packet_header* header;
+    XGL_OBJECT object;
+    uint32_t allocationIdx;
+    XGL_GPU_SIZE rangeOffset;
+    XGL_GPU_SIZE rangeSize;
+    XGL_GPU_MEMORY mem;
+    XGL_GPU_SIZE memOffset;
+    XGL_RESULT result;
+} struct_xglBindObjectMemoryRange;
+
+static struct_xglBindObjectMemoryRange* interpret_body_as_xglBindObjectMemoryRange(glv_trace_packet_header* pHeader)
+{
+    struct_xglBindObjectMemoryRange* pPacket = (struct_xglBindObjectMemoryRange*)pHeader->pBody;
+    pPacket->header = pHeader;
+    return pPacket;
+}
+
+typedef struct struct_xglBindImageMemoryRange {
+    glv_trace_packet_header* header;
+    XGL_IMAGE image;
+    uint32_t allocationIdx;
+    const XGL_IMAGE_MEMORY_BIND_INFO* bindInfo;
+    XGL_GPU_MEMORY mem;
+    XGL_GPU_SIZE memOffset;
+    XGL_RESULT result;
+} struct_xglBindImageMemoryRange;
+
+static struct_xglBindImageMemoryRange* interpret_body_as_xglBindImageMemoryRange(glv_trace_packet_header* pHeader)
+{
+    struct_xglBindImageMemoryRange* pPacket = (struct_xglBindImageMemoryRange*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->bindInfo = (const XGL_IMAGE_MEMORY_BIND_INFO*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->bindInfo);
+    return pPacket;
+}
+
+typedef struct struct_xglCreateFence {
+    glv_trace_packet_header* header;
+    XGL_DEVICE device;
+    const XGL_FENCE_CREATE_INFO* pCreateInfo;
+    XGL_FENCE* pFence;
+    XGL_RESULT result;
+} struct_xglCreateFence;
+
+static struct_xglCreateFence* interpret_body_as_xglCreateFence(glv_trace_packet_header* pHeader)
+{
+    struct_xglCreateFence* pPacket = (struct_xglCreateFence*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->pCreateInfo = (const XGL_FENCE_CREATE_INFO*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pCreateInfo);
+    pPacket->pFence = (XGL_FENCE*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pFence);
+    return pPacket;
+}
+
+typedef struct struct_xglGetFenceStatus {
+    glv_trace_packet_header* header;
+    XGL_FENCE fence;
+    XGL_RESULT result;
+} struct_xglGetFenceStatus;
+
+static struct_xglGetFenceStatus* interpret_body_as_xglGetFenceStatus(glv_trace_packet_header* pHeader)
+{
+    struct_xglGetFenceStatus* pPacket = (struct_xglGetFenceStatus*)pHeader->pBody;
+    pPacket->header = pHeader;
+    return pPacket;
+}
+
+typedef struct struct_xglWaitForFences {
+    glv_trace_packet_header* header;
+    XGL_DEVICE device;
+    uint32_t fenceCount;
+    const XGL_FENCE* pFences;
+    bool32_t waitAll;
+    uint64_t timeout;
+    XGL_RESULT result;
+} struct_xglWaitForFences;
+
+static struct_xglWaitForFences* interpret_body_as_xglWaitForFences(glv_trace_packet_header* pHeader)
+{
+    struct_xglWaitForFences* pPacket = (struct_xglWaitForFences*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->pFences = (const XGL_FENCE*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pFences);
+    return pPacket;
+}
+
+typedef struct struct_xglCreateQueueSemaphore {
+    glv_trace_packet_header* header;
+    XGL_DEVICE device;
+    const XGL_QUEUE_SEMAPHORE_CREATE_INFO* pCreateInfo;
+    XGL_QUEUE_SEMAPHORE* pSemaphore;
+    XGL_RESULT result;
+} struct_xglCreateQueueSemaphore;
+
+static struct_xglCreateQueueSemaphore* interpret_body_as_xglCreateQueueSemaphore(glv_trace_packet_header* pHeader)
+{
+    struct_xglCreateQueueSemaphore* pPacket = (struct_xglCreateQueueSemaphore*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->pCreateInfo = (const XGL_QUEUE_SEMAPHORE_CREATE_INFO*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pCreateInfo);
+    pPacket->pSemaphore = (XGL_QUEUE_SEMAPHORE*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pSemaphore);
+    return pPacket;
+}
+
+typedef struct struct_xglSignalQueueSemaphore {
+    glv_trace_packet_header* header;
+    XGL_QUEUE queue;
+    XGL_QUEUE_SEMAPHORE semaphore;
+    XGL_RESULT result;
+} struct_xglSignalQueueSemaphore;
+
+static struct_xglSignalQueueSemaphore* interpret_body_as_xglSignalQueueSemaphore(glv_trace_packet_header* pHeader)
+{
+    struct_xglSignalQueueSemaphore* pPacket = (struct_xglSignalQueueSemaphore*)pHeader->pBody;
+    pPacket->header = pHeader;
+    return pPacket;
+}
+
+typedef struct struct_xglWaitQueueSemaphore {
+    glv_trace_packet_header* header;
+    XGL_QUEUE queue;
+    XGL_QUEUE_SEMAPHORE semaphore;
+    XGL_RESULT result;
+} struct_xglWaitQueueSemaphore;
+
+static struct_xglWaitQueueSemaphore* interpret_body_as_xglWaitQueueSemaphore(glv_trace_packet_header* pHeader)
+{
+    struct_xglWaitQueueSemaphore* pPacket = (struct_xglWaitQueueSemaphore*)pHeader->pBody;
+    pPacket->header = pHeader;
+    return pPacket;
+}
+
+typedef struct struct_xglCreateEvent {
+    glv_trace_packet_header* header;
+    XGL_DEVICE device;
+    const XGL_EVENT_CREATE_INFO* pCreateInfo;
+    XGL_EVENT* pEvent;
+    XGL_RESULT result;
+} struct_xglCreateEvent;
+
+static struct_xglCreateEvent* interpret_body_as_xglCreateEvent(glv_trace_packet_header* pHeader)
+{
+    struct_xglCreateEvent* pPacket = (struct_xglCreateEvent*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->pCreateInfo = (const XGL_EVENT_CREATE_INFO*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pCreateInfo);
+    pPacket->pEvent = (XGL_EVENT*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pEvent);
+    return pPacket;
+}
+
+typedef struct struct_xglGetEventStatus {
+    glv_trace_packet_header* header;
+    XGL_EVENT event;
+    XGL_RESULT result;
+} struct_xglGetEventStatus;
+
+static struct_xglGetEventStatus* interpret_body_as_xglGetEventStatus(glv_trace_packet_header* pHeader)
+{
+    struct_xglGetEventStatus* pPacket = (struct_xglGetEventStatus*)pHeader->pBody;
+    pPacket->header = pHeader;
+    return pPacket;
+}
+
+typedef struct struct_xglSetEvent {
+    glv_trace_packet_header* header;
+    XGL_EVENT event;
+    XGL_RESULT result;
+} struct_xglSetEvent;
+
+static struct_xglSetEvent* interpret_body_as_xglSetEvent(glv_trace_packet_header* pHeader)
+{
+    struct_xglSetEvent* pPacket = (struct_xglSetEvent*)pHeader->pBody;
+    pPacket->header = pHeader;
+    return pPacket;
+}
+
+typedef struct struct_xglResetEvent {
+    glv_trace_packet_header* header;
+    XGL_EVENT event;
+    XGL_RESULT result;
+} struct_xglResetEvent;
+
+static struct_xglResetEvent* interpret_body_as_xglResetEvent(glv_trace_packet_header* pHeader)
+{
+    struct_xglResetEvent* pPacket = (struct_xglResetEvent*)pHeader->pBody;
+    pPacket->header = pHeader;
+    return pPacket;
+}
+
+typedef struct struct_xglCreateQueryPool {
+    glv_trace_packet_header* header;
+    XGL_DEVICE device;
+    const XGL_QUERY_POOL_CREATE_INFO* pCreateInfo;
+    XGL_QUERY_POOL* pQueryPool;
+    XGL_RESULT result;
+} struct_xglCreateQueryPool;
+
+static struct_xglCreateQueryPool* interpret_body_as_xglCreateQueryPool(glv_trace_packet_header* pHeader)
+{
+    struct_xglCreateQueryPool* pPacket = (struct_xglCreateQueryPool*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->pCreateInfo = (const XGL_QUERY_POOL_CREATE_INFO*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pCreateInfo);
+    pPacket->pQueryPool = (XGL_QUERY_POOL*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pQueryPool);
+    return pPacket;
+}
+
+typedef struct struct_xglGetQueryPoolResults {
+    glv_trace_packet_header* header;
+    XGL_QUERY_POOL queryPool;
+    uint32_t startQuery;
+    uint32_t queryCount;
+    size_t* pDataSize;
+    void* pData;
+    XGL_RESULT result;
+} struct_xglGetQueryPoolResults;
+
+static struct_xglGetQueryPoolResults* interpret_body_as_xglGetQueryPoolResults(glv_trace_packet_header* pHeader)
+{
+    struct_xglGetQueryPoolResults* pPacket = (struct_xglGetQueryPoolResults*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->pDataSize = (size_t*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pDataSize);
+    pPacket->pData = (void*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pData);
+    return pPacket;
+}
+
+typedef struct struct_xglGetFormatInfo {
+    glv_trace_packet_header* header;
+    XGL_DEVICE device;
+    XGL_FORMAT format;
+    XGL_FORMAT_INFO_TYPE infoType;
+    size_t* pDataSize;
+    void* pData;
+    XGL_RESULT result;
+} struct_xglGetFormatInfo;
+
+static struct_xglGetFormatInfo* interpret_body_as_xglGetFormatInfo(glv_trace_packet_header* pHeader)
+{
+    struct_xglGetFormatInfo* pPacket = (struct_xglGetFormatInfo*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->pDataSize = (size_t*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pDataSize);
+    pPacket->pData = (void*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pData);
+    return pPacket;
+}
+
+typedef struct struct_xglCreateBuffer {
+    glv_trace_packet_header* header;
+    XGL_DEVICE device;
+    const XGL_BUFFER_CREATE_INFO* pCreateInfo;
+    XGL_BUFFER* pBuffer;
+    XGL_RESULT result;
+} struct_xglCreateBuffer;
+
+static struct_xglCreateBuffer* interpret_body_as_xglCreateBuffer(glv_trace_packet_header* pHeader)
+{
+    struct_xglCreateBuffer* pPacket = (struct_xglCreateBuffer*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->pCreateInfo = (const XGL_BUFFER_CREATE_INFO*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pCreateInfo);
+    pPacket->pBuffer = (XGL_BUFFER*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pBuffer);
+    return pPacket;
+}
+
+typedef struct struct_xglCreateBufferView {
+    glv_trace_packet_header* header;
+    XGL_DEVICE device;
+    const XGL_BUFFER_VIEW_CREATE_INFO* pCreateInfo;
+    XGL_BUFFER_VIEW* pView;
+    XGL_RESULT result;
+} struct_xglCreateBufferView;
+
+static struct_xglCreateBufferView* interpret_body_as_xglCreateBufferView(glv_trace_packet_header* pHeader)
+{
+    struct_xglCreateBufferView* pPacket = (struct_xglCreateBufferView*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->pCreateInfo = (const XGL_BUFFER_VIEW_CREATE_INFO*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pCreateInfo);
+    pPacket->pView = (XGL_BUFFER_VIEW*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pView);
+    return pPacket;
+}
+
+typedef struct struct_xglCreateImage {
+    glv_trace_packet_header* header;
+    XGL_DEVICE device;
+    const XGL_IMAGE_CREATE_INFO* pCreateInfo;
+    XGL_IMAGE* pImage;
+    XGL_RESULT result;
+} struct_xglCreateImage;
+
+static struct_xglCreateImage* interpret_body_as_xglCreateImage(glv_trace_packet_header* pHeader)
+{
+    struct_xglCreateImage* pPacket = (struct_xglCreateImage*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->pCreateInfo = (const XGL_IMAGE_CREATE_INFO*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pCreateInfo);
+    pPacket->pImage = (XGL_IMAGE*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pImage);
+    return pPacket;
+}
+
+typedef struct struct_xglSetFastClearColor {
+    glv_trace_packet_header* header;
+    XGL_IMAGE image;
+    const float color[4];
+    XGL_RESULT result;
+} struct_xglSetFastClearColor;
+
+static struct_xglSetFastClearColor* interpret_body_as_xglSetFastClearColor(glv_trace_packet_header* pHeader)
+{
+    struct_xglSetFastClearColor* pPacket = (struct_xglSetFastClearColor*)pHeader->pBody;
+    pPacket->header = pHeader;
+    return pPacket;
+}
+
+typedef struct struct_xglSetFastClearDepth {
+    glv_trace_packet_header* header;
+    XGL_IMAGE image;
+    float depth;
+    XGL_RESULT result;
+} struct_xglSetFastClearDepth;
+
+static struct_xglSetFastClearDepth* interpret_body_as_xglSetFastClearDepth(glv_trace_packet_header* pHeader)
+{
+    struct_xglSetFastClearDepth* pPacket = (struct_xglSetFastClearDepth*)pHeader->pBody;
+    pPacket->header = pHeader;
+    return pPacket;
+}
+
+typedef struct struct_xglGetImageSubresourceInfo {
+    glv_trace_packet_header* header;
+    XGL_IMAGE image;
+    const XGL_IMAGE_SUBRESOURCE* pSubresource;
+    XGL_SUBRESOURCE_INFO_TYPE infoType;
+    size_t* pDataSize;
+    void* pData;
+    XGL_RESULT result;
+} struct_xglGetImageSubresourceInfo;
+
+static struct_xglGetImageSubresourceInfo* interpret_body_as_xglGetImageSubresourceInfo(glv_trace_packet_header* pHeader)
+{
+    struct_xglGetImageSubresourceInfo* pPacket = (struct_xglGetImageSubresourceInfo*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->pSubresource = (const XGL_IMAGE_SUBRESOURCE*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pSubresource);
+    pPacket->pDataSize = (size_t*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pDataSize);
+    pPacket->pData = (void*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pData);
+    return pPacket;
+}
+
+typedef struct struct_xglCreateImageView {
+    glv_trace_packet_header* header;
+    XGL_DEVICE device;
+    const XGL_IMAGE_VIEW_CREATE_INFO* pCreateInfo;
+    XGL_IMAGE_VIEW* pView;
+    XGL_RESULT result;
+} struct_xglCreateImageView;
+
+static struct_xglCreateImageView* interpret_body_as_xglCreateImageView(glv_trace_packet_header* pHeader)
+{
+    struct_xglCreateImageView* pPacket = (struct_xglCreateImageView*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->pCreateInfo = (const XGL_IMAGE_VIEW_CREATE_INFO*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pCreateInfo);
+    pPacket->pView = (XGL_IMAGE_VIEW*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pView);
+    return pPacket;
+}
+
+typedef struct struct_xglCreateColorAttachmentView {
+    glv_trace_packet_header* header;
+    XGL_DEVICE device;
+    const XGL_COLOR_ATTACHMENT_VIEW_CREATE_INFO* pCreateInfo;
+    XGL_COLOR_ATTACHMENT_VIEW* pView;
+    XGL_RESULT result;
+} struct_xglCreateColorAttachmentView;
+
+static struct_xglCreateColorAttachmentView* interpret_body_as_xglCreateColorAttachmentView(glv_trace_packet_header* pHeader)
+{
+    struct_xglCreateColorAttachmentView* pPacket = (struct_xglCreateColorAttachmentView*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->pCreateInfo = (const XGL_COLOR_ATTACHMENT_VIEW_CREATE_INFO*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pCreateInfo);
+    pPacket->pView = (XGL_COLOR_ATTACHMENT_VIEW*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pView);
+    return pPacket;
+}
+
+typedef struct struct_xglCreateDepthStencilView {
+    glv_trace_packet_header* header;
+    XGL_DEVICE device;
+    const XGL_DEPTH_STENCIL_VIEW_CREATE_INFO* pCreateInfo;
+    XGL_DEPTH_STENCIL_VIEW* pView;
+    XGL_RESULT result;
+} struct_xglCreateDepthStencilView;
+
+static struct_xglCreateDepthStencilView* interpret_body_as_xglCreateDepthStencilView(glv_trace_packet_header* pHeader)
+{
+    struct_xglCreateDepthStencilView* pPacket = (struct_xglCreateDepthStencilView*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->pCreateInfo = (const XGL_DEPTH_STENCIL_VIEW_CREATE_INFO*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pCreateInfo);
+    pPacket->pView = (XGL_DEPTH_STENCIL_VIEW*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pView);
+    return pPacket;
+}
+
+typedef struct struct_xglCreateShader {
+    glv_trace_packet_header* header;
+    XGL_DEVICE device;
+    const XGL_SHADER_CREATE_INFO* pCreateInfo;
+    XGL_SHADER* pShader;
+    XGL_RESULT result;
+} struct_xglCreateShader;
+
+static struct_xglCreateShader* interpret_body_as_xglCreateShader(glv_trace_packet_header* pHeader)
+{
+    struct_xglCreateShader* pPacket = (struct_xglCreateShader*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->pCreateInfo = (const XGL_SHADER_CREATE_INFO*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pCreateInfo);
+    if (pPacket->pCreateInfo != NULL)
+    {
+        XGL_SHADER_CREATE_INFO* pInfo = (XGL_SHADER_CREATE_INFO*)pPacket->pCreateInfo;
+        pInfo->pCode = glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pCreateInfo->pCode);
+    }
+    pPacket->pShader = (XGL_SHADER*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pShader);
+    return pPacket;
+}
+
+typedef struct struct_xglCreateGraphicsPipeline {
+    glv_trace_packet_header* header;
+    XGL_DEVICE device;
+    const XGL_GRAPHICS_PIPELINE_CREATE_INFO* pCreateInfo;
+    XGL_PIPELINE* pPipeline;
+    XGL_RESULT result;
+} struct_xglCreateGraphicsPipeline;
+
+static struct_xglCreateGraphicsPipeline* interpret_body_as_xglCreateGraphicsPipeline(glv_trace_packet_header* pHeader)
+{
+    struct_xglCreateGraphicsPipeline* pPacket = (struct_xglCreateGraphicsPipeline*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->pCreateInfo = (const XGL_GRAPHICS_PIPELINE_CREATE_INFO*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pCreateInfo);
+    if (pPacket->pCreateInfo != NULL)
+    {
+        if (pPacket->pCreateInfo->sType == XGL_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO) {
+            // need to make a non-const pointer to the pointer so that we can properly change the original pointer to the interpretted one
+            void** ppNextVoidPtr = (void**)&pPacket->pCreateInfo->pNext;
+            *ppNextVoidPtr = (void*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pCreateInfo->pNext);
+            XGL_PIPELINE_SHADER_STAGE_CREATE_INFO* pNext = (XGL_PIPELINE_SHADER_STAGE_CREATE_INFO*)pPacket->pCreateInfo->pNext;
+            while ((NULL != pNext) && (XGL_NULL_HANDLE != pNext))
+        {
+                switch(pNext->sType)
+            {
+                    case XGL_STRUCTURE_TYPE_PIPELINE_IA_STATE_CREATE_INFO:
+                    case XGL_STRUCTURE_TYPE_PIPELINE_TESS_STATE_CREATE_INFO:
+                    case XGL_STRUCTURE_TYPE_PIPELINE_RS_STATE_CREATE_INFO:
+                    case XGL_STRUCTURE_TYPE_PIPELINE_VP_STATE_CREATE_INFO:
+                    case XGL_STRUCTURE_TYPE_PIPELINE_MS_STATE_CREATE_INFO:
+                    case XGL_STRUCTURE_TYPE_PIPELINE_DS_STATE_CREATE_INFO:
+                    {
+                        void** ppNextVoidPtr = (void**)&pNext->pNext;
+                        *ppNextVoidPtr = (void*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pNext->pNext);
+                        break;
+                    }
+                    case XGL_STRUCTURE_TYPE_PIPELINE_CB_STATE_CREATE_INFO:
+                    {
+                        void** ppNextVoidPtr = (void**)&pNext->pNext;
+                        XGL_PIPELINE_CB_STATE_CREATE_INFO *pCb = (XGL_PIPELINE_CB_STATE_CREATE_INFO *) pNext;
+                        *ppNextVoidPtr = (void*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pNext->pNext);
+                        pCb->pAttachments = (XGL_PIPELINE_CB_ATTACHMENT_STATE*) glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pCb->pAttachments);
+                        break;
+                    }
+                    case XGL_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO:
+                    {
+                        void** ppNextVoidPtr = (void**)&pNext->pNext;
+                        *ppNextVoidPtr = (void*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pNext->pNext);
+                        interpret_pipeline_shader(pHeader, &pNext->shader);
+                        break;
+                    }
+                    case XGL_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_CREATE_INFO:
+                    {
+                        void** ppNextVoidPtr = (void**)&pNext->pNext;
+                        XGL_PIPELINE_VERTEX_INPUT_CREATE_INFO *pVi = (XGL_PIPELINE_VERTEX_INPUT_CREATE_INFO *) pNext;
+                        *ppNextVoidPtr = (void*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pNext->pNext);
+                        pVi->pVertexBindingDescriptions = (XGL_VERTEX_INPUT_BINDING_DESCRIPTION*) glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pVi->pVertexBindingDescriptions);
+                        pVi->pVertexAttributeDescriptions = (XGL_VERTEX_INPUT_ATTRIBUTE_DESCRIPTION*) glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pVi->pVertexAttributeDescriptions);
+                        break;
+                    }
+                    default:
+                    {
+                       glv_LogError("Encountered an unexpected type in pipeline state list.\n");
+                       pPacket->header = NULL;
+                       pNext->pNext = NULL;
+                    }
+                }
+                pNext = (XGL_PIPELINE_SHADER_STAGE_CREATE_INFO*)pNext->pNext;
+            }
+        } else {
+            // This is unexpected.
+            glv_LogError("CreateGraphicsPipeline must have CreateInfo stype of XGL_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO.\n");
+            pPacket->header = NULL;
+        }
+    }
+    pPacket->pPipeline = (XGL_PIPELINE*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pPipeline);
+    return pPacket;
+}
+
+typedef struct struct_xglCreateComputePipeline {
+    glv_trace_packet_header* header;
+    XGL_DEVICE device;
+    const XGL_COMPUTE_PIPELINE_CREATE_INFO* pCreateInfo;
+    XGL_PIPELINE* pPipeline;
+    XGL_RESULT result;
+} struct_xglCreateComputePipeline;
+
+static struct_xglCreateComputePipeline* interpret_body_as_xglCreateComputePipeline(glv_trace_packet_header* pHeader)
+{
+    struct_xglCreateComputePipeline* pPacket = (struct_xglCreateComputePipeline*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->pCreateInfo = (const XGL_COMPUTE_PIPELINE_CREATE_INFO*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pCreateInfo);
+    if (pPacket->pCreateInfo != NULL)
+    {
+        interpret_pipeline_shader(pHeader, (XGL_PIPELINE_SHADER*)(&pPacket->pCreateInfo->cs));
+    }
+    pPacket->pPipeline = (XGL_PIPELINE*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pPipeline);
+    return pPacket;
+}
+
+typedef struct struct_xglStorePipeline {
+    glv_trace_packet_header* header;
+    XGL_PIPELINE pipeline;
+    size_t* pDataSize;
+    void* pData;
+    XGL_RESULT result;
+} struct_xglStorePipeline;
+
+static struct_xglStorePipeline* interpret_body_as_xglStorePipeline(glv_trace_packet_header* pHeader)
+{
+    struct_xglStorePipeline* pPacket = (struct_xglStorePipeline*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->pDataSize = (size_t*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pDataSize);
+    pPacket->pData = (void*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pData);
+    return pPacket;
+}
+
+typedef struct struct_xglLoadPipeline {
+    glv_trace_packet_header* header;
+    XGL_DEVICE device;
+    size_t dataSize;
+    const void* pData;
+    XGL_PIPELINE* pPipeline;
+    XGL_RESULT result;
+} struct_xglLoadPipeline;
+
+static struct_xglLoadPipeline* interpret_body_as_xglLoadPipeline(glv_trace_packet_header* pHeader)
+{
+    struct_xglLoadPipeline* pPacket = (struct_xglLoadPipeline*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->pData = (const void*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pData);
+    pPacket->pPipeline = (XGL_PIPELINE*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pPipeline);
+    return pPacket;
+}
+
+typedef struct struct_xglCreatePipelineDelta {
+    glv_trace_packet_header* header;
+    XGL_DEVICE device;
+    XGL_PIPELINE p1;
+    XGL_PIPELINE p2;
+    XGL_PIPELINE_DELTA* delta;
+    XGL_RESULT result;
+} struct_xglCreatePipelineDelta;
+
+static struct_xglCreatePipelineDelta* interpret_body_as_xglCreatePipelineDelta(glv_trace_packet_header* pHeader)
+{
+    struct_xglCreatePipelineDelta* pPacket = (struct_xglCreatePipelineDelta*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->delta = (XGL_PIPELINE_DELTA*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->delta);
+    return pPacket;
+}
+
+typedef struct struct_xglCreateSampler {
+    glv_trace_packet_header* header;
+    XGL_DEVICE device;
+    const XGL_SAMPLER_CREATE_INFO* pCreateInfo;
+    XGL_SAMPLER* pSampler;
+    XGL_RESULT result;
+} struct_xglCreateSampler;
+
+static struct_xglCreateSampler* interpret_body_as_xglCreateSampler(glv_trace_packet_header* pHeader)
+{
+    struct_xglCreateSampler* pPacket = (struct_xglCreateSampler*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->pCreateInfo = (const XGL_SAMPLER_CREATE_INFO*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pCreateInfo);
+    pPacket->pSampler = (XGL_SAMPLER*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pSampler);
+    return pPacket;
+}
+
+typedef struct struct_xglCreateDescriptorSetLayout {
+    glv_trace_packet_header* header;
+    XGL_DEVICE device;
+    XGL_FLAGS stageFlags;
+    const uint32_t* pSetBindPoints;
+    XGL_DESCRIPTOR_SET_LAYOUT priorSetLayout;
+    const XGL_DESCRIPTOR_SET_LAYOUT_CREATE_INFO* pSetLayoutInfoList;
+    XGL_DESCRIPTOR_SET_LAYOUT* pSetLayout;
+    XGL_RESULT result;
+} struct_xglCreateDescriptorSetLayout;
+
+static struct_xglCreateDescriptorSetLayout* interpret_body_as_xglCreateDescriptorSetLayout(glv_trace_packet_header* pHeader)
+{
+    struct_xglCreateDescriptorSetLayout* pPacket = (struct_xglCreateDescriptorSetLayout*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->pSetBindPoints = (const uint32_t*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pSetBindPoints);
+    pPacket->pSetLayoutInfoList = (const XGL_DESCRIPTOR_SET_LAYOUT_CREATE_INFO*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pSetLayoutInfoList);
+    if (pPacket->pSetLayoutInfoList != NULL)
+    {
+        if (pPacket->pSetLayoutInfoList->sType == XGL_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO) {
+            // need to make a non-const pointer to the pointer so that we can properly change the original pointer to the interpretted one
+            void** ppNextVoidPtr = (void**)&(pPacket->pSetLayoutInfoList->pNext);
+            *ppNextVoidPtr = (void*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pSetLayoutInfoList->pNext);
+            XGL_DESCRIPTOR_SET_LAYOUT_CREATE_INFO* pNext = (XGL_DESCRIPTOR_SET_LAYOUT_CREATE_INFO*)pPacket->pSetLayoutInfoList->pNext;
+            while (NULL != pNext)
+            {
+                switch(pNext->sType)
+                {
+                    case XGL_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO:
+                    {
+                        void** ppNextVoidPtr = (void**)&pNext->pNext;
+                        *ppNextVoidPtr = (void*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pNext->pNext);
+                        break;
+                    }
+                    default:
+                    {
+                        glv_LogError("Encountered an unexpected type in descriptor set layout create list.\n");
+                        pPacket->header = NULL;
+                        pNext->pNext = NULL;
+                    }
+                }
+                pNext = (XGL_DESCRIPTOR_SET_LAYOUT_CREATE_INFO*)pNext->pNext;
+             }
+        } else {
+             // This is unexpected.
+             glv_LogError("CreateDescriptorSetLayout must have LayoutInfoList stype of XGL_STRCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO\n");
+             pPacket->header = NULL;
+        }
+    }
+    pPacket->pSetLayout = (XGL_DESCRIPTOR_SET_LAYOUT*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pSetLayout);
+    return pPacket;
+}
+
+typedef struct struct_xglBeginDescriptorRegionUpdate {
+    glv_trace_packet_header* header;
+    XGL_DEVICE device;
+    XGL_DESCRIPTOR_UPDATE_MODE updateMode;
+    XGL_RESULT result;
+} struct_xglBeginDescriptorRegionUpdate;
+
+static struct_xglBeginDescriptorRegionUpdate* interpret_body_as_xglBeginDescriptorRegionUpdate(glv_trace_packet_header* pHeader)
+{
+    struct_xglBeginDescriptorRegionUpdate* pPacket = (struct_xglBeginDescriptorRegionUpdate*)pHeader->pBody;
+    pPacket->header = pHeader;
+    return pPacket;
+}
+
+typedef struct struct_xglEndDescriptorRegionUpdate {
+    glv_trace_packet_header* header;
+    XGL_DEVICE device;
+    XGL_CMD_BUFFER cmd;
+    XGL_RESULT result;
+} struct_xglEndDescriptorRegionUpdate;
+
+static struct_xglEndDescriptorRegionUpdate* interpret_body_as_xglEndDescriptorRegionUpdate(glv_trace_packet_header* pHeader)
+{
+    struct_xglEndDescriptorRegionUpdate* pPacket = (struct_xglEndDescriptorRegionUpdate*)pHeader->pBody;
+    pPacket->header = pHeader;
+    return pPacket;
+}
+
+typedef struct struct_xglCreateDescriptorRegion {
+    glv_trace_packet_header* header;
+    XGL_DEVICE device;
+    XGL_DESCRIPTOR_REGION_USAGE regionUsage;
+    uint32_t maxSets;
+    const XGL_DESCRIPTOR_REGION_CREATE_INFO* pCreateInfo;
+    XGL_DESCRIPTOR_REGION* pDescriptorRegion;
+    XGL_RESULT result;
+} struct_xglCreateDescriptorRegion;
+
+static struct_xglCreateDescriptorRegion* interpret_body_as_xglCreateDescriptorRegion(glv_trace_packet_header* pHeader)
+{
+    struct_xglCreateDescriptorRegion* pPacket = (struct_xglCreateDescriptorRegion*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->pCreateInfo = (const XGL_DESCRIPTOR_REGION_CREATE_INFO*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pCreateInfo);
+    if (pPacket->pCreateInfo != NULL)
+    {
+        XGL_DESCRIPTOR_REGION_CREATE_INFO* pInfo = (XGL_DESCRIPTOR_REGION_CREATE_INFO*)pPacket->pCreateInfo;
+        pInfo->pTypeCount = (XGL_DESCRIPTOR_TYPE_COUNT*) glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pCreateInfo->pTypeCount);
+
+    }
+    pPacket->pDescriptorRegion = (XGL_DESCRIPTOR_REGION*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pDescriptorRegion);
+    return pPacket;
+}
+
+typedef struct struct_xglClearDescriptorRegion {
+    glv_trace_packet_header* header;
+    XGL_DESCRIPTOR_REGION descriptorRegion;
+    XGL_RESULT result;
+} struct_xglClearDescriptorRegion;
+
+static struct_xglClearDescriptorRegion* interpret_body_as_xglClearDescriptorRegion(glv_trace_packet_header* pHeader)
+{
+    struct_xglClearDescriptorRegion* pPacket = (struct_xglClearDescriptorRegion*)pHeader->pBody;
+    pPacket->header = pHeader;
+    return pPacket;
+}
+
+typedef struct struct_xglAllocDescriptorSets {
+    glv_trace_packet_header* header;
+    XGL_DESCRIPTOR_REGION descriptorRegion;
+    XGL_DESCRIPTOR_SET_USAGE setUsage;
+    uint32_t count;
+    const XGL_DESCRIPTOR_SET_LAYOUT* pSetLayouts;
+    XGL_DESCRIPTOR_SET* pDescriptorSets;
+    uint32_t* pCount;
+    XGL_RESULT result;
+} struct_xglAllocDescriptorSets;
+
+static struct_xglAllocDescriptorSets* interpret_body_as_xglAllocDescriptorSets(glv_trace_packet_header* pHeader)
+{
+    struct_xglAllocDescriptorSets* pPacket = (struct_xglAllocDescriptorSets*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->pSetLayouts = (const XGL_DESCRIPTOR_SET_LAYOUT*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pSetLayouts);
+    pPacket->pDescriptorSets = (XGL_DESCRIPTOR_SET*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pDescriptorSets);
+    pPacket->pCount = (uint32_t*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pCount);
+    return pPacket;
+}
+
+typedef struct struct_xglClearDescriptorSets {
+    glv_trace_packet_header* header;
+    XGL_DESCRIPTOR_REGION descriptorRegion;
+    uint32_t count;
+    const XGL_DESCRIPTOR_SET* pDescriptorSets;
+} struct_xglClearDescriptorSets;
+
+static struct_xglClearDescriptorSets* interpret_body_as_xglClearDescriptorSets(glv_trace_packet_header* pHeader)
+{
+    struct_xglClearDescriptorSets* pPacket = (struct_xglClearDescriptorSets*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->pDescriptorSets = (const XGL_DESCRIPTOR_SET*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pDescriptorSets);
+    return pPacket;
+}
+
+typedef struct struct_xglUpdateDescriptors {
+    glv_trace_packet_header* header;
+    XGL_DESCRIPTOR_SET descriptorSet;
+    const void* pUpdateChain;
+} struct_xglUpdateDescriptors;
+
+static struct_xglUpdateDescriptors* interpret_body_as_xglUpdateDescriptors(glv_trace_packet_header* pHeader)
+{
+    struct_xglUpdateDescriptors* pPacket = (struct_xglUpdateDescriptors*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->pUpdateChain = (const void*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pUpdateChain);
+    if (pPacket->pUpdateChain != NULL)
+    {
+        XGL_UPDATE_SAMPLERS* pNext = (XGL_UPDATE_SAMPLERS*)pPacket->pUpdateChain;
+        while ((NULL != pNext) && (XGL_NULL_HANDLE != pNext))
+        {
+            switch(pNext->sType)
+            {
+                case XGL_STRUCTURE_TYPE_UPDATE_AS_COPY:
+                {
+                    void** ppNextVoidPtr = (void**)&pNext->pNext;
+                    *ppNextVoidPtr = (void*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pNext->pNext);
+                    break;
+                }
+                case XGL_STRUCTURE_TYPE_UPDATE_SAMPLERS:
+                {
+                    void** ppNextVoidPtr = (void**)&pNext->pNext;
+                    XGL_UPDATE_SAMPLERS* pUS = (XGL_UPDATE_SAMPLERS*)pNext;
+                    *ppNextVoidPtr = (void*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pNext->pNext);
+                    pUS->pSamplers = (XGL_SAMPLER*) glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pUS->pSamplers);
+                    break;
+                }
+                case XGL_STRUCTURE_TYPE_UPDATE_SAMPLER_TEXTURES:
+                {
+                    void** ppNextVoidPtr = (void**)&pNext->pNext;
+                    XGL_UPDATE_SAMPLER_TEXTURES* pUST = (XGL_UPDATE_SAMPLER_TEXTURES*)pNext;
+                    *ppNextVoidPtr = (void*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pNext->pNext);
+                    pUST->pSamplerImageViews = (XGL_SAMPLER_IMAGE_VIEW_INFO*) glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pUST->pSamplerImageViews);
+                    uint32_t i;
+                    for (i = 0; i < pUST->count; i++) {
+                        XGL_IMAGE_VIEW_ATTACH_INFO** ppLocalImageView = (XGL_IMAGE_VIEW_ATTACH_INFO**)&pUST->pSamplerImageViews[i].pImageView;
+                        *ppLocalImageView = (XGL_IMAGE_VIEW_ATTACH_INFO*) glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pUST->pSamplerImageViews[i].pImageView);
+                    }
+                    break;
+                }
+                case XGL_STRUCTURE_TYPE_UPDATE_IMAGES:
+                {
+                    void** ppNextVoidPtr = (void**)&pNext->pNext;
+                    XGL_UPDATE_IMAGES* pUI = (XGL_UPDATE_IMAGES*)pNext;
+                    *ppNextVoidPtr = (void*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pNext->pNext);
+                    XGL_IMAGE_VIEW_ATTACH_INFO** ppLocalImageView = (XGL_IMAGE_VIEW_ATTACH_INFO**)&pUI->pImageViews;
+                    *ppLocalImageView = (XGL_IMAGE_VIEW_ATTACH_INFO*) glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pUI->pImageViews);
+                    uint32_t i;
+                    for (i = 0; i < pUI->count; i++) {
+                        XGL_IMAGE_VIEW_ATTACH_INFO** ppLocalImageViews = (XGL_IMAGE_VIEW_ATTACH_INFO**)&pUI->pImageViews[i];
+                        *ppLocalImageViews = (XGL_IMAGE_VIEW_ATTACH_INFO*) glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pUI->pImageViews[i]);
+                    }
+                    break;
+                }
+                case XGL_STRUCTURE_TYPE_UPDATE_BUFFERS:
+                {
+                    void** ppNextVoidPtr = (void**)&pNext->pNext;
+                    XGL_UPDATE_BUFFERS* pUB = (XGL_UPDATE_BUFFERS*)pNext;
+                    *ppNextVoidPtr = (void*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pNext->pNext);
+                    XGL_BUFFER_VIEW_ATTACH_INFO** ppLocalBufferView = (XGL_BUFFER_VIEW_ATTACH_INFO**)&pUB->pBufferViews;
+                    *ppLocalBufferView = (XGL_BUFFER_VIEW_ATTACH_INFO*) glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pUB->pBufferViews);
+                    uint32_t i;
+                    for (i = 0; i < pUB->count; i++) {
+                        XGL_BUFFER_VIEW_ATTACH_INFO** ppLocalBufferViews = (XGL_BUFFER_VIEW_ATTACH_INFO**)&pUB->pBufferViews[i];
+                        *ppLocalBufferViews = (XGL_BUFFER_VIEW_ATTACH_INFO*) glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pUB->pBufferViews[i]);
+                    }
+                    break;
+                }
+                default:
+                {
+                   glv_LogError("Encountered an unexpected type in update descriptors pUpdateChain.\n");
+                   pPacket->header = NULL;
+                   pNext->pNext = NULL;
+                }
+            }
+            pNext = (XGL_UPDATE_SAMPLERS*)pNext->pNext;
+        }
+    }
+    return pPacket;
+}
+
+typedef struct struct_xglCreateDynamicViewportState {
+    glv_trace_packet_header* header;
+    XGL_DEVICE device;
+    const XGL_DYNAMIC_VP_STATE_CREATE_INFO* pCreateInfo;
+    XGL_DYNAMIC_VP_STATE_OBJECT* pState;
+    XGL_RESULT result;
+} struct_xglCreateDynamicViewportState;
+
+static struct_xglCreateDynamicViewportState* interpret_body_as_xglCreateDynamicViewportState(glv_trace_packet_header* pHeader)
+{
+    struct_xglCreateDynamicViewportState* pPacket = (struct_xglCreateDynamicViewportState*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->pCreateInfo = (const XGL_DYNAMIC_VP_STATE_CREATE_INFO*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pCreateInfo);
+    if (pPacket->pCreateInfo != NULL)
+    {
+        XGL_DYNAMIC_VP_STATE_CREATE_INFO* pInfo = (XGL_DYNAMIC_VP_STATE_CREATE_INFO*)pPacket->pCreateInfo;
+        pInfo->pViewports = (XGL_VIEWPORT*) glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pCreateInfo->pViewports);
+        pInfo->pScissors = (XGL_RECT*) glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pCreateInfo->pScissors);
+    }
+    pPacket->pState = (XGL_DYNAMIC_VP_STATE_OBJECT*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pState);
+    return pPacket;
+}
+
+typedef struct struct_xglCreateDynamicRasterState {
+    glv_trace_packet_header* header;
+    XGL_DEVICE device;
+    const XGL_DYNAMIC_RS_STATE_CREATE_INFO* pCreateInfo;
+    XGL_DYNAMIC_RS_STATE_OBJECT* pState;
+    XGL_RESULT result;
+} struct_xglCreateDynamicRasterState;
+
+static struct_xglCreateDynamicRasterState* interpret_body_as_xglCreateDynamicRasterState(glv_trace_packet_header* pHeader)
+{
+    struct_xglCreateDynamicRasterState* pPacket = (struct_xglCreateDynamicRasterState*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->pCreateInfo = (const XGL_DYNAMIC_RS_STATE_CREATE_INFO*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pCreateInfo);
+    pPacket->pState = (XGL_DYNAMIC_RS_STATE_OBJECT*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pState);
+    return pPacket;
+}
+
+typedef struct struct_xglCreateDynamicColorBlendState {
+    glv_trace_packet_header* header;
+    XGL_DEVICE device;
+    const XGL_DYNAMIC_CB_STATE_CREATE_INFO* pCreateInfo;
+    XGL_DYNAMIC_CB_STATE_OBJECT* pState;
+    XGL_RESULT result;
+} struct_xglCreateDynamicColorBlendState;
+
+static struct_xglCreateDynamicColorBlendState* interpret_body_as_xglCreateDynamicColorBlendState(glv_trace_packet_header* pHeader)
+{
+    struct_xglCreateDynamicColorBlendState* pPacket = (struct_xglCreateDynamicColorBlendState*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->pCreateInfo = (const XGL_DYNAMIC_CB_STATE_CREATE_INFO*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pCreateInfo);
+    pPacket->pState = (XGL_DYNAMIC_CB_STATE_OBJECT*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pState);
+    return pPacket;
+}
+
+typedef struct struct_xglCreateDynamicDepthStencilState {
+    glv_trace_packet_header* header;
+    XGL_DEVICE device;
+    const XGL_DYNAMIC_DS_STATE_CREATE_INFO* pCreateInfo;
+    XGL_DYNAMIC_DS_STATE_OBJECT* pState;
+    XGL_RESULT result;
+} struct_xglCreateDynamicDepthStencilState;
+
+static struct_xglCreateDynamicDepthStencilState* interpret_body_as_xglCreateDynamicDepthStencilState(glv_trace_packet_header* pHeader)
+{
+    struct_xglCreateDynamicDepthStencilState* pPacket = (struct_xglCreateDynamicDepthStencilState*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->pCreateInfo = (const XGL_DYNAMIC_DS_STATE_CREATE_INFO*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pCreateInfo);
+    pPacket->pState = (XGL_DYNAMIC_DS_STATE_OBJECT*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pState);
+    return pPacket;
+}
+
+typedef struct struct_xglCreateCommandBuffer {
+    glv_trace_packet_header* header;
+    XGL_DEVICE device;
+    const XGL_CMD_BUFFER_CREATE_INFO* pCreateInfo;
+    XGL_CMD_BUFFER* pCmdBuffer;
+    XGL_RESULT result;
+} struct_xglCreateCommandBuffer;
+
+static struct_xglCreateCommandBuffer* interpret_body_as_xglCreateCommandBuffer(glv_trace_packet_header* pHeader)
+{
+    struct_xglCreateCommandBuffer* pPacket = (struct_xglCreateCommandBuffer*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->pCreateInfo = (const XGL_CMD_BUFFER_CREATE_INFO*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pCreateInfo);
+    pPacket->pCmdBuffer = (XGL_CMD_BUFFER*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pCmdBuffer);
+    return pPacket;
+}
+
+typedef struct struct_xglBeginCommandBuffer {
+    glv_trace_packet_header* header;
+    XGL_CMD_BUFFER cmdBuffer;
+    const XGL_CMD_BUFFER_BEGIN_INFO* pBeginInfo;
+    XGL_RESULT result;
+} struct_xglBeginCommandBuffer;
+
+static struct_xglBeginCommandBuffer* interpret_body_as_xglBeginCommandBuffer(glv_trace_packet_header* pHeader)
+{
+    struct_xglBeginCommandBuffer* pPacket = (struct_xglBeginCommandBuffer*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->pBeginInfo = (const XGL_CMD_BUFFER_BEGIN_INFO*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pBeginInfo);
+    if (pPacket->pBeginInfo != NULL)
+    {
+        if (pPacket->pBeginInfo->sType == XGL_STRUCTURE_TYPE_CMD_BUFFER_BEGIN_INFO) {
+            // need to make a non-const pointer to the pointer so that we can properly change the original pointer to the interpretted one
+            XGL_CMD_BUFFER_GRAPHICS_BEGIN_INFO** ppNext = (XGL_CMD_BUFFER_GRAPHICS_BEGIN_INFO**)&(pPacket->pBeginInfo->pNext);
+            *ppNext = (XGL_CMD_BUFFER_GRAPHICS_BEGIN_INFO*) glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pBeginInfo->pNext);
+            XGL_CMD_BUFFER_GRAPHICS_BEGIN_INFO* pNext = *ppNext;
+            while (NULL != pNext)
+            {
+                switch(pNext->sType)
+                {
+                    case XGL_STRUCTURE_TYPE_CMD_BUFFER_GRAPHICS_BEGIN_INFO:
+                    {
+                        ppNext = (XGL_CMD_BUFFER_GRAPHICS_BEGIN_INFO**) &pNext->pNext;
+                        *ppNext = (XGL_CMD_BUFFER_GRAPHICS_BEGIN_INFO*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pNext->pNext);
+                        break;
+                    }
+                    default:
+                    {
+                        glv_LogError("Encountered an unexpected type in begin command buffer list.\n");
+                        pPacket->header = NULL;
+                        pNext->pNext = NULL;
+                    }
+                }
+                pNext = (XGL_CMD_BUFFER_GRAPHICS_BEGIN_INFO*)pNext->pNext;
+            }
+        } else {
+            // This is unexpected.
+            glv_LogError("BeginCommandBuffer must have BeginInfo stype of XGL_STRUCTURE_TYPE_CMD_BUFFER_BEGIN_INFO.\n");
+            pPacket->header = NULL;
+        }
+    }
+    return pPacket;
+}
+
+typedef struct struct_xglEndCommandBuffer {
+    glv_trace_packet_header* header;
+    XGL_CMD_BUFFER cmdBuffer;
+    XGL_RESULT result;
+} struct_xglEndCommandBuffer;
+
+static struct_xglEndCommandBuffer* interpret_body_as_xglEndCommandBuffer(glv_trace_packet_header* pHeader)
+{
+    struct_xglEndCommandBuffer* pPacket = (struct_xglEndCommandBuffer*)pHeader->pBody;
+    pPacket->header = pHeader;
+    return pPacket;
+}
+
+typedef struct struct_xglResetCommandBuffer {
+    glv_trace_packet_header* header;
+    XGL_CMD_BUFFER cmdBuffer;
+    XGL_RESULT result;
+} struct_xglResetCommandBuffer;
+
+static struct_xglResetCommandBuffer* interpret_body_as_xglResetCommandBuffer(glv_trace_packet_header* pHeader)
+{
+    struct_xglResetCommandBuffer* pPacket = (struct_xglResetCommandBuffer*)pHeader->pBody;
+    pPacket->header = pHeader;
+    return pPacket;
+}
+
+typedef struct struct_xglCmdBindPipeline {
+    glv_trace_packet_header* header;
+    XGL_CMD_BUFFER cmdBuffer;
+    XGL_PIPELINE_BIND_POINT pipelineBindPoint;
+    XGL_PIPELINE pipeline;
+} struct_xglCmdBindPipeline;
+
+static struct_xglCmdBindPipeline* interpret_body_as_xglCmdBindPipeline(glv_trace_packet_header* pHeader)
+{
+    struct_xglCmdBindPipeline* pPacket = (struct_xglCmdBindPipeline*)pHeader->pBody;
+    pPacket->header = pHeader;
+    return pPacket;
+}
+
+typedef struct struct_xglCmdBindPipelineDelta {
+    glv_trace_packet_header* header;
+    XGL_CMD_BUFFER cmdBuffer;
+    XGL_PIPELINE_BIND_POINT pipelineBindPoint;
+    XGL_PIPELINE_DELTA delta;
+} struct_xglCmdBindPipelineDelta;
+
+static struct_xglCmdBindPipelineDelta* interpret_body_as_xglCmdBindPipelineDelta(glv_trace_packet_header* pHeader)
+{
+    struct_xglCmdBindPipelineDelta* pPacket = (struct_xglCmdBindPipelineDelta*)pHeader->pBody;
+    pPacket->header = pHeader;
+    return pPacket;
+}
+
+typedef struct struct_xglCmdBindDynamicStateObject {
+    glv_trace_packet_header* header;
+    XGL_CMD_BUFFER cmdBuffer;
+    XGL_STATE_BIND_POINT stateBindPoint;
+    XGL_DYNAMIC_STATE_OBJECT state;
+} struct_xglCmdBindDynamicStateObject;
+
+static struct_xglCmdBindDynamicStateObject* interpret_body_as_xglCmdBindDynamicStateObject(glv_trace_packet_header* pHeader)
+{
+    struct_xglCmdBindDynamicStateObject* pPacket = (struct_xglCmdBindDynamicStateObject*)pHeader->pBody;
+    pPacket->header = pHeader;
+    return pPacket;
+}
+
+typedef struct struct_xglCmdBindDescriptorSet {
+    glv_trace_packet_header* header;
+    XGL_CMD_BUFFER cmdBuffer;
+    XGL_PIPELINE_BIND_POINT pipelineBindPoint;
+    XGL_DESCRIPTOR_SET descriptorSet;
+    const uint32_t* pUserData;
+} struct_xglCmdBindDescriptorSet;
+
+static struct_xglCmdBindDescriptorSet* interpret_body_as_xglCmdBindDescriptorSet(glv_trace_packet_header* pHeader)
+{
+    struct_xglCmdBindDescriptorSet* pPacket = (struct_xglCmdBindDescriptorSet*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->pUserData = (const uint32_t*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pUserData);
+    return pPacket;
+}
+
+typedef struct struct_xglCmdBindVertexBuffer {
+    glv_trace_packet_header* header;
+    XGL_CMD_BUFFER cmdBuffer;
+    XGL_BUFFER buffer;
+    XGL_GPU_SIZE offset;
+    uint32_t binding;
+} struct_xglCmdBindVertexBuffer;
+
+static struct_xglCmdBindVertexBuffer* interpret_body_as_xglCmdBindVertexBuffer(glv_trace_packet_header* pHeader)
+{
+    struct_xglCmdBindVertexBuffer* pPacket = (struct_xglCmdBindVertexBuffer*)pHeader->pBody;
+    pPacket->header = pHeader;
+    return pPacket;
+}
+
+typedef struct struct_xglCmdBindIndexBuffer {
+    glv_trace_packet_header* header;
+    XGL_CMD_BUFFER cmdBuffer;
+    XGL_BUFFER buffer;
+    XGL_GPU_SIZE offset;
+    XGL_INDEX_TYPE indexType;
+} struct_xglCmdBindIndexBuffer;
+
+static struct_xglCmdBindIndexBuffer* interpret_body_as_xglCmdBindIndexBuffer(glv_trace_packet_header* pHeader)
+{
+    struct_xglCmdBindIndexBuffer* pPacket = (struct_xglCmdBindIndexBuffer*)pHeader->pBody;
+    pPacket->header = pHeader;
+    return pPacket;
+}
+
+typedef struct struct_xglCmdDraw {
+    glv_trace_packet_header* header;
+    XGL_CMD_BUFFER cmdBuffer;
+    uint32_t firstVertex;
+    uint32_t vertexCount;
+    uint32_t firstInstance;
+    uint32_t instanceCount;
+} struct_xglCmdDraw;
+
+static struct_xglCmdDraw* interpret_body_as_xglCmdDraw(glv_trace_packet_header* pHeader)
+{
+    struct_xglCmdDraw* pPacket = (struct_xglCmdDraw*)pHeader->pBody;
+    pPacket->header = pHeader;
+    return pPacket;
+}
+
+typedef struct struct_xglCmdDrawIndexed {
+    glv_trace_packet_header* header;
+    XGL_CMD_BUFFER cmdBuffer;
+    uint32_t firstIndex;
+    uint32_t indexCount;
+    int32_t vertexOffset;
+    uint32_t firstInstance;
+    uint32_t instanceCount;
+} struct_xglCmdDrawIndexed;
+
+static struct_xglCmdDrawIndexed* interpret_body_as_xglCmdDrawIndexed(glv_trace_packet_header* pHeader)
+{
+    struct_xglCmdDrawIndexed* pPacket = (struct_xglCmdDrawIndexed*)pHeader->pBody;
+    pPacket->header = pHeader;
+    return pPacket;
+}
+
+typedef struct struct_xglCmdDrawIndirect {
+    glv_trace_packet_header* header;
+    XGL_CMD_BUFFER cmdBuffer;
+    XGL_BUFFER buffer;
+    XGL_GPU_SIZE offset;
+    uint32_t count;
+    uint32_t stride;
+} struct_xglCmdDrawIndirect;
+
+static struct_xglCmdDrawIndirect* interpret_body_as_xglCmdDrawIndirect(glv_trace_packet_header* pHeader)
+{
+    struct_xglCmdDrawIndirect* pPacket = (struct_xglCmdDrawIndirect*)pHeader->pBody;
+    pPacket->header = pHeader;
+    return pPacket;
+}
+
+typedef struct struct_xglCmdDrawIndexedIndirect {
+    glv_trace_packet_header* header;
+    XGL_CMD_BUFFER cmdBuffer;
+    XGL_BUFFER buffer;
+    XGL_GPU_SIZE offset;
+    uint32_t count;
+    uint32_t stride;
+} struct_xglCmdDrawIndexedIndirect;
+
+static struct_xglCmdDrawIndexedIndirect* interpret_body_as_xglCmdDrawIndexedIndirect(glv_trace_packet_header* pHeader)
+{
+    struct_xglCmdDrawIndexedIndirect* pPacket = (struct_xglCmdDrawIndexedIndirect*)pHeader->pBody;
+    pPacket->header = pHeader;
+    return pPacket;
+}
+
+typedef struct struct_xglCmdDispatch {
+    glv_trace_packet_header* header;
+    XGL_CMD_BUFFER cmdBuffer;
+    uint32_t x;
+    uint32_t y;
+    uint32_t z;
+} struct_xglCmdDispatch;
+
+static struct_xglCmdDispatch* interpret_body_as_xglCmdDispatch(glv_trace_packet_header* pHeader)
+{
+    struct_xglCmdDispatch* pPacket = (struct_xglCmdDispatch*)pHeader->pBody;
+    pPacket->header = pHeader;
+    return pPacket;
+}
+
+typedef struct struct_xglCmdDispatchIndirect {
+    glv_trace_packet_header* header;
+    XGL_CMD_BUFFER cmdBuffer;
+    XGL_BUFFER buffer;
+    XGL_GPU_SIZE offset;
+} struct_xglCmdDispatchIndirect;
+
+static struct_xglCmdDispatchIndirect* interpret_body_as_xglCmdDispatchIndirect(glv_trace_packet_header* pHeader)
+{
+    struct_xglCmdDispatchIndirect* pPacket = (struct_xglCmdDispatchIndirect*)pHeader->pBody;
+    pPacket->header = pHeader;
+    return pPacket;
+}
+
+typedef struct struct_xglCmdCopyBuffer {
+    glv_trace_packet_header* header;
+    XGL_CMD_BUFFER cmdBuffer;
+    XGL_BUFFER srcBuffer;
+    XGL_BUFFER destBuffer;
+    uint32_t regionCount;
+    const XGL_BUFFER_COPY* pRegions;
+} struct_xglCmdCopyBuffer;
+
+static struct_xglCmdCopyBuffer* interpret_body_as_xglCmdCopyBuffer(glv_trace_packet_header* pHeader)
+{
+    struct_xglCmdCopyBuffer* pPacket = (struct_xglCmdCopyBuffer*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->pRegions = (const XGL_BUFFER_COPY*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pRegions);
+    return pPacket;
+}
+
+typedef struct struct_xglCmdCopyImage {
+    glv_trace_packet_header* header;
+    XGL_CMD_BUFFER cmdBuffer;
+    XGL_IMAGE srcImage;
+    XGL_IMAGE destImage;
+    uint32_t regionCount;
+    const XGL_IMAGE_COPY* pRegions;
+} struct_xglCmdCopyImage;
+
+static struct_xglCmdCopyImage* interpret_body_as_xglCmdCopyImage(glv_trace_packet_header* pHeader)
+{
+    struct_xglCmdCopyImage* pPacket = (struct_xglCmdCopyImage*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->pRegions = (const XGL_IMAGE_COPY*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pRegions);
+    return pPacket;
+}
+
+typedef struct struct_xglCmdCopyBufferToImage {
+    glv_trace_packet_header* header;
+    XGL_CMD_BUFFER cmdBuffer;
+    XGL_BUFFER srcBuffer;
+    XGL_IMAGE destImage;
+    uint32_t regionCount;
+    const XGL_BUFFER_IMAGE_COPY* pRegions;
+} struct_xglCmdCopyBufferToImage;
+
+static struct_xglCmdCopyBufferToImage* interpret_body_as_xglCmdCopyBufferToImage(glv_trace_packet_header* pHeader)
+{
+    struct_xglCmdCopyBufferToImage* pPacket = (struct_xglCmdCopyBufferToImage*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->pRegions = (const XGL_BUFFER_IMAGE_COPY*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pRegions);
+    return pPacket;
+}
+
+typedef struct struct_xglCmdCopyImageToBuffer {
+    glv_trace_packet_header* header;
+    XGL_CMD_BUFFER cmdBuffer;
+    XGL_IMAGE srcImage;
+    XGL_BUFFER destBuffer;
+    uint32_t regionCount;
+    const XGL_BUFFER_IMAGE_COPY* pRegions;
+} struct_xglCmdCopyImageToBuffer;
+
+static struct_xglCmdCopyImageToBuffer* interpret_body_as_xglCmdCopyImageToBuffer(glv_trace_packet_header* pHeader)
+{
+    struct_xglCmdCopyImageToBuffer* pPacket = (struct_xglCmdCopyImageToBuffer*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->pRegions = (const XGL_BUFFER_IMAGE_COPY*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pRegions);
+    return pPacket;
+}
+
+typedef struct struct_xglCmdCloneImageData {
+    glv_trace_packet_header* header;
+    XGL_CMD_BUFFER cmdBuffer;
+    XGL_IMAGE srcImage;
+    XGL_IMAGE_LAYOUT srcImageLayout;
+    XGL_IMAGE destImage;
+    XGL_IMAGE_LAYOUT destImageLayout;
+} struct_xglCmdCloneImageData;
+
+static struct_xglCmdCloneImageData* interpret_body_as_xglCmdCloneImageData(glv_trace_packet_header* pHeader)
+{
+    struct_xglCmdCloneImageData* pPacket = (struct_xglCmdCloneImageData*)pHeader->pBody;
+    pPacket->header = pHeader;
+    return pPacket;
+}
+
+typedef struct struct_xglCmdUpdateBuffer {
+    glv_trace_packet_header* header;
+    XGL_CMD_BUFFER cmdBuffer;
+    XGL_BUFFER destBuffer;
+    XGL_GPU_SIZE destOffset;
+    XGL_GPU_SIZE dataSize;
+    const uint32_t* pData;
+} struct_xglCmdUpdateBuffer;
+
+static struct_xglCmdUpdateBuffer* interpret_body_as_xglCmdUpdateBuffer(glv_trace_packet_header* pHeader)
+{
+    struct_xglCmdUpdateBuffer* pPacket = (struct_xglCmdUpdateBuffer*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->pData = (const uint32_t*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pData);
+    return pPacket;
+}
+
+typedef struct struct_xglCmdFillBuffer {
+    glv_trace_packet_header* header;
+    XGL_CMD_BUFFER cmdBuffer;
+    XGL_BUFFER destBuffer;
+    XGL_GPU_SIZE destOffset;
+    XGL_GPU_SIZE fillSize;
+    uint32_t data;
+} struct_xglCmdFillBuffer;
+
+static struct_xglCmdFillBuffer* interpret_body_as_xglCmdFillBuffer(glv_trace_packet_header* pHeader)
+{
+    struct_xglCmdFillBuffer* pPacket = (struct_xglCmdFillBuffer*)pHeader->pBody;
+    pPacket->header = pHeader;
+    return pPacket;
+}
+
+typedef struct struct_xglCmdClearColorImage {
+    glv_trace_packet_header* header;
+    XGL_CMD_BUFFER cmdBuffer;
+    XGL_IMAGE image;
+    const float color[4];
+    uint32_t rangeCount;
+    const XGL_IMAGE_SUBRESOURCE_RANGE* pRanges;
+} struct_xglCmdClearColorImage;
+
+static struct_xglCmdClearColorImage* interpret_body_as_xglCmdClearColorImage(glv_trace_packet_header* pHeader)
+{
+    struct_xglCmdClearColorImage* pPacket = (struct_xglCmdClearColorImage*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->pRanges = (const XGL_IMAGE_SUBRESOURCE_RANGE*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pRanges);
+    return pPacket;
+}
+
+typedef struct struct_xglCmdClearColorImageRaw {
+    glv_trace_packet_header* header;
+    XGL_CMD_BUFFER cmdBuffer;
+    XGL_IMAGE image;
+    const uint32_t color[4];
+    uint32_t rangeCount;
+    const XGL_IMAGE_SUBRESOURCE_RANGE* pRanges;
+} struct_xglCmdClearColorImageRaw;
+
+static struct_xglCmdClearColorImageRaw* interpret_body_as_xglCmdClearColorImageRaw(glv_trace_packet_header* pHeader)
+{
+    struct_xglCmdClearColorImageRaw* pPacket = (struct_xglCmdClearColorImageRaw*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->pRanges = (const XGL_IMAGE_SUBRESOURCE_RANGE*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pRanges);
+    return pPacket;
+}
+
+typedef struct struct_xglCmdClearDepthStencil {
+    glv_trace_packet_header* header;
+    XGL_CMD_BUFFER cmdBuffer;
+    XGL_IMAGE image;
+    float depth;
+    uint32_t stencil;
+    uint32_t rangeCount;
+    const XGL_IMAGE_SUBRESOURCE_RANGE* pRanges;
+} struct_xglCmdClearDepthStencil;
+
+static struct_xglCmdClearDepthStencil* interpret_body_as_xglCmdClearDepthStencil(glv_trace_packet_header* pHeader)
+{
+    struct_xglCmdClearDepthStencil* pPacket = (struct_xglCmdClearDepthStencil*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->pRanges = (const XGL_IMAGE_SUBRESOURCE_RANGE*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pRanges);
+    return pPacket;
+}
+
+typedef struct struct_xglCmdResolveImage {
+    glv_trace_packet_header* header;
+    XGL_CMD_BUFFER cmdBuffer;
+    XGL_IMAGE srcImage;
+    XGL_IMAGE destImage;
+    uint32_t rectCount;
+    const XGL_IMAGE_RESOLVE* pRects;
+} struct_xglCmdResolveImage;
+
+static struct_xglCmdResolveImage* interpret_body_as_xglCmdResolveImage(glv_trace_packet_header* pHeader)
+{
+    struct_xglCmdResolveImage* pPacket = (struct_xglCmdResolveImage*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->pRects = (const XGL_IMAGE_RESOLVE*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pRects);
+    return pPacket;
+}
+
+typedef struct struct_xglCmdSetEvent {
+    glv_trace_packet_header* header;
+    XGL_CMD_BUFFER cmdBuffer;
+    XGL_EVENT event;
+    XGL_SET_EVENT pipeEvent;
+} struct_xglCmdSetEvent;
+
+static struct_xglCmdSetEvent* interpret_body_as_xglCmdSetEvent(glv_trace_packet_header* pHeader)
+{
+    struct_xglCmdSetEvent* pPacket = (struct_xglCmdSetEvent*)pHeader->pBody;
+    pPacket->header = pHeader;
+    return pPacket;
+}
+
+typedef struct struct_xglCmdResetEvent {
+    glv_trace_packet_header* header;
+    XGL_CMD_BUFFER cmdBuffer;
+    XGL_EVENT event;
+} struct_xglCmdResetEvent;
+
+static struct_xglCmdResetEvent* interpret_body_as_xglCmdResetEvent(glv_trace_packet_header* pHeader)
+{
+    struct_xglCmdResetEvent* pPacket = (struct_xglCmdResetEvent*)pHeader->pBody;
+    pPacket->header = pHeader;
+    return pPacket;
+}
+
+typedef struct struct_xglCmdWaitEvents {
+    glv_trace_packet_header* header;
+    XGL_CMD_BUFFER cmdBuffer;
+    const XGL_EVENT_WAIT_INFO* pWaitInfo;
+} struct_xglCmdWaitEvents;
+
+static struct_xglCmdWaitEvents* interpret_body_as_xglCmdWaitEvents(glv_trace_packet_header* pHeader)
+{
+    struct_xglCmdWaitEvents* pPacket = (struct_xglCmdWaitEvents*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->pWaitInfo = (const XGL_EVENT_WAIT_INFO*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pWaitInfo);
+    if (pPacket->pWaitInfo != NULL)
+    {
+        XGL_EVENT_WAIT_INFO* pInfo = (XGL_EVENT_WAIT_INFO*)pPacket->pWaitInfo;
+        pInfo->pEvents = (XGL_EVENT*) glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pWaitInfo->pEvents);
+        pInfo->ppMemBarriers = (const void**) glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pWaitInfo->ppMemBarriers);
+        uint32_t i;
+        for (i = 0; i < pInfo->memBarrierCount; i++) {
+            void** ppLocalMemBarriers = (void**)&pInfo->ppMemBarriers[i];
+            *ppLocalMemBarriers = (void*) glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pInfo->ppMemBarriers[i]);
+        }
+    }
+    return pPacket;
+}
+
+typedef struct struct_xglCmdPipelineBarrier {
+    glv_trace_packet_header* header;
+    XGL_CMD_BUFFER cmdBuffer;
+    const XGL_PIPELINE_BARRIER* pBarrier;
+} struct_xglCmdPipelineBarrier;
+
+static struct_xglCmdPipelineBarrier* interpret_body_as_xglCmdPipelineBarrier(glv_trace_packet_header* pHeader)
+{
+    struct_xglCmdPipelineBarrier* pPacket = (struct_xglCmdPipelineBarrier*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->pBarrier = (const XGL_PIPELINE_BARRIER*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pBarrier);
+    if (pPacket->pBarrier != NULL)
+    {
+        XGL_PIPELINE_BARRIER* pBarrier = (XGL_PIPELINE_BARRIER*)pPacket->pBarrier;
+        pBarrier->pEvents = (XGL_SET_EVENT*) glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pBarrier->pEvents);
+        pBarrier->ppMemBarriers = (const void**) glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pBarrier->ppMemBarriers);
+        uint32_t i;
+        for (i = 0; i < pBarrier->memBarrierCount; i++) {
+            void** ppLocalMemBarriers = (void**)&pBarrier->ppMemBarriers[i];
+            *ppLocalMemBarriers = (void*) glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pBarrier->ppMemBarriers[i]);
+        }
+    }
+    return pPacket;
+}
+
+typedef struct struct_xglCmdBeginQuery {
+    glv_trace_packet_header* header;
+    XGL_CMD_BUFFER cmdBuffer;
+    XGL_QUERY_POOL queryPool;
+    uint32_t slot;
+    XGL_FLAGS flags;
+} struct_xglCmdBeginQuery;
+
+static struct_xglCmdBeginQuery* interpret_body_as_xglCmdBeginQuery(glv_trace_packet_header* pHeader)
+{
+    struct_xglCmdBeginQuery* pPacket = (struct_xglCmdBeginQuery*)pHeader->pBody;
+    pPacket->header = pHeader;
+    return pPacket;
+}
+
+typedef struct struct_xglCmdEndQuery {
+    glv_trace_packet_header* header;
+    XGL_CMD_BUFFER cmdBuffer;
+    XGL_QUERY_POOL queryPool;
+    uint32_t slot;
+} struct_xglCmdEndQuery;
+
+static struct_xglCmdEndQuery* interpret_body_as_xglCmdEndQuery(glv_trace_packet_header* pHeader)
+{
+    struct_xglCmdEndQuery* pPacket = (struct_xglCmdEndQuery*)pHeader->pBody;
+    pPacket->header = pHeader;
+    return pPacket;
+}
+
+typedef struct struct_xglCmdResetQueryPool {
+    glv_trace_packet_header* header;
+    XGL_CMD_BUFFER cmdBuffer;
+    XGL_QUERY_POOL queryPool;
+    uint32_t startQuery;
+    uint32_t queryCount;
+} struct_xglCmdResetQueryPool;
+
+static struct_xglCmdResetQueryPool* interpret_body_as_xglCmdResetQueryPool(glv_trace_packet_header* pHeader)
+{
+    struct_xglCmdResetQueryPool* pPacket = (struct_xglCmdResetQueryPool*)pHeader->pBody;
+    pPacket->header = pHeader;
+    return pPacket;
+}
+
+typedef struct struct_xglCmdWriteTimestamp {
+    glv_trace_packet_header* header;
+    XGL_CMD_BUFFER cmdBuffer;
+    XGL_TIMESTAMP_TYPE timestampType;
+    XGL_BUFFER destBuffer;
+    XGL_GPU_SIZE destOffset;
+} struct_xglCmdWriteTimestamp;
+
+static struct_xglCmdWriteTimestamp* interpret_body_as_xglCmdWriteTimestamp(glv_trace_packet_header* pHeader)
+{
+    struct_xglCmdWriteTimestamp* pPacket = (struct_xglCmdWriteTimestamp*)pHeader->pBody;
+    pPacket->header = pHeader;
+    return pPacket;
+}
+
+typedef struct struct_xglCmdInitAtomicCounters {
+    glv_trace_packet_header* header;
+    XGL_CMD_BUFFER cmdBuffer;
+    XGL_PIPELINE_BIND_POINT pipelineBindPoint;
+    uint32_t startCounter;
+    uint32_t counterCount;
+    const uint32_t* pData;
+} struct_xglCmdInitAtomicCounters;
+
+static struct_xglCmdInitAtomicCounters* interpret_body_as_xglCmdInitAtomicCounters(glv_trace_packet_header* pHeader)
+{
+    struct_xglCmdInitAtomicCounters* pPacket = (struct_xglCmdInitAtomicCounters*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->pData = (const uint32_t*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pData);
+    return pPacket;
+}
+
+typedef struct struct_xglCmdLoadAtomicCounters {
+    glv_trace_packet_header* header;
+    XGL_CMD_BUFFER cmdBuffer;
+    XGL_PIPELINE_BIND_POINT pipelineBindPoint;
+    uint32_t startCounter;
+    uint32_t counterCount;
+    XGL_BUFFER srcBuffer;
+    XGL_GPU_SIZE srcOffset;
+} struct_xglCmdLoadAtomicCounters;
+
+static struct_xglCmdLoadAtomicCounters* interpret_body_as_xglCmdLoadAtomicCounters(glv_trace_packet_header* pHeader)
+{
+    struct_xglCmdLoadAtomicCounters* pPacket = (struct_xglCmdLoadAtomicCounters*)pHeader->pBody;
+    pPacket->header = pHeader;
+    return pPacket;
+}
+
+typedef struct struct_xglCmdSaveAtomicCounters {
+    glv_trace_packet_header* header;
+    XGL_CMD_BUFFER cmdBuffer;
+    XGL_PIPELINE_BIND_POINT pipelineBindPoint;
+    uint32_t startCounter;
+    uint32_t counterCount;
+    XGL_BUFFER destBuffer;
+    XGL_GPU_SIZE destOffset;
+} struct_xglCmdSaveAtomicCounters;
+
+static struct_xglCmdSaveAtomicCounters* interpret_body_as_xglCmdSaveAtomicCounters(glv_trace_packet_header* pHeader)
+{
+    struct_xglCmdSaveAtomicCounters* pPacket = (struct_xglCmdSaveAtomicCounters*)pHeader->pBody;
+    pPacket->header = pHeader;
+    return pPacket;
+}
+
+typedef struct struct_xglCreateFramebuffer {
+    glv_trace_packet_header* header;
+    XGL_DEVICE device;
+    const XGL_FRAMEBUFFER_CREATE_INFO* pCreateInfo;
+    XGL_FRAMEBUFFER* pFramebuffer;
+    XGL_RESULT result;
+} struct_xglCreateFramebuffer;
+
+static struct_xglCreateFramebuffer* interpret_body_as_xglCreateFramebuffer(glv_trace_packet_header* pHeader)
+{
+    struct_xglCreateFramebuffer* pPacket = (struct_xglCreateFramebuffer*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->pCreateInfo = (const XGL_FRAMEBUFFER_CREATE_INFO*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pCreateInfo);
+    if (pPacket->pCreateInfo != NULL)
+    {
+        XGL_FRAMEBUFFER_CREATE_INFO* pInfo = (XGL_FRAMEBUFFER_CREATE_INFO*)pPacket->pCreateInfo;
+        pInfo->pColorAttachments = (XGL_COLOR_ATTACHMENT_BIND_INFO*) glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pCreateInfo->pColorAttachments);
+        pInfo->pDepthStencilAttachment = (XGL_DEPTH_STENCIL_BIND_INFO*) glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pCreateInfo->pDepthStencilAttachment);
+
+    }
+    pPacket->pFramebuffer = (XGL_FRAMEBUFFER*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pFramebuffer);
+    return pPacket;
+}
+
+typedef struct struct_xglCreateRenderPass {
+    glv_trace_packet_header* header;
+    XGL_DEVICE device;
+    const XGL_RENDER_PASS_CREATE_INFO* pCreateInfo;
+    XGL_RENDER_PASS* pRenderPass;
+    XGL_RESULT result;
+} struct_xglCreateRenderPass;
+
+static struct_xglCreateRenderPass* interpret_body_as_xglCreateRenderPass(glv_trace_packet_header* pHeader)
+{
+    struct_xglCreateRenderPass* pPacket = (struct_xglCreateRenderPass*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->pCreateInfo = (const XGL_RENDER_PASS_CREATE_INFO*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pCreateInfo);
+    if (pPacket->pCreateInfo != NULL)
+    {
+        XGL_RENDER_PASS_CREATE_INFO* pInfo = (XGL_RENDER_PASS_CREATE_INFO*)pPacket->pCreateInfo;
+        pInfo->pColorLoadOps = (XGL_ATTACHMENT_LOAD_OP*) glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pCreateInfo->pColorLoadOps);
+        pInfo->pColorStoreOps = (XGL_ATTACHMENT_STORE_OP*) glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pCreateInfo->pColorStoreOps);
+        pInfo->pColorLoadClearValues = (XGL_CLEAR_COLOR*) glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pCreateInfo->pColorLoadClearValues);
+
+    }
+    pPacket->pRenderPass = (XGL_RENDER_PASS*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pRenderPass);
+    return pPacket;
+}
+
+typedef struct struct_xglCmdBeginRenderPass {
+    glv_trace_packet_header* header;
+    XGL_CMD_BUFFER cmdBuffer;
+    XGL_RENDER_PASS renderPass;
+} struct_xglCmdBeginRenderPass;
+
+static struct_xglCmdBeginRenderPass* interpret_body_as_xglCmdBeginRenderPass(glv_trace_packet_header* pHeader)
+{
+    struct_xglCmdBeginRenderPass* pPacket = (struct_xglCmdBeginRenderPass*)pHeader->pBody;
+    pPacket->header = pHeader;
+    return pPacket;
+}
+
+typedef struct struct_xglCmdEndRenderPass {
+    glv_trace_packet_header* header;
+    XGL_CMD_BUFFER cmdBuffer;
+    XGL_RENDER_PASS renderPass;
+} struct_xglCmdEndRenderPass;
+
+static struct_xglCmdEndRenderPass* interpret_body_as_xglCmdEndRenderPass(glv_trace_packet_header* pHeader)
+{
+    struct_xglCmdEndRenderPass* pPacket = (struct_xglCmdEndRenderPass*)pHeader->pBody;
+    pPacket->header = pHeader;
+    return pPacket;
+}
+
diff --git a/tools/glave/src/glv_extensions/glvdebug_xgl/codegen/glvtrace_xgl_xgldbg_structs.h b/tools/glave/src/glv_extensions/glvdebug_xgl/codegen/glvtrace_xgl_xgldbg_structs.h
new file mode 100644
index 0000000..cfe77e6
--- /dev/null
+++ b/tools/glave/src/glv_extensions/glvdebug_xgl/codegen/glvtrace_xgl_xgldbg_structs.h
@@ -0,0 +1,164 @@
+/* THIS FILE IS GENERATED.  DO NOT EDIT. */
+
+/*
+ * XGL
+ *
+ * Copyright (C) 2014 LunarG, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+#pragma once
+
+#include "xglDbg.h"
+#include "glv_trace_packet_utils.h"
+
+
+typedef struct struct_xglDbgSetValidationLevel {
+    glv_trace_packet_header* pHeader;
+    XGL_DEVICE device;
+    XGL_VALIDATION_LEVEL validationLevel;
+    XGL_RESULT result;
+} struct_xglDbgSetValidationLevel;
+
+static struct_xglDbgSetValidationLevel* interpret_body_as_xglDbgSetValidationLevel(glv_trace_packet_header* pHeader)
+{
+    struct_xglDbgSetValidationLevel* pPacket = (struct_xglDbgSetValidationLevel*)pHeader->pBody;
+    pPacket->pHeader = pHeader;
+    return pPacket;
+}
+
+typedef struct struct_xglDbgRegisterMsgCallback {
+    glv_trace_packet_header* pHeader;
+    XGL_DBG_MSG_CALLBACK_FUNCTION pfnMsgCallback;
+    void* pUserData;
+    XGL_RESULT result;
+} struct_xglDbgRegisterMsgCallback;
+
+static struct_xglDbgRegisterMsgCallback* interpret_body_as_xglDbgRegisterMsgCallback(glv_trace_packet_header* pHeader)
+{
+    struct_xglDbgRegisterMsgCallback* pPacket = (struct_xglDbgRegisterMsgCallback*)pHeader->pBody;
+    pPacket->pHeader = pHeader;
+    pPacket->pUserData = (void*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pUserData);
+    return pPacket;
+}
+
+typedef struct struct_xglDbgUnregisterMsgCallback {
+    glv_trace_packet_header* pHeader;
+    XGL_DBG_MSG_CALLBACK_FUNCTION pfnMsgCallback;
+    XGL_RESULT result;
+} struct_xglDbgUnregisterMsgCallback;
+
+static struct_xglDbgUnregisterMsgCallback* interpret_body_as_xglDbgUnregisterMsgCallback(glv_trace_packet_header* pHeader)
+{
+    struct_xglDbgUnregisterMsgCallback* pPacket = (struct_xglDbgUnregisterMsgCallback*)pHeader->pBody;
+    pPacket->pHeader = pHeader;
+    return pPacket;
+}
+
+typedef struct struct_xglDbgSetMessageFilter {
+    glv_trace_packet_header* pHeader;
+    XGL_DEVICE device;
+    int32_t msgCode;
+    XGL_DBG_MSG_FILTER filter;
+    XGL_RESULT result;
+} struct_xglDbgSetMessageFilter;
+
+static struct_xglDbgSetMessageFilter* interpret_body_as_xglDbgSetMessageFilter(glv_trace_packet_header* pHeader)
+{
+    struct_xglDbgSetMessageFilter* pPacket = (struct_xglDbgSetMessageFilter*)pHeader->pBody;
+    pPacket->pHeader = pHeader;
+    return pPacket;
+}
+
+typedef struct struct_xglDbgSetObjectTag {
+    glv_trace_packet_header* pHeader;
+    XGL_BASE_OBJECT object;
+    size_t tagSize;
+    const void* pTag;
+    XGL_RESULT result;
+} struct_xglDbgSetObjectTag;
+
+static struct_xglDbgSetObjectTag* interpret_body_as_xglDbgSetObjectTag(glv_trace_packet_header* pHeader)
+{
+    struct_xglDbgSetObjectTag* pPacket = (struct_xglDbgSetObjectTag*)pHeader->pBody;
+    pPacket->pHeader = pHeader;
+    pPacket->pTag = (const void*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pTag);
+    return pPacket;
+}
+
+typedef struct struct_xglDbgSetGlobalOption {
+    glv_trace_packet_header* pHeader;
+    XGL_DBG_GLOBAL_OPTION dbgOption;
+    size_t dataSize;
+    const void* pData;
+    XGL_RESULT result;
+} struct_xglDbgSetGlobalOption;
+
+static struct_xglDbgSetGlobalOption* interpret_body_as_xglDbgSetGlobalOption(glv_trace_packet_header* pHeader)
+{
+    struct_xglDbgSetGlobalOption* pPacket = (struct_xglDbgSetGlobalOption*)pHeader->pBody;
+    pPacket->pHeader = pHeader;
+    pPacket->pData = (const void*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pData);
+    return pPacket;
+}
+
+typedef struct struct_xglDbgSetDeviceOption {
+    glv_trace_packet_header* pHeader;
+    XGL_DEVICE device;
+    XGL_DBG_DEVICE_OPTION dbgOption;
+    size_t dataSize;
+    const void* pData;
+    XGL_RESULT result;
+} struct_xglDbgSetDeviceOption;
+
+static struct_xglDbgSetDeviceOption* interpret_body_as_xglDbgSetDeviceOption(glv_trace_packet_header* pHeader)
+{
+    struct_xglDbgSetDeviceOption* pPacket = (struct_xglDbgSetDeviceOption*)pHeader->pBody;
+    pPacket->pHeader = pHeader;
+    pPacket->pData = (const void*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pData);
+    return pPacket;
+}
+
+typedef struct struct_xglCmdDbgMarkerBegin {
+    glv_trace_packet_header* pHeader;
+    XGL_CMD_BUFFER cmdBuffer;
+    const char* pMarker;
+} struct_xglCmdDbgMarkerBegin;
+
+static struct_xglCmdDbgMarkerBegin* interpret_body_as_xglCmdDbgMarkerBegin(glv_trace_packet_header* pHeader)
+{
+    struct_xglCmdDbgMarkerBegin* pPacket = (struct_xglCmdDbgMarkerBegin*)pHeader->pBody;
+    pPacket->pHeader = pHeader;
+    pPacket->pMarker = (const char*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pMarker);
+    return pPacket;
+}
+
+typedef struct struct_xglCmdDbgMarkerEnd {
+    glv_trace_packet_header* pHeader;
+    XGL_CMD_BUFFER cmdBuffer;
+} struct_xglCmdDbgMarkerEnd;
+
+static struct_xglCmdDbgMarkerEnd* interpret_body_as_xglCmdDbgMarkerEnd(glv_trace_packet_header* pHeader)
+{
+    struct_xglCmdDbgMarkerEnd* pPacket = (struct_xglCmdDbgMarkerEnd*)pHeader->pBody;
+    pPacket->pHeader = pHeader;
+    return pPacket;
+}
+
diff --git a/tools/glave/src/glv_extensions/glvdebug_xgl/codegen/glvtrace_xgl_xglwsix11ext_structs.h b/tools/glave/src/glv_extensions/glvdebug_xgl/codegen/glvtrace_xgl_xglwsix11ext_structs.h
new file mode 100644
index 0000000..9dd4da1
--- /dev/null
+++ b/tools/glave/src/glv_extensions/glvdebug_xgl/codegen/glvtrace_xgl_xglwsix11ext_structs.h
@@ -0,0 +1,103 @@
+/* THIS FILE IS GENERATED.  DO NOT EDIT. */
+
+/*
+ * XGL
+ *
+ * Copyright (C) 2014 LunarG, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+#pragma once
+
+#if defined(PLATFORM_LINUX) || defined(XCB_NVIDIA)
+#include "xglWsiX11Ext.h"
+#else
+#include "xglWsiWinExt.h"
+#endif
+#include "glv_trace_packet_utils.h"
+
+
+typedef struct struct_xglWsiX11AssociateConnection {
+    glv_trace_packet_header* pHeader;
+    XGL_PHYSICAL_GPU gpu;
+    const XGL_WSI_X11_CONNECTION_INFO* pConnectionInfo;
+    XGL_RESULT result;
+} struct_xglWsiX11AssociateConnection;
+
+static struct_xglWsiX11AssociateConnection* interpret_body_as_xglWsiX11AssociateConnection(glv_trace_packet_header* pHeader)
+{
+    struct_xglWsiX11AssociateConnection* pPacket = (struct_xglWsiX11AssociateConnection*)pHeader->pBody;
+    pPacket->pHeader = pHeader;
+    pPacket->pConnectionInfo = (const XGL_WSI_X11_CONNECTION_INFO*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pConnectionInfo);
+    return pPacket;
+}
+
+typedef struct struct_xglWsiX11GetMSC {
+    glv_trace_packet_header* pHeader;
+    XGL_DEVICE device;
+    xcb_window_t window;
+    xcb_randr_crtc_t crtc;
+    uint64_t* pMsc;
+    XGL_RESULT result;
+} struct_xglWsiX11GetMSC;
+
+static struct_xglWsiX11GetMSC* interpret_body_as_xglWsiX11GetMSC(glv_trace_packet_header* pHeader)
+{
+    struct_xglWsiX11GetMSC* pPacket = (struct_xglWsiX11GetMSC*)pHeader->pBody;
+    pPacket->pHeader = pHeader;
+    pPacket->pMsc = (uint64_t*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pMsc);
+    return pPacket;
+}
+
+typedef struct struct_xglWsiX11CreatePresentableImage {
+    glv_trace_packet_header* pHeader;
+    XGL_DEVICE device;
+    const XGL_WSI_X11_PRESENTABLE_IMAGE_CREATE_INFO* pCreateInfo;
+    XGL_IMAGE* pImage;
+    XGL_GPU_MEMORY* pMem;
+    XGL_RESULT result;
+} struct_xglWsiX11CreatePresentableImage;
+
+static struct_xglWsiX11CreatePresentableImage* interpret_body_as_xglWsiX11CreatePresentableImage(glv_trace_packet_header* pHeader)
+{
+    struct_xglWsiX11CreatePresentableImage* pPacket = (struct_xglWsiX11CreatePresentableImage*)pHeader->pBody;
+    pPacket->pHeader = pHeader;
+    pPacket->pCreateInfo = (const XGL_WSI_X11_PRESENTABLE_IMAGE_CREATE_INFO*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pCreateInfo);
+    pPacket->pImage = (XGL_IMAGE*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pImage);
+    pPacket->pMem = (XGL_GPU_MEMORY*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pMem);
+    return pPacket;
+}
+
+typedef struct struct_xglWsiX11QueuePresent {
+    glv_trace_packet_header* pHeader;
+    XGL_QUEUE queue;
+    const XGL_WSI_X11_PRESENT_INFO* pPresentInfo;
+    XGL_FENCE fence;
+    XGL_RESULT result;
+} struct_xglWsiX11QueuePresent;
+
+static struct_xglWsiX11QueuePresent* interpret_body_as_xglWsiX11QueuePresent(glv_trace_packet_header* pHeader)
+{
+    struct_xglWsiX11QueuePresent* pPacket = (struct_xglWsiX11QueuePresent*)pHeader->pBody;
+    pPacket->pHeader = pHeader;
+    pPacket->pPresentInfo = (const XGL_WSI_X11_PRESENT_INFO*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pPresentInfo);
+    return pPacket;
+}
+
diff --git a/tools/glave/src/glv_extensions/glvreplay_xgl/CMakeLists.txt b/tools/glave/src/glv_extensions/glvreplay_xgl/CMakeLists.txt
index b497055..c7a1caf 100644
--- a/tools/glave/src/glv_extensions/glvreplay_xgl/CMakeLists.txt
+++ b/tools/glave/src/glv_extensions/glvreplay_xgl/CMakeLists.txt
@@ -7,17 +7,25 @@
 
 include_directories(${CMAKE_CURRENT_BINARY_DIR} ${SRC_DIR}/../../../include ${SRC_DIR}/../../../layers ${SRC_DIR}/glv_extensions/glvreplay_xgl)
 
-# This file is shared between replayer and tracer and are generated to each dir.  Should generate them to common area
-add_custom_command(OUTPUT glvtrace_xgl_packet_id.h xgl_enum_string_helper.h glvtrace_xgl_xgl_structs.h glvtrace_xgl_xglwsix11ext_structs.h glvtrace_xgl_xgldbg_structs.h glvreplay_xgl_replay.h glvreplay_xgl_replay.cpp
-        COMMAND ${PYTHON_CMD} ${SRC_DIR}/../../../glave-generate.py glave-packet-id > glvtrace_xgl_packet_id.h
-        COMMAND ${PYTHON_CMD} ${SRC_DIR}/../../../glave-generate.py glave-core-structs > glvtrace_xgl_xgl_structs.h
-        COMMAND ${PYTHON_CMD} ${SRC_DIR}/../../../glave-generate.py glave-wsi-trace-structs > glvtrace_xgl_xglwsix11ext_structs.h
-        COMMAND ${PYTHON_CMD} ${SRC_DIR}/../../../glave-generate.py glave-dbg-trace-structs > glvtrace_xgl_xgldbg_structs.h
-        COMMAND ${PYTHON_CMD} ${SRC_DIR}/../../../glave-generate.py glave-replay-h > glvreplay_xgl_replay.h
-        COMMAND ${PYTHON_CMD} ${SRC_DIR}/../../../glave-generate.py glave-replay-c > glvreplay_xgl_replay.cpp
-        COMMAND ${PYTHON_CMD} ${SRC_DIR}/../../../xgl_helper.py --gen_enum_string_helper ${SRC_DIR}/../../../include/xgl.h --abs_out_dir ${CMAKE_CURRENT_BINARY_DIR}
-	           DEPENDS ${SRC_DIR}/../../../glave-generate.py
-	                   ${SRC_DIR}/../../../xgl_helper.py)
+file(MAKE_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/codegen)
+
+add_custom_command(OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/codegen/glvtrace_xgl_packet_id.h
+                          ${CMAKE_CURRENT_SOURCE_DIR}/codegen/xgl_enum_string_helper.h
+                          ${CMAKE_CURRENT_SOURCE_DIR}/codegen/glvtrace_xgl_xgl_structs.h
+                          ${CMAKE_CURRENT_SOURCE_DIR}/codegen/glvtrace_xgl_xglwsix11ext_structs.h
+                          ${CMAKE_CURRENT_SOURCE_DIR}/codegen/glvtrace_xgl_xgldbg_structs.h
+                          ${CMAKE_CURRENT_SOURCE_DIR}/codegen/glvreplay_xgl_replay.h
+                          ${CMAKE_CURRENT_SOURCE_DIR}/codegen/glvreplay_xgl_replay.cpp
+        COMMAND ${PYTHON_CMD} ${SRC_DIR}/../scripts/vk_generate.py glave-packet-id > glvtrace_xgl_packet_id.h
+        COMMAND ${PYTHON_CMD} ${SRC_DIR}/../scripts/vk_generate.py glave-core-structs > glvtrace_xgl_xgl_structs.h
+        COMMAND ${PYTHON_CMD} ${SRC_DIR}/../scripts/vk_generate.py glave-wsi-trace-structs > glvtrace_xgl_xglwsix11ext_structs.h
+        COMMAND ${PYTHON_CMD} ${SRC_DIR}/../scripts/vk_generate.py glave-dbg-trace-structs > glvtrace_xgl_xgldbg_structs.h
+        COMMAND ${PYTHON_CMD} ${SRC_DIR}/../scripts/vk_generate.py glave-replay-h > glvreplay_xgl_replay.h
+        COMMAND ${PYTHON_CMD} ${SRC_DIR}/../scripts/vk_generate.py glave-replay-c > glvreplay_xgl_replay.cpp
+        COMMAND ${PYTHON_CMD} ${SRC_DIR}/../../../xgl_helper.py --gen_enum_string_helper ${SRC_DIR}/../../../include/xgl.h --abs_out_dir ${CMAKE_CURRENT_SOURCE_DIR}/codegen
+                   DEPENDS ${SRC_DIR}/../scripts/vk_generate.py
+                           ${SRC_DIR}/../../../xgl_helper.py
+                   WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/codegen)
 
 if (${CMAKE_SYSTEM_NAME} MATCHES "Windows")
     set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DXCB_NVIDIA")
@@ -40,21 +48,22 @@
     ${SRC_LIST}
     glvreplay_xgl.cpp
     glvreplay_xgl_settings.cpp
-    glvreplay_xgl_replay.cpp
+    codegen/glvreplay_xgl_replay.cpp
 )
 
 set (HDR_LIST
-    glvtrace_xgl_packet_id.h
-    glvtrace_xgl_xgl_structs.h
-    glvtrace_xgl_xglwsix11ext_structs.h
-    glvtrace_xgl_xgldbg_structs.h
-    xgl_enum_string_helper.h
+    codegen/glvtrace_xgl_packet_id.h
+    codegen/glvtrace_xgl_xgl_structs.h
+    codegen/glvtrace_xgl_xglwsix11ext_structs.h
+    codegen/glvtrace_xgl_xgldbg_structs.h
+    codegen/xgl_enum_string_helper.h
     glvreplay_xgl.h
     glvreplay_xgl_settings.h
-    glvreplay_xgl_replay.h
+    codegen/glvreplay_xgl_replay.h
 )
 
 include_directories(
+    codegen
     ${SRC_DIR}/glvreplay
     ${SRC_DIR}/glvcommon
     ${SRC_DIR}/thirdparty
diff --git a/tools/glave/src/glv_extensions/glvreplay_xgl/codegen/glvreplay_xgl_replay.cpp b/tools/glave/src/glv_extensions/glvreplay_xgl/codegen/glvreplay_xgl_replay.cpp
new file mode 100644
index 0000000..fb6a2fb
--- /dev/null
+++ b/tools/glave/src/glv_extensions/glvreplay_xgl/codegen/glvreplay_xgl_replay.cpp
@@ -0,0 +1,2379 @@
+/* THIS FILE IS GENERATED.  DO NOT EDIT. */
+
+/*
+ * XGL
+ *
+ * Copyright (C) 2014 LunarG, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+#include "glvreplay_xgl_replay.h"
+
+#include "glvreplay_xgl.h"
+
+#include "glvreplay_xgl_write_ppm.h"
+
+#include "glvreplay_main.h"
+
+#include <algorithm>
+#include <queue>
+glvreplay_settings *g_pReplaySettings;
+extern "C" {
+#include "glvtrace_xgl_xgl_structs.h"
+#include "glvtrace_xgl_xgldbg_structs.h"
+#include "glvtrace_xgl_xglwsix11ext_structs.h"
+#include "glvtrace_xgl_packet_id.h"
+#include "xgl_enum_string_helper.h"
+}
+
+#define APP_NAME "glvreplay_xgl"
+#define IDI_ICON 101
+
+static const char* g_extensions[] =
+{
+        "XGL_WSI_WINDOWS",
+        "XGL_TIMER_QUEUE",
+        "XGL_GPU_TIMESTAMP_CALIBRATION",
+        "XGL_DMA_QUEUE",
+        "XGL_COMMAND_BUFFER_CONTROL_FLOW",
+        "XGL_COPY_OCCLUSION_QUERY_DATA",
+        "XGL_ADVANCED_MULTISAMPLING",
+        "XGL_BORDER_COLOR_PALETTE"
+};
+
+XGL_RESULT xglDisplay::init_xgl(unsigned int gpu_idx)
+{
+#if 0
+    XGL_APPLICATION_INFO appInfo = {};
+    appInfo.pAppName = APP_NAME;
+    appInfo.pEngineName = "";
+    appInfo.apiVersion = XGL_API_VERSION;
+    XGL_RESULT res = xglInitAndEnumerateGpus(&appInfo, NULL, XGL_MAX_PHYSICAL_GPUS, &m_gpuCount, m_gpus);
+    if ( res == XGL_SUCCESS ) {
+        // retrieve the GPU information for all GPUs
+        for( uint32_t gpu = 0; gpu < m_gpuCount; gpu++)
+        {
+            size_t gpuInfoSize = sizeof(m_gpuProps[0]);
+
+            // get the GPU physical properties:
+            res = xglGetGpuInfo( m_gpus[gpu], XGL_INFO_TYPE_PHYSICAL_GPU_PROPERTIES, &gpuInfoSize, &m_gpuProps[gpu]);
+            if (res != XGL_SUCCESS)
+                glv_LogWarn("Failed to retrieve properties for gpu[%d] result %d\n", gpu, res);
+        }
+        res = XGL_SUCCESS;
+    } else if ((gpu_idx + 1) > m_gpuCount) {
+        glv_LogError("xglInitAndEnumerate number of gpus does not include requested index: num %d, requested %d\n", m_gpuCount, gpu_idx);
+        return -1;
+    } else {
+        glv_LogError("xglInitAndEnumerate failed\n");
+        return res;
+    }
+    // TODO add multi-gpu support always use gpu[gpu_idx] for now
+    // get all extensions supported by this device gpu[gpu_idx]
+    // first check if extensions are available and save a list of them
+    bool foundWSIExt = false;
+    for( int ext = 0; ext < sizeof( extensions ) / sizeof( extensions[0] ); ext++)
+    {
+        res = xglGetExtensionSupport( m_gpus[gpu_idx], extensions[ext] );
+        if (res == XGL_SUCCESS) {
+            m_extensions.push_back((char *) extensions[ext]);
+            if (!strcmp(extensions[ext], "XGL_WSI_WINDOWS"))
+                foundWSIExt = true;
+        }
+    }
+    if (!foundWSIExt) {
+        glv_LogError("XGL_WSI_WINDOWS extension not supported by gpu[%d]\n", gpu_idx);
+        return XGL_ERROR_INCOMPATIBLE_DEVICE;
+    }
+    // TODO generalize this: use one universal queue for now
+    XGL_DEVICE_QUEUE_CREATE_INFO dqci = {};
+    dqci.queueCount = 1;
+    dqci.queueType = XGL_QUEUE_UNIVERSAL;
+    // create the device enabling validation level 4
+    const char * const * extNames = &m_extensions[0];
+    XGL_DEVICE_CREATE_INFO info = {};
+    info.queueRecordCount = 1;
+    info.pRequestedQueues = &dqci;
+    info.extensionCount = static_cast <uint32_t> (m_extensions.size());
+    info.ppEnabledExtensionNames = extNames;
+    info.flags = XGL_DEVICE_CREATE_VALIDATION;
+    info.maxValidationLevel = XGL_VALIDATION_LEVEL_4;
+    bool32_t xglTrue = XGL_TRUE;
+    res = xglDbgSetGlobalOption( XGL_DBG_OPTION_BREAK_ON_ERROR, sizeof( xglTrue ), &xglTrue );
+    if (res != XGL_SUCCESS)
+        glv_LogWarn("Could not set debug option break on error\n");
+    res = xglCreateDevice( m_gpus[0], &info, &m_dev[gpu_idx]);
+    return res;
+#else
+    return XGL_ERROR_INITIALIZATION_FAILED;
+#endif
+}
+int xglDisplay::init(const unsigned int gpu_idx)
+{
+    //m_gpuIdx = gpu_idx;
+#if 0
+    XGL_RESULT result = init_xgl(gpu_idx);
+    if (result != XGL_SUCCESS) {
+        glv_LogError("could not init xgl library");
+        return -1;
+    } else {
+        m_initedXGL = true;
+    }
+#endif
+#if defined(PLATFORM_LINUX) || defined(XCB_NVIDIA)
+    const xcb_setup_t *setup;
+    xcb_screen_iterator_t iter;
+    int scr;
+    xcb_connection_t *pConnection;
+    pConnection = xcb_connect(NULL, &scr);
+    setup = xcb_get_setup(pConnection);
+    iter = xcb_setup_roots_iterator(setup);
+    while (scr-- > 0)
+        xcb_screen_next(&iter);
+    m_pXcbScreen = iter.data;
+    m_WsiConnection.pConnection = pConnection;
+    m_WsiConnection.root = m_pXcbScreen->root;
+#endif
+    return 0;
+}
+xglDisplay::xglDisplay()
+    : m_initedXGL(false),
+    m_windowWidth(0),
+    m_windowHeight(0)
+{
+#if defined(PLATFORM_LINUX) || defined(XCB_NVIDIA)
+    m_WsiConnection.pConnection = NULL;
+    m_WsiConnection.root = 0;
+    m_WsiConnection.provider = 0;
+    m_pXcbScreen = NULL;
+    m_XcbWindow = 0;
+#elif defined(WIN32)
+    m_windowHandle = NULL;
+#endif
+}
+xglDisplay::~xglDisplay()
+{
+#if defined(PLATFORM_LINUX) || defined(XCB_NVIDIA)
+    if (m_XcbWindow != 0)
+    {
+        xcb_destroy_window(m_WsiConnection.pConnection, m_XcbWindow);
+    }
+    if (m_WsiConnection.pConnection != NULL)
+    {
+        xcb_disconnect(m_WsiConnection.pConnection);
+    }
+#endif
+}
+#if defined(WIN32)
+LRESULT WINAPI WindowProcXgl( HWND window, unsigned int msg, WPARAM wp, LPARAM lp)
+{
+    switch(msg)
+    {
+        case WM_CLOSE:
+            DestroyWindow( window);
+            // fall-thru
+        case WM_DESTROY:
+            PostQuitMessage(0) ;
+            return 0L ;
+        default:
+            return DefWindowProc( window, msg, wp, lp ) ;
+    }
+}
+#endif
+int xglDisplay::set_window(glv_window_handle hWindow, unsigned int width, unsigned int height)
+{
+#if defined(PLATFORM_LINUX) || defined(XCB_NVIDIA)
+    m_XcbWindow = hWindow;
+#elif defined(WIN32)
+    m_windowHandle = hWindow;
+#endif
+    m_windowWidth = width;
+    m_windowHeight = height;
+    return 0;
+}
+
+int xglDisplay::create_window(const unsigned int width, const unsigned int height)
+{
+#if defined(PLATFORM_LINUX) || defined(XCB_NVIDIA)
+
+    uint32_t value_mask, value_list[32];
+    m_XcbWindow = xcb_generate_id(m_WsiConnection.pConnection);
+
+    value_mask = XCB_CW_BACK_PIXEL | XCB_CW_EVENT_MASK;
+    value_list[0] = m_pXcbScreen->black_pixel;
+    value_list[1] = XCB_EVENT_MASK_KEY_RELEASE |
+                    XCB_EVENT_MASK_EXPOSURE;
+
+    xcb_create_window(m_WsiConnection.pConnection,
+            XCB_COPY_FROM_PARENT,
+            m_XcbWindow, m_WsiConnection.root,
+            0, 0, width, height, 0,
+            XCB_WINDOW_CLASS_INPUT_OUTPUT,
+            m_pXcbScreen->root_visual,
+            value_mask, value_list);
+
+    xcb_map_window(m_WsiConnection.pConnection, m_XcbWindow);
+    xcb_flush(m_WsiConnection.pConnection);
+    return 0;
+#elif defined(WIN32)
+    // Register Window class
+    WNDCLASSEX wcex = {};
+    wcex.cbSize = sizeof( WNDCLASSEX);
+    wcex.style = CS_HREDRAW | CS_VREDRAW;
+    wcex.lpfnWndProc = WindowProcXgl;
+    wcex.cbClsExtra = 0;
+    wcex.cbWndExtra = 0;
+    wcex.hInstance = GetModuleHandle(0);
+    wcex.hIcon = LoadIcon(wcex.hInstance, MAKEINTRESOURCE( IDI_ICON));
+    wcex.hCursor = LoadCursor( NULL, IDC_ARROW);
+    wcex.hbrBackground = ( HBRUSH )( COLOR_WINDOW + 1);
+    wcex.lpszMenuName = NULL;
+    wcex.lpszClassName = APP_NAME;
+    wcex.hIconSm = LoadIcon( wcex.hInstance, MAKEINTRESOURCE( IDI_ICON));
+    if( !RegisterClassEx( &wcex))
+    {
+        glv_LogError("Failed to register windows class\n");
+        return -1;
+    }
+
+    // create the window
+    m_windowHandle = CreateWindow(APP_NAME, APP_NAME, WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU, 0, 0,
+                          width, height, NULL, NULL, wcex.hInstance, NULL);
+
+    if (m_windowHandle)
+    {
+        ShowWindow( m_windowHandle, SW_SHOWDEFAULT);
+        m_windowWidth = width;
+        m_windowHeight = height;
+    } else {
+        glv_LogError("Failed to create window\n");
+        return -1;
+    }
+    return 0;
+#endif
+}
+
+void xglDisplay::resize_window(const unsigned int width, const unsigned int height)
+{
+#if defined(PLATFORM_LINUX) || defined(XCB_NVIDIA)
+    if (width != m_windowWidth || height != m_windowHeight)
+    {
+        uint32_t values[2];
+        values[0] = width;
+        values[1] = height;
+        xcb_configure_window(m_WsiConnection.pConnection, m_XcbWindow, XCB_CONFIG_WINDOW_WIDTH | XCB_CONFIG_WINDOW_HEIGHT, values);
+        m_windowWidth = width;
+        m_windowHeight = height;
+    }
+#elif defined(WIN32)
+    if (width != m_windowWidth || height != m_windowHeight)
+    {
+        SetWindowPos(get_window_handle(), HWND_TOP, 0, 0, width, height, SWP_NOMOVE);
+        m_windowWidth = width;
+        m_windowHeight = height;
+    }
+#endif
+}
+
+void xglDisplay::process_event()
+{
+}
+
+void objMemory::setCount(const uint32_t num)
+{
+    m_numAllocations = num;
+}
+
+void objMemory::setReqs(const XGL_MEMORY_REQUIREMENTS *pReqs, const uint32_t num)
+{
+    if (m_numAllocations != num && m_numAllocations != 0)
+        glv_LogError("objMemory::setReqs, internal mismatch on number of allocations");
+    if (m_pMemReqs == NULL && pReqs != NULL)
+    {
+        m_pMemReqs = (XGL_MEMORY_REQUIREMENTS *) glv_malloc(num * sizeof(XGL_MEMORY_REQUIREMENTS));
+        if (m_pMemReqs == NULL)
+        {
+            glv_LogError("objMemory::setReqs out of memory");
+            return;
+        }
+        memcpy(m_pMemReqs, pReqs, num);
+    }
+}
+
+    // memory mapping functions for app writes into mapped memory
+    bool gpuMemory::isPendingAlloc()
+    {
+        return m_pendingAlloc;
+    }
+
+    void gpuMemory::setAllocInfo(const XGL_MEMORY_ALLOC_INFO *info, const bool pending)
+    {
+        m_pendingAlloc = pending;
+        m_allocInfo = *info;
+    }
+
+    void gpuMemory::setMemoryDataAddr(void *pBuf)
+    {
+        if (m_mapRange.empty())
+        {
+            glv_LogError("gpuMemory::setMemoryDataAddr() m_mapRange is empty\n");
+            return;
+        }
+        struct mapRange mr = m_mapRange.back();
+        if (mr.pData != NULL)
+            glv_LogWarn("gpuMemory::setMemoryDataAddr() data already mapped overwrite old mapping\n");
+        else if (pBuf == NULL)
+            glv_LogWarn("gpuMemory::setMemoryDataAddr() adding NULL pointer\n");
+        mr.pData = pBuf;
+    }
+
+    void gpuMemory::setMemoryMapRange(void *pBuf, const size_t size, const size_t offset, const bool pending)
+    {
+        struct mapRange mr;
+        mr.pData = pBuf;
+        mr.size = size;
+        mr.offset = offset;
+        mr.pending = pending;
+        m_mapRange.push_back(mr);
+    }
+
+    void gpuMemory::copyMappingData(const void* pSrcData)
+    {
+        if (m_mapRange.empty())
+        {
+            glv_LogError("gpuMemory::copyMappingData() m_mapRange is empty\n");
+            return;
+        }
+        struct mapRange mr = m_mapRange.back();
+        if (!pSrcData || !mr.pData)
+        {
+            if (!pSrcData)
+                glv_LogError("gpuMemory::copyMappingData() null src pointer\n");
+            else
+                glv_LogError("gpuMemory::copyMappingData() null dest pointer size=%u\n", m_allocInfo.allocationSize);
+            m_mapRange.pop_back();
+            return;
+        }
+        memcpy(mr.pData, pSrcData, m_allocInfo.allocationSize);
+        if (!mr.pending)
+          m_mapRange.pop_back();
+    }
+
+    size_t gpuMemory::getMemoryMapSize()
+    {
+        return (!m_mapRange.empty()) ? m_mapRange.back().size : 0;
+    }
+
+xglReplay::xglReplay(glvreplay_settings *pReplaySettings)
+{
+    g_pReplaySettings = pReplaySettings;
+    m_display = new xglDisplay();
+    m_pDSDump = NULL;
+    m_pCBDump = NULL;
+    m_adjustForGPU = false;
+    if (g_pReplaySettings && g_pReplaySettings->screenshotList) {
+        process_screenshot_list(g_pReplaySettings->screenshotList);
+    }
+}
+
+xglReplay::~xglReplay()
+{
+    delete m_display;
+    glv_platform_close_library(m_xglFuncs.m_libHandle);
+}
+int xglReplay::init(glv_replay::Display & disp)
+{
+    int err;
+#if defined PLATFORM_LINUX
+    void * handle = dlopen("libXGL.so", RTLD_LAZY);
+#else
+    HMODULE handle = LoadLibrary("xgl.dll" );
+#endif
+
+    if (handle == NULL) {
+        glv_LogError("Failed to open xgl library.\n");
+        return -1;
+    }
+    m_xglFuncs.init_funcs(handle);
+    disp.set_implementation(m_display);
+    if ((err = m_display->init(disp.get_gpu())) != 0) {
+        glv_LogError("Failed to init XGL display.\n");
+        return err;
+    }
+    if (disp.get_window_handle() == 0)
+    {
+        if ((err = m_display->create_window(disp.get_width(), disp.get_height())) != 0) {
+            glv_LogError("Failed to create Window\n");
+            return err;
+        }
+    }
+    else
+    {
+        if ((err = m_display->set_window(disp.get_window_handle(), disp.get_width(), disp.get_height())) != 0)
+        {
+            glv_LogError("Failed to set Window\n");
+            return err;
+        }
+    }
+    return 0;
+}
+glv_replay::GLV_REPLAY_RESULT xglReplay::handle_replay_errors(const char* entrypointName, const XGL_RESULT resCall, const XGL_RESULT resTrace, const glv_replay::GLV_REPLAY_RESULT resIn)
+{
+    glv_replay::GLV_REPLAY_RESULT res = resIn;
+    if (resCall != resTrace) {
+        glv_LogWarn("Mismatched return from API call (%s) traced result %s, replay result %s\n", entrypointName,
+                string_XGL_RESULT((XGL_RESULT)resTrace), string_XGL_RESULT((XGL_RESULT)resCall));
+        res = glv_replay::GLV_REPLAY_BAD_RETURN;
+    }
+#if 0
+    if (resCall != XGL_SUCCESS) {
+        glv_LogWarn("API call (%s) returned failed result %s\n", entrypointName, string_XGL_RESULT(resCall));
+    }
+#endif
+    return res;
+}
+void xglReplay::push_validation_msg(XGL_VALIDATION_LEVEL validationLevel, XGL_BASE_OBJECT srcObject, size_t location, int32_t msgCode, const char * pMsg)
+{
+    struct validationMsg msgObj;
+    msgObj.validationLevel = validationLevel;
+    msgObj.srcObject = srcObject;
+    msgObj.location = location;
+    msgObj.msgCode = msgCode;
+    strncpy(msgObj.msg, pMsg, 256);
+    msgObj.msg[255] = '\0';
+    m_validationMsgs.push_back(msgObj);
+}
+
+glv_replay::GLV_REPLAY_RESULT xglReplay::pop_validation_msgs()
+{
+    if (m_validationMsgs.size() == 0)
+        return glv_replay::GLV_REPLAY_SUCCESS;
+    m_validationMsgs.clear();
+    return glv_replay::GLV_REPLAY_VALIDATION_ERROR;
+}
+int xglReplay::dump_validation_data()
+{
+   if  (!m_pDSDump || !m_pCBDump)
+   {
+       return -1;
+   }
+   m_pDSDump((char *) "pipeline_dump.dot");
+   m_pCBDump((char *) "cb_dump.dot");
+   return 0;
+}
+void xglFuncs::init_funcs(void * handle)
+{
+    m_libHandle = handle;
+    real_xglCreateInstance = (type_xglCreateInstance)(glv_platform_get_library_entrypoint(handle, "xglCreateInstance"));
+    real_xglDestroyInstance = (type_xglDestroyInstance)(glv_platform_get_library_entrypoint(handle, "xglDestroyInstance"));
+    real_xglEnumerateGpus = (type_xglEnumerateGpus)(glv_platform_get_library_entrypoint(handle, "xglEnumerateGpus"));
+    real_xglGetGpuInfo = (type_xglGetGpuInfo)(glv_platform_get_library_entrypoint(handle, "xglGetGpuInfo"));
+    real_xglGetProcAddr = (type_xglGetProcAddr)(glv_platform_get_library_entrypoint(handle, "xglGetProcAddr"));
+    real_xglCreateDevice = (type_xglCreateDevice)(glv_platform_get_library_entrypoint(handle, "xglCreateDevice"));
+    real_xglDestroyDevice = (type_xglDestroyDevice)(glv_platform_get_library_entrypoint(handle, "xglDestroyDevice"));
+    real_xglGetExtensionSupport = (type_xglGetExtensionSupport)(glv_platform_get_library_entrypoint(handle, "xglGetExtensionSupport"));
+    real_xglEnumerateLayers = (type_xglEnumerateLayers)(glv_platform_get_library_entrypoint(handle, "xglEnumerateLayers"));
+    real_xglGetDeviceQueue = (type_xglGetDeviceQueue)(glv_platform_get_library_entrypoint(handle, "xglGetDeviceQueue"));
+    real_xglQueueSubmit = (type_xglQueueSubmit)(glv_platform_get_library_entrypoint(handle, "xglQueueSubmit"));
+    real_xglQueueSetGlobalMemReferences = (type_xglQueueSetGlobalMemReferences)(glv_platform_get_library_entrypoint(handle, "xglQueueSetGlobalMemReferences"));
+    real_xglQueueWaitIdle = (type_xglQueueWaitIdle)(glv_platform_get_library_entrypoint(handle, "xglQueueWaitIdle"));
+    real_xglDeviceWaitIdle = (type_xglDeviceWaitIdle)(glv_platform_get_library_entrypoint(handle, "xglDeviceWaitIdle"));
+    real_xglAllocMemory = (type_xglAllocMemory)(glv_platform_get_library_entrypoint(handle, "xglAllocMemory"));
+    real_xglFreeMemory = (type_xglFreeMemory)(glv_platform_get_library_entrypoint(handle, "xglFreeMemory"));
+    real_xglSetMemoryPriority = (type_xglSetMemoryPriority)(glv_platform_get_library_entrypoint(handle, "xglSetMemoryPriority"));
+    real_xglMapMemory = (type_xglMapMemory)(glv_platform_get_library_entrypoint(handle, "xglMapMemory"));
+    real_xglUnmapMemory = (type_xglUnmapMemory)(glv_platform_get_library_entrypoint(handle, "xglUnmapMemory"));
+    real_xglPinSystemMemory = (type_xglPinSystemMemory)(glv_platform_get_library_entrypoint(handle, "xglPinSystemMemory"));
+    real_xglGetMultiGpuCompatibility = (type_xglGetMultiGpuCompatibility)(glv_platform_get_library_entrypoint(handle, "xglGetMultiGpuCompatibility"));
+    real_xglOpenSharedMemory = (type_xglOpenSharedMemory)(glv_platform_get_library_entrypoint(handle, "xglOpenSharedMemory"));
+    real_xglOpenSharedQueueSemaphore = (type_xglOpenSharedQueueSemaphore)(glv_platform_get_library_entrypoint(handle, "xglOpenSharedQueueSemaphore"));
+    real_xglOpenPeerMemory = (type_xglOpenPeerMemory)(glv_platform_get_library_entrypoint(handle, "xglOpenPeerMemory"));
+    real_xglOpenPeerImage = (type_xglOpenPeerImage)(glv_platform_get_library_entrypoint(handle, "xglOpenPeerImage"));
+    real_xglDestroyObject = (type_xglDestroyObject)(glv_platform_get_library_entrypoint(handle, "xglDestroyObject"));
+    real_xglGetObjectInfo = (type_xglGetObjectInfo)(glv_platform_get_library_entrypoint(handle, "xglGetObjectInfo"));
+    real_xglBindObjectMemory = (type_xglBindObjectMemory)(glv_platform_get_library_entrypoint(handle, "xglBindObjectMemory"));
+    real_xglBindObjectMemoryRange = (type_xglBindObjectMemoryRange)(glv_platform_get_library_entrypoint(handle, "xglBindObjectMemoryRange"));
+    real_xglBindImageMemoryRange = (type_xglBindImageMemoryRange)(glv_platform_get_library_entrypoint(handle, "xglBindImageMemoryRange"));
+    real_xglCreateFence = (type_xglCreateFence)(glv_platform_get_library_entrypoint(handle, "xglCreateFence"));
+    real_xglGetFenceStatus = (type_xglGetFenceStatus)(glv_platform_get_library_entrypoint(handle, "xglGetFenceStatus"));
+    real_xglWaitForFences = (type_xglWaitForFences)(glv_platform_get_library_entrypoint(handle, "xglWaitForFences"));
+    real_xglCreateQueueSemaphore = (type_xglCreateQueueSemaphore)(glv_platform_get_library_entrypoint(handle, "xglCreateQueueSemaphore"));
+    real_xglSignalQueueSemaphore = (type_xglSignalQueueSemaphore)(glv_platform_get_library_entrypoint(handle, "xglSignalQueueSemaphore"));
+    real_xglWaitQueueSemaphore = (type_xglWaitQueueSemaphore)(glv_platform_get_library_entrypoint(handle, "xglWaitQueueSemaphore"));
+    real_xglCreateEvent = (type_xglCreateEvent)(glv_platform_get_library_entrypoint(handle, "xglCreateEvent"));
+    real_xglGetEventStatus = (type_xglGetEventStatus)(glv_platform_get_library_entrypoint(handle, "xglGetEventStatus"));
+    real_xglSetEvent = (type_xglSetEvent)(glv_platform_get_library_entrypoint(handle, "xglSetEvent"));
+    real_xglResetEvent = (type_xglResetEvent)(glv_platform_get_library_entrypoint(handle, "xglResetEvent"));
+    real_xglCreateQueryPool = (type_xglCreateQueryPool)(glv_platform_get_library_entrypoint(handle, "xglCreateQueryPool"));
+    real_xglGetQueryPoolResults = (type_xglGetQueryPoolResults)(glv_platform_get_library_entrypoint(handle, "xglGetQueryPoolResults"));
+    real_xglGetFormatInfo = (type_xglGetFormatInfo)(glv_platform_get_library_entrypoint(handle, "xglGetFormatInfo"));
+    real_xglCreateBuffer = (type_xglCreateBuffer)(glv_platform_get_library_entrypoint(handle, "xglCreateBuffer"));
+    real_xglCreateBufferView = (type_xglCreateBufferView)(glv_platform_get_library_entrypoint(handle, "xglCreateBufferView"));
+    real_xglCreateImage = (type_xglCreateImage)(glv_platform_get_library_entrypoint(handle, "xglCreateImage"));
+    real_xglSetFastClearColor = (type_xglSetFastClearColor)(glv_platform_get_library_entrypoint(handle, "xglSetFastClearColor"));
+    real_xglSetFastClearDepth = (type_xglSetFastClearDepth)(glv_platform_get_library_entrypoint(handle, "xglSetFastClearDepth"));
+    real_xglGetImageSubresourceInfo = (type_xglGetImageSubresourceInfo)(glv_platform_get_library_entrypoint(handle, "xglGetImageSubresourceInfo"));
+    real_xglCreateImageView = (type_xglCreateImageView)(glv_platform_get_library_entrypoint(handle, "xglCreateImageView"));
+    real_xglCreateColorAttachmentView = (type_xglCreateColorAttachmentView)(glv_platform_get_library_entrypoint(handle, "xglCreateColorAttachmentView"));
+    real_xglCreateDepthStencilView = (type_xglCreateDepthStencilView)(glv_platform_get_library_entrypoint(handle, "xglCreateDepthStencilView"));
+    real_xglCreateShader = (type_xglCreateShader)(glv_platform_get_library_entrypoint(handle, "xglCreateShader"));
+    real_xglCreateGraphicsPipeline = (type_xglCreateGraphicsPipeline)(glv_platform_get_library_entrypoint(handle, "xglCreateGraphicsPipeline"));
+    real_xglCreateComputePipeline = (type_xglCreateComputePipeline)(glv_platform_get_library_entrypoint(handle, "xglCreateComputePipeline"));
+    real_xglStorePipeline = (type_xglStorePipeline)(glv_platform_get_library_entrypoint(handle, "xglStorePipeline"));
+    real_xglLoadPipeline = (type_xglLoadPipeline)(glv_platform_get_library_entrypoint(handle, "xglLoadPipeline"));
+    real_xglCreatePipelineDelta = (type_xglCreatePipelineDelta)(glv_platform_get_library_entrypoint(handle, "xglCreatePipelineDelta"));
+    real_xglCreateSampler = (type_xglCreateSampler)(glv_platform_get_library_entrypoint(handle, "xglCreateSampler"));
+    real_xglCreateDescriptorSetLayout = (type_xglCreateDescriptorSetLayout)(glv_platform_get_library_entrypoint(handle, "xglCreateDescriptorSetLayout"));
+    real_xglBeginDescriptorRegionUpdate = (type_xglBeginDescriptorRegionUpdate)(glv_platform_get_library_entrypoint(handle, "xglBeginDescriptorRegionUpdate"));
+    real_xglEndDescriptorRegionUpdate = (type_xglEndDescriptorRegionUpdate)(glv_platform_get_library_entrypoint(handle, "xglEndDescriptorRegionUpdate"));
+    real_xglCreateDescriptorRegion = (type_xglCreateDescriptorRegion)(glv_platform_get_library_entrypoint(handle, "xglCreateDescriptorRegion"));
+    real_xglClearDescriptorRegion = (type_xglClearDescriptorRegion)(glv_platform_get_library_entrypoint(handle, "xglClearDescriptorRegion"));
+    real_xglAllocDescriptorSets = (type_xglAllocDescriptorSets)(glv_platform_get_library_entrypoint(handle, "xglAllocDescriptorSets"));
+    real_xglClearDescriptorSets = (type_xglClearDescriptorSets)(glv_platform_get_library_entrypoint(handle, "xglClearDescriptorSets"));
+    real_xglUpdateDescriptors = (type_xglUpdateDescriptors)(glv_platform_get_library_entrypoint(handle, "xglUpdateDescriptors"));
+    real_xglCreateDynamicViewportState = (type_xglCreateDynamicViewportState)(glv_platform_get_library_entrypoint(handle, "xglCreateDynamicViewportState"));
+    real_xglCreateDynamicRasterState = (type_xglCreateDynamicRasterState)(glv_platform_get_library_entrypoint(handle, "xglCreateDynamicRasterState"));
+    real_xglCreateDynamicColorBlendState = (type_xglCreateDynamicColorBlendState)(glv_platform_get_library_entrypoint(handle, "xglCreateDynamicColorBlendState"));
+    real_xglCreateDynamicDepthStencilState = (type_xglCreateDynamicDepthStencilState)(glv_platform_get_library_entrypoint(handle, "xglCreateDynamicDepthStencilState"));
+    real_xglCreateCommandBuffer = (type_xglCreateCommandBuffer)(glv_platform_get_library_entrypoint(handle, "xglCreateCommandBuffer"));
+    real_xglBeginCommandBuffer = (type_xglBeginCommandBuffer)(glv_platform_get_library_entrypoint(handle, "xglBeginCommandBuffer"));
+    real_xglEndCommandBuffer = (type_xglEndCommandBuffer)(glv_platform_get_library_entrypoint(handle, "xglEndCommandBuffer"));
+    real_xglResetCommandBuffer = (type_xglResetCommandBuffer)(glv_platform_get_library_entrypoint(handle, "xglResetCommandBuffer"));
+    real_xglCmdBindPipeline = (type_xglCmdBindPipeline)(glv_platform_get_library_entrypoint(handle, "xglCmdBindPipeline"));
+    real_xglCmdBindPipelineDelta = (type_xglCmdBindPipelineDelta)(glv_platform_get_library_entrypoint(handle, "xglCmdBindPipelineDelta"));
+    real_xglCmdBindDynamicStateObject = (type_xglCmdBindDynamicStateObject)(glv_platform_get_library_entrypoint(handle, "xglCmdBindDynamicStateObject"));
+    real_xglCmdBindDescriptorSet = (type_xglCmdBindDescriptorSet)(glv_platform_get_library_entrypoint(handle, "xglCmdBindDescriptorSet"));
+    real_xglCmdBindVertexBuffer = (type_xglCmdBindVertexBuffer)(glv_platform_get_library_entrypoint(handle, "xglCmdBindVertexBuffer"));
+    real_xglCmdBindIndexBuffer = (type_xglCmdBindIndexBuffer)(glv_platform_get_library_entrypoint(handle, "xglCmdBindIndexBuffer"));
+    real_xglCmdDraw = (type_xglCmdDraw)(glv_platform_get_library_entrypoint(handle, "xglCmdDraw"));
+    real_xglCmdDrawIndexed = (type_xglCmdDrawIndexed)(glv_platform_get_library_entrypoint(handle, "xglCmdDrawIndexed"));
+    real_xglCmdDrawIndirect = (type_xglCmdDrawIndirect)(glv_platform_get_library_entrypoint(handle, "xglCmdDrawIndirect"));
+    real_xglCmdDrawIndexedIndirect = (type_xglCmdDrawIndexedIndirect)(glv_platform_get_library_entrypoint(handle, "xglCmdDrawIndexedIndirect"));
+    real_xglCmdDispatch = (type_xglCmdDispatch)(glv_platform_get_library_entrypoint(handle, "xglCmdDispatch"));
+    real_xglCmdDispatchIndirect = (type_xglCmdDispatchIndirect)(glv_platform_get_library_entrypoint(handle, "xglCmdDispatchIndirect"));
+    real_xglCmdCopyBuffer = (type_xglCmdCopyBuffer)(glv_platform_get_library_entrypoint(handle, "xglCmdCopyBuffer"));
+    real_xglCmdCopyImage = (type_xglCmdCopyImage)(glv_platform_get_library_entrypoint(handle, "xglCmdCopyImage"));
+    real_xglCmdCopyBufferToImage = (type_xglCmdCopyBufferToImage)(glv_platform_get_library_entrypoint(handle, "xglCmdCopyBufferToImage"));
+    real_xglCmdCopyImageToBuffer = (type_xglCmdCopyImageToBuffer)(glv_platform_get_library_entrypoint(handle, "xglCmdCopyImageToBuffer"));
+    real_xglCmdCloneImageData = (type_xglCmdCloneImageData)(glv_platform_get_library_entrypoint(handle, "xglCmdCloneImageData"));
+    real_xglCmdUpdateBuffer = (type_xglCmdUpdateBuffer)(glv_platform_get_library_entrypoint(handle, "xglCmdUpdateBuffer"));
+    real_xglCmdFillBuffer = (type_xglCmdFillBuffer)(glv_platform_get_library_entrypoint(handle, "xglCmdFillBuffer"));
+    real_xglCmdClearColorImage = (type_xglCmdClearColorImage)(glv_platform_get_library_entrypoint(handle, "xglCmdClearColorImage"));
+    real_xglCmdClearColorImageRaw = (type_xglCmdClearColorImageRaw)(glv_platform_get_library_entrypoint(handle, "xglCmdClearColorImageRaw"));
+    real_xglCmdClearDepthStencil = (type_xglCmdClearDepthStencil)(glv_platform_get_library_entrypoint(handle, "xglCmdClearDepthStencil"));
+    real_xglCmdResolveImage = (type_xglCmdResolveImage)(glv_platform_get_library_entrypoint(handle, "xglCmdResolveImage"));
+    real_xglCmdSetEvent = (type_xglCmdSetEvent)(glv_platform_get_library_entrypoint(handle, "xglCmdSetEvent"));
+    real_xglCmdResetEvent = (type_xglCmdResetEvent)(glv_platform_get_library_entrypoint(handle, "xglCmdResetEvent"));
+    real_xglCmdWaitEvents = (type_xglCmdWaitEvents)(glv_platform_get_library_entrypoint(handle, "xglCmdWaitEvents"));
+    real_xglCmdPipelineBarrier = (type_xglCmdPipelineBarrier)(glv_platform_get_library_entrypoint(handle, "xglCmdPipelineBarrier"));
+    real_xglCmdBeginQuery = (type_xglCmdBeginQuery)(glv_platform_get_library_entrypoint(handle, "xglCmdBeginQuery"));
+    real_xglCmdEndQuery = (type_xglCmdEndQuery)(glv_platform_get_library_entrypoint(handle, "xglCmdEndQuery"));
+    real_xglCmdResetQueryPool = (type_xglCmdResetQueryPool)(glv_platform_get_library_entrypoint(handle, "xglCmdResetQueryPool"));
+    real_xglCmdWriteTimestamp = (type_xglCmdWriteTimestamp)(glv_platform_get_library_entrypoint(handle, "xglCmdWriteTimestamp"));
+    real_xglCmdInitAtomicCounters = (type_xglCmdInitAtomicCounters)(glv_platform_get_library_entrypoint(handle, "xglCmdInitAtomicCounters"));
+    real_xglCmdLoadAtomicCounters = (type_xglCmdLoadAtomicCounters)(glv_platform_get_library_entrypoint(handle, "xglCmdLoadAtomicCounters"));
+    real_xglCmdSaveAtomicCounters = (type_xglCmdSaveAtomicCounters)(glv_platform_get_library_entrypoint(handle, "xglCmdSaveAtomicCounters"));
+    real_xglCreateFramebuffer = (type_xglCreateFramebuffer)(glv_platform_get_library_entrypoint(handle, "xglCreateFramebuffer"));
+    real_xglCreateRenderPass = (type_xglCreateRenderPass)(glv_platform_get_library_entrypoint(handle, "xglCreateRenderPass"));
+    real_xglCmdBeginRenderPass = (type_xglCmdBeginRenderPass)(glv_platform_get_library_entrypoint(handle, "xglCmdBeginRenderPass"));
+    real_xglCmdEndRenderPass = (type_xglCmdEndRenderPass)(glv_platform_get_library_entrypoint(handle, "xglCmdEndRenderPass"));
+    real_xglDbgSetValidationLevel = (type_xglDbgSetValidationLevel)(glv_platform_get_library_entrypoint(handle, "xglDbgSetValidationLevel"));
+    real_xglDbgRegisterMsgCallback = (type_xglDbgRegisterMsgCallback)(glv_platform_get_library_entrypoint(handle, "xglDbgRegisterMsgCallback"));
+    real_xglDbgUnregisterMsgCallback = (type_xglDbgUnregisterMsgCallback)(glv_platform_get_library_entrypoint(handle, "xglDbgUnregisterMsgCallback"));
+    real_xglDbgSetMessageFilter = (type_xglDbgSetMessageFilter)(glv_platform_get_library_entrypoint(handle, "xglDbgSetMessageFilter"));
+    real_xglDbgSetObjectTag = (type_xglDbgSetObjectTag)(glv_platform_get_library_entrypoint(handle, "xglDbgSetObjectTag"));
+    real_xglDbgSetGlobalOption = (type_xglDbgSetGlobalOption)(glv_platform_get_library_entrypoint(handle, "xglDbgSetGlobalOption"));
+    real_xglDbgSetDeviceOption = (type_xglDbgSetDeviceOption)(glv_platform_get_library_entrypoint(handle, "xglDbgSetDeviceOption"));
+    real_xglCmdDbgMarkerBegin = (type_xglCmdDbgMarkerBegin)(glv_platform_get_library_entrypoint(handle, "xglCmdDbgMarkerBegin"));
+    real_xglCmdDbgMarkerEnd = (type_xglCmdDbgMarkerEnd)(glv_platform_get_library_entrypoint(handle, "xglCmdDbgMarkerEnd"));
+    real_xglWsiX11AssociateConnection = (type_xglWsiX11AssociateConnection)(glv_platform_get_library_entrypoint(handle, "xglWsiX11AssociateConnection"));
+    real_xglWsiX11GetMSC = (type_xglWsiX11GetMSC)(glv_platform_get_library_entrypoint(handle, "xglWsiX11GetMSC"));
+    real_xglWsiX11CreatePresentableImage = (type_xglWsiX11CreatePresentableImage)(glv_platform_get_library_entrypoint(handle, "xglWsiX11CreatePresentableImage"));
+    real_xglWsiX11QueuePresent = (type_xglWsiX11QueuePresent)(glv_platform_get_library_entrypoint(handle, "xglWsiX11QueuePresent"));
+}
+#define CHECK_RETURN_VALUE(entrypoint) returnValue = handle_replay_errors(#entrypoint, replayResult, pPacket->result, returnValue);
+
+glv_replay::GLV_REPLAY_RESULT xglReplay::replay(glv_trace_packet_header *packet)
+{
+    glv_replay::GLV_REPLAY_RESULT returnValue = glv_replay::GLV_REPLAY_SUCCESS;
+    XGL_RESULT replayResult = XGL_ERROR_UNKNOWN;
+    switch (packet->packet_id)
+    {
+        case GLV_TPI_XGL_xglApiVersion:
+            break;  // nothing to replay on the version packet
+        case GLV_TPI_XGL_xglCreateInstance:
+        {
+            struct_xglCreateInstance* pPacket = (struct_xglCreateInstance*)(packet->pBody);
+            XGL_INSTANCE local_pInstance;
+            replayResult = m_xglFuncs.real_xglCreateInstance(pPacket->pAppInfo, pPacket->pAllocCb, &local_pInstance);
+            if (replayResult == XGL_SUCCESS)
+            {
+                add_to_map(pPacket->pInstance, &local_pInstance);
+            }
+            CHECK_RETURN_VALUE(xglCreateInstance);
+            break;
+        }
+        case GLV_TPI_XGL_xglDestroyInstance:
+        {
+            struct_xglDestroyInstance* pPacket = (struct_xglDestroyInstance*)(packet->pBody);
+            xglDbgUnregisterMsgCallback(g_fpDbgMsgCallback);
+            replayResult = m_xglFuncs.real_xglDestroyInstance(remap(pPacket->instance));
+            if (replayResult == XGL_SUCCESS)
+            {
+                // TODO need to handle multiple instances and only clearing maps within an instance.
+                // TODO this only works with a single instance used at any given time.
+                clear_all_map_handles();
+            }
+            CHECK_RETURN_VALUE(xglDestroyInstance);
+            break;
+        }
+        case GLV_TPI_XGL_xglEnumerateGpus:
+        {
+            struct_xglEnumerateGpus* pPacket = (struct_xglEnumerateGpus*)(packet->pBody);
+            if (!m_display->m_initedXGL)
+            {
+                uint32_t gpuCount;
+                XGL_PHYSICAL_GPU gpus[XGL_MAX_PHYSICAL_GPUS];
+                uint32_t maxGpus = (pPacket->maxGpus < XGL_MAX_PHYSICAL_GPUS) ? pPacket->maxGpus : XGL_MAX_PHYSICAL_GPUS;
+                replayResult = m_xglFuncs.real_xglEnumerateGpus(remap(pPacket->instance), maxGpus, &gpuCount, &gpus[0]);
+                CHECK_RETURN_VALUE(xglEnumerateGpus);
+                //TODO handle different number of gpus in trace versus replay
+                if (gpuCount != *(pPacket->pGpuCount))
+                {
+                    glv_LogWarn("number of gpus mismatched in replay %u versus trace %u\n", gpuCount, *(pPacket->pGpuCount));
+                }
+                else if (gpuCount == 0)
+                {
+                     glv_LogError("xglEnumerateGpus number of gpus is zero\n");
+                }
+                else
+                {
+                    glv_LogInfo("Enumerated %d GPUs in the system\n", gpuCount);
+                }
+                // TODO handle enumeration results in a different order from trace to replay
+                for (uint32_t i = 0; i < gpuCount; i++)
+                {
+                    if (pPacket->pGpus)
+                        add_to_map(&(pPacket->pGpus[i]), &(gpus[i]));
+                }
+            }
+            break;
+        }
+        case GLV_TPI_XGL_xglGetGpuInfo:
+        {
+            struct_xglGetGpuInfo* pPacket = (struct_xglGetGpuInfo*)(packet->pBody);
+            if (!m_display->m_initedXGL)
+            {
+                switch (pPacket->infoType) {
+                case XGL_INFO_TYPE_PHYSICAL_GPU_PROPERTIES:
+                {
+                    XGL_PHYSICAL_GPU_PROPERTIES gpuProps;
+                    size_t dataSize = sizeof(XGL_PHYSICAL_GPU_PROPERTIES);
+                    replayResult = m_xglFuncs.real_xglGetGpuInfo(remap(pPacket->gpu), pPacket->infoType, &dataSize,
+                                    (pPacket->pData == NULL) ? NULL : &gpuProps);
+                    if (pPacket->pData != NULL)
+                    {
+                        glv_LogInfo("Replay Gpu Properties\n");
+                        glv_LogInfo("Vendor ID %x, Device ID %x, name %s\n",gpuProps.vendorId, gpuProps.deviceId, gpuProps.gpuName);
+                        glv_LogInfo("API version %u, Driver version %u, gpu Type %u\n",gpuProps.apiVersion, gpuProps.driverVersion, gpuProps.gpuType);
+                    }
+                    break;
+                }
+                case XGL_INFO_TYPE_PHYSICAL_GPU_PERFORMANCE:
+                {
+                    XGL_PHYSICAL_GPU_PERFORMANCE gpuPerfs;
+                    size_t dataSize = sizeof(XGL_PHYSICAL_GPU_PERFORMANCE);
+                    replayResult = m_xglFuncs.real_xglGetGpuInfo(remap(pPacket->gpu), pPacket->infoType, &dataSize,
+                                    (pPacket->pData == NULL) ? NULL : &gpuPerfs);
+                    if (pPacket->pData != NULL)
+                    {
+                        glv_LogInfo("Replay Gpu Performance\n");
+                        glv_LogInfo("Max GPU clock %f, max shader ALUs/clock %f, max texel fetches/clock %f\n",gpuPerfs.maxGpuClock, gpuPerfs.aluPerClock, gpuPerfs.texPerClock);
+                        glv_LogInfo("Max primitives/clock %f, Max pixels/clock %f\n",gpuPerfs.primsPerClock, gpuPerfs.pixelsPerClock);
+                    }
+                    break;
+                }
+                case XGL_INFO_TYPE_PHYSICAL_GPU_QUEUE_PROPERTIES:
+                {
+                    XGL_PHYSICAL_GPU_QUEUE_PROPERTIES *pGpuQueue, *pQ;
+                    size_t dataSize = sizeof(XGL_PHYSICAL_GPU_QUEUE_PROPERTIES);
+                    size_t numQueues = 1;
+                    assert(pPacket->pDataSize);
+                    if ((*(pPacket->pDataSize) % dataSize) != 0)
+                        glv_LogWarn("xglGetGpuInfo() for GPU_QUEUE_PROPERTIES not an integral data size assuming 1\n");
+                    else
+                        numQueues = *(pPacket->pDataSize) / dataSize;
+                    dataSize = numQueues * dataSize;
+                    pQ = static_cast < XGL_PHYSICAL_GPU_QUEUE_PROPERTIES *> (glv_malloc(dataSize));
+                    pGpuQueue = pQ;
+                    replayResult = m_xglFuncs.real_xglGetGpuInfo(remap(pPacket->gpu), pPacket->infoType, &dataSize,
+                                    (pPacket->pData == NULL) ? NULL : pGpuQueue);
+                    if (pPacket->pData != NULL)
+                    {
+                        for (unsigned int i = 0; i < numQueues; i++)
+                        {
+                            glv_LogInfo("Replay Gpu Queue Property for index %d, flags %u\n", i, pGpuQueue->queueFlags);
+                            glv_LogInfo("Max available count %u, max atomic counters %u, supports timestamps %u\n",pGpuQueue->queueCount, pGpuQueue->maxAtomicCounters, pGpuQueue->supportsTimestamps);
+                            pGpuQueue++;
+                        }
+                    }
+                    glv_free(pQ);
+                    break;
+                }
+                default:
+                {
+                    size_t size = 0;
+                    void* pData = NULL;
+                    if (pPacket->pData != NULL && pPacket->pDataSize != NULL)
+                    {
+                        size = *pPacket->pDataSize;
+                        pData = glv_malloc(*pPacket->pDataSize);
+                    }
+                    replayResult = m_xglFuncs.real_xglGetGpuInfo(remap(pPacket->gpu), pPacket->infoType, &size, pData);
+                    if (replayResult == XGL_SUCCESS)
+                    {
+                        if (size != *pPacket->pDataSize && pData != NULL)
+                        {
+                            glv_LogWarn("xglGetGpuInfo returned a differing data size: replay (%d bytes) vs trace (%d bytes)\n", size, *pPacket->pDataSize);
+                        }
+                        else if (pData != NULL && memcmp(pData, pPacket->pData, size) != 0)
+                        {
+                            glv_LogWarn("xglGetGpuInfo returned differing data contents than the trace file contained.\n");
+                        }
+                    }
+                    glv_free(pData);
+                    break;
+                }
+                };
+                CHECK_RETURN_VALUE(xglGetGpuInfo);
+            }
+            break;
+        }
+        case GLV_TPI_XGL_xglGetProcAddr:
+        {
+            struct_xglGetProcAddr* pPacket = (struct_xglGetProcAddr*)(packet->pBody);
+            m_xglFuncs.real_xglGetProcAddr(remap(pPacket->gpu), pPacket->pName);
+            break;
+        }
+        case GLV_TPI_XGL_xglCreateDevice:
+        {
+            struct_xglCreateDevice* pPacket = (struct_xglCreateDevice*)(packet->pBody);
+            if (!m_display->m_initedXGL)
+            {
+                XGL_DEVICE device;
+                if (g_xglReplaySettings.debugLevel > 0)
+                {
+                    XGL_DEVICE_CREATE_INFO cInfo, *ci, *pCreateInfoSaved;
+                    unsigned int numLayers = 0;
+                    char ** layersStr = get_enableLayers_list(&numLayers);
+                    apply_layerSettings_overrides();
+                    XGL_LAYER_CREATE_INFO layerInfo;
+                    pCreateInfoSaved = (XGL_DEVICE_CREATE_INFO *) pPacket->pCreateInfo;
+                    ci = (XGL_DEVICE_CREATE_INFO *) pPacket->pCreateInfo;
+                    if (layersStr != NULL && numLayers > 0)
+                    {
+                        while (ci->pNext != NULL)
+                            ci = (XGL_DEVICE_CREATE_INFO *) ci->pNext;
+                        ci->pNext = &layerInfo;
+                        layerInfo.sType = XGL_STRUCTURE_TYPE_LAYER_CREATE_INFO;
+                        layerInfo.pNext = 0;
+                        layerInfo.layerCount = numLayers;
+                        layerInfo.ppActiveLayerNames = layersStr;
+                    }
+                    memcpy(&cInfo, pPacket->pCreateInfo, sizeof(XGL_DEVICE_CREATE_INFO));
+                    cInfo.flags = pPacket->pCreateInfo->flags | XGL_DEVICE_CREATE_VALIDATION_BIT;
+                    cInfo.maxValidationLevel = (XGL_VALIDATION_LEVEL)((g_xglReplaySettings.debugLevel <= 4) ? (unsigned int) XGL_VALIDATION_LEVEL_0 + g_xglReplaySettings.debugLevel : (unsigned int) XGL_VALIDATION_LEVEL_0);
+                    pPacket->pCreateInfo = &cInfo;
+                    replayResult = m_xglFuncs.real_xglCreateDevice(remap(pPacket->gpu), pPacket->pCreateInfo, &device);
+                    // restore the packet for next replay
+                    ci->pNext = NULL;
+                    pPacket->pCreateInfo = pCreateInfoSaved;
+                    release_enableLayer_list(layersStr);
+                    if (xglDbgRegisterMsgCallback(g_fpDbgMsgCallback, NULL) != XGL_SUCCESS)
+                        glv_LogError("Failed to register xgl callback for replayer error handling\n");
+#if !defined(_WIN32)
+                    m_pDSDump = (DRAW_STATE_DUMP_DOT_FILE) m_xglFuncs.real_xglGetProcAddr(remap(pPacket->gpu), "drawStateDumpDotFile");
+                    m_pCBDump = (DRAW_STATE_DUMP_COMMAND_BUFFER_DOT_FILE) m_xglFuncs.real_xglGetProcAddr(remap(pPacket->gpu), "drawStateDumpCommandBufferDotFile");
+#endif
+                }
+                else 
+                    replayResult = m_xglFuncs.real_xglCreateDevice(remap(pPacket->gpu), pPacket->pCreateInfo, &device);
+                CHECK_RETURN_VALUE(xglCreateDevice);
+                if (replayResult == XGL_SUCCESS)
+                {
+                    add_to_map(pPacket->pDevice, &device);
+                }
+            }
+            break;
+        }
+        case GLV_TPI_XGL_xglDestroyDevice:
+        {
+            struct_xglDestroyDevice* pPacket = (struct_xglDestroyDevice*)(packet->pBody);
+            replayResult = m_xglFuncs.real_xglDestroyDevice(remap(pPacket->device));
+            if (replayResult == XGL_SUCCESS)
+            {
+                m_pCBDump = NULL;
+                m_pDSDump = NULL;
+                rm_from_map(pPacket->device);
+                m_display->m_initedXGL = false;
+            }
+            CHECK_RETURN_VALUE(xglDestroyDevice);
+            break;
+        }
+        case GLV_TPI_XGL_xglGetExtensionSupport:
+        {
+            struct_xglGetExtensionSupport* pPacket = (struct_xglGetExtensionSupport*)(packet->pBody);
+            if (!m_display->m_initedXGL) {
+                replayResult = m_xglFuncs.real_xglGetExtensionSupport(remap(pPacket->gpu), pPacket->pExtName);
+                CHECK_RETURN_VALUE(xglGetExtensionSupport);
+                if (replayResult == XGL_SUCCESS) {
+                    for (unsigned int ext = 0; ext < sizeof(g_extensions) / sizeof(g_extensions[0]); ext++)
+                    {
+                        if (!strncmp(g_extensions[ext], pPacket->pExtName, strlen(g_extensions[ext]))) {
+                            bool extInList = false;
+                            for (unsigned int j = 0; j < m_display->m_extensions.size(); ++j) {
+                                if (!strncmp(m_display->m_extensions[j], g_extensions[ext], strlen(g_extensions[ext])))
+                                    extInList = true;
+                                break;
+                            }
+                            if (!extInList)
+                                m_display->m_extensions.push_back((char *) g_extensions[ext]);
+                            break;
+                        }
+                    }
+                }
+            }
+            break;
+        }
+        case GLV_TPI_XGL_xglEnumerateLayers:
+        {
+            struct_xglEnumerateLayers* pPacket = (struct_xglEnumerateLayers*)(packet->pBody);
+            char **bufptr = GLV_NEW_ARRAY(char *, pPacket->maxLayerCount);
+            char **ptrLayers = (pPacket->pOutLayers == NULL) ? bufptr : (char **) pPacket->pOutLayers;
+            for (unsigned int i = 0; i < pPacket->maxLayerCount; i++)
+                bufptr[i] = GLV_NEW_ARRAY(char, pPacket->maxStringSize);
+            replayResult = m_xglFuncs.real_xglEnumerateLayers(remap(pPacket->gpu), pPacket->maxLayerCount, pPacket->maxStringSize, pPacket->pOutLayerCount, ptrLayers, pPacket->pReserved);
+            for (unsigned int i = 0; i < pPacket->maxLayerCount; i++)
+                GLV_DELETE(bufptr[i]);
+            CHECK_RETURN_VALUE(xglEnumerateLayers);
+            break;
+        }
+        case GLV_TPI_XGL_xglGetDeviceQueue:
+        {
+            struct_xglGetDeviceQueue* pPacket = (struct_xglGetDeviceQueue*)(packet->pBody);
+            XGL_QUEUE local_pQueue;
+            replayResult = m_xglFuncs.real_xglGetDeviceQueue(remap(pPacket->device), pPacket->queueType, pPacket->queueIndex, &local_pQueue);
+            if (replayResult == XGL_SUCCESS)
+            {
+                add_to_map(pPacket->pQueue, &local_pQueue);
+            }
+            CHECK_RETURN_VALUE(xglGetDeviceQueue);
+            break;
+        }
+        case GLV_TPI_XGL_xglQueueSubmit:
+        {
+            struct_xglQueueSubmit* pPacket = (struct_xglQueueSubmit*)(packet->pBody);
+            XGL_CMD_BUFFER *remappedBuffers = NULL;
+            if (pPacket->pCmdBuffers != NULL)
+            {
+                remappedBuffers = GLV_NEW_ARRAY( XGL_CMD_BUFFER, pPacket->cmdBufferCount);
+                for (uint32_t i = 0; i < pPacket->cmdBufferCount; i++)
+                {
+                    *(remappedBuffers + i) = remap(*(pPacket->pCmdBuffers + i));
+                }
+            }
+            XGL_MEMORY_REF* memRefs = NULL;
+            if (pPacket->pMemRefs != NULL)
+            {
+                memRefs = GLV_NEW_ARRAY(XGL_MEMORY_REF, pPacket->memRefCount);
+                memcpy(memRefs, pPacket->pMemRefs, sizeof(XGL_MEMORY_REF) * pPacket->memRefCount);
+                for (uint32_t i = 0; i < pPacket->memRefCount; i++)
+                {
+                    memRefs[i].mem = remap(pPacket->pMemRefs[i].mem);
+                }
+            }
+            replayResult = m_xglFuncs.real_xglQueueSubmit(remap(pPacket->queue), pPacket->cmdBufferCount, remappedBuffers, pPacket->memRefCount,
+                memRefs, remap(pPacket->fence));
+            GLV_DELETE(remappedBuffers);
+            GLV_DELETE(memRefs);
+            CHECK_RETURN_VALUE(xglQueueSubmit);
+            break;
+        }
+        case GLV_TPI_XGL_xglQueueSetGlobalMemReferences:
+        {
+            struct_xglQueueSetGlobalMemReferences* pPacket = (struct_xglQueueSetGlobalMemReferences*)(packet->pBody);
+            replayResult = m_xglFuncs.real_xglQueueSetGlobalMemReferences(remap(pPacket->queue), pPacket->memRefCount, pPacket->pMemRefs);
+            CHECK_RETURN_VALUE(xglQueueSetGlobalMemReferences);
+            break;
+        }
+        case GLV_TPI_XGL_xglQueueWaitIdle:
+        {
+            struct_xglQueueWaitIdle* pPacket = (struct_xglQueueWaitIdle*)(packet->pBody);
+            replayResult = m_xglFuncs.real_xglQueueWaitIdle(remap(pPacket->queue));
+            CHECK_RETURN_VALUE(xglQueueWaitIdle);
+            break;
+        }
+        case GLV_TPI_XGL_xglDeviceWaitIdle:
+        {
+            struct_xglDeviceWaitIdle* pPacket = (struct_xglDeviceWaitIdle*)(packet->pBody);
+            replayResult = m_xglFuncs.real_xglDeviceWaitIdle(remap(pPacket->device));
+            CHECK_RETURN_VALUE(xglDeviceWaitIdle);
+            break;
+        }
+        case GLV_TPI_XGL_xglAllocMemory:
+        {
+            struct_xglAllocMemory* pPacket = (struct_xglAllocMemory*)(packet->pBody);
+            struct gpuMemObj local_mem;
+            if (!m_adjustForGPU)
+                replayResult = m_xglFuncs.real_xglAllocMemory(remap(pPacket->device), pPacket->pAllocInfo, &local_mem.replayGpuMem);
+            if (replayResult == XGL_SUCCESS || m_adjustForGPU)
+            {
+                local_mem.pGpuMem = new (gpuMemory);
+                if (local_mem.pGpuMem)
+                    local_mem.pGpuMem->setAllocInfo(pPacket->pAllocInfo, m_adjustForGPU);
+                add_to_map(pPacket->pMem, &local_mem);
+            }
+            CHECK_RETURN_VALUE(xglAllocMemory);
+            break;
+        }
+        case GLV_TPI_XGL_xglFreeMemory:
+        {
+            struct_xglFreeMemory* pPacket = (struct_xglFreeMemory*)(packet->pBody);
+            struct gpuMemObj local_mem;
+            local_mem = m_gpuMemorys.find(pPacket->mem)->second;
+            // TODO how/when to free pendingAlloc that did not use and existing gpuMemObj
+            replayResult = m_xglFuncs.real_xglFreeMemory(local_mem.replayGpuMem);
+            if (replayResult == XGL_SUCCESS) 
+            {
+                delete local_mem.pGpuMem;
+                rm_from_map(pPacket->mem);
+            }
+            CHECK_RETURN_VALUE(xglFreeMemory);
+            break;
+        }
+        case GLV_TPI_XGL_xglSetMemoryPriority:
+        {
+            struct_xglSetMemoryPriority* pPacket = (struct_xglSetMemoryPriority*)(packet->pBody);
+            replayResult = m_xglFuncs.real_xglSetMemoryPriority(remap(pPacket->mem), pPacket->priority);
+            CHECK_RETURN_VALUE(xglSetMemoryPriority);
+            break;
+        }
+        case GLV_TPI_XGL_xglMapMemory:
+        {
+            struct_xglMapMemory* pPacket = (struct_xglMapMemory*)(packet->pBody);
+            struct gpuMemObj local_mem = m_gpuMemorys.find(pPacket->mem)->second;
+            void* pData;
+            if (!local_mem.pGpuMem->isPendingAlloc())
+            {
+                replayResult = m_xglFuncs.real_xglMapMemory(local_mem.replayGpuMem, pPacket->flags, &pData);
+                if (replayResult == XGL_SUCCESS)
+                {
+                    if (local_mem.pGpuMem)
+                        local_mem.pGpuMem->setMemoryMapRange(pData, 0, 0, false);
+                }
+            } else
+            {
+                if (local_mem.pGpuMem)
+                        local_mem.pGpuMem->setMemoryMapRange(NULL, 0, 0, true);
+            }
+            CHECK_RETURN_VALUE(xglMapMemory);
+            break;
+        }
+        case GLV_TPI_XGL_xglUnmapMemory:
+        {
+            struct_xglUnmapMemory* pPacket = (struct_xglUnmapMemory*)(packet->pBody);
+            struct gpuMemObj local_mem = m_gpuMemorys.find(pPacket->mem)->second;
+            if (!local_mem.pGpuMem->isPendingAlloc())
+            {
+                if (local_mem.pGpuMem)
+                    local_mem.pGpuMem->copyMappingData(pPacket->pData);  // copies data from packet into memory buffer
+                replayResult = m_xglFuncs.real_xglUnmapMemory(local_mem.replayGpuMem);
+            } else
+            {
+                if (local_mem.pGpuMem)
+                {
+                    unsigned char *pBuf = (unsigned char *) glv_malloc(local_mem.pGpuMem->getMemoryMapSize());
+                    if (!pBuf)
+                        glv_LogError("vkUnmapMemory() malloc failed");
+                    local_mem.pGpuMem->setMemoryDataAddr(pBuf);
+                    local_mem.pGpuMem->copyMappingData(pPacket->pData);
+                }
+            }
+            CHECK_RETURN_VALUE(xglUnmapMemory);
+            break;
+        }
+        case GLV_TPI_XGL_xglPinSystemMemory:
+        {
+            struct_xglPinSystemMemory* pPacket = (struct_xglPinSystemMemory*)(packet->pBody);
+            struct gpuMemObj local_mem;
+            /* TODO do we need to skip (make pending) this call for m_adjustForGPU */
+            replayResult = m_xglFuncs.real_xglPinSystemMemory(remap(pPacket->device), pPacket->pSysMem, pPacket->memSize, &local_mem.replayGpuMem);
+            if (replayResult == XGL_SUCCESS)
+                add_to_map(pPacket->pMem, &local_mem);
+            CHECK_RETURN_VALUE(xglPinSystemMemory);
+            break;
+        }
+        case GLV_TPI_XGL_xglGetMultiGpuCompatibility:
+        {
+            struct_xglGetMultiGpuCompatibility* pPacket = (struct_xglGetMultiGpuCompatibility*)(packet->pBody);
+            XGL_GPU_COMPATIBILITY_INFO cInfo;
+            XGL_PHYSICAL_GPU handle0, handle1;
+            handle0 = remap(pPacket->gpu0);
+            handle1 = remap(pPacket->gpu1);
+            replayResult = m_xglFuncs.real_xglGetMultiGpuCompatibility(handle0, handle1, &cInfo);
+            CHECK_RETURN_VALUE(xglGetMultiGpuCompatibility);
+            break;
+        }
+        case GLV_TPI_XGL_xglOpenSharedMemory:
+        {
+            struct_xglOpenSharedMemory* pPacket = (struct_xglOpenSharedMemory*)(packet->pBody);
+            XGL_DEVICE handle;
+            XGL_GPU_MEMORY local_pMem;
+            handle = remap(pPacket->device);
+            replayResult = m_xglFuncs.real_xglOpenSharedMemory(handle, pPacket->pOpenInfo, &local_pMem);
+            CHECK_RETURN_VALUE(xglOpenSharedMemory);
+            break;
+        }
+        case GLV_TPI_XGL_xglOpenSharedQueueSemaphore:
+        {
+            struct_xglOpenSharedQueueSemaphore* pPacket = (struct_xglOpenSharedQueueSemaphore*)(packet->pBody);
+            XGL_DEVICE handle;
+            XGL_QUEUE_SEMAPHORE local_pSemaphore;
+            handle = remap(pPacket->device);
+            replayResult = m_xglFuncs.real_xglOpenSharedQueueSemaphore(handle, pPacket->pOpenInfo, &local_pSemaphore);
+            CHECK_RETURN_VALUE(xglOpenSharedQueueSemaphore);
+            break;
+        }
+        case GLV_TPI_XGL_xglOpenPeerMemory:
+        {
+            struct_xglOpenPeerMemory* pPacket = (struct_xglOpenPeerMemory*)(packet->pBody);
+            XGL_DEVICE handle;
+            XGL_GPU_MEMORY local_pMem;
+            handle = remap(pPacket->device);
+            replayResult = m_xglFuncs.real_xglOpenPeerMemory(handle, pPacket->pOpenInfo, &local_pMem);
+            CHECK_RETURN_VALUE(xglOpenPeerMemory);
+            break;
+        }
+        case GLV_TPI_XGL_xglOpenPeerImage:
+        {
+            struct_xglOpenPeerImage* pPacket = (struct_xglOpenPeerImage*)(packet->pBody);
+            XGL_DEVICE handle;
+            XGL_GPU_MEMORY local_pMem;
+            XGL_IMAGE local_pImage;
+            handle = remap(pPacket->device);
+            replayResult = m_xglFuncs.real_xglOpenPeerImage(handle, pPacket->pOpenInfo, &local_pImage, &local_pMem);
+            CHECK_RETURN_VALUE(xglOpenPeerImage);
+            break;
+        }
+        case GLV_TPI_XGL_xglDestroyObject:
+        {
+            struct_xglDestroyObject* pPacket = (struct_xglDestroyObject*)(packet->pBody);
+            XGL_OBJECT object = remap(pPacket->object);
+            if (object != XGL_NULL_HANDLE)
+                replayResult = m_xglFuncs.real_xglDestroyObject(object);
+            if (replayResult == XGL_SUCCESS)
+                rm_from_map(pPacket->object);
+            CHECK_RETURN_VALUE(xglDestroyObject);
+            break;
+        }
+        case GLV_TPI_XGL_xglGetObjectInfo:
+        {
+            struct_xglGetObjectInfo* pPacket = (struct_xglGetObjectInfo*)(packet->pBody);
+            size_t size = 0;
+            void* pData = NULL;
+            if (pPacket->pData != NULL && pPacket->pDataSize != NULL)
+            {
+                size = *pPacket->pDataSize;
+                pData = glv_malloc(*pPacket->pDataSize);
+                memcpy(pData, pPacket->pData, *pPacket->pDataSize);
+            }
+            // TODO only search for object once rather than at remap() and init_objMemXXX()
+            replayResult = m_xglFuncs.real_xglGetObjectInfo(remap(pPacket->object), pPacket->infoType, &size, pData);
+            if (replayResult == XGL_SUCCESS)
+            {
+                if (size != *pPacket->pDataSize && pData != NULL)
+                {
+                    glv_LogWarn("xglGetObjectInfo returned a differing data size: replay (%d bytes) vs trace (%d bytes)\n", size, *pPacket->pDataSize);
+                } else if (pData != NULL)
+                {
+                    switch (pPacket->infoType)
+                    {
+                        case XGL_INFO_TYPE_MEMORY_ALLOCATION_COUNT:
+                        {
+                            uint32_t traceCount = *((uint32_t *) pPacket->pData);
+                            uint32_t replayCount = *((uint32_t *) pData);
+                            if (traceCount != replayCount)
+                                glv_LogWarn("xglGetObjectInfo(INFO_TYPE_MEMORY_ALLOCATION_COUNT) mismatch: trace count %u, replay count %u\n", traceCount, replayCount);
+                            if (m_adjustForGPU)
+                                init_objMemCount(pPacket->object, replayCount);
+                            break;
+                        }
+                        case XGL_INFO_TYPE_MEMORY_REQUIREMENTS:
+                        {
+                            XGL_MEMORY_REQUIREMENTS *traceReqs = (XGL_MEMORY_REQUIREMENTS *) pPacket->pData;
+                            XGL_MEMORY_REQUIREMENTS *replayReqs = (XGL_MEMORY_REQUIREMENTS *) pData;
+                            unsigned int num = size / sizeof(XGL_MEMORY_REQUIREMENTS);
+                            for (unsigned int i = 0; i < num; i++)
+                            {
+                                if (traceReqs->size != replayReqs->size)
+                                    glv_LogWarn("xglGetObjectInfo(INFO_TYPE_MEMORY_REQUIREMENTS) mismatch: trace size %u, replay size %u\n", traceReqs->size, replayReqs->size);
+                                if (traceReqs->alignment != replayReqs->alignment)
+                                    glv_LogWarn("xglGetObjectInfo(INFO_TYPE_MEMORY_REQUIREMENTS) mismatch: trace alignment %u, replay aligmnent %u\n", traceReqs->alignment, replayReqs->alignment);
+                                if (traceReqs->granularity != replayReqs->granularity)
+                                    glv_LogWarn("xglGetObjectInfo(INFO_TYPE_MEMORY_REQUIREMENTS) mismatch: trace granularity %u, replay granularity %u\n", traceReqs->granularity, replayReqs->granularity);
+                                if (traceReqs->memProps != replayReqs->memProps)
+                                    glv_LogWarn("xglGetObjectInfo(INFO_TYPE_MEMORY_REQUIREMENTS) mismatch: trace memProps %u, replay memProps %u\n", traceReqs->memProps, replayReqs->memProps);
+                                if (traceReqs->memType != replayReqs->memType)
+                                    glv_LogWarn("xglGetObjectInfo(INFO_TYPE_MEMORY_REQUIREMENTS) mismatch: trace memType %u, replay memType %u\n", traceReqs->memType, replayReqs->memType);
+                                traceReqs++;
+                                replayReqs++;
+                            }
+                            if (m_adjustForGPU)
+                                init_objMemReqs(pPacket->object, replayReqs - num, num);
+                            break;
+                        }
+                        default:
+                            if (memcmp(pData, pPacket->pData, size) != 0)
+                                glv_LogWarn("xglGetObjectInfo() mismatch on *pData: between trace and replay *pDataSize %u\n", size);
+                    }
+                }
+            }
+            glv_free(pData);
+            CHECK_RETURN_VALUE(xglGetObjectInfo);
+            break;
+        }
+        case GLV_TPI_XGL_xglBindObjectMemory:
+        {
+            struct_xglBindObjectMemory* pPacket = (struct_xglBindObjectMemory*)(packet->pBody);
+            replayResult = m_xglFuncs.real_xglBindObjectMemory(remap(pPacket->object), pPacket->allocationIdx, remap(pPacket->mem), pPacket->offset);
+            CHECK_RETURN_VALUE(xglBindObjectMemory);
+            break;
+        }
+        case GLV_TPI_XGL_xglBindObjectMemoryRange:
+        {
+            struct_xglBindObjectMemoryRange* pPacket = (struct_xglBindObjectMemoryRange*)(packet->pBody);
+            replayResult = m_xglFuncs.real_xglBindObjectMemoryRange(remap(pPacket->object), pPacket->allocationIdx, pPacket->rangeOffset, pPacket->rangeSize, remap(pPacket->mem), pPacket->memOffset);
+            CHECK_RETURN_VALUE(xglBindObjectMemoryRange);
+            break;
+        }
+        case GLV_TPI_XGL_xglBindImageMemoryRange:
+        {
+            struct_xglBindImageMemoryRange* pPacket = (struct_xglBindImageMemoryRange*)(packet->pBody);
+            replayResult = m_xglFuncs.real_xglBindImageMemoryRange(remap(pPacket->image), pPacket->allocationIdx, pPacket->bindInfo, remap(pPacket->mem), pPacket->memOffset);
+            CHECK_RETURN_VALUE(xglBindImageMemoryRange);
+            break;
+        }
+        case GLV_TPI_XGL_xglCreateFence:
+        {
+            struct_xglCreateFence* pPacket = (struct_xglCreateFence*)(packet->pBody);
+            XGL_FENCE local_pFence;
+            replayResult = m_xglFuncs.real_xglCreateFence(remap(pPacket->device), pPacket->pCreateInfo, &local_pFence);
+            if (replayResult == XGL_SUCCESS)
+            {
+                add_to_map(pPacket->pFence, &local_pFence);
+            }
+            CHECK_RETURN_VALUE(xglCreateFence);
+            break;
+        }
+        case GLV_TPI_XGL_xglGetFenceStatus:
+        {
+            struct_xglGetFenceStatus* pPacket = (struct_xglGetFenceStatus*)(packet->pBody);
+            do {
+                replayResult = m_xglFuncs.real_xglGetFenceStatus(remap(pPacket->fence));
+            } while (replayResult != pPacket->result  && pPacket->result == XGL_SUCCESS);
+            if (pPacket->result != XGL_NOT_READY || replayResult != XGL_SUCCESS)
+            CHECK_RETURN_VALUE(xglGetFenceStatus);
+            break;
+        }
+        case GLV_TPI_XGL_xglWaitForFences:
+        {
+            struct_xglWaitForFences* pPacket = (struct_xglWaitForFences*)(packet->pBody);
+            XGL_FENCE *pFence = GLV_NEW_ARRAY(XGL_FENCE, pPacket->fenceCount);
+            for (uint32_t i = 0; i < pPacket->fenceCount; i++)
+            {
+                *(pFence + i) = remap(*(pPacket->pFences + i));
+            }
+            replayResult = m_xglFuncs.real_xglWaitForFences(remap(pPacket->device), pPacket->fenceCount, pFence, pPacket->waitAll, pPacket->timeout);
+            GLV_DELETE(pFence);
+            CHECK_RETURN_VALUE(xglWaitForFences);
+            break;
+        }
+        case GLV_TPI_XGL_xglCreateQueueSemaphore:
+        {
+            struct_xglCreateQueueSemaphore* pPacket = (struct_xglCreateQueueSemaphore*)(packet->pBody);
+            XGL_QUEUE_SEMAPHORE local_pSemaphore;
+            replayResult = m_xglFuncs.real_xglCreateQueueSemaphore(remap(pPacket->device), pPacket->pCreateInfo, &local_pSemaphore);
+            if (replayResult == XGL_SUCCESS)
+            {
+                add_to_map(pPacket->pSemaphore, &local_pSemaphore);
+            }
+            CHECK_RETURN_VALUE(xglCreateQueueSemaphore);
+            break;
+        }
+        case GLV_TPI_XGL_xglSignalQueueSemaphore:
+        {
+            struct_xglSignalQueueSemaphore* pPacket = (struct_xglSignalQueueSemaphore*)(packet->pBody);
+            replayResult = m_xglFuncs.real_xglSignalQueueSemaphore(remap(pPacket->queue), remap(pPacket->semaphore));
+            CHECK_RETURN_VALUE(xglSignalQueueSemaphore);
+            break;
+        }
+        case GLV_TPI_XGL_xglWaitQueueSemaphore:
+        {
+            struct_xglWaitQueueSemaphore* pPacket = (struct_xglWaitQueueSemaphore*)(packet->pBody);
+            replayResult = m_xglFuncs.real_xglWaitQueueSemaphore(remap(pPacket->queue), remap(pPacket->semaphore));
+            CHECK_RETURN_VALUE(xglWaitQueueSemaphore);
+            break;
+        }
+        case GLV_TPI_XGL_xglCreateEvent:
+        {
+            struct_xglCreateEvent* pPacket = (struct_xglCreateEvent*)(packet->pBody);
+            XGL_EVENT local_pEvent;
+            replayResult = m_xglFuncs.real_xglCreateEvent(remap(pPacket->device), pPacket->pCreateInfo, &local_pEvent);
+            if (replayResult == XGL_SUCCESS)
+            {
+                add_to_map(pPacket->pEvent, &local_pEvent);
+            }
+            CHECK_RETURN_VALUE(xglCreateEvent);
+            break;
+        }
+        case GLV_TPI_XGL_xglGetEventStatus:
+        {
+            struct_xglGetEventStatus* pPacket = (struct_xglGetEventStatus*)(packet->pBody);
+            do {
+                replayResult = m_xglFuncs.real_xglGetEventStatus(remap(pPacket->event));
+            } while ((pPacket->result == XGL_EVENT_SET || pPacket->result == XGL_EVENT_RESET) && replayResult != pPacket->result);
+            if (pPacket->result != XGL_NOT_READY || replayResult != XGL_SUCCESS)
+            CHECK_RETURN_VALUE(xglGetEventStatus);
+            break;
+        }
+        case GLV_TPI_XGL_xglSetEvent:
+        {
+            struct_xglSetEvent* pPacket = (struct_xglSetEvent*)(packet->pBody);
+            replayResult = m_xglFuncs.real_xglSetEvent(remap(pPacket->event));
+            CHECK_RETURN_VALUE(xglSetEvent);
+            break;
+        }
+        case GLV_TPI_XGL_xglResetEvent:
+        {
+            struct_xglResetEvent* pPacket = (struct_xglResetEvent*)(packet->pBody);
+            replayResult = m_xglFuncs.real_xglResetEvent(remap(pPacket->event));
+            CHECK_RETURN_VALUE(xglResetEvent);
+            break;
+        }
+        case GLV_TPI_XGL_xglCreateQueryPool:
+        {
+            struct_xglCreateQueryPool* pPacket = (struct_xglCreateQueryPool*)(packet->pBody);
+            XGL_QUERY_POOL local_pQueryPool;
+            replayResult = m_xglFuncs.real_xglCreateQueryPool(remap(pPacket->device), pPacket->pCreateInfo, &local_pQueryPool);
+            if (replayResult == XGL_SUCCESS)
+            {
+                add_to_map(pPacket->pQueryPool, &local_pQueryPool);
+            }
+            CHECK_RETURN_VALUE(xglCreateQueryPool);
+            break;
+        }
+        case GLV_TPI_XGL_xglGetQueryPoolResults:
+        {
+            struct_xglGetQueryPoolResults* pPacket = (struct_xglGetQueryPoolResults*)(packet->pBody);
+            replayResult = m_xglFuncs.real_xglGetQueryPoolResults(remap(pPacket->queryPool), pPacket->startQuery, pPacket->queryCount, pPacket->pDataSize, pPacket->pData);
+            CHECK_RETURN_VALUE(xglGetQueryPoolResults);
+            break;
+        }
+        case GLV_TPI_XGL_xglGetFormatInfo:
+        {
+            struct_xglGetFormatInfo* pPacket = (struct_xglGetFormatInfo*)(packet->pBody);
+            size_t size = 0;
+            void* pData = NULL;
+            if (pPacket->pData != NULL && pPacket->pDataSize != NULL)
+            {
+                size = *pPacket->pDataSize;
+                pData = glv_malloc(*pPacket->pDataSize);
+            }
+            replayResult = m_xglFuncs.real_xglGetFormatInfo(remap(pPacket->device), pPacket->format, pPacket->infoType, &size, pData);
+            if (replayResult == XGL_SUCCESS)
+            {
+                if (size != *pPacket->pDataSize && pData != NULL)
+                {
+                    glv_LogWarn("xglGetFormatInfo returned a differing data size: replay (%d bytes) vs trace (%d bytes)\n", size, *pPacket->pDataSize);
+                }
+                else if (pData != NULL && memcmp(pData, pPacket->pData, size) != 0)
+                {
+                    glv_LogWarn("xglGetFormatInfo returned differing data contents than the trace file contained.\n");
+                }
+            }
+            glv_free(pData);
+            CHECK_RETURN_VALUE(xglGetFormatInfo);
+            break;
+        }
+        case GLV_TPI_XGL_xglCreateBuffer:
+        {
+            struct_xglCreateBuffer* pPacket = (struct_xglCreateBuffer*)(packet->pBody);
+            struct bufferObj local_bufferObj;
+            replayResult = m_xglFuncs.real_xglCreateBuffer(remap(pPacket->device), pPacket->pCreateInfo, &local_bufferObj.replayBuffer);
+            if (replayResult == XGL_SUCCESS)
+            {
+                add_to_map(pPacket->pBuffer, &local_bufferObj);
+            }
+            CHECK_RETURN_VALUE(xglCreateBuffer);
+            break;
+        }
+        case GLV_TPI_XGL_xglCreateBufferView:
+        {
+            struct_xglCreateBufferView* pPacket = (struct_xglCreateBufferView*)(packet->pBody);
+            XGL_BUFFER_VIEW_CREATE_INFO createInfo;
+            memcpy(&createInfo, pPacket->pCreateInfo, sizeof(XGL_BUFFER_VIEW_CREATE_INFO));
+            createInfo.buffer = remap(pPacket->pCreateInfo->buffer);
+            XGL_BUFFER_VIEW local_pView;
+            replayResult = m_xglFuncs.real_xglCreateBufferView(remap(pPacket->device), &createInfo, &local_pView);
+            if (replayResult == XGL_SUCCESS)
+            {
+                add_to_map(pPacket->pView, &local_pView);
+            }
+            CHECK_RETURN_VALUE(xglCreateBufferView);
+            break;
+        }
+        case GLV_TPI_XGL_xglCreateImage:
+        {
+            struct_xglCreateImage* pPacket = (struct_xglCreateImage*)(packet->pBody);
+            struct imageObj local_imageObj;
+            replayResult = m_xglFuncs.real_xglCreateImage(remap(pPacket->device), pPacket->pCreateInfo, &local_imageObj.replayImage);
+            if (replayResult == XGL_SUCCESS)
+            {
+                add_to_map(pPacket->pImage, &local_imageObj);
+            }
+            CHECK_RETURN_VALUE(xglCreateImage);
+            break;
+        }
+        case GLV_TPI_XGL_xglSetFastClearColor:
+        {
+            struct_xglSetFastClearColor* pPacket = (struct_xglSetFastClearColor*)(packet->pBody);
+            replayResult = m_xglFuncs.real_xglSetFastClearColor(remap(pPacket->image), pPacket->color);
+            CHECK_RETURN_VALUE(xglSetFastClearColor);
+            break;
+        }
+        case GLV_TPI_XGL_xglSetFastClearDepth:
+        {
+            struct_xglSetFastClearDepth* pPacket = (struct_xglSetFastClearDepth*)(packet->pBody);
+            replayResult = m_xglFuncs.real_xglSetFastClearDepth(remap(pPacket->image), pPacket->depth);
+            CHECK_RETURN_VALUE(xglSetFastClearDepth);
+            break;
+        }
+        case GLV_TPI_XGL_xglGetImageSubresourceInfo:
+        {
+            struct_xglGetImageSubresourceInfo* pPacket = (struct_xglGetImageSubresourceInfo*)(packet->pBody);
+            size_t size = 0;
+            void* pData = NULL;
+            if (pPacket->pData != NULL && pPacket->pDataSize != NULL)
+            {
+                size = *pPacket->pDataSize;
+                pData = glv_malloc(*pPacket->pDataSize);
+            }
+            replayResult = m_xglFuncs.real_xglGetImageSubresourceInfo(remap(pPacket->image), pPacket->pSubresource, pPacket->infoType, &size, pData);
+            if (replayResult == XGL_SUCCESS)
+            {
+                if (size != *pPacket->pDataSize && pData != NULL)
+                {
+                    glv_LogWarn("xglGetImageSubresourceInfo returned a differing data size: replay (%d bytes) vs trace (%d bytes)\n", size, *pPacket->pDataSize);
+                }
+                else if (pData != NULL && memcmp(pData, pPacket->pData, size) != 0)
+                {
+                    glv_LogWarn("xglGetImageSubresourceInfo returned differing data contents than the trace file contained.\n");
+                }
+            }
+            glv_free(pData);
+            CHECK_RETURN_VALUE(xglGetImageSubresourceInfo);
+            break;
+        }
+        case GLV_TPI_XGL_xglCreateImageView:
+        {
+            struct_xglCreateImageView* pPacket = (struct_xglCreateImageView*)(packet->pBody);
+            XGL_IMAGE_VIEW_CREATE_INFO createInfo;
+            memcpy(&createInfo, pPacket->pCreateInfo, sizeof(XGL_IMAGE_VIEW_CREATE_INFO));
+            createInfo.image = remap(pPacket->pCreateInfo->image);
+            XGL_IMAGE_VIEW local_pView;
+            replayResult = m_xglFuncs.real_xglCreateImageView(remap(pPacket->device), &createInfo, &local_pView);
+            if (replayResult == XGL_SUCCESS)
+            {
+                add_to_map(pPacket->pView, &local_pView);
+            }
+            CHECK_RETURN_VALUE(xglCreateImageView);
+            break;
+        }
+        case GLV_TPI_XGL_xglCreateColorAttachmentView:
+        {
+            struct_xglCreateColorAttachmentView* pPacket = (struct_xglCreateColorAttachmentView*)(packet->pBody);
+            XGL_COLOR_ATTACHMENT_VIEW_CREATE_INFO createInfo;
+            memcpy(&createInfo, pPacket->pCreateInfo, sizeof(XGL_COLOR_ATTACHMENT_VIEW_CREATE_INFO));
+            createInfo.image = remap(pPacket->pCreateInfo->image);
+            XGL_COLOR_ATTACHMENT_VIEW local_pView;
+            replayResult = m_xglFuncs.real_xglCreateColorAttachmentView(remap(pPacket->device), &createInfo, &local_pView);
+            if (replayResult == XGL_SUCCESS)
+            {
+                add_to_map(pPacket->pView, &local_pView);
+            }
+            CHECK_RETURN_VALUE(xglCreateColorAttachmentView);
+            break;
+        }
+        case GLV_TPI_XGL_xglCreateDepthStencilView:
+        {
+            struct_xglCreateDepthStencilView* pPacket = (struct_xglCreateDepthStencilView*)(packet->pBody);
+            XGL_DEPTH_STENCIL_VIEW_CREATE_INFO createInfo;
+            memcpy(&createInfo, pPacket->pCreateInfo, sizeof(XGL_DEPTH_STENCIL_VIEW_CREATE_INFO));
+            createInfo.image = remap(pPacket->pCreateInfo->image);
+            XGL_DEPTH_STENCIL_VIEW local_pView;
+            replayResult = m_xglFuncs.real_xglCreateDepthStencilView(remap(pPacket->device), &createInfo, &local_pView);
+            if (replayResult == XGL_SUCCESS)
+            {
+                add_to_map(pPacket->pView, &local_pView);
+            }
+            CHECK_RETURN_VALUE(xglCreateDepthStencilView);
+            break;
+        }
+        case GLV_TPI_XGL_xglCreateShader:
+        {
+            struct_xglCreateShader* pPacket = (struct_xglCreateShader*)(packet->pBody);
+            XGL_SHADER local_pShader;
+            replayResult = m_xglFuncs.real_xglCreateShader(remap(pPacket->device), pPacket->pCreateInfo, &local_pShader);
+            if (replayResult == XGL_SUCCESS)
+            {
+                add_to_map(pPacket->pShader, &local_pShader);
+            }
+            CHECK_RETURN_VALUE(xglCreateShader);
+            break;
+        }
+        case GLV_TPI_XGL_xglCreateGraphicsPipeline:
+        {
+            struct_xglCreateGraphicsPipeline* pPacket = (struct_xglCreateGraphicsPipeline*)(packet->pBody);
+            XGL_GRAPHICS_PIPELINE_CREATE_INFO createInfo;
+            struct shaderPair saveShader[10];
+            unsigned int idx = 0;
+            memcpy(&createInfo, pPacket->pCreateInfo, sizeof(XGL_GRAPHICS_PIPELINE_CREATE_INFO));
+            createInfo.lastSetLayout = remap(createInfo.lastSetLayout);
+            // Cast to shader type, as those are of primariy interest and all structs in LL have same header w/ sType & pNext
+            XGL_PIPELINE_SHADER_STAGE_CREATE_INFO* pPacketNext = (XGL_PIPELINE_SHADER_STAGE_CREATE_INFO*)pPacket->pCreateInfo->pNext;
+            XGL_PIPELINE_SHADER_STAGE_CREATE_INFO* pNext = (XGL_PIPELINE_SHADER_STAGE_CREATE_INFO*)createInfo.pNext;
+            while (XGL_NULL_HANDLE != pPacketNext)
+            {
+                if (XGL_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO == pNext->sType)
+                {
+                    saveShader[idx].val = pNext->shader.shader;
+                    saveShader[idx++].addr = &(pNext->shader.shader);
+                    pNext->shader.shader = remap(pPacketNext->shader.shader);
+                }
+                pPacketNext = (XGL_PIPELINE_SHADER_STAGE_CREATE_INFO*)pPacketNext->pNext;
+                pNext = (XGL_PIPELINE_SHADER_STAGE_CREATE_INFO*)pNext->pNext;
+            }
+            XGL_PIPELINE pipeline;
+            replayResult = m_xglFuncs.real_xglCreateGraphicsPipeline(remap(pPacket->device), &createInfo, &pipeline);
+            if (replayResult == XGL_SUCCESS)
+            {
+                add_to_map(pPacket->pPipeline, &pipeline);
+            }
+            for (unsigned int i = 0; i < idx; i++)
+                *(saveShader[i].addr) = saveShader[i].val;
+            CHECK_RETURN_VALUE(xglCreateGraphicsPipeline);
+            break;
+        }
+        case GLV_TPI_XGL_xglCreateComputePipeline:
+        {
+            struct_xglCreateComputePipeline* pPacket = (struct_xglCreateComputePipeline*)(packet->pBody);
+            XGL_COMPUTE_PIPELINE_CREATE_INFO createInfo;
+            memcpy(&createInfo, pPacket->pCreateInfo, sizeof(XGL_COMPUTE_PIPELINE_CREATE_INFO));
+            createInfo.cs.shader = remap(pPacket->pCreateInfo->cs.shader);
+            XGL_PIPELINE local_pPipeline;
+            replayResult = m_xglFuncs.real_xglCreateComputePipeline(remap(pPacket->device), &createInfo, &local_pPipeline);
+            if (replayResult == XGL_SUCCESS)
+            {
+                add_to_map(pPacket->pPipeline, &local_pPipeline);
+            }
+            CHECK_RETURN_VALUE(xglCreateComputePipeline);
+            break;
+        }
+        case GLV_TPI_XGL_xglStorePipeline:
+        {
+            struct_xglStorePipeline* pPacket = (struct_xglStorePipeline*)(packet->pBody);
+            size_t size = 0;
+            void* pData = NULL;
+            if (pPacket->pData != NULL && pPacket->pDataSize != NULL)
+            {
+                size = *pPacket->pDataSize;
+                pData = glv_malloc(*pPacket->pDataSize);
+            }
+            replayResult = m_xglFuncs.real_xglStorePipeline(remap(pPacket->pipeline), &size, pData);
+            if (replayResult == XGL_SUCCESS)
+            {
+                if (size != *pPacket->pDataSize && pData != NULL)
+                {
+                    glv_LogWarn("xglStorePipeline returned a differing data size: replay (%d bytes) vs trace (%d bytes)\n", size, *pPacket->pDataSize);
+                }
+                else if (pData != NULL && memcmp(pData, pPacket->pData, size) != 0)
+                {
+                    glv_LogWarn("xglStorePipeline returned differing data contents than the trace file contained.\n");
+                }
+            }
+            glv_free(pData);
+            CHECK_RETURN_VALUE(xglStorePipeline);
+            break;
+        }
+        case GLV_TPI_XGL_xglLoadPipeline:
+        {
+            struct_xglLoadPipeline* pPacket = (struct_xglLoadPipeline*)(packet->pBody);
+            XGL_PIPELINE local_pPipeline;
+            replayResult = m_xglFuncs.real_xglLoadPipeline(remap(pPacket->device), pPacket->dataSize, pPacket->pData, &local_pPipeline);
+            if (replayResult == XGL_SUCCESS)
+            {
+                add_to_map(pPacket->pPipeline, &local_pPipeline);
+            }
+            CHECK_RETURN_VALUE(xglLoadPipeline);
+            break;
+        }
+        case GLV_TPI_XGL_xglCreatePipelineDelta:
+        {
+            struct_xglCreatePipelineDelta* pPacket = (struct_xglCreatePipelineDelta*)(packet->pBody);
+            XGL_PIPELINE_DELTA local_delta;
+            replayResult = m_xglFuncs.real_xglCreatePipelineDelta(remap(pPacket->device), pPacket->p1, pPacket->p2, &local_delta);
+            if (replayResult == XGL_SUCCESS)
+            {
+                add_to_map(pPacket->delta, &local_delta);
+            }
+            CHECK_RETURN_VALUE(xglCreatePipelineDelta);
+            break;
+        }
+        case GLV_TPI_XGL_xglCreateSampler:
+        {
+            struct_xglCreateSampler* pPacket = (struct_xglCreateSampler*)(packet->pBody);
+            XGL_SAMPLER local_pSampler;
+            replayResult = m_xglFuncs.real_xglCreateSampler(remap(pPacket->device), pPacket->pCreateInfo, &local_pSampler);
+            if (replayResult == XGL_SUCCESS)
+            {
+                add_to_map(pPacket->pSampler, &local_pSampler);
+            }
+            CHECK_RETURN_VALUE(xglCreateSampler);
+            break;
+        }
+        case GLV_TPI_XGL_xglCreateDescriptorSetLayout:
+        {
+            struct_xglCreateDescriptorSetLayout* pPacket = (struct_xglCreateDescriptorSetLayout*)(packet->pBody);
+            XGL_SAMPLER saveSampler;
+            if (pPacket->pSetLayoutInfoList != NULL) {
+                XGL_SAMPLER *pSampler = (XGL_SAMPLER *) &pPacket->pSetLayoutInfoList->immutableSampler;
+                saveSampler = pPacket->pSetLayoutInfoList->immutableSampler;
+                *pSampler = remap(saveSampler);
+            }
+            XGL_DESCRIPTOR_SET_LAYOUT setLayout;
+            replayResult = m_xglFuncs.real_xglCreateDescriptorSetLayout(remap(pPacket->device), pPacket->stageFlags, pPacket->pSetBindPoints, remap(pPacket->priorSetLayout), pPacket->pSetLayoutInfoList, &setLayout);
+            if (replayResult == XGL_SUCCESS)
+            {
+                add_to_map(pPacket->pSetLayout, &setLayout);
+            }
+            if (pPacket->pSetLayoutInfoList != NULL) {
+                XGL_SAMPLER *pSampler = (XGL_SAMPLER *) &pPacket->pSetLayoutInfoList->immutableSampler;
+                *pSampler = saveSampler;
+            }
+            CHECK_RETURN_VALUE(xglCreateDescriptorSetLayout);
+            break;
+        }
+        case GLV_TPI_XGL_xglBeginDescriptorRegionUpdate:
+        {
+            struct_xglBeginDescriptorRegionUpdate* pPacket = (struct_xglBeginDescriptorRegionUpdate*)(packet->pBody);
+            replayResult = m_xglFuncs.real_xglBeginDescriptorRegionUpdate(remap(pPacket->device), pPacket->updateMode);
+            CHECK_RETURN_VALUE(xglBeginDescriptorRegionUpdate);
+            break;
+        }
+        case GLV_TPI_XGL_xglEndDescriptorRegionUpdate:
+        {
+            struct_xglEndDescriptorRegionUpdate* pPacket = (struct_xglEndDescriptorRegionUpdate*)(packet->pBody);
+            replayResult = m_xglFuncs.real_xglEndDescriptorRegionUpdate(remap(pPacket->device), remap(pPacket->cmd));
+            CHECK_RETURN_VALUE(xglEndDescriptorRegionUpdate);
+            break;
+        }
+        case GLV_TPI_XGL_xglCreateDescriptorRegion:
+        {
+            struct_xglCreateDescriptorRegion* pPacket = (struct_xglCreateDescriptorRegion*)(packet->pBody);
+            XGL_DESCRIPTOR_REGION local_pDescriptorRegion;
+            replayResult = m_xglFuncs.real_xglCreateDescriptorRegion(remap(pPacket->device), pPacket->regionUsage, pPacket->maxSets, pPacket->pCreateInfo, &local_pDescriptorRegion);
+            if (replayResult == XGL_SUCCESS)
+            {
+                add_to_map(pPacket->pDescriptorRegion, &local_pDescriptorRegion);
+            }
+            CHECK_RETURN_VALUE(xglCreateDescriptorRegion);
+            break;
+        }
+        case GLV_TPI_XGL_xglClearDescriptorRegion:
+        {
+            struct_xglClearDescriptorRegion* pPacket = (struct_xglClearDescriptorRegion*)(packet->pBody);
+            replayResult = m_xglFuncs.real_xglClearDescriptorRegion(remap(pPacket->descriptorRegion));
+            CHECK_RETURN_VALUE(xglClearDescriptorRegion);
+            break;
+        }
+        case GLV_TPI_XGL_xglAllocDescriptorSets:
+        {
+            struct_xglAllocDescriptorSets* pPacket = (struct_xglAllocDescriptorSets*)(packet->pBody);
+            uint32_t local_pCount;
+            XGL_DESCRIPTOR_SET local_pDescriptorSets[100];
+            XGL_DESCRIPTOR_SET_LAYOUT localDescSets[100];
+            assert(pPacket->count <= 100);
+            for (uint32_t i = 0; i < pPacket->count; i++)
+            {
+                localDescSets[i] = remap(pPacket->pSetLayouts[i]);
+            }
+            replayResult = m_xglFuncs.real_xglAllocDescriptorSets(remap(pPacket->descriptorRegion), pPacket->setUsage, pPacket->count, localDescSets, local_pDescriptorSets, &local_pCount);
+            if (replayResult == XGL_SUCCESS)
+            {
+                for (uint32_t i = 0; i < local_pCount; i++) {
+                    add_to_map(&pPacket->pDescriptorSets[i], &local_pDescriptorSets[i]);
+                }
+            }
+            CHECK_RETURN_VALUE(xglAllocDescriptorSets);
+            break;
+        }
+        case GLV_TPI_XGL_xglClearDescriptorSets:
+        {
+            struct_xglClearDescriptorSets* pPacket = (struct_xglClearDescriptorSets*)(packet->pBody);
+            XGL_DESCRIPTOR_SET localDescSets[100];
+            assert(pPacket->count <= 100);
+            for (uint32_t i = 0; i < pPacket->count; i++)
+            {
+                localDescSets[i] = remap(pPacket->pDescriptorSets[i]);
+            }
+            m_xglFuncs.real_xglClearDescriptorSets(remap(pPacket->descriptorRegion), pPacket->count, localDescSets);
+            break;
+        }
+        case GLV_TPI_XGL_xglUpdateDescriptors:
+        {
+            struct_xglUpdateDescriptors* pPacket = (struct_xglUpdateDescriptors*)(packet->pBody);
+            XGL_UPDATE_SAMPLERS* pUpdateChain = (XGL_UPDATE_SAMPLERS*)pPacket->pUpdateChain;
+            std::queue<XGL_SAMPLER> saveSamplers;
+            std::queue<XGL_BUFFER_VIEW> saveBufferViews;
+            std::queue<XGL_IMAGE_VIEW> saveImageViews;
+            std::queue<XGL_DESCRIPTOR_SET> saveDescSets;
+            while (pUpdateChain) {
+                switch(pUpdateChain->sType)
+                {
+                    case XGL_STRUCTURE_TYPE_UPDATE_SAMPLERS:
+                        for (uint32_t i = 0; i < ((XGL_UPDATE_SAMPLERS*)pUpdateChain)->count; i++) {
+                            XGL_SAMPLER* pLocalSampler = (XGL_SAMPLER*) &((XGL_UPDATE_SAMPLERS*)pUpdateChain)->pSamplers[i];
+                            saveSamplers.push(*pLocalSampler);
+                            *pLocalSampler = remap(((XGL_UPDATE_SAMPLERS*)pUpdateChain)->pSamplers[i]);
+                        }
+                        break;
+                    case XGL_STRUCTURE_TYPE_UPDATE_SAMPLER_TEXTURES:
+                    {
+                        XGL_UPDATE_SAMPLER_TEXTURES *pUST = (XGL_UPDATE_SAMPLER_TEXTURES *) pUpdateChain;
+                        for (uint32_t i = 0; i < pUST->count; i++) {
+                            XGL_SAMPLER *pLocalSampler = (XGL_SAMPLER *) &pUST->pSamplerImageViews[i].pSampler;
+                            saveSamplers.push(*pLocalSampler);
+                            *pLocalSampler = remap(pUST->pSamplerImageViews[i].pSampler);
+                            XGL_IMAGE_VIEW *pLocalView = (XGL_IMAGE_VIEW *) &pUST->pSamplerImageViews[i].pImageView->view;
+                            saveImageViews.push(*pLocalView);
+                            *pLocalView = remap(pUST->pSamplerImageViews[i].pImageView->view);
+                        }
+                        break;
+                    }
+                    case XGL_STRUCTURE_TYPE_UPDATE_IMAGES:
+                    {
+                        XGL_UPDATE_IMAGES *pUI = (XGL_UPDATE_IMAGES*) pUpdateChain;
+                        for (uint32_t i = 0; i < pUI->count; i++) {
+                            XGL_IMAGE_VIEW* pLocalView = (XGL_IMAGE_VIEW*) &pUI->pImageViews[i]->view;
+                            saveImageViews.push(*pLocalView);
+                            *pLocalView = remap(pUI->pImageViews[i]->view);
+                        }
+                        break;
+                    }
+                    case XGL_STRUCTURE_TYPE_UPDATE_BUFFERS:
+                    {
+                        XGL_UPDATE_BUFFERS *pUB = (XGL_UPDATE_BUFFERS *) pUpdateChain;
+                        for (uint32_t i = 0; i < pUB->count; i++) {
+                            XGL_BUFFER_VIEW* pLocalView = (XGL_BUFFER_VIEW*) &pUB->pBufferViews[i]->view;
+                            saveBufferViews.push(*pLocalView);
+                            *pLocalView = remap(pUB->pBufferViews[i]->view);
+                        }
+                        break;
+                    }
+                    case XGL_STRUCTURE_TYPE_UPDATE_AS_COPY:
+                        saveDescSets.push(((XGL_UPDATE_AS_COPY*)pUpdateChain)->descriptorSet);
+                        ((XGL_UPDATE_AS_COPY*)pUpdateChain)->descriptorSet = remap(((XGL_UPDATE_AS_COPY*)pUpdateChain)->descriptorSet);
+                        break;
+                    default:
+                        assert(0);
+                        break;
+                }
+                pUpdateChain = (XGL_UPDATE_SAMPLERS*) pUpdateChain->pNext;
+            }
+            m_xglFuncs.real_xglUpdateDescriptors(remap(pPacket->descriptorSet), pPacket->pUpdateChain);
+            pUpdateChain = (XGL_UPDATE_SAMPLERS*) pPacket->pUpdateChain;
+            while (pUpdateChain) {
+                switch(pUpdateChain->sType)
+                {
+                    case XGL_STRUCTURE_TYPE_UPDATE_SAMPLERS:
+                        for (uint32_t i = 0; i < ((XGL_UPDATE_SAMPLERS*)pUpdateChain)->count; i++) {
+                            XGL_SAMPLER* pLocalSampler = (XGL_SAMPLER*) &((XGL_UPDATE_SAMPLERS*)pUpdateChain)->pSamplers[i];
+                            *pLocalSampler = saveSamplers.front();
+                            saveSamplers.pop();
+                        }
+                        break;
+                    case XGL_STRUCTURE_TYPE_UPDATE_SAMPLER_TEXTURES:
+                    {
+                        XGL_UPDATE_SAMPLER_TEXTURES *pUST = (XGL_UPDATE_SAMPLER_TEXTURES *) pUpdateChain;
+                        for (uint32_t i = 0; i < pUST->count; i++) {
+                            XGL_SAMPLER *plocalSampler = (XGL_SAMPLER *) &pUST->pSamplerImageViews[i].pSampler;
+                            *plocalSampler = saveSamplers.front();
+                            saveSamplers.pop();
+                            XGL_IMAGE_VIEW *pLocalView = (XGL_IMAGE_VIEW *) &pUST->pSamplerImageViews[i].pImageView->view;
+                            *pLocalView = saveImageViews.front();
+                            saveImageViews.pop();
+                        }
+                        break;
+                    }
+                    case XGL_STRUCTURE_TYPE_UPDATE_IMAGES:
+                    {
+                        XGL_UPDATE_IMAGES *pUI = (XGL_UPDATE_IMAGES*) pUpdateChain;
+                        for (uint32_t i = 0; i < pUI->count; i++) {
+                            XGL_IMAGE_VIEW* pLocalView = (XGL_IMAGE_VIEW*) &pUI->pImageViews[i]->view;
+                            *pLocalView = saveImageViews.front();
+                            saveImageViews.pop();
+                        }
+                        break;
+                    }
+                    case XGL_STRUCTURE_TYPE_UPDATE_BUFFERS:
+                    {
+                        XGL_UPDATE_BUFFERS *pUB = (XGL_UPDATE_BUFFERS *) pUpdateChain;
+                        for (uint32_t i = 0; i < pUB->count; i++) {
+                            XGL_BUFFER_VIEW* pLocalView = (XGL_BUFFER_VIEW*) &pUB->pBufferViews[i]->view;
+                            *pLocalView = saveBufferViews.front();
+                            saveBufferViews.pop();
+                        }
+                        break;
+                    }
+                    case XGL_STRUCTURE_TYPE_UPDATE_AS_COPY:
+                        ((XGL_UPDATE_AS_COPY*)pUpdateChain)->descriptorSet = saveDescSets.front();
+                        saveDescSets.pop();
+                        //pFreeMe = (XGL_UPDATE_SAMPLERS*)pLocalUpdateChain;
+                        //pLocalUpdateChain = (void*)((XGL_UPDATE_SAMPLERS*)pLocalUpdateChain)->pNext;
+                        //free(pFreeMe);
+                        break;
+                    default:
+                        assert(0);
+                        break;
+                }
+                pUpdateChain = (XGL_UPDATE_SAMPLERS*) pUpdateChain->pNext;
+            }
+            break;
+        }
+        case GLV_TPI_XGL_xglCreateDynamicViewportState:
+        {
+            struct_xglCreateDynamicViewportState* pPacket = (struct_xglCreateDynamicViewportState*)(packet->pBody);
+            XGL_DYNAMIC_VP_STATE_OBJECT local_pState;
+            replayResult = m_xglFuncs.real_xglCreateDynamicViewportState(remap(pPacket->device), pPacket->pCreateInfo, &local_pState);
+            if (replayResult == XGL_SUCCESS)
+            {
+                add_to_map(pPacket->pState, &local_pState);
+            }
+            CHECK_RETURN_VALUE(xglCreateDynamicViewportState);
+            break;
+        }
+        case GLV_TPI_XGL_xglCreateDynamicRasterState:
+        {
+            struct_xglCreateDynamicRasterState* pPacket = (struct_xglCreateDynamicRasterState*)(packet->pBody);
+            XGL_DYNAMIC_RS_STATE_OBJECT local_pState;
+            replayResult = m_xglFuncs.real_xglCreateDynamicRasterState(remap(pPacket->device), pPacket->pCreateInfo, &local_pState);
+            if (replayResult == XGL_SUCCESS)
+            {
+                add_to_map(pPacket->pState, &local_pState);
+            }
+            CHECK_RETURN_VALUE(xglCreateDynamicRasterState);
+            break;
+        }
+        case GLV_TPI_XGL_xglCreateDynamicColorBlendState:
+        {
+            struct_xglCreateDynamicColorBlendState* pPacket = (struct_xglCreateDynamicColorBlendState*)(packet->pBody);
+            XGL_DYNAMIC_CB_STATE_OBJECT local_pState;
+            replayResult = m_xglFuncs.real_xglCreateDynamicColorBlendState(remap(pPacket->device), pPacket->pCreateInfo, &local_pState);
+            if (replayResult == XGL_SUCCESS)
+            {
+                add_to_map(pPacket->pState, &local_pState);
+            }
+            CHECK_RETURN_VALUE(xglCreateDynamicColorBlendState);
+            break;
+        }
+        case GLV_TPI_XGL_xglCreateDynamicDepthStencilState:
+        {
+            struct_xglCreateDynamicDepthStencilState* pPacket = (struct_xglCreateDynamicDepthStencilState*)(packet->pBody);
+            XGL_DYNAMIC_DS_STATE_OBJECT local_pState;
+            replayResult = m_xglFuncs.real_xglCreateDynamicDepthStencilState(remap(pPacket->device), pPacket->pCreateInfo, &local_pState);
+            if (replayResult == XGL_SUCCESS)
+            {
+                add_to_map(pPacket->pState, &local_pState);
+            }
+            CHECK_RETURN_VALUE(xglCreateDynamicDepthStencilState);
+            break;
+        }
+        case GLV_TPI_XGL_xglCreateCommandBuffer:
+        {
+            struct_xglCreateCommandBuffer* pPacket = (struct_xglCreateCommandBuffer*)(packet->pBody);
+            XGL_CMD_BUFFER local_pCmdBuffer;
+            replayResult = m_xglFuncs.real_xglCreateCommandBuffer(remap(pPacket->device), pPacket->pCreateInfo, &local_pCmdBuffer);
+            if (replayResult == XGL_SUCCESS)
+            {
+                add_to_map(pPacket->pCmdBuffer, &local_pCmdBuffer);
+            }
+            CHECK_RETURN_VALUE(xglCreateCommandBuffer);
+            break;
+        }
+        case GLV_TPI_XGL_xglBeginCommandBuffer:
+        {
+            struct_xglBeginCommandBuffer* pPacket = (struct_xglBeginCommandBuffer*)(packet->pBody);
+            XGL_CMD_BUFFER_BEGIN_INFO* pInfo = (XGL_CMD_BUFFER_BEGIN_INFO*)pPacket->pBeginInfo;
+            // assume only zero or one graphics_begin_info in the chain
+            XGL_RENDER_PASS savedRP, *pRP;
+            XGL_CMD_BUFFER_GRAPHICS_BEGIN_INFO *pGInfo = NULL;
+            while (pInfo != NULL)
+            {
+
+                if (pInfo->sType == XGL_STRUCTURE_TYPE_CMD_BUFFER_GRAPHICS_BEGIN_INFO)
+                {
+                    pGInfo = (XGL_CMD_BUFFER_GRAPHICS_BEGIN_INFO *) pInfo;
+                    savedRP = pGInfo->renderPass;
+                    pRP = &(pGInfo->renderPass);
+                    *pRP = remap(pGInfo->renderPass);
+                    break;
+                }
+                pInfo = (XGL_CMD_BUFFER_BEGIN_INFO*) pInfo->pNext;
+            }
+            replayResult = m_xglFuncs.real_xglBeginCommandBuffer(remap(pPacket->cmdBuffer), pPacket->pBeginInfo);
+            if (pGInfo != NULL)
+                pGInfo->renderPass = savedRP;
+            CHECK_RETURN_VALUE(xglBeginCommandBuffer);
+            break;
+        }
+        case GLV_TPI_XGL_xglEndCommandBuffer:
+        {
+            struct_xglEndCommandBuffer* pPacket = (struct_xglEndCommandBuffer*)(packet->pBody);
+            replayResult = m_xglFuncs.real_xglEndCommandBuffer(remap(pPacket->cmdBuffer));
+            CHECK_RETURN_VALUE(xglEndCommandBuffer);
+            break;
+        }
+        case GLV_TPI_XGL_xglResetCommandBuffer:
+        {
+            struct_xglResetCommandBuffer* pPacket = (struct_xglResetCommandBuffer*)(packet->pBody);
+            replayResult = m_xglFuncs.real_xglResetCommandBuffer(remap(pPacket->cmdBuffer));
+            CHECK_RETURN_VALUE(xglResetCommandBuffer);
+            break;
+        }
+        case GLV_TPI_XGL_xglCmdBindPipeline:
+        {
+            struct_xglCmdBindPipeline* pPacket = (struct_xglCmdBindPipeline*)(packet->pBody);
+            m_xglFuncs.real_xglCmdBindPipeline(remap(pPacket->cmdBuffer), pPacket->pipelineBindPoint, remap(pPacket->pipeline));
+            break;
+        }
+        case GLV_TPI_XGL_xglCmdBindPipelineDelta:
+        {
+            struct_xglCmdBindPipelineDelta* pPacket = (struct_xglCmdBindPipelineDelta*)(packet->pBody);
+            m_xglFuncs.real_xglCmdBindPipelineDelta(remap(pPacket->cmdBuffer), pPacket->pipelineBindPoint, remap(pPacket->delta));
+            break;
+        }
+        case GLV_TPI_XGL_xglCmdBindDynamicStateObject:
+        {
+            struct_xglCmdBindDynamicStateObject* pPacket = (struct_xglCmdBindDynamicStateObject*)(packet->pBody);
+            m_xglFuncs.real_xglCmdBindDynamicStateObject(remap(pPacket->cmdBuffer), pPacket->stateBindPoint, remap(pPacket->state));
+            break;
+        }
+        case GLV_TPI_XGL_xglCmdBindDescriptorSet:
+        {
+            struct_xglCmdBindDescriptorSet* pPacket = (struct_xglCmdBindDescriptorSet*)(packet->pBody);
+            m_xglFuncs.real_xglCmdBindDescriptorSet(remap(pPacket->cmdBuffer), pPacket->pipelineBindPoint, remap(pPacket->descriptorSet), pPacket->pUserData);
+            break;
+        }
+        case GLV_TPI_XGL_xglCmdBindVertexBuffer:
+        {
+            struct_xglCmdBindVertexBuffer* pPacket = (struct_xglCmdBindVertexBuffer*)(packet->pBody);
+            m_xglFuncs.real_xglCmdBindVertexBuffer(remap(pPacket->cmdBuffer), remap(pPacket->buffer), pPacket->offset, pPacket->binding);
+            break;
+        }
+        case GLV_TPI_XGL_xglCmdBindIndexBuffer:
+        {
+            struct_xglCmdBindIndexBuffer* pPacket = (struct_xglCmdBindIndexBuffer*)(packet->pBody);
+            m_xglFuncs.real_xglCmdBindIndexBuffer(remap(pPacket->cmdBuffer), remap(pPacket->buffer), pPacket->offset, pPacket->indexType);
+            break;
+        }
+        case GLV_TPI_XGL_xglCmdDraw:
+        {
+            struct_xglCmdDraw* pPacket = (struct_xglCmdDraw*)(packet->pBody);
+            m_xglFuncs.real_xglCmdDraw(remap(pPacket->cmdBuffer), pPacket->firstVertex, pPacket->vertexCount, pPacket->firstInstance, pPacket->instanceCount);
+            break;
+        }
+        case GLV_TPI_XGL_xglCmdDrawIndexed:
+        {
+            struct_xglCmdDrawIndexed* pPacket = (struct_xglCmdDrawIndexed*)(packet->pBody);
+            m_xglFuncs.real_xglCmdDrawIndexed(remap(pPacket->cmdBuffer), pPacket->firstIndex, pPacket->indexCount, pPacket->vertexOffset, pPacket->firstInstance, pPacket->instanceCount);
+            break;
+        }
+        case GLV_TPI_XGL_xglCmdDrawIndirect:
+        {
+            struct_xglCmdDrawIndirect* pPacket = (struct_xglCmdDrawIndirect*)(packet->pBody);
+            m_xglFuncs.real_xglCmdDrawIndirect(remap(pPacket->cmdBuffer), remap(pPacket->buffer), pPacket->offset, pPacket->count, pPacket->stride);
+            break;
+        }
+        case GLV_TPI_XGL_xglCmdDrawIndexedIndirect:
+        {
+            struct_xglCmdDrawIndexedIndirect* pPacket = (struct_xglCmdDrawIndexedIndirect*)(packet->pBody);
+            m_xglFuncs.real_xglCmdDrawIndexedIndirect(remap(pPacket->cmdBuffer), remap(pPacket->buffer), pPacket->offset, pPacket->count, pPacket->stride);
+            break;
+        }
+        case GLV_TPI_XGL_xglCmdDispatch:
+        {
+            struct_xglCmdDispatch* pPacket = (struct_xglCmdDispatch*)(packet->pBody);
+            m_xglFuncs.real_xglCmdDispatch(remap(pPacket->cmdBuffer), pPacket->x, pPacket->y, pPacket->z);
+            break;
+        }
+        case GLV_TPI_XGL_xglCmdDispatchIndirect:
+        {
+            struct_xglCmdDispatchIndirect* pPacket = (struct_xglCmdDispatchIndirect*)(packet->pBody);
+            m_xglFuncs.real_xglCmdDispatchIndirect(remap(pPacket->cmdBuffer), remap(pPacket->buffer), pPacket->offset);
+            break;
+        }
+        case GLV_TPI_XGL_xglCmdCopyBuffer:
+        {
+            struct_xglCmdCopyBuffer* pPacket = (struct_xglCmdCopyBuffer*)(packet->pBody);
+            m_xglFuncs.real_xglCmdCopyBuffer(remap(pPacket->cmdBuffer), remap(pPacket->srcBuffer), remap(pPacket->destBuffer), pPacket->regionCount, pPacket->pRegions);
+            break;
+        }
+        case GLV_TPI_XGL_xglCmdCopyImage:
+        {
+            struct_xglCmdCopyImage* pPacket = (struct_xglCmdCopyImage*)(packet->pBody);
+            m_xglFuncs.real_xglCmdCopyImage(remap(pPacket->cmdBuffer), remap(pPacket->srcImage), remap(pPacket->destImage), pPacket->regionCount, pPacket->pRegions);
+            break;
+        }
+        case GLV_TPI_XGL_xglCmdCopyBufferToImage:
+        {
+            struct_xglCmdCopyBufferToImage* pPacket = (struct_xglCmdCopyBufferToImage*)(packet->pBody);
+            m_xglFuncs.real_xglCmdCopyBufferToImage(remap(pPacket->cmdBuffer), remap(pPacket->srcBuffer), remap(pPacket->destImage), pPacket->regionCount, pPacket->pRegions);
+            break;
+        }
+        case GLV_TPI_XGL_xglCmdCopyImageToBuffer:
+        {
+            struct_xglCmdCopyImageToBuffer* pPacket = (struct_xglCmdCopyImageToBuffer*)(packet->pBody);
+            m_xglFuncs.real_xglCmdCopyImageToBuffer(remap(pPacket->cmdBuffer), remap(pPacket->srcImage), remap(pPacket->destBuffer), pPacket->regionCount, pPacket->pRegions);
+            break;
+        }
+        case GLV_TPI_XGL_xglCmdCloneImageData:
+        {
+            struct_xglCmdCloneImageData* pPacket = (struct_xglCmdCloneImageData*)(packet->pBody);
+            m_xglFuncs.real_xglCmdCloneImageData(remap(pPacket->cmdBuffer), remap(pPacket->srcImage), pPacket->srcImageLayout, remap(pPacket->destImage), pPacket->destImageLayout);
+            break;
+        }
+        case GLV_TPI_XGL_xglCmdUpdateBuffer:
+        {
+            struct_xglCmdUpdateBuffer* pPacket = (struct_xglCmdUpdateBuffer*)(packet->pBody);
+            m_xglFuncs.real_xglCmdUpdateBuffer(remap(pPacket->cmdBuffer), remap(pPacket->destBuffer), pPacket->destOffset, pPacket->dataSize, pPacket->pData);
+            break;
+        }
+        case GLV_TPI_XGL_xglCmdFillBuffer:
+        {
+            struct_xglCmdFillBuffer* pPacket = (struct_xglCmdFillBuffer*)(packet->pBody);
+            m_xglFuncs.real_xglCmdFillBuffer(remap(pPacket->cmdBuffer), remap(pPacket->destBuffer), pPacket->destOffset, pPacket->fillSize, pPacket->data);
+            break;
+        }
+        case GLV_TPI_XGL_xglCmdClearColorImage:
+        {
+            struct_xglCmdClearColorImage* pPacket = (struct_xglCmdClearColorImage*)(packet->pBody);
+            m_xglFuncs.real_xglCmdClearColorImage(remap(pPacket->cmdBuffer), remap(pPacket->image), pPacket->color, pPacket->rangeCount, pPacket->pRanges);
+            break;
+        }
+        case GLV_TPI_XGL_xglCmdClearColorImageRaw:
+        {
+            struct_xglCmdClearColorImageRaw* pPacket = (struct_xglCmdClearColorImageRaw*)(packet->pBody);
+            m_xglFuncs.real_xglCmdClearColorImageRaw(remap(pPacket->cmdBuffer), remap(pPacket->image), pPacket->color, pPacket->rangeCount, pPacket->pRanges);
+            break;
+        }
+        case GLV_TPI_XGL_xglCmdClearDepthStencil:
+        {
+            struct_xglCmdClearDepthStencil* pPacket = (struct_xglCmdClearDepthStencil*)(packet->pBody);
+            m_xglFuncs.real_xglCmdClearDepthStencil(remap(pPacket->cmdBuffer), remap(pPacket->image), pPacket->depth, pPacket->stencil, pPacket->rangeCount, pPacket->pRanges);
+            break;
+        }
+        case GLV_TPI_XGL_xglCmdResolveImage:
+        {
+            struct_xglCmdResolveImage* pPacket = (struct_xglCmdResolveImage*)(packet->pBody);
+            m_xglFuncs.real_xglCmdResolveImage(remap(pPacket->cmdBuffer), remap(pPacket->srcImage), remap(pPacket->destImage), pPacket->rectCount, pPacket->pRects);
+            break;
+        }
+        case GLV_TPI_XGL_xglCmdSetEvent:
+        {
+            struct_xglCmdSetEvent* pPacket = (struct_xglCmdSetEvent*)(packet->pBody);
+            m_xglFuncs.real_xglCmdSetEvent(remap(pPacket->cmdBuffer), remap(pPacket->event), pPacket->pipeEvent);
+            break;
+        }
+        case GLV_TPI_XGL_xglCmdResetEvent:
+        {
+            struct_xglCmdResetEvent* pPacket = (struct_xglCmdResetEvent*)(packet->pBody);
+            m_xglFuncs.real_xglCmdResetEvent(remap(pPacket->cmdBuffer), remap(pPacket->event));
+            break;
+        }
+        case GLV_TPI_XGL_xglCmdWaitEvents:
+        {
+            struct_xglCmdWaitEvents* pPacket = (struct_xglCmdWaitEvents*)(packet->pBody);
+            XGL_EVENT saveEvent[100];
+            uint32_t idx, numRemapBuf=0, numRemapImg=0;
+            assert(pPacket->pWaitInfo && pPacket->pWaitInfo->eventCount <= 100);
+            for (idx = 0; idx < pPacket->pWaitInfo->eventCount; idx++)
+            {
+                XGL_EVENT *pEvent = (XGL_EVENT *) &(pPacket->pWaitInfo->pEvents[idx]);
+                saveEvent[idx] = pPacket->pWaitInfo->pEvents[idx];
+                *pEvent = remap(pPacket->pWaitInfo->pEvents[idx]);
+            }
+
+            XGL_BUFFER saveBuf[100];
+            XGL_IMAGE saveImg[100];
+            for (idx = 0; idx < pPacket->pWaitInfo->memBarrierCount; idx++)
+            {
+                XGL_MEMORY_BARRIER *pNext = (XGL_MEMORY_BARRIER *) pPacket->pWaitInfo->ppMemBarriers[idx];
+                assert(pNext);
+                if (pNext->sType == XGL_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER) {
+                    XGL_BUFFER_MEMORY_BARRIER *pNextBuf = (XGL_BUFFER_MEMORY_BARRIER *) pPacket->pWaitInfo->ppMemBarriers[idx];
+                    assert(numRemapBuf < 100);
+                    saveBuf[numRemapBuf++] = pNextBuf->buffer;
+                    pNextBuf->buffer = remap(pNextBuf->buffer);
+                } else if (pNext->sType == XGL_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER) {
+                    XGL_IMAGE_MEMORY_BARRIER *pNextImg = (XGL_IMAGE_MEMORY_BARRIER *) pPacket->pWaitInfo->ppMemBarriers[idx];
+                    assert(numRemapImg < 100);
+                    saveImg[numRemapImg++] = pNextImg->image;
+                    pNextImg->image = remap(pNextImg->image);
+                }
+            }
+            m_xglFuncs.real_xglCmdWaitEvents(remap(pPacket->cmdBuffer), pPacket->pWaitInfo);
+            for (idx = 0; idx < pPacket->pWaitInfo->memBarrierCount; idx++) {
+                XGL_MEMORY_BARRIER *pNext = (XGL_MEMORY_BARRIER *) pPacket->pWaitInfo->ppMemBarriers[idx];
+                if (pNext->sType == XGL_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER) {
+                    XGL_BUFFER_MEMORY_BARRIER *pNextBuf = (XGL_BUFFER_MEMORY_BARRIER *) pPacket->pWaitInfo->ppMemBarriers[idx];
+                    pNextBuf->buffer = saveBuf[idx];
+                } else if (pNext->sType == XGL_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER) {
+                    XGL_IMAGE_MEMORY_BARRIER *pNextImg = (XGL_IMAGE_MEMORY_BARRIER *) pPacket->pWaitInfo->ppMemBarriers[idx];
+                    pNextImg->image = saveImg[idx];
+                }
+            }
+            for (idx = 0; idx < pPacket->pWaitInfo->eventCount; idx++) {
+                XGL_EVENT *pEvent = (XGL_EVENT *) &(pPacket->pWaitInfo->pEvents[idx]);
+                *pEvent = saveEvent[idx];
+            }
+            break;
+        }
+        case GLV_TPI_XGL_xglCmdPipelineBarrier:
+        {
+            struct_xglCmdPipelineBarrier* pPacket = (struct_xglCmdPipelineBarrier*)(packet->pBody);
+            uint32_t idx, numRemapBuf=0, numRemapImg=0;
+            XGL_BUFFER saveBuf[100];
+            XGL_IMAGE saveImg[100];
+            for (idx = 0; idx < pPacket->pBarrier->memBarrierCount; idx++)
+            {
+                XGL_MEMORY_BARRIER *pNext = (XGL_MEMORY_BARRIER *) pPacket->pBarrier->ppMemBarriers[idx];
+                assert(pNext);
+                if (pNext->sType == XGL_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER) {
+                    XGL_BUFFER_MEMORY_BARRIER *pNextBuf = (XGL_BUFFER_MEMORY_BARRIER *) pPacket->pBarrier->ppMemBarriers[idx];
+                    assert(numRemapBuf < 100);
+                    saveBuf[numRemapBuf++] = pNextBuf->buffer;
+                    pNextBuf->buffer = remap(pNextBuf->buffer);
+                } else if (pNext->sType == XGL_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER) {
+                    XGL_IMAGE_MEMORY_BARRIER *pNextImg = (XGL_IMAGE_MEMORY_BARRIER *) pPacket->pBarrier->ppMemBarriers[idx];
+                    assert(numRemapImg < 100);
+                    saveImg[numRemapImg++] = pNextImg->image;
+                    pNextImg->image = remap(pNextImg->image);
+                }
+            }
+            m_xglFuncs.real_xglCmdPipelineBarrier(remap(pPacket->cmdBuffer), pPacket->pBarrier);
+            for (idx = 0; idx < pPacket->pBarrier->memBarrierCount; idx++) {
+                XGL_MEMORY_BARRIER *pNext = (XGL_MEMORY_BARRIER *) pPacket->pBarrier->ppMemBarriers[idx];
+                if (pNext->sType == XGL_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER) {
+                    XGL_BUFFER_MEMORY_BARRIER *pNextBuf = (XGL_BUFFER_MEMORY_BARRIER *) pPacket->pBarrier->ppMemBarriers[idx];
+                    pNextBuf->buffer = saveBuf[idx];
+                } else if (pNext->sType == XGL_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER) {
+                    XGL_IMAGE_MEMORY_BARRIER *pNextImg = (XGL_IMAGE_MEMORY_BARRIER *) pPacket->pBarrier->ppMemBarriers[idx];
+                    pNextImg->image = saveImg[idx];
+                }
+            }
+            break;
+        }
+        case GLV_TPI_XGL_xglCmdBeginQuery:
+        {
+            struct_xglCmdBeginQuery* pPacket = (struct_xglCmdBeginQuery*)(packet->pBody);
+            m_xglFuncs.real_xglCmdBeginQuery(remap(pPacket->cmdBuffer), remap(pPacket->queryPool), pPacket->slot, pPacket->flags);
+            break;
+        }
+        case GLV_TPI_XGL_xglCmdEndQuery:
+        {
+            struct_xglCmdEndQuery* pPacket = (struct_xglCmdEndQuery*)(packet->pBody);
+            m_xglFuncs.real_xglCmdEndQuery(remap(pPacket->cmdBuffer), remap(pPacket->queryPool), pPacket->slot);
+            break;
+        }
+        case GLV_TPI_XGL_xglCmdResetQueryPool:
+        {
+            struct_xglCmdResetQueryPool* pPacket = (struct_xglCmdResetQueryPool*)(packet->pBody);
+            m_xglFuncs.real_xglCmdResetQueryPool(remap(pPacket->cmdBuffer), remap(pPacket->queryPool), pPacket->startQuery, pPacket->queryCount);
+            break;
+        }
+        case GLV_TPI_XGL_xglCmdWriteTimestamp:
+        {
+            struct_xglCmdWriteTimestamp* pPacket = (struct_xglCmdWriteTimestamp*)(packet->pBody);
+            m_xglFuncs.real_xglCmdWriteTimestamp(remap(pPacket->cmdBuffer), pPacket->timestampType, remap(pPacket->destBuffer), pPacket->destOffset);
+            break;
+        }
+        case GLV_TPI_XGL_xglCmdInitAtomicCounters:
+        {
+            struct_xglCmdInitAtomicCounters* pPacket = (struct_xglCmdInitAtomicCounters*)(packet->pBody);
+            m_xglFuncs.real_xglCmdInitAtomicCounters(remap(pPacket->cmdBuffer), pPacket->pipelineBindPoint, pPacket->startCounter, pPacket->counterCount, pPacket->pData);
+            break;
+        }
+        case GLV_TPI_XGL_xglCmdLoadAtomicCounters:
+        {
+            struct_xglCmdLoadAtomicCounters* pPacket = (struct_xglCmdLoadAtomicCounters*)(packet->pBody);
+            m_xglFuncs.real_xglCmdLoadAtomicCounters(remap(pPacket->cmdBuffer), pPacket->pipelineBindPoint, pPacket->startCounter, pPacket->counterCount, remap(pPacket->srcBuffer), pPacket->srcOffset);
+            break;
+        }
+        case GLV_TPI_XGL_xglCmdSaveAtomicCounters:
+        {
+            struct_xglCmdSaveAtomicCounters* pPacket = (struct_xglCmdSaveAtomicCounters*)(packet->pBody);
+            m_xglFuncs.real_xglCmdSaveAtomicCounters(remap(pPacket->cmdBuffer), pPacket->pipelineBindPoint, pPacket->startCounter, pPacket->counterCount, remap(pPacket->destBuffer), pPacket->destOffset);
+            break;
+        }
+        case GLV_TPI_XGL_xglCreateFramebuffer:
+        {
+            struct_xglCreateFramebuffer* pPacket = (struct_xglCreateFramebuffer*)(packet->pBody);
+            XGL_FRAMEBUFFER_CREATE_INFO *pInfo = (XGL_FRAMEBUFFER_CREATE_INFO *) pPacket->pCreateInfo;
+            XGL_COLOR_ATTACHMENT_BIND_INFO *pColorAttachments, *pSavedColor = (XGL_COLOR_ATTACHMENT_BIND_INFO*)pInfo->pColorAttachments;
+            bool allocatedColorAttachments = false;
+            if (pSavedColor != NULL)
+            {
+                allocatedColorAttachments = true;
+                pColorAttachments = GLV_NEW_ARRAY(XGL_COLOR_ATTACHMENT_BIND_INFO, pInfo->colorAttachmentCount);
+                memcpy(pColorAttachments, pSavedColor, sizeof(XGL_COLOR_ATTACHMENT_BIND_INFO) * pInfo->colorAttachmentCount);
+                for (uint32_t i = 0; i < pInfo->colorAttachmentCount; i++)
+                {
+                    pColorAttachments[i].view = remap(pInfo->pColorAttachments[i].view);
+                }
+                pInfo->pColorAttachments = pColorAttachments;
+            }
+            // remap depth stencil target
+            const XGL_DEPTH_STENCIL_BIND_INFO *pSavedDS = pInfo->pDepthStencilAttachment;
+            XGL_DEPTH_STENCIL_BIND_INFO depthTarget;
+            if (pSavedDS != NULL)
+            {
+                memcpy(&depthTarget, pSavedDS, sizeof(XGL_DEPTH_STENCIL_BIND_INFO));
+                depthTarget.view = remap(pSavedDS->view);
+                pInfo->pDepthStencilAttachment = &depthTarget;
+            }
+            XGL_FRAMEBUFFER local_framebuffer;
+            replayResult = m_xglFuncs.real_xglCreateFramebuffer(remap(pPacket->device), pPacket->pCreateInfo, &local_framebuffer);
+            pInfo->pColorAttachments = pSavedColor;
+            pInfo->pDepthStencilAttachment = pSavedDS;
+            if (replayResult == XGL_SUCCESS)
+            {
+                add_to_map(pPacket->pFramebuffer, &local_framebuffer);
+            }
+            if (allocatedColorAttachments)
+            {
+                GLV_DELETE((void*)pColorAttachments);
+            }
+            CHECK_RETURN_VALUE(xglCreateFramebuffer);
+            break;
+        }
+        case GLV_TPI_XGL_xglCreateRenderPass:
+        {
+            struct_xglCreateRenderPass* pPacket = (struct_xglCreateRenderPass*)(packet->pBody);
+            XGL_RENDER_PASS_CREATE_INFO *pInfo = (XGL_RENDER_PASS_CREATE_INFO *) pPacket->pCreateInfo;
+            // remap framebuffer
+            XGL_FRAMEBUFFER savedFB = 0, *pFB = &(pInfo->framebuffer);
+            if (*pFB != NULL)
+            {
+                savedFB = pInfo->framebuffer;
+                *pFB = remap(pInfo->framebuffer);
+            }
+            XGL_RENDER_PASS local_renderpass;
+            replayResult = m_xglFuncs.real_xglCreateRenderPass(remap(pPacket->device), pPacket->pCreateInfo, &local_renderpass);
+            if (*pFB != NULL)
+                pInfo->framebuffer = savedFB;
+            if (replayResult == XGL_SUCCESS)
+            {
+                add_to_map(pPacket->pRenderPass, &local_renderpass);
+            }
+            CHECK_RETURN_VALUE(xglCreateRenderPass);
+            break;
+        }
+        case GLV_TPI_XGL_xglCmdBeginRenderPass:
+        {
+            struct_xglCmdBeginRenderPass* pPacket = (struct_xglCmdBeginRenderPass*)(packet->pBody);
+            m_xglFuncs.real_xglCmdBeginRenderPass(remap(pPacket->cmdBuffer), remap(pPacket->renderPass));
+            break;
+        }
+        case GLV_TPI_XGL_xglCmdEndRenderPass:
+        {
+            struct_xglCmdEndRenderPass* pPacket = (struct_xglCmdEndRenderPass*)(packet->pBody);
+            m_xglFuncs.real_xglCmdEndRenderPass(remap(pPacket->cmdBuffer), remap(pPacket->renderPass));
+            break;
+        }
+        case GLV_TPI_XGL_xglDbgSetValidationLevel:
+        {
+            struct_xglDbgSetValidationLevel* pPacket = (struct_xglDbgSetValidationLevel*)(packet->pBody);
+            replayResult = m_xglFuncs.real_xglDbgSetValidationLevel(remap(pPacket->device), pPacket->validationLevel);
+            CHECK_RETURN_VALUE(xglDbgSetValidationLevel);
+            break;
+        }
+        case GLV_TPI_XGL_xglDbgRegisterMsgCallback:
+        {
+            // Just eating these calls as no way to restore dbg func ptr.
+            break;
+        }
+        case GLV_TPI_XGL_xglDbgUnregisterMsgCallback:
+        {
+            // Just eating these calls as no way to restore dbg func ptr.
+            break;
+        }
+        case GLV_TPI_XGL_xglDbgSetMessageFilter:
+        {
+            struct_xglDbgSetMessageFilter* pPacket = (struct_xglDbgSetMessageFilter*)(packet->pBody);
+            replayResult = m_xglFuncs.real_xglDbgSetMessageFilter(remap(pPacket->device), pPacket->msgCode, pPacket->filter);
+            CHECK_RETURN_VALUE(xglDbgSetMessageFilter);
+            break;
+        }
+        case GLV_TPI_XGL_xglDbgSetObjectTag:
+        {
+            struct_xglDbgSetObjectTag* pPacket = (struct_xglDbgSetObjectTag*)(packet->pBody);
+            replayResult = m_xglFuncs.real_xglDbgSetObjectTag(remap(pPacket->object), pPacket->tagSize, pPacket->pTag);
+            CHECK_RETURN_VALUE(xglDbgSetObjectTag);
+            break;
+        }
+        case GLV_TPI_XGL_xglDbgSetGlobalOption:
+        {
+            struct_xglDbgSetGlobalOption* pPacket = (struct_xglDbgSetGlobalOption*)(packet->pBody);
+            replayResult = m_xglFuncs.real_xglDbgSetGlobalOption(pPacket->dbgOption, pPacket->dataSize, pPacket->pData);
+            CHECK_RETURN_VALUE(xglDbgSetGlobalOption);
+            break;
+        }
+        case GLV_TPI_XGL_xglDbgSetDeviceOption:
+        {
+            struct_xglDbgSetDeviceOption* pPacket = (struct_xglDbgSetDeviceOption*)(packet->pBody);
+            replayResult = m_xglFuncs.real_xglDbgSetDeviceOption(remap(pPacket->device), pPacket->dbgOption, pPacket->dataSize, pPacket->pData);
+            CHECK_RETURN_VALUE(xglDbgSetDeviceOption);
+            break;
+        }
+        case GLV_TPI_XGL_xglCmdDbgMarkerBegin:
+        {
+            struct_xglCmdDbgMarkerBegin* pPacket = (struct_xglCmdDbgMarkerBegin*)(packet->pBody);
+            m_xglFuncs.real_xglCmdDbgMarkerBegin(remap(pPacket->cmdBuffer), pPacket->pMarker);
+            break;
+        }
+        case GLV_TPI_XGL_xglCmdDbgMarkerEnd:
+        {
+            struct_xglCmdDbgMarkerEnd* pPacket = (struct_xglCmdDbgMarkerEnd*)(packet->pBody);
+            m_xglFuncs.real_xglCmdDbgMarkerEnd(remap(pPacket->cmdBuffer));
+            break;
+        }
+        case GLV_TPI_XGL_xglWsiX11AssociateConnection:
+        {
+            struct_xglWsiX11AssociateConnection* pPacket = (struct_xglWsiX11AssociateConnection*)(packet->pBody);
+#if defined(PLATFORM_LINUX) || defined(XCB_NVIDIA)
+            //associate with the replayers Wsi connection rather than tracers
+            replayResult = m_xglFuncs.real_xglWsiX11AssociateConnection(remap(pPacket->gpu), &(m_display->m_WsiConnection));
+#elif defined(WIN32)
+            //TBD
+            replayResult = XGL_SUCCESS;
+#endif
+            CHECK_RETURN_VALUE(xglWsiX11AssociateConnection);
+            break;
+        }
+        case GLV_TPI_XGL_xglWsiX11GetMSC:
+        {
+            struct_xglWsiX11GetMSC* pPacket = (struct_xglWsiX11GetMSC*)(packet->pBody);
+#if defined(PLATFORM_LINUX) || defined(XCB_NVIDIA)
+            xcb_window_t window = m_display->m_XcbWindow;
+            replayResult = m_xglFuncs.real_xglWsiX11GetMSC(remap(pPacket->device), window, pPacket->crtc, pPacket->pMsc);
+#elif defined(WIN32)
+            //TBD
+            replayResult = XGL_SUCCESS;
+#else
+#endif
+            CHECK_RETURN_VALUE(xglWsiX11GetMSC);
+            break;
+        }
+        case GLV_TPI_XGL_xglWsiX11CreatePresentableImage:
+        {
+            struct_xglWsiX11CreatePresentableImage* pPacket = (struct_xglWsiX11CreatePresentableImage*)(packet->pBody);
+#if defined(PLATFORM_LINUX) || defined(XCB_NVIDIA)
+            struct imageObj local_imgObj;
+            struct gpuMemObj local_mem;
+            m_display->imageHeight.push_back(pPacket->pCreateInfo->extent.height);
+            m_display->imageWidth.push_back(pPacket->pCreateInfo->extent.width);
+            replayResult = m_xglFuncs.real_xglWsiX11CreatePresentableImage(remap(pPacket->device), pPacket->pCreateInfo, &local_imgObj.replayImage, &local_mem.replayGpuMem);
+            if (replayResult == XGL_SUCCESS)
+            {
+                if (pPacket->pImage != NULL)
+                    add_to_map(pPacket->pImage, &local_imgObj);
+                if(pPacket->pMem != NULL)
+                    add_to_map(pPacket->pMem, &local_mem);
+                m_display->imageHandles.push_back(local_imgObj.replayImage);
+                m_display->imageMemory.push_back(local_mem.replayGpuMem);
+            }
+#elif defined(WIN32)
+            //TBD
+            replayResult = XGL_SUCCESS;
+#endif
+            CHECK_RETURN_VALUE(xglWsiX11CreatePresentableImage);
+            break;
+        }
+        case GLV_TPI_XGL_xglWsiX11QueuePresent:
+        {
+            struct_xglWsiX11QueuePresent* pPacket = (struct_xglWsiX11QueuePresent*)(packet->pBody);
+#if defined(PLATFORM_LINUX) || defined(XCB_NVIDIA)
+            XGL_WSI_X11_PRESENT_INFO pInfo;
+            std::vector<int>::iterator it;
+            memcpy(&pInfo, pPacket->pPresentInfo, sizeof(XGL_WSI_X11_PRESENT_INFO));
+            pInfo.srcImage = remap(pPacket->pPresentInfo->srcImage);
+            // use replayers Xcb window
+            pInfo.destWindow = m_display->m_XcbWindow;
+            replayResult = m_xglFuncs.real_xglWsiX11QueuePresent(remap(pPacket->queue), &pInfo, remap(pPacket->fence));
+            it = std::find(m_screenshotFrames.begin(), m_screenshotFrames.end(), m_display->m_frameNumber);
+            if (it != m_screenshotFrames.end())
+            {
+                for(unsigned int i=0; i<m_display->imageHandles.size(); i++)
+                {
+                    if (m_display->imageHandles[i] == pInfo.srcImage)
+                    {
+                        char frameName[32];
+                        sprintf(frameName, "%d",m_display->m_frameNumber);
+                        glvWritePPM(frameName, m_display->imageWidth[i], m_display->imageHeight[i],
+                            m_display->imageHandles[i], m_display->imageMemory[i], &m_xglFuncs);
+                        break;
+                    }
+                }
+            }
+#elif defined(WIN32)
+            //TBD
+            replayResult = XGL_SUCCESS;
+#endif
+            m_display->m_frameNumber++;
+            CHECK_RETURN_VALUE(xglWsiX11QueuePresent);
+            break;
+        }
+        default:
+            glv_LogWarn("Unrecognized packet_id %u, skipping\n", packet->packet_id);
+            returnValue = glv_replay::GLV_REPLAY_INVALID_ID;
+            break;
+    }
+    return returnValue;
+}
diff --git a/tools/glave/src/glv_extensions/glvreplay_xgl/codegen/glvreplay_xgl_replay.h b/tools/glave/src/glv_extensions/glvreplay_xgl/codegen/glvreplay_xgl_replay.h
new file mode 100644
index 0000000..af8e09d
--- /dev/null
+++ b/tools/glave/src/glv_extensions/glvreplay_xgl/codegen/glvreplay_xgl_replay.h
@@ -0,0 +1,1604 @@
+/* THIS FILE IS GENERATED.  DO NOT EDIT. */
+
+/*
+ * XGL
+ *
+ * Copyright (C) 2014 LunarG, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+#pragma once
+
+#include <set>
+#include <map>
+#include <vector>
+#include <string>
+#if defined(PLATFORM_LINUX) || defined(XCB_NVIDIA)
+#include <xcb/xcb.h>
+
+#endif
+#include "glvreplay_window.h"
+#include "glvreplay_factory.h"
+#include "glv_trace_packet_identifiers.h"
+
+#include "xgl.h"
+#include "xglDbg.h"
+#if defined(PLATFORM_LINUX) || defined(XCB_NVIDIA)
+#include "xglWsiX11Ext.h"
+#else
+#include "xglWsiWinExt.h"
+#endif
+#include "draw_state.h"
+
+class ApiReplay {
+public:
+    virtual ~ApiReplay() { }
+    virtual enum glv_replay::GLV_REPLAY_RESULT replay(glv_trace_packet_header * packet) = 0;
+    virtual int init(glv_replay::Display & disp) = 0;
+    virtual void push_validation_msg(XGL_VALIDATION_LEVEL validationLevel, XGL_BASE_OBJECT srcObject, size_t location, int32_t msgCode, const char* pMsg) = 0;
+    virtual glv_replay::GLV_REPLAY_RESULT pop_validation_msgs() = 0;
+    virtual int dump_validation_data() = 0;
+};
+
+class xglDisplay: public glv_replay::DisplayImp {
+friend class xglReplay;
+public:
+    xglDisplay();
+    ~xglDisplay();
+    int init(const unsigned int gpu_idx);
+    int set_window(glv_window_handle hWindow, unsigned int width, unsigned int height);
+    int create_window(const unsigned int width, const unsigned int height);
+    void resize_window(const unsigned int width, const unsigned int height);
+    void process_event();
+    // XGL_DEVICE get_device() { return m_dev[m_gpuIdx];}
+#if defined(PLATFORM_LINUX) || defined(XCB_NVIDIA)
+    xcb_window_t get_window_handle() { return m_XcbWindow; }
+#elif defined(WIN32)
+    HWND get_window_handle() { return m_windowHandle; }
+#endif
+private:
+    XGL_RESULT init_xgl(const unsigned int gpu_idx);
+    bool m_initedXGL;
+#if defined(PLATFORM_LINUX) || defined(XCB_NVIDIA)
+    XGL_WSI_X11_CONNECTION_INFO m_WsiConnection;
+    xcb_screen_t *m_pXcbScreen;
+    xcb_window_t m_XcbWindow;
+#elif defined(WIN32)
+    HWND m_windowHandle;
+#endif
+    unsigned int m_windowWidth;
+    unsigned int m_windowHeight;
+    unsigned int m_frameNumber;
+    std::vector<uint32_t> imageWidth;
+    std::vector<uint32_t> imageHeight;
+    std::vector<XGL_IMAGE> imageHandles;
+    std::vector<XGL_GPU_MEMORY> imageMemory;
+#if 0
+    XGL_DEVICE m_dev[XGL_MAX_PHYSICAL_GPUS];
+    uint32_t m_gpuCount;
+    unsigned int m_gpuIdx;
+    XGL_PHYSICAL_GPU m_gpus[XGL_MAX_PHYSICAL_GPUS];
+    XGL_PHYSICAL_GPU_PROPERTIES m_gpuProps[XGL_MAX_PHYSICAL_GPUS];
+#endif
+    std::vector<char *>m_extensions;
+};
+
+class objMemory {
+public:
+    objMemory() : m_numAllocations(0), m_pMemReqs(NULL) {}
+    ~objMemory() { free(m_pMemReqs);}
+    void setCount(const uint32_t num);
+    void setReqs(const XGL_MEMORY_REQUIREMENTS *pReqs, const uint32_t num);
+private:
+    uint32_t m_numAllocations;
+    XGL_MEMORY_REQUIREMENTS *m_pMemReqs;
+};
+
+class gpuMemory {
+public:
+    gpuMemory() : m_pendingAlloc(false) {m_allocInfo.allocationSize = 0;}
+    ~gpuMemory() {}
+    bool isPendingAlloc();
+    void setAllocInfo(const XGL_MEMORY_ALLOC_INFO *info, const bool pending);
+    void setMemoryDataAddr(void *pBuf);
+    void setMemoryMapRange(void *pBuf, const size_t size, const size_t offset, const bool pending);
+    void copyMappingData(const void *pSrcData);
+    size_t getMemoryMapSize();
+private:
+    bool m_pendingAlloc;
+    struct mapRange {
+        bool pending;
+        size_t size;
+        size_t offset;
+        void *pData;
+    };
+    std::vector<struct mapRange> m_mapRange;
+    XGL_MEMORY_ALLOC_INFO m_allocInfo;
+};
+
+struct xglFuncs {
+    void init_funcs(void * libHandle);
+    void *m_libHandle;
+
+    typedef XGL_RESULT( XGLAPI * type_xglCreateInstance)(
+        const XGL_APPLICATION_INFO* pAppInfo,
+        const XGL_ALLOC_CALLBACKS* pAllocCb,
+        XGL_INSTANCE* pInstance);
+    type_xglCreateInstance real_xglCreateInstance;
+    typedef XGL_RESULT( XGLAPI * type_xglDestroyInstance)(
+        XGL_INSTANCE instance);
+    type_xglDestroyInstance real_xglDestroyInstance;
+    typedef XGL_RESULT( XGLAPI * type_xglEnumerateGpus)(
+        XGL_INSTANCE instance,
+        uint32_t maxGpus,
+        uint32_t* pGpuCount,
+        XGL_PHYSICAL_GPU* pGpus);
+    type_xglEnumerateGpus real_xglEnumerateGpus;
+    typedef XGL_RESULT( XGLAPI * type_xglGetGpuInfo)(
+        XGL_PHYSICAL_GPU gpu,
+        XGL_PHYSICAL_GPU_INFO_TYPE infoType,
+        size_t* pDataSize,
+        void* pData);
+    type_xglGetGpuInfo real_xglGetGpuInfo;
+    typedef void*( XGLAPI * type_xglGetProcAddr)(
+        XGL_PHYSICAL_GPU gpu,
+        const char* pName);
+    type_xglGetProcAddr real_xglGetProcAddr;
+    typedef XGL_RESULT( XGLAPI * type_xglCreateDevice)(
+        XGL_PHYSICAL_GPU gpu,
+        const XGL_DEVICE_CREATE_INFO* pCreateInfo,
+        XGL_DEVICE* pDevice);
+    type_xglCreateDevice real_xglCreateDevice;
+    typedef XGL_RESULT( XGLAPI * type_xglDestroyDevice)(
+        XGL_DEVICE device);
+    type_xglDestroyDevice real_xglDestroyDevice;
+    typedef XGL_RESULT( XGLAPI * type_xglGetExtensionSupport)(
+        XGL_PHYSICAL_GPU gpu,
+        const char* pExtName);
+    type_xglGetExtensionSupport real_xglGetExtensionSupport;
+    typedef XGL_RESULT( XGLAPI * type_xglEnumerateLayers)(
+        XGL_PHYSICAL_GPU gpu,
+        size_t maxLayerCount,
+        size_t maxStringSize,
+        size_t* pOutLayerCount,
+        char* const* pOutLayers,
+        void* pReserved);
+    type_xglEnumerateLayers real_xglEnumerateLayers;
+    typedef XGL_RESULT( XGLAPI * type_xglGetDeviceQueue)(
+        XGL_DEVICE device,
+        XGL_QUEUE_TYPE queueType,
+        uint32_t queueIndex,
+        XGL_QUEUE* pQueue);
+    type_xglGetDeviceQueue real_xglGetDeviceQueue;
+    typedef XGL_RESULT( XGLAPI * type_xglQueueSubmit)(
+        XGL_QUEUE queue,
+        uint32_t cmdBufferCount,
+        const XGL_CMD_BUFFER* pCmdBuffers,
+        uint32_t memRefCount,
+        const XGL_MEMORY_REF* pMemRefs,
+        XGL_FENCE fence);
+    type_xglQueueSubmit real_xglQueueSubmit;
+    typedef XGL_RESULT( XGLAPI * type_xglQueueSetGlobalMemReferences)(
+        XGL_QUEUE queue,
+        uint32_t memRefCount,
+        const XGL_MEMORY_REF* pMemRefs);
+    type_xglQueueSetGlobalMemReferences real_xglQueueSetGlobalMemReferences;
+    typedef XGL_RESULT( XGLAPI * type_xglQueueWaitIdle)(
+        XGL_QUEUE queue);
+    type_xglQueueWaitIdle real_xglQueueWaitIdle;
+    typedef XGL_RESULT( XGLAPI * type_xglDeviceWaitIdle)(
+        XGL_DEVICE device);
+    type_xglDeviceWaitIdle real_xglDeviceWaitIdle;
+    typedef XGL_RESULT( XGLAPI * type_xglAllocMemory)(
+        XGL_DEVICE device,
+        const XGL_MEMORY_ALLOC_INFO* pAllocInfo,
+        XGL_GPU_MEMORY* pMem);
+    type_xglAllocMemory real_xglAllocMemory;
+    typedef XGL_RESULT( XGLAPI * type_xglFreeMemory)(
+        XGL_GPU_MEMORY mem);
+    type_xglFreeMemory real_xglFreeMemory;
+    typedef XGL_RESULT( XGLAPI * type_xglSetMemoryPriority)(
+        XGL_GPU_MEMORY mem,
+        XGL_MEMORY_PRIORITY priority);
+    type_xglSetMemoryPriority real_xglSetMemoryPriority;
+    typedef XGL_RESULT( XGLAPI * type_xglMapMemory)(
+        XGL_GPU_MEMORY mem,
+        XGL_FLAGS flags,
+        void** ppData);
+    type_xglMapMemory real_xglMapMemory;
+    typedef XGL_RESULT( XGLAPI * type_xglUnmapMemory)(
+        XGL_GPU_MEMORY mem);
+    type_xglUnmapMemory real_xglUnmapMemory;
+    typedef XGL_RESULT( XGLAPI * type_xglPinSystemMemory)(
+        XGL_DEVICE device,
+        const void* pSysMem,
+        size_t memSize,
+        XGL_GPU_MEMORY* pMem);
+    type_xglPinSystemMemory real_xglPinSystemMemory;
+    typedef XGL_RESULT( XGLAPI * type_xglGetMultiGpuCompatibility)(
+        XGL_PHYSICAL_GPU gpu0,
+        XGL_PHYSICAL_GPU gpu1,
+        XGL_GPU_COMPATIBILITY_INFO* pInfo);
+    type_xglGetMultiGpuCompatibility real_xglGetMultiGpuCompatibility;
+    typedef XGL_RESULT( XGLAPI * type_xglOpenSharedMemory)(
+        XGL_DEVICE device,
+        const XGL_MEMORY_OPEN_INFO* pOpenInfo,
+        XGL_GPU_MEMORY* pMem);
+    type_xglOpenSharedMemory real_xglOpenSharedMemory;
+    typedef XGL_RESULT( XGLAPI * type_xglOpenSharedQueueSemaphore)(
+        XGL_DEVICE device,
+        const XGL_QUEUE_SEMAPHORE_OPEN_INFO* pOpenInfo,
+        XGL_QUEUE_SEMAPHORE* pSemaphore);
+    type_xglOpenSharedQueueSemaphore real_xglOpenSharedQueueSemaphore;
+    typedef XGL_RESULT( XGLAPI * type_xglOpenPeerMemory)(
+        XGL_DEVICE device,
+        const XGL_PEER_MEMORY_OPEN_INFO* pOpenInfo,
+        XGL_GPU_MEMORY* pMem);
+    type_xglOpenPeerMemory real_xglOpenPeerMemory;
+    typedef XGL_RESULT( XGLAPI * type_xglOpenPeerImage)(
+        XGL_DEVICE device,
+        const XGL_PEER_IMAGE_OPEN_INFO* pOpenInfo,
+        XGL_IMAGE* pImage,
+        XGL_GPU_MEMORY* pMem);
+    type_xglOpenPeerImage real_xglOpenPeerImage;
+    typedef XGL_RESULT( XGLAPI * type_xglDestroyObject)(
+        XGL_OBJECT object);
+    type_xglDestroyObject real_xglDestroyObject;
+    typedef XGL_RESULT( XGLAPI * type_xglGetObjectInfo)(
+        XGL_BASE_OBJECT object,
+        XGL_OBJECT_INFO_TYPE infoType,
+        size_t* pDataSize,
+        void* pData);
+    type_xglGetObjectInfo real_xglGetObjectInfo;
+    typedef XGL_RESULT( XGLAPI * type_xglBindObjectMemory)(
+        XGL_OBJECT object,
+        uint32_t allocationIdx,
+        XGL_GPU_MEMORY mem,
+        XGL_GPU_SIZE offset);
+    type_xglBindObjectMemory real_xglBindObjectMemory;
+    typedef XGL_RESULT( XGLAPI * type_xglBindObjectMemoryRange)(
+        XGL_OBJECT object,
+        uint32_t allocationIdx,
+        XGL_GPU_SIZE rangeOffset,
+        XGL_GPU_SIZE rangeSize,
+        XGL_GPU_MEMORY mem,
+        XGL_GPU_SIZE memOffset);
+    type_xglBindObjectMemoryRange real_xglBindObjectMemoryRange;
+    typedef XGL_RESULT( XGLAPI * type_xglBindImageMemoryRange)(
+        XGL_IMAGE image,
+        uint32_t allocationIdx,
+        const XGL_IMAGE_MEMORY_BIND_INFO* bindInfo,
+        XGL_GPU_MEMORY mem,
+        XGL_GPU_SIZE memOffset);
+    type_xglBindImageMemoryRange real_xglBindImageMemoryRange;
+    typedef XGL_RESULT( XGLAPI * type_xglCreateFence)(
+        XGL_DEVICE device,
+        const XGL_FENCE_CREATE_INFO* pCreateInfo,
+        XGL_FENCE* pFence);
+    type_xglCreateFence real_xglCreateFence;
+    typedef XGL_RESULT( XGLAPI * type_xglGetFenceStatus)(
+        XGL_FENCE fence);
+    type_xglGetFenceStatus real_xglGetFenceStatus;
+    typedef XGL_RESULT( XGLAPI * type_xglWaitForFences)(
+        XGL_DEVICE device,
+        uint32_t fenceCount,
+        const XGL_FENCE* pFences,
+        bool32_t waitAll,
+        uint64_t timeout);
+    type_xglWaitForFences real_xglWaitForFences;
+    typedef XGL_RESULT( XGLAPI * type_xglCreateQueueSemaphore)(
+        XGL_DEVICE device,
+        const XGL_QUEUE_SEMAPHORE_CREATE_INFO* pCreateInfo,
+        XGL_QUEUE_SEMAPHORE* pSemaphore);
+    type_xglCreateQueueSemaphore real_xglCreateQueueSemaphore;
+    typedef XGL_RESULT( XGLAPI * type_xglSignalQueueSemaphore)(
+        XGL_QUEUE queue,
+        XGL_QUEUE_SEMAPHORE semaphore);
+    type_xglSignalQueueSemaphore real_xglSignalQueueSemaphore;
+    typedef XGL_RESULT( XGLAPI * type_xglWaitQueueSemaphore)(
+        XGL_QUEUE queue,
+        XGL_QUEUE_SEMAPHORE semaphore);
+    type_xglWaitQueueSemaphore real_xglWaitQueueSemaphore;
+    typedef XGL_RESULT( XGLAPI * type_xglCreateEvent)(
+        XGL_DEVICE device,
+        const XGL_EVENT_CREATE_INFO* pCreateInfo,
+        XGL_EVENT* pEvent);
+    type_xglCreateEvent real_xglCreateEvent;
+    typedef XGL_RESULT( XGLAPI * type_xglGetEventStatus)(
+        XGL_EVENT event);
+    type_xglGetEventStatus real_xglGetEventStatus;
+    typedef XGL_RESULT( XGLAPI * type_xglSetEvent)(
+        XGL_EVENT event);
+    type_xglSetEvent real_xglSetEvent;
+    typedef XGL_RESULT( XGLAPI * type_xglResetEvent)(
+        XGL_EVENT event);
+    type_xglResetEvent real_xglResetEvent;
+    typedef XGL_RESULT( XGLAPI * type_xglCreateQueryPool)(
+        XGL_DEVICE device,
+        const XGL_QUERY_POOL_CREATE_INFO* pCreateInfo,
+        XGL_QUERY_POOL* pQueryPool);
+    type_xglCreateQueryPool real_xglCreateQueryPool;
+    typedef XGL_RESULT( XGLAPI * type_xglGetQueryPoolResults)(
+        XGL_QUERY_POOL queryPool,
+        uint32_t startQuery,
+        uint32_t queryCount,
+        size_t* pDataSize,
+        void* pData);
+    type_xglGetQueryPoolResults real_xglGetQueryPoolResults;
+    typedef XGL_RESULT( XGLAPI * type_xglGetFormatInfo)(
+        XGL_DEVICE device,
+        XGL_FORMAT format,
+        XGL_FORMAT_INFO_TYPE infoType,
+        size_t* pDataSize,
+        void* pData);
+    type_xglGetFormatInfo real_xglGetFormatInfo;
+    typedef XGL_RESULT( XGLAPI * type_xglCreateBuffer)(
+        XGL_DEVICE device,
+        const XGL_BUFFER_CREATE_INFO* pCreateInfo,
+        XGL_BUFFER* pBuffer);
+    type_xglCreateBuffer real_xglCreateBuffer;
+    typedef XGL_RESULT( XGLAPI * type_xglCreateBufferView)(
+        XGL_DEVICE device,
+        const XGL_BUFFER_VIEW_CREATE_INFO* pCreateInfo,
+        XGL_BUFFER_VIEW* pView);
+    type_xglCreateBufferView real_xglCreateBufferView;
+    typedef XGL_RESULT( XGLAPI * type_xglCreateImage)(
+        XGL_DEVICE device,
+        const XGL_IMAGE_CREATE_INFO* pCreateInfo,
+        XGL_IMAGE* pImage);
+    type_xglCreateImage real_xglCreateImage;
+    typedef XGL_RESULT( XGLAPI * type_xglSetFastClearColor)(
+        XGL_IMAGE image,
+        const float color[4]);
+    type_xglSetFastClearColor real_xglSetFastClearColor;
+    typedef XGL_RESULT( XGLAPI * type_xglSetFastClearDepth)(
+        XGL_IMAGE image,
+        float depth);
+    type_xglSetFastClearDepth real_xglSetFastClearDepth;
+    typedef XGL_RESULT( XGLAPI * type_xglGetImageSubresourceInfo)(
+        XGL_IMAGE image,
+        const XGL_IMAGE_SUBRESOURCE* pSubresource,
+        XGL_SUBRESOURCE_INFO_TYPE infoType,
+        size_t* pDataSize,
+        void* pData);
+    type_xglGetImageSubresourceInfo real_xglGetImageSubresourceInfo;
+    typedef XGL_RESULT( XGLAPI * type_xglCreateImageView)(
+        XGL_DEVICE device,
+        const XGL_IMAGE_VIEW_CREATE_INFO* pCreateInfo,
+        XGL_IMAGE_VIEW* pView);
+    type_xglCreateImageView real_xglCreateImageView;
+    typedef XGL_RESULT( XGLAPI * type_xglCreateColorAttachmentView)(
+        XGL_DEVICE device,
+        const XGL_COLOR_ATTACHMENT_VIEW_CREATE_INFO* pCreateInfo,
+        XGL_COLOR_ATTACHMENT_VIEW* pView);
+    type_xglCreateColorAttachmentView real_xglCreateColorAttachmentView;
+    typedef XGL_RESULT( XGLAPI * type_xglCreateDepthStencilView)(
+        XGL_DEVICE device,
+        const XGL_DEPTH_STENCIL_VIEW_CREATE_INFO* pCreateInfo,
+        XGL_DEPTH_STENCIL_VIEW* pView);
+    type_xglCreateDepthStencilView real_xglCreateDepthStencilView;
+    typedef XGL_RESULT( XGLAPI * type_xglCreateShader)(
+        XGL_DEVICE device,
+        const XGL_SHADER_CREATE_INFO* pCreateInfo,
+        XGL_SHADER* pShader);
+    type_xglCreateShader real_xglCreateShader;
+    typedef XGL_RESULT( XGLAPI * type_xglCreateGraphicsPipeline)(
+        XGL_DEVICE device,
+        const XGL_GRAPHICS_PIPELINE_CREATE_INFO* pCreateInfo,
+        XGL_PIPELINE* pPipeline);
+    type_xglCreateGraphicsPipeline real_xglCreateGraphicsPipeline;
+    typedef XGL_RESULT( XGLAPI * type_xglCreateComputePipeline)(
+        XGL_DEVICE device,
+        const XGL_COMPUTE_PIPELINE_CREATE_INFO* pCreateInfo,
+        XGL_PIPELINE* pPipeline);
+    type_xglCreateComputePipeline real_xglCreateComputePipeline;
+    typedef XGL_RESULT( XGLAPI * type_xglStorePipeline)(
+        XGL_PIPELINE pipeline,
+        size_t* pDataSize,
+        void* pData);
+    type_xglStorePipeline real_xglStorePipeline;
+    typedef XGL_RESULT( XGLAPI * type_xglLoadPipeline)(
+        XGL_DEVICE device,
+        size_t dataSize,
+        const void* pData,
+        XGL_PIPELINE* pPipeline);
+    type_xglLoadPipeline real_xglLoadPipeline;
+    typedef XGL_RESULT( XGLAPI * type_xglCreatePipelineDelta)(
+        XGL_DEVICE device,
+        XGL_PIPELINE p1,
+        XGL_PIPELINE p2,
+        XGL_PIPELINE_DELTA* delta);
+    type_xglCreatePipelineDelta real_xglCreatePipelineDelta;
+    typedef XGL_RESULT( XGLAPI * type_xglCreateSampler)(
+        XGL_DEVICE device,
+        const XGL_SAMPLER_CREATE_INFO* pCreateInfo,
+        XGL_SAMPLER* pSampler);
+    type_xglCreateSampler real_xglCreateSampler;
+    typedef XGL_RESULT( XGLAPI * type_xglCreateDescriptorSetLayout)(
+        XGL_DEVICE device,
+        XGL_FLAGS stageFlags,
+        const uint32_t* pSetBindPoints,
+        XGL_DESCRIPTOR_SET_LAYOUT priorSetLayout,
+        const XGL_DESCRIPTOR_SET_LAYOUT_CREATE_INFO* pSetLayoutInfoList,
+        XGL_DESCRIPTOR_SET_LAYOUT* pSetLayout);
+    type_xglCreateDescriptorSetLayout real_xglCreateDescriptorSetLayout;
+    typedef XGL_RESULT( XGLAPI * type_xglBeginDescriptorRegionUpdate)(
+        XGL_DEVICE device,
+        XGL_DESCRIPTOR_UPDATE_MODE updateMode);
+    type_xglBeginDescriptorRegionUpdate real_xglBeginDescriptorRegionUpdate;
+    typedef XGL_RESULT( XGLAPI * type_xglEndDescriptorRegionUpdate)(
+        XGL_DEVICE device,
+        XGL_CMD_BUFFER cmd);
+    type_xglEndDescriptorRegionUpdate real_xglEndDescriptorRegionUpdate;
+    typedef XGL_RESULT( XGLAPI * type_xglCreateDescriptorRegion)(
+        XGL_DEVICE device,
+        XGL_DESCRIPTOR_REGION_USAGE regionUsage,
+        uint32_t maxSets,
+        const XGL_DESCRIPTOR_REGION_CREATE_INFO* pCreateInfo,
+        XGL_DESCRIPTOR_REGION* pDescriptorRegion);
+    type_xglCreateDescriptorRegion real_xglCreateDescriptorRegion;
+    typedef XGL_RESULT( XGLAPI * type_xglClearDescriptorRegion)(
+        XGL_DESCRIPTOR_REGION descriptorRegion);
+    type_xglClearDescriptorRegion real_xglClearDescriptorRegion;
+    typedef XGL_RESULT( XGLAPI * type_xglAllocDescriptorSets)(
+        XGL_DESCRIPTOR_REGION descriptorRegion,
+        XGL_DESCRIPTOR_SET_USAGE setUsage,
+        uint32_t count,
+        const XGL_DESCRIPTOR_SET_LAYOUT* pSetLayouts,
+        XGL_DESCRIPTOR_SET* pDescriptorSets,
+        uint32_t* pCount);
+    type_xglAllocDescriptorSets real_xglAllocDescriptorSets;
+    typedef void( XGLAPI * type_xglClearDescriptorSets)(
+        XGL_DESCRIPTOR_REGION descriptorRegion,
+        uint32_t count,
+        const XGL_DESCRIPTOR_SET* pDescriptorSets);
+    type_xglClearDescriptorSets real_xglClearDescriptorSets;
+    typedef void( XGLAPI * type_xglUpdateDescriptors)(
+        XGL_DESCRIPTOR_SET descriptorSet,
+        const void* pUpdateChain);
+    type_xglUpdateDescriptors real_xglUpdateDescriptors;
+    typedef XGL_RESULT( XGLAPI * type_xglCreateDynamicViewportState)(
+        XGL_DEVICE device,
+        const XGL_DYNAMIC_VP_STATE_CREATE_INFO* pCreateInfo,
+        XGL_DYNAMIC_VP_STATE_OBJECT* pState);
+    type_xglCreateDynamicViewportState real_xglCreateDynamicViewportState;
+    typedef XGL_RESULT( XGLAPI * type_xglCreateDynamicRasterState)(
+        XGL_DEVICE device,
+        const XGL_DYNAMIC_RS_STATE_CREATE_INFO* pCreateInfo,
+        XGL_DYNAMIC_RS_STATE_OBJECT* pState);
+    type_xglCreateDynamicRasterState real_xglCreateDynamicRasterState;
+    typedef XGL_RESULT( XGLAPI * type_xglCreateDynamicColorBlendState)(
+        XGL_DEVICE device,
+        const XGL_DYNAMIC_CB_STATE_CREATE_INFO* pCreateInfo,
+        XGL_DYNAMIC_CB_STATE_OBJECT* pState);
+    type_xglCreateDynamicColorBlendState real_xglCreateDynamicColorBlendState;
+    typedef XGL_RESULT( XGLAPI * type_xglCreateDynamicDepthStencilState)(
+        XGL_DEVICE device,
+        const XGL_DYNAMIC_DS_STATE_CREATE_INFO* pCreateInfo,
+        XGL_DYNAMIC_DS_STATE_OBJECT* pState);
+    type_xglCreateDynamicDepthStencilState real_xglCreateDynamicDepthStencilState;
+    typedef XGL_RESULT( XGLAPI * type_xglCreateCommandBuffer)(
+        XGL_DEVICE device,
+        const XGL_CMD_BUFFER_CREATE_INFO* pCreateInfo,
+        XGL_CMD_BUFFER* pCmdBuffer);
+    type_xglCreateCommandBuffer real_xglCreateCommandBuffer;
+    typedef XGL_RESULT( XGLAPI * type_xglBeginCommandBuffer)(
+        XGL_CMD_BUFFER cmdBuffer,
+        const XGL_CMD_BUFFER_BEGIN_INFO* pBeginInfo);
+    type_xglBeginCommandBuffer real_xglBeginCommandBuffer;
+    typedef XGL_RESULT( XGLAPI * type_xglEndCommandBuffer)(
+        XGL_CMD_BUFFER cmdBuffer);
+    type_xglEndCommandBuffer real_xglEndCommandBuffer;
+    typedef XGL_RESULT( XGLAPI * type_xglResetCommandBuffer)(
+        XGL_CMD_BUFFER cmdBuffer);
+    type_xglResetCommandBuffer real_xglResetCommandBuffer;
+    typedef void( XGLAPI * type_xglCmdBindPipeline)(
+        XGL_CMD_BUFFER cmdBuffer,
+        XGL_PIPELINE_BIND_POINT pipelineBindPoint,
+        XGL_PIPELINE pipeline);
+    type_xglCmdBindPipeline real_xglCmdBindPipeline;
+    typedef void( XGLAPI * type_xglCmdBindPipelineDelta)(
+        XGL_CMD_BUFFER cmdBuffer,
+        XGL_PIPELINE_BIND_POINT pipelineBindPoint,
+        XGL_PIPELINE_DELTA delta);
+    type_xglCmdBindPipelineDelta real_xglCmdBindPipelineDelta;
+    typedef void( XGLAPI * type_xglCmdBindDynamicStateObject)(
+        XGL_CMD_BUFFER cmdBuffer,
+        XGL_STATE_BIND_POINT stateBindPoint,
+        XGL_DYNAMIC_STATE_OBJECT state);
+    type_xglCmdBindDynamicStateObject real_xglCmdBindDynamicStateObject;
+    typedef void( XGLAPI * type_xglCmdBindDescriptorSet)(
+        XGL_CMD_BUFFER cmdBuffer,
+        XGL_PIPELINE_BIND_POINT pipelineBindPoint,
+        XGL_DESCRIPTOR_SET descriptorSet,
+        const uint32_t* pUserData);
+    type_xglCmdBindDescriptorSet real_xglCmdBindDescriptorSet;
+    typedef void( XGLAPI * type_xglCmdBindVertexBuffer)(
+        XGL_CMD_BUFFER cmdBuffer,
+        XGL_BUFFER buffer,
+        XGL_GPU_SIZE offset,
+        uint32_t binding);
+    type_xglCmdBindVertexBuffer real_xglCmdBindVertexBuffer;
+    typedef void( XGLAPI * type_xglCmdBindIndexBuffer)(
+        XGL_CMD_BUFFER cmdBuffer,
+        XGL_BUFFER buffer,
+        XGL_GPU_SIZE offset,
+        XGL_INDEX_TYPE indexType);
+    type_xglCmdBindIndexBuffer real_xglCmdBindIndexBuffer;
+    typedef void( XGLAPI * type_xglCmdDraw)(
+        XGL_CMD_BUFFER cmdBuffer,
+        uint32_t firstVertex,
+        uint32_t vertexCount,
+        uint32_t firstInstance,
+        uint32_t instanceCount);
+    type_xglCmdDraw real_xglCmdDraw;
+    typedef void( XGLAPI * type_xglCmdDrawIndexed)(
+        XGL_CMD_BUFFER cmdBuffer,
+        uint32_t firstIndex,
+        uint32_t indexCount,
+        int32_t vertexOffset,
+        uint32_t firstInstance,
+        uint32_t instanceCount);
+    type_xglCmdDrawIndexed real_xglCmdDrawIndexed;
+    typedef void( XGLAPI * type_xglCmdDrawIndirect)(
+        XGL_CMD_BUFFER cmdBuffer,
+        XGL_BUFFER buffer,
+        XGL_GPU_SIZE offset,
+        uint32_t count,
+        uint32_t stride);
+    type_xglCmdDrawIndirect real_xglCmdDrawIndirect;
+    typedef void( XGLAPI * type_xglCmdDrawIndexedIndirect)(
+        XGL_CMD_BUFFER cmdBuffer,
+        XGL_BUFFER buffer,
+        XGL_GPU_SIZE offset,
+        uint32_t count,
+        uint32_t stride);
+    type_xglCmdDrawIndexedIndirect real_xglCmdDrawIndexedIndirect;
+    typedef void( XGLAPI * type_xglCmdDispatch)(
+        XGL_CMD_BUFFER cmdBuffer,
+        uint32_t x,
+        uint32_t y,
+        uint32_t z);
+    type_xglCmdDispatch real_xglCmdDispatch;
+    typedef void( XGLAPI * type_xglCmdDispatchIndirect)(
+        XGL_CMD_BUFFER cmdBuffer,
+        XGL_BUFFER buffer,
+        XGL_GPU_SIZE offset);
+    type_xglCmdDispatchIndirect real_xglCmdDispatchIndirect;
+    typedef void( XGLAPI * type_xglCmdCopyBuffer)(
+        XGL_CMD_BUFFER cmdBuffer,
+        XGL_BUFFER srcBuffer,
+        XGL_BUFFER destBuffer,
+        uint32_t regionCount,
+        const XGL_BUFFER_COPY* pRegions);
+    type_xglCmdCopyBuffer real_xglCmdCopyBuffer;
+    typedef void( XGLAPI * type_xglCmdCopyImage)(
+        XGL_CMD_BUFFER cmdBuffer,
+        XGL_IMAGE srcImage,
+        XGL_IMAGE destImage,
+        uint32_t regionCount,
+        const XGL_IMAGE_COPY* pRegions);
+    type_xglCmdCopyImage real_xglCmdCopyImage;
+    typedef void( XGLAPI * type_xglCmdCopyBufferToImage)(
+        XGL_CMD_BUFFER cmdBuffer,
+        XGL_BUFFER srcBuffer,
+        XGL_IMAGE destImage,
+        uint32_t regionCount,
+        const XGL_BUFFER_IMAGE_COPY* pRegions);
+    type_xglCmdCopyBufferToImage real_xglCmdCopyBufferToImage;
+    typedef void( XGLAPI * type_xglCmdCopyImageToBuffer)(
+        XGL_CMD_BUFFER cmdBuffer,
+        XGL_IMAGE srcImage,
+        XGL_BUFFER destBuffer,
+        uint32_t regionCount,
+        const XGL_BUFFER_IMAGE_COPY* pRegions);
+    type_xglCmdCopyImageToBuffer real_xglCmdCopyImageToBuffer;
+    typedef void( XGLAPI * type_xglCmdCloneImageData)(
+        XGL_CMD_BUFFER cmdBuffer,
+        XGL_IMAGE srcImage,
+        XGL_IMAGE_LAYOUT srcImageLayout,
+        XGL_IMAGE destImage,
+        XGL_IMAGE_LAYOUT destImageLayout);
+    type_xglCmdCloneImageData real_xglCmdCloneImageData;
+    typedef void( XGLAPI * type_xglCmdUpdateBuffer)(
+        XGL_CMD_BUFFER cmdBuffer,
+        XGL_BUFFER destBuffer,
+        XGL_GPU_SIZE destOffset,
+        XGL_GPU_SIZE dataSize,
+        const uint32_t* pData);
+    type_xglCmdUpdateBuffer real_xglCmdUpdateBuffer;
+    typedef void( XGLAPI * type_xglCmdFillBuffer)(
+        XGL_CMD_BUFFER cmdBuffer,
+        XGL_BUFFER destBuffer,
+        XGL_GPU_SIZE destOffset,
+        XGL_GPU_SIZE fillSize,
+        uint32_t data);
+    type_xglCmdFillBuffer real_xglCmdFillBuffer;
+    typedef void( XGLAPI * type_xglCmdClearColorImage)(
+        XGL_CMD_BUFFER cmdBuffer,
+        XGL_IMAGE image,
+        const float color[4],
+        uint32_t rangeCount,
+        const XGL_IMAGE_SUBRESOURCE_RANGE* pRanges);
+    type_xglCmdClearColorImage real_xglCmdClearColorImage;
+    typedef void( XGLAPI * type_xglCmdClearColorImageRaw)(
+        XGL_CMD_BUFFER cmdBuffer,
+        XGL_IMAGE image,
+        const uint32_t color[4],
+        uint32_t rangeCount,
+        const XGL_IMAGE_SUBRESOURCE_RANGE* pRanges);
+    type_xglCmdClearColorImageRaw real_xglCmdClearColorImageRaw;
+    typedef void( XGLAPI * type_xglCmdClearDepthStencil)(
+        XGL_CMD_BUFFER cmdBuffer,
+        XGL_IMAGE image,
+        float depth,
+        uint32_t stencil,
+        uint32_t rangeCount,
+        const XGL_IMAGE_SUBRESOURCE_RANGE* pRanges);
+    type_xglCmdClearDepthStencil real_xglCmdClearDepthStencil;
+    typedef void( XGLAPI * type_xglCmdResolveImage)(
+        XGL_CMD_BUFFER cmdBuffer,
+        XGL_IMAGE srcImage,
+        XGL_IMAGE destImage,
+        uint32_t rectCount,
+        const XGL_IMAGE_RESOLVE* pRects);
+    type_xglCmdResolveImage real_xglCmdResolveImage;
+    typedef void( XGLAPI * type_xglCmdSetEvent)(
+        XGL_CMD_BUFFER cmdBuffer,
+        XGL_EVENT event,
+        XGL_SET_EVENT pipeEvent);
+    type_xglCmdSetEvent real_xglCmdSetEvent;
+    typedef void( XGLAPI * type_xglCmdResetEvent)(
+        XGL_CMD_BUFFER cmdBuffer,
+        XGL_EVENT event);
+    type_xglCmdResetEvent real_xglCmdResetEvent;
+    typedef void( XGLAPI * type_xglCmdWaitEvents)(
+        XGL_CMD_BUFFER cmdBuffer,
+        const XGL_EVENT_WAIT_INFO* pWaitInfo);
+    type_xglCmdWaitEvents real_xglCmdWaitEvents;
+    typedef void( XGLAPI * type_xglCmdPipelineBarrier)(
+        XGL_CMD_BUFFER cmdBuffer,
+        const XGL_PIPELINE_BARRIER* pBarrier);
+    type_xglCmdPipelineBarrier real_xglCmdPipelineBarrier;
+    typedef void( XGLAPI * type_xglCmdBeginQuery)(
+        XGL_CMD_BUFFER cmdBuffer,
+        XGL_QUERY_POOL queryPool,
+        uint32_t slot,
+        XGL_FLAGS flags);
+    type_xglCmdBeginQuery real_xglCmdBeginQuery;
+    typedef void( XGLAPI * type_xglCmdEndQuery)(
+        XGL_CMD_BUFFER cmdBuffer,
+        XGL_QUERY_POOL queryPool,
+        uint32_t slot);
+    type_xglCmdEndQuery real_xglCmdEndQuery;
+    typedef void( XGLAPI * type_xglCmdResetQueryPool)(
+        XGL_CMD_BUFFER cmdBuffer,
+        XGL_QUERY_POOL queryPool,
+        uint32_t startQuery,
+        uint32_t queryCount);
+    type_xglCmdResetQueryPool real_xglCmdResetQueryPool;
+    typedef void( XGLAPI * type_xglCmdWriteTimestamp)(
+        XGL_CMD_BUFFER cmdBuffer,
+        XGL_TIMESTAMP_TYPE timestampType,
+        XGL_BUFFER destBuffer,
+        XGL_GPU_SIZE destOffset);
+    type_xglCmdWriteTimestamp real_xglCmdWriteTimestamp;
+    typedef void( XGLAPI * type_xglCmdInitAtomicCounters)(
+        XGL_CMD_BUFFER cmdBuffer,
+        XGL_PIPELINE_BIND_POINT pipelineBindPoint,
+        uint32_t startCounter,
+        uint32_t counterCount,
+        const uint32_t* pData);
+    type_xglCmdInitAtomicCounters real_xglCmdInitAtomicCounters;
+    typedef void( XGLAPI * type_xglCmdLoadAtomicCounters)(
+        XGL_CMD_BUFFER cmdBuffer,
+        XGL_PIPELINE_BIND_POINT pipelineBindPoint,
+        uint32_t startCounter,
+        uint32_t counterCount,
+        XGL_BUFFER srcBuffer,
+        XGL_GPU_SIZE srcOffset);
+    type_xglCmdLoadAtomicCounters real_xglCmdLoadAtomicCounters;
+    typedef void( XGLAPI * type_xglCmdSaveAtomicCounters)(
+        XGL_CMD_BUFFER cmdBuffer,
+        XGL_PIPELINE_BIND_POINT pipelineBindPoint,
+        uint32_t startCounter,
+        uint32_t counterCount,
+        XGL_BUFFER destBuffer,
+        XGL_GPU_SIZE destOffset);
+    type_xglCmdSaveAtomicCounters real_xglCmdSaveAtomicCounters;
+    typedef XGL_RESULT( XGLAPI * type_xglCreateFramebuffer)(
+        XGL_DEVICE device,
+        const XGL_FRAMEBUFFER_CREATE_INFO* pCreateInfo,
+        XGL_FRAMEBUFFER* pFramebuffer);
+    type_xglCreateFramebuffer real_xglCreateFramebuffer;
+    typedef XGL_RESULT( XGLAPI * type_xglCreateRenderPass)(
+        XGL_DEVICE device,
+        const XGL_RENDER_PASS_CREATE_INFO* pCreateInfo,
+        XGL_RENDER_PASS* pRenderPass);
+    type_xglCreateRenderPass real_xglCreateRenderPass;
+    typedef void( XGLAPI * type_xglCmdBeginRenderPass)(
+        XGL_CMD_BUFFER cmdBuffer,
+        XGL_RENDER_PASS renderPass);
+    type_xglCmdBeginRenderPass real_xglCmdBeginRenderPass;
+    typedef void( XGLAPI * type_xglCmdEndRenderPass)(
+        XGL_CMD_BUFFER cmdBuffer,
+        XGL_RENDER_PASS renderPass);
+    type_xglCmdEndRenderPass real_xglCmdEndRenderPass;
+    typedef XGL_RESULT( XGLAPI * type_xglDbgSetValidationLevel)(
+        XGL_DEVICE device,
+        XGL_VALIDATION_LEVEL validationLevel);
+    type_xglDbgSetValidationLevel real_xglDbgSetValidationLevel;
+    typedef XGL_RESULT( XGLAPI * type_xglDbgRegisterMsgCallback)(
+        XGL_DBG_MSG_CALLBACK_FUNCTION pfnMsgCallback,
+        void* pUserData);
+    type_xglDbgRegisterMsgCallback real_xglDbgRegisterMsgCallback;
+    typedef XGL_RESULT( XGLAPI * type_xglDbgUnregisterMsgCallback)(
+        XGL_DBG_MSG_CALLBACK_FUNCTION pfnMsgCallback);
+    type_xglDbgUnregisterMsgCallback real_xglDbgUnregisterMsgCallback;
+    typedef XGL_RESULT( XGLAPI * type_xglDbgSetMessageFilter)(
+        XGL_DEVICE device,
+        int32_t msgCode,
+        XGL_DBG_MSG_FILTER filter);
+    type_xglDbgSetMessageFilter real_xglDbgSetMessageFilter;
+    typedef XGL_RESULT( XGLAPI * type_xglDbgSetObjectTag)(
+        XGL_BASE_OBJECT object,
+        size_t tagSize,
+        const void* pTag);
+    type_xglDbgSetObjectTag real_xglDbgSetObjectTag;
+    typedef XGL_RESULT( XGLAPI * type_xglDbgSetGlobalOption)(
+        XGL_DBG_GLOBAL_OPTION dbgOption,
+        size_t dataSize,
+        const void* pData);
+    type_xglDbgSetGlobalOption real_xglDbgSetGlobalOption;
+    typedef XGL_RESULT( XGLAPI * type_xglDbgSetDeviceOption)(
+        XGL_DEVICE device,
+        XGL_DBG_DEVICE_OPTION dbgOption,
+        size_t dataSize,
+        const void* pData);
+    type_xglDbgSetDeviceOption real_xglDbgSetDeviceOption;
+    typedef void( XGLAPI * type_xglCmdDbgMarkerBegin)(
+        XGL_CMD_BUFFER cmdBuffer,
+        const char* pMarker);
+    type_xglCmdDbgMarkerBegin real_xglCmdDbgMarkerBegin;
+    typedef void( XGLAPI * type_xglCmdDbgMarkerEnd)(
+        XGL_CMD_BUFFER cmdBuffer);
+    type_xglCmdDbgMarkerEnd real_xglCmdDbgMarkerEnd;
+    typedef XGL_RESULT( XGLAPI * type_xglWsiX11AssociateConnection)(
+        XGL_PHYSICAL_GPU gpu,
+        const XGL_WSI_X11_CONNECTION_INFO* pConnectionInfo);
+    type_xglWsiX11AssociateConnection real_xglWsiX11AssociateConnection;
+    typedef XGL_RESULT( XGLAPI * type_xglWsiX11GetMSC)(
+        XGL_DEVICE device,
+        xcb_window_t window,
+        xcb_randr_crtc_t crtc,
+        uint64_t* pMsc);
+    type_xglWsiX11GetMSC real_xglWsiX11GetMSC;
+    typedef XGL_RESULT( XGLAPI * type_xglWsiX11CreatePresentableImage)(
+        XGL_DEVICE device,
+        const XGL_WSI_X11_PRESENTABLE_IMAGE_CREATE_INFO* pCreateInfo,
+        XGL_IMAGE* pImage,
+        XGL_GPU_MEMORY* pMem);
+    type_xglWsiX11CreatePresentableImage real_xglWsiX11CreatePresentableImage;
+    typedef XGL_RESULT( XGLAPI * type_xglWsiX11QueuePresent)(
+        XGL_QUEUE queue,
+        const XGL_WSI_X11_PRESENT_INFO* pPresentInfo,
+        XGL_FENCE fence);
+    type_xglWsiX11QueuePresent real_xglWsiX11QueuePresent;
+};
+class xglReplay : public ApiReplay {
+public:
+    ~xglReplay();
+    xglReplay(glvreplay_settings *pReplaySettings);
+
+    int init(glv_replay::Display & disp);
+    xglDisplay * get_display() {return m_display;}
+    glv_replay::GLV_REPLAY_RESULT replay(glv_trace_packet_header *packet);
+    glv_replay::GLV_REPLAY_RESULT handle_replay_errors(const char* entrypointName, const XGL_RESULT resCall, const XGL_RESULT resTrace, const glv_replay::GLV_REPLAY_RESULT resIn);
+
+    void push_validation_msg(XGL_VALIDATION_LEVEL validationLevel, XGL_BASE_OBJECT srcObject, size_t location, int32_t msgCode, const char* pMsg);
+    glv_replay::GLV_REPLAY_RESULT pop_validation_msgs();
+    int dump_validation_data();
+private:
+    struct xglFuncs m_xglFuncs;
+    DRAW_STATE_DUMP_DOT_FILE m_pDSDump;
+    DRAW_STATE_DUMP_COMMAND_BUFFER_DOT_FILE m_pCBDump;
+    xglDisplay *m_display;
+    struct shaderPair {
+        XGL_SHADER *addr;
+        XGL_SHADER val;
+    };
+    struct validationMsg {
+        XGL_VALIDATION_LEVEL validationLevel;
+        XGL_BASE_OBJECT srcObject;
+        size_t location;
+        int32_t msgCode;
+        char msg[256];
+    };
+    std::vector<struct validationMsg> m_validationMsgs;
+    std::vector<int> m_screenshotFrames;
+    bool m_adjustForGPU; // true if replay adjusts behavior based on GPU
+    struct imageObj {
+       objMemory imageMem;
+       XGL_IMAGE replayImage;
+    };
+
+    struct bufferObj {
+       objMemory bufferMem;
+       XGL_BUFFER replayBuffer;
+    };
+
+    struct gpuMemObj {
+       gpuMemory *pGpuMem;
+       XGL_GPU_MEMORY replayGpuMem;
+    };
+
+    void init_objMemCount(const XGL_BASE_OBJECT& object, const uint32_t &num)
+    {
+        XGL_IMAGE img = static_cast <XGL_IMAGE> (object);
+        std::map<XGL_IMAGE, struct imageObj>::const_iterator it = m_images.find(img);
+        if (it != m_images.end())
+        {
+            objMemory obj = it->second.imageMem;
+            obj.setCount(num);
+            return;
+        }
+        XGL_BUFFER buf = static_cast <XGL_BUFFER> (object);
+        std::map<XGL_BUFFER, struct bufferObj>::const_iterator itb = m_buffers.find(buf);
+        if (itb != m_buffers.end())
+        {
+            objMemory obj = itb->second.bufferMem;
+            obj.setCount(num);
+            return;
+        }
+        return;
+    }
+
+    void init_objMemReqs(const XGL_BASE_OBJECT& object, const XGL_MEMORY_REQUIREMENTS *pMemReqs, const unsigned int num)
+    {
+        XGL_IMAGE img = static_cast <XGL_IMAGE> (object);
+        std::map<XGL_IMAGE, struct imageObj>::const_iterator it = m_images.find(img);
+        if (it != m_images.end())
+        {
+            objMemory obj = it->second.imageMem;
+            obj.setReqs(pMemReqs, num);
+            return;
+        }
+        XGL_BUFFER buf = static_cast <XGL_BUFFER> (object);
+        std::map<XGL_BUFFER, struct bufferObj>::const_iterator itb = m_buffers.find(buf);
+        if (itb != m_buffers.end())
+        {
+            objMemory obj = itb->second.bufferMem;
+            obj.setReqs(pMemReqs, num);
+            return;
+        }
+        return;
+    }
+
+    void clear_all_map_handles()
+    {
+        m_bufferViews.clear();
+        m_buffers.clear();
+        m_cmdBuffers.clear();
+        m_colorAttachmentViews.clear();
+        m_depthStencilViews.clear();
+        m_descriptorRegions.clear();
+        m_descriptorSetLayouts.clear();
+        m_descriptorSets.clear();
+        m_devices.clear();
+        m_dynamicCbStateObjects.clear();
+        m_dynamicDsStateObjects.clear();
+        m_dynamicRsStateObjects.clear();
+        m_dynamicVpStateObjects.clear();
+        m_events.clear();
+        m_fences.clear();
+        m_framebuffers.clear();
+        m_gpuMemorys.clear();
+        m_imageViews.clear();
+        m_images.clear();
+        m_instances.clear();
+        m_physicalGpus.clear();
+        m_pipelineDeltas.clear();
+        m_pipelines.clear();
+        m_queryPools.clear();
+        m_queueSemaphores.clear();
+        m_queues.clear();
+        m_renderPasss.clear();
+        m_samplers.clear();
+        m_shaders.clear();
+    }
+
+    std::map<XGL_BUFFER_VIEW, XGL_BUFFER_VIEW> m_bufferViews;
+    void add_to_map(XGL_BUFFER_VIEW* pTraceVal, XGL_BUFFER_VIEW* pReplayVal)
+    {
+        assert(pTraceVal != NULL);
+        assert(pReplayVal != NULL);
+        m_bufferViews[*pTraceVal] = *pReplayVal;
+    }
+
+    void rm_from_map(const XGL_BUFFER_VIEW& key)
+    {
+        m_bufferViews.erase(key);
+    }
+
+    XGL_BUFFER_VIEW remap(const XGL_BUFFER_VIEW& value)
+    {
+        std::map<XGL_BUFFER_VIEW, XGL_BUFFER_VIEW>::const_iterator q = m_bufferViews.find(value);
+        return (q == m_bufferViews.end()) ? XGL_NULL_HANDLE : q->second;
+    }
+
+    std::map<XGL_BUFFER, struct bufferObj> m_buffers;
+    void add_to_map(XGL_BUFFER* pTraceVal, struct bufferObj* pReplayVal)
+    {
+        assert(pTraceVal != NULL);
+        assert(pReplayVal != NULL);
+        m_buffers[*pTraceVal] = *pReplayVal;
+    }
+
+    void rm_from_map(const XGL_BUFFER& key)
+    {
+        m_buffers.erase(key);
+    }
+
+    XGL_BUFFER remap(const XGL_BUFFER& value)
+    {
+        std::map<XGL_BUFFER, struct bufferObj>::const_iterator q = m_buffers.find(value);
+        return (q == m_buffers.end()) ? XGL_NULL_HANDLE : q->second.replayBuffer;
+    }
+
+    std::map<XGL_CMD_BUFFER, XGL_CMD_BUFFER> m_cmdBuffers;
+    void add_to_map(XGL_CMD_BUFFER* pTraceVal, XGL_CMD_BUFFER* pReplayVal)
+    {
+        assert(pTraceVal != NULL);
+        assert(pReplayVal != NULL);
+        m_cmdBuffers[*pTraceVal] = *pReplayVal;
+    }
+
+    void rm_from_map(const XGL_CMD_BUFFER& key)
+    {
+        m_cmdBuffers.erase(key);
+    }
+
+    XGL_CMD_BUFFER remap(const XGL_CMD_BUFFER& value)
+    {
+        std::map<XGL_CMD_BUFFER, XGL_CMD_BUFFER>::const_iterator q = m_cmdBuffers.find(value);
+        return (q == m_cmdBuffers.end()) ? XGL_NULL_HANDLE : q->second;
+    }
+
+    std::map<XGL_COLOR_ATTACHMENT_VIEW, XGL_COLOR_ATTACHMENT_VIEW> m_colorAttachmentViews;
+    void add_to_map(XGL_COLOR_ATTACHMENT_VIEW* pTraceVal, XGL_COLOR_ATTACHMENT_VIEW* pReplayVal)
+    {
+        assert(pTraceVal != NULL);
+        assert(pReplayVal != NULL);
+        m_colorAttachmentViews[*pTraceVal] = *pReplayVal;
+    }
+
+    void rm_from_map(const XGL_COLOR_ATTACHMENT_VIEW& key)
+    {
+        m_colorAttachmentViews.erase(key);
+    }
+
+    XGL_COLOR_ATTACHMENT_VIEW remap(const XGL_COLOR_ATTACHMENT_VIEW& value)
+    {
+        std::map<XGL_COLOR_ATTACHMENT_VIEW, XGL_COLOR_ATTACHMENT_VIEW>::const_iterator q = m_colorAttachmentViews.find(value);
+        return (q == m_colorAttachmentViews.end()) ? XGL_NULL_HANDLE : q->second;
+    }
+
+    std::map<XGL_DEPTH_STENCIL_VIEW, XGL_DEPTH_STENCIL_VIEW> m_depthStencilViews;
+    void add_to_map(XGL_DEPTH_STENCIL_VIEW* pTraceVal, XGL_DEPTH_STENCIL_VIEW* pReplayVal)
+    {
+        assert(pTraceVal != NULL);
+        assert(pReplayVal != NULL);
+        m_depthStencilViews[*pTraceVal] = *pReplayVal;
+    }
+
+    void rm_from_map(const XGL_DEPTH_STENCIL_VIEW& key)
+    {
+        m_depthStencilViews.erase(key);
+    }
+
+    XGL_DEPTH_STENCIL_VIEW remap(const XGL_DEPTH_STENCIL_VIEW& value)
+    {
+        std::map<XGL_DEPTH_STENCIL_VIEW, XGL_DEPTH_STENCIL_VIEW>::const_iterator q = m_depthStencilViews.find(value);
+        return (q == m_depthStencilViews.end()) ? XGL_NULL_HANDLE : q->second;
+    }
+
+    std::map<XGL_DESCRIPTOR_REGION, XGL_DESCRIPTOR_REGION> m_descriptorRegions;
+    void add_to_map(XGL_DESCRIPTOR_REGION* pTraceVal, XGL_DESCRIPTOR_REGION* pReplayVal)
+    {
+        assert(pTraceVal != NULL);
+        assert(pReplayVal != NULL);
+        m_descriptorRegions[*pTraceVal] = *pReplayVal;
+    }
+
+    void rm_from_map(const XGL_DESCRIPTOR_REGION& key)
+    {
+        m_descriptorRegions.erase(key);
+    }
+
+    XGL_DESCRIPTOR_REGION remap(const XGL_DESCRIPTOR_REGION& value)
+    {
+        std::map<XGL_DESCRIPTOR_REGION, XGL_DESCRIPTOR_REGION>::const_iterator q = m_descriptorRegions.find(value);
+        return (q == m_descriptorRegions.end()) ? XGL_NULL_HANDLE : q->second;
+    }
+
+    std::map<XGL_DESCRIPTOR_SET_LAYOUT, XGL_DESCRIPTOR_SET_LAYOUT> m_descriptorSetLayouts;
+    void add_to_map(XGL_DESCRIPTOR_SET_LAYOUT* pTraceVal, XGL_DESCRIPTOR_SET_LAYOUT* pReplayVal)
+    {
+        assert(pTraceVal != NULL);
+        assert(pReplayVal != NULL);
+        m_descriptorSetLayouts[*pTraceVal] = *pReplayVal;
+    }
+
+    void rm_from_map(const XGL_DESCRIPTOR_SET_LAYOUT& key)
+    {
+        m_descriptorSetLayouts.erase(key);
+    }
+
+    XGL_DESCRIPTOR_SET_LAYOUT remap(const XGL_DESCRIPTOR_SET_LAYOUT& value)
+    {
+        std::map<XGL_DESCRIPTOR_SET_LAYOUT, XGL_DESCRIPTOR_SET_LAYOUT>::const_iterator q = m_descriptorSetLayouts.find(value);
+        return (q == m_descriptorSetLayouts.end()) ? XGL_NULL_HANDLE : q->second;
+    }
+
+    std::map<XGL_DESCRIPTOR_SET, XGL_DESCRIPTOR_SET> m_descriptorSets;
+    void add_to_map(XGL_DESCRIPTOR_SET* pTraceVal, XGL_DESCRIPTOR_SET* pReplayVal)
+    {
+        assert(pTraceVal != NULL);
+        assert(pReplayVal != NULL);
+        m_descriptorSets[*pTraceVal] = *pReplayVal;
+    }
+
+    void rm_from_map(const XGL_DESCRIPTOR_SET& key)
+    {
+        m_descriptorSets.erase(key);
+    }
+
+    XGL_DESCRIPTOR_SET remap(const XGL_DESCRIPTOR_SET& value)
+    {
+        std::map<XGL_DESCRIPTOR_SET, XGL_DESCRIPTOR_SET>::const_iterator q = m_descriptorSets.find(value);
+        return (q == m_descriptorSets.end()) ? XGL_NULL_HANDLE : q->second;
+    }
+
+    std::map<XGL_DEVICE, XGL_DEVICE> m_devices;
+    void add_to_map(XGL_DEVICE* pTraceVal, XGL_DEVICE* pReplayVal)
+    {
+        assert(pTraceVal != NULL);
+        assert(pReplayVal != NULL);
+        m_devices[*pTraceVal] = *pReplayVal;
+    }
+
+    void rm_from_map(const XGL_DEVICE& key)
+    {
+        m_devices.erase(key);
+    }
+
+    XGL_DEVICE remap(const XGL_DEVICE& value)
+    {
+        std::map<XGL_DEVICE, XGL_DEVICE>::const_iterator q = m_devices.find(value);
+        return (q == m_devices.end()) ? XGL_NULL_HANDLE : q->second;
+    }
+
+    std::map<XGL_DYNAMIC_CB_STATE_OBJECT, XGL_DYNAMIC_CB_STATE_OBJECT> m_dynamicCbStateObjects;
+    void add_to_map(XGL_DYNAMIC_CB_STATE_OBJECT* pTraceVal, XGL_DYNAMIC_CB_STATE_OBJECT* pReplayVal)
+    {
+        assert(pTraceVal != NULL);
+        assert(pReplayVal != NULL);
+        m_dynamicCbStateObjects[*pTraceVal] = *pReplayVal;
+    }
+
+    void rm_from_map(const XGL_DYNAMIC_CB_STATE_OBJECT& key)
+    {
+        m_dynamicCbStateObjects.erase(key);
+    }
+
+    XGL_DYNAMIC_CB_STATE_OBJECT remap(const XGL_DYNAMIC_CB_STATE_OBJECT& value)
+    {
+        std::map<XGL_DYNAMIC_CB_STATE_OBJECT, XGL_DYNAMIC_CB_STATE_OBJECT>::const_iterator q = m_dynamicCbStateObjects.find(value);
+        return (q == m_dynamicCbStateObjects.end()) ? XGL_NULL_HANDLE : q->second;
+    }
+
+    std::map<XGL_DYNAMIC_DS_STATE_OBJECT, XGL_DYNAMIC_DS_STATE_OBJECT> m_dynamicDsStateObjects;
+    void add_to_map(XGL_DYNAMIC_DS_STATE_OBJECT* pTraceVal, XGL_DYNAMIC_DS_STATE_OBJECT* pReplayVal)
+    {
+        assert(pTraceVal != NULL);
+        assert(pReplayVal != NULL);
+        m_dynamicDsStateObjects[*pTraceVal] = *pReplayVal;
+    }
+
+    void rm_from_map(const XGL_DYNAMIC_DS_STATE_OBJECT& key)
+    {
+        m_dynamicDsStateObjects.erase(key);
+    }
+
+    XGL_DYNAMIC_DS_STATE_OBJECT remap(const XGL_DYNAMIC_DS_STATE_OBJECT& value)
+    {
+        std::map<XGL_DYNAMIC_DS_STATE_OBJECT, XGL_DYNAMIC_DS_STATE_OBJECT>::const_iterator q = m_dynamicDsStateObjects.find(value);
+        return (q == m_dynamicDsStateObjects.end()) ? XGL_NULL_HANDLE : q->second;
+    }
+
+    std::map<XGL_DYNAMIC_RS_STATE_OBJECT, XGL_DYNAMIC_RS_STATE_OBJECT> m_dynamicRsStateObjects;
+    void add_to_map(XGL_DYNAMIC_RS_STATE_OBJECT* pTraceVal, XGL_DYNAMIC_RS_STATE_OBJECT* pReplayVal)
+    {
+        assert(pTraceVal != NULL);
+        assert(pReplayVal != NULL);
+        m_dynamicRsStateObjects[*pTraceVal] = *pReplayVal;
+    }
+
+    void rm_from_map(const XGL_DYNAMIC_RS_STATE_OBJECT& key)
+    {
+        m_dynamicRsStateObjects.erase(key);
+    }
+
+    XGL_DYNAMIC_RS_STATE_OBJECT remap(const XGL_DYNAMIC_RS_STATE_OBJECT& value)
+    {
+        std::map<XGL_DYNAMIC_RS_STATE_OBJECT, XGL_DYNAMIC_RS_STATE_OBJECT>::const_iterator q = m_dynamicRsStateObjects.find(value);
+        return (q == m_dynamicRsStateObjects.end()) ? XGL_NULL_HANDLE : q->second;
+    }
+
+    std::map<XGL_DYNAMIC_VP_STATE_OBJECT, XGL_DYNAMIC_VP_STATE_OBJECT> m_dynamicVpStateObjects;
+    void add_to_map(XGL_DYNAMIC_VP_STATE_OBJECT* pTraceVal, XGL_DYNAMIC_VP_STATE_OBJECT* pReplayVal)
+    {
+        assert(pTraceVal != NULL);
+        assert(pReplayVal != NULL);
+        m_dynamicVpStateObjects[*pTraceVal] = *pReplayVal;
+    }
+
+    void rm_from_map(const XGL_DYNAMIC_VP_STATE_OBJECT& key)
+    {
+        m_dynamicVpStateObjects.erase(key);
+    }
+
+    XGL_DYNAMIC_VP_STATE_OBJECT remap(const XGL_DYNAMIC_VP_STATE_OBJECT& value)
+    {
+        std::map<XGL_DYNAMIC_VP_STATE_OBJECT, XGL_DYNAMIC_VP_STATE_OBJECT>::const_iterator q = m_dynamicVpStateObjects.find(value);
+        return (q == m_dynamicVpStateObjects.end()) ? XGL_NULL_HANDLE : q->second;
+    }
+
+    std::map<XGL_EVENT, XGL_EVENT> m_events;
+    void add_to_map(XGL_EVENT* pTraceVal, XGL_EVENT* pReplayVal)
+    {
+        assert(pTraceVal != NULL);
+        assert(pReplayVal != NULL);
+        m_events[*pTraceVal] = *pReplayVal;
+    }
+
+    void rm_from_map(const XGL_EVENT& key)
+    {
+        m_events.erase(key);
+    }
+
+    XGL_EVENT remap(const XGL_EVENT& value)
+    {
+        std::map<XGL_EVENT, XGL_EVENT>::const_iterator q = m_events.find(value);
+        return (q == m_events.end()) ? XGL_NULL_HANDLE : q->second;
+    }
+
+    std::map<XGL_FENCE, XGL_FENCE> m_fences;
+    void add_to_map(XGL_FENCE* pTraceVal, XGL_FENCE* pReplayVal)
+    {
+        assert(pTraceVal != NULL);
+        assert(pReplayVal != NULL);
+        m_fences[*pTraceVal] = *pReplayVal;
+    }
+
+    void rm_from_map(const XGL_FENCE& key)
+    {
+        m_fences.erase(key);
+    }
+
+    XGL_FENCE remap(const XGL_FENCE& value)
+    {
+        std::map<XGL_FENCE, XGL_FENCE>::const_iterator q = m_fences.find(value);
+        return (q == m_fences.end()) ? XGL_NULL_HANDLE : q->second;
+    }
+
+    std::map<XGL_FRAMEBUFFER, XGL_FRAMEBUFFER> m_framebuffers;
+    void add_to_map(XGL_FRAMEBUFFER* pTraceVal, XGL_FRAMEBUFFER* pReplayVal)
+    {
+        assert(pTraceVal != NULL);
+        assert(pReplayVal != NULL);
+        m_framebuffers[*pTraceVal] = *pReplayVal;
+    }
+
+    void rm_from_map(const XGL_FRAMEBUFFER& key)
+    {
+        m_framebuffers.erase(key);
+    }
+
+    XGL_FRAMEBUFFER remap(const XGL_FRAMEBUFFER& value)
+    {
+        std::map<XGL_FRAMEBUFFER, XGL_FRAMEBUFFER>::const_iterator q = m_framebuffers.find(value);
+        return (q == m_framebuffers.end()) ? XGL_NULL_HANDLE : q->second;
+    }
+
+    std::map<XGL_GPU_MEMORY, struct gpuMemObj> m_gpuMemorys;
+    void add_to_map(XGL_GPU_MEMORY* pTraceVal, struct gpuMemObj* pReplayVal)
+    {
+        assert(pTraceVal != NULL);
+        assert(pReplayVal != NULL);
+        m_gpuMemorys[*pTraceVal] = *pReplayVal;
+    }
+
+    void rm_from_map(const XGL_GPU_MEMORY& key)
+    {
+        m_gpuMemorys.erase(key);
+    }
+
+    XGL_GPU_MEMORY remap(const XGL_GPU_MEMORY& value)
+    {
+        std::map<XGL_GPU_MEMORY, struct gpuMemObj>::const_iterator q = m_gpuMemorys.find(value);
+        return (q == m_gpuMemorys.end()) ? XGL_NULL_HANDLE : q->second.replayGpuMem;
+    }
+
+    std::map<XGL_IMAGE_VIEW, XGL_IMAGE_VIEW> m_imageViews;
+    void add_to_map(XGL_IMAGE_VIEW* pTraceVal, XGL_IMAGE_VIEW* pReplayVal)
+    {
+        assert(pTraceVal != NULL);
+        assert(pReplayVal != NULL);
+        m_imageViews[*pTraceVal] = *pReplayVal;
+    }
+
+    void rm_from_map(const XGL_IMAGE_VIEW& key)
+    {
+        m_imageViews.erase(key);
+    }
+
+    XGL_IMAGE_VIEW remap(const XGL_IMAGE_VIEW& value)
+    {
+        std::map<XGL_IMAGE_VIEW, XGL_IMAGE_VIEW>::const_iterator q = m_imageViews.find(value);
+        return (q == m_imageViews.end()) ? XGL_NULL_HANDLE : q->second;
+    }
+
+    std::map<XGL_IMAGE, struct imageObj> m_images;
+    void add_to_map(XGL_IMAGE* pTraceVal, struct imageObj* pReplayVal)
+    {
+        assert(pTraceVal != NULL);
+        assert(pReplayVal != NULL);
+        m_images[*pTraceVal] = *pReplayVal;
+    }
+
+    void rm_from_map(const XGL_IMAGE& key)
+    {
+        m_images.erase(key);
+    }
+
+    XGL_IMAGE remap(const XGL_IMAGE& value)
+    {
+        std::map<XGL_IMAGE, struct imageObj>::const_iterator q = m_images.find(value);
+        return (q == m_images.end()) ? XGL_NULL_HANDLE : q->second.replayImage;
+    }
+
+    std::map<XGL_INSTANCE, XGL_INSTANCE> m_instances;
+    void add_to_map(XGL_INSTANCE* pTraceVal, XGL_INSTANCE* pReplayVal)
+    {
+        assert(pTraceVal != NULL);
+        assert(pReplayVal != NULL);
+        m_instances[*pTraceVal] = *pReplayVal;
+    }
+
+    void rm_from_map(const XGL_INSTANCE& key)
+    {
+        m_instances.erase(key);
+    }
+
+    XGL_INSTANCE remap(const XGL_INSTANCE& value)
+    {
+        std::map<XGL_INSTANCE, XGL_INSTANCE>::const_iterator q = m_instances.find(value);
+        return (q == m_instances.end()) ? XGL_NULL_HANDLE : q->second;
+    }
+
+    std::map<XGL_PHYSICAL_GPU, XGL_PHYSICAL_GPU> m_physicalGpus;
+    void add_to_map(XGL_PHYSICAL_GPU* pTraceVal, XGL_PHYSICAL_GPU* pReplayVal)
+    {
+        assert(pTraceVal != NULL);
+        assert(pReplayVal != NULL);
+        m_physicalGpus[*pTraceVal] = *pReplayVal;
+    }
+
+    void rm_from_map(const XGL_PHYSICAL_GPU& key)
+    {
+        m_physicalGpus.erase(key);
+    }
+
+    XGL_PHYSICAL_GPU remap(const XGL_PHYSICAL_GPU& value)
+    {
+        std::map<XGL_PHYSICAL_GPU, XGL_PHYSICAL_GPU>::const_iterator q = m_physicalGpus.find(value);
+        return (q == m_physicalGpus.end()) ? XGL_NULL_HANDLE : q->second;
+    }
+
+    std::map<XGL_PIPELINE_DELTA, XGL_PIPELINE_DELTA> m_pipelineDeltas;
+    void add_to_map(XGL_PIPELINE_DELTA* pTraceVal, XGL_PIPELINE_DELTA* pReplayVal)
+    {
+        assert(pTraceVal != NULL);
+        assert(pReplayVal != NULL);
+        m_pipelineDeltas[*pTraceVal] = *pReplayVal;
+    }
+
+    void rm_from_map(const XGL_PIPELINE_DELTA& key)
+    {
+        m_pipelineDeltas.erase(key);
+    }
+
+    XGL_PIPELINE_DELTA remap(const XGL_PIPELINE_DELTA& value)
+    {
+        std::map<XGL_PIPELINE_DELTA, XGL_PIPELINE_DELTA>::const_iterator q = m_pipelineDeltas.find(value);
+        return (q == m_pipelineDeltas.end()) ? XGL_NULL_HANDLE : q->second;
+    }
+
+    std::map<XGL_PIPELINE, XGL_PIPELINE> m_pipelines;
+    void add_to_map(XGL_PIPELINE* pTraceVal, XGL_PIPELINE* pReplayVal)
+    {
+        assert(pTraceVal != NULL);
+        assert(pReplayVal != NULL);
+        m_pipelines[*pTraceVal] = *pReplayVal;
+    }
+
+    void rm_from_map(const XGL_PIPELINE& key)
+    {
+        m_pipelines.erase(key);
+    }
+
+    XGL_PIPELINE remap(const XGL_PIPELINE& value)
+    {
+        std::map<XGL_PIPELINE, XGL_PIPELINE>::const_iterator q = m_pipelines.find(value);
+        return (q == m_pipelines.end()) ? XGL_NULL_HANDLE : q->second;
+    }
+
+    std::map<XGL_QUERY_POOL, XGL_QUERY_POOL> m_queryPools;
+    void add_to_map(XGL_QUERY_POOL* pTraceVal, XGL_QUERY_POOL* pReplayVal)
+    {
+        assert(pTraceVal != NULL);
+        assert(pReplayVal != NULL);
+        m_queryPools[*pTraceVal] = *pReplayVal;
+    }
+
+    void rm_from_map(const XGL_QUERY_POOL& key)
+    {
+        m_queryPools.erase(key);
+    }
+
+    XGL_QUERY_POOL remap(const XGL_QUERY_POOL& value)
+    {
+        std::map<XGL_QUERY_POOL, XGL_QUERY_POOL>::const_iterator q = m_queryPools.find(value);
+        return (q == m_queryPools.end()) ? XGL_NULL_HANDLE : q->second;
+    }
+
+    std::map<XGL_QUEUE_SEMAPHORE, XGL_QUEUE_SEMAPHORE> m_queueSemaphores;
+    void add_to_map(XGL_QUEUE_SEMAPHORE* pTraceVal, XGL_QUEUE_SEMAPHORE* pReplayVal)
+    {
+        assert(pTraceVal != NULL);
+        assert(pReplayVal != NULL);
+        m_queueSemaphores[*pTraceVal] = *pReplayVal;
+    }
+
+    void rm_from_map(const XGL_QUEUE_SEMAPHORE& key)
+    {
+        m_queueSemaphores.erase(key);
+    }
+
+    XGL_QUEUE_SEMAPHORE remap(const XGL_QUEUE_SEMAPHORE& value)
+    {
+        std::map<XGL_QUEUE_SEMAPHORE, XGL_QUEUE_SEMAPHORE>::const_iterator q = m_queueSemaphores.find(value);
+        return (q == m_queueSemaphores.end()) ? XGL_NULL_HANDLE : q->second;
+    }
+
+    std::map<XGL_QUEUE, XGL_QUEUE> m_queues;
+    void add_to_map(XGL_QUEUE* pTraceVal, XGL_QUEUE* pReplayVal)
+    {
+        assert(pTraceVal != NULL);
+        assert(pReplayVal != NULL);
+        m_queues[*pTraceVal] = *pReplayVal;
+    }
+
+    void rm_from_map(const XGL_QUEUE& key)
+    {
+        m_queues.erase(key);
+    }
+
+    XGL_QUEUE remap(const XGL_QUEUE& value)
+    {
+        std::map<XGL_QUEUE, XGL_QUEUE>::const_iterator q = m_queues.find(value);
+        return (q == m_queues.end()) ? XGL_NULL_HANDLE : q->second;
+    }
+
+    std::map<XGL_RENDER_PASS, XGL_RENDER_PASS> m_renderPasss;
+    void add_to_map(XGL_RENDER_PASS* pTraceVal, XGL_RENDER_PASS* pReplayVal)
+    {
+        assert(pTraceVal != NULL);
+        assert(pReplayVal != NULL);
+        m_renderPasss[*pTraceVal] = *pReplayVal;
+    }
+
+    void rm_from_map(const XGL_RENDER_PASS& key)
+    {
+        m_renderPasss.erase(key);
+    }
+
+    XGL_RENDER_PASS remap(const XGL_RENDER_PASS& value)
+    {
+        std::map<XGL_RENDER_PASS, XGL_RENDER_PASS>::const_iterator q = m_renderPasss.find(value);
+        return (q == m_renderPasss.end()) ? XGL_NULL_HANDLE : q->second;
+    }
+
+    std::map<XGL_SAMPLER, XGL_SAMPLER> m_samplers;
+    void add_to_map(XGL_SAMPLER* pTraceVal, XGL_SAMPLER* pReplayVal)
+    {
+        assert(pTraceVal != NULL);
+        assert(pReplayVal != NULL);
+        m_samplers[*pTraceVal] = *pReplayVal;
+    }
+
+    void rm_from_map(const XGL_SAMPLER& key)
+    {
+        m_samplers.erase(key);
+    }
+
+    XGL_SAMPLER remap(const XGL_SAMPLER& value)
+    {
+        std::map<XGL_SAMPLER, XGL_SAMPLER>::const_iterator q = m_samplers.find(value);
+        return (q == m_samplers.end()) ? XGL_NULL_HANDLE : q->second;
+    }
+
+    std::map<XGL_SHADER, XGL_SHADER> m_shaders;
+    void add_to_map(XGL_SHADER* pTraceVal, XGL_SHADER* pReplayVal)
+    {
+        assert(pTraceVal != NULL);
+        assert(pReplayVal != NULL);
+        m_shaders[*pTraceVal] = *pReplayVal;
+    }
+
+    void rm_from_map(const XGL_SHADER& key)
+    {
+        m_shaders.erase(key);
+    }
+
+    XGL_SHADER remap(const XGL_SHADER& value)
+    {
+        std::map<XGL_SHADER, XGL_SHADER>::const_iterator q = m_shaders.find(value);
+        return (q == m_shaders.end()) ? XGL_NULL_HANDLE : q->second;
+    }
+
+    XGL_DYNAMIC_STATE_OBJECT remap(const XGL_DYNAMIC_STATE_OBJECT& state)
+    {
+        XGL_DYNAMIC_STATE_OBJECT obj;
+        if ((obj = remap(static_cast <XGL_DYNAMIC_VP_STATE_OBJECT> (state))) != XGL_NULL_HANDLE)
+            return obj;
+        if ((obj = remap(static_cast <XGL_DYNAMIC_RS_STATE_OBJECT> (state))) != XGL_NULL_HANDLE)
+            return obj;
+        if ((obj = remap(static_cast <XGL_DYNAMIC_CB_STATE_OBJECT> (state))) != XGL_NULL_HANDLE)
+            return obj;
+        if ((obj = remap(static_cast <XGL_DYNAMIC_DS_STATE_OBJECT> (state))) != XGL_NULL_HANDLE)
+            return obj;
+        return XGL_NULL_HANDLE;
+    }
+    void rm_from_map(const XGL_DYNAMIC_STATE_OBJECT& state)
+    {
+        rm_from_map(static_cast <XGL_DYNAMIC_VP_STATE_OBJECT> (state));
+        rm_from_map(static_cast <XGL_DYNAMIC_RS_STATE_OBJECT> (state));
+        rm_from_map(static_cast <XGL_DYNAMIC_CB_STATE_OBJECT> (state));
+        rm_from_map(static_cast <XGL_DYNAMIC_DS_STATE_OBJECT> (state));
+    }
+
+    XGL_OBJECT remap(const XGL_OBJECT& object)
+    {
+        XGL_OBJECT obj;
+        if ((obj = remap(static_cast <XGL_BUFFER> (object))) != XGL_NULL_HANDLE)
+            return obj;
+        if ((obj = remap(static_cast <XGL_BUFFER_VIEW> (object))) != XGL_NULL_HANDLE)
+            return obj;
+        if ((obj = remap(static_cast <XGL_IMAGE> (object))) != XGL_NULL_HANDLE)
+            return obj;
+        if ((obj = remap(static_cast <XGL_IMAGE_VIEW> (object))) != XGL_NULL_HANDLE)
+            return obj;
+        if ((obj = remap(static_cast <XGL_COLOR_ATTACHMENT_VIEW> (object))) != XGL_NULL_HANDLE)
+            return obj;
+        if ((obj = remap(static_cast <XGL_DEPTH_STENCIL_VIEW> (object))) != XGL_NULL_HANDLE)
+            return obj;
+        if ((obj = remap(static_cast <XGL_SHADER> (object))) != XGL_NULL_HANDLE)
+            return obj;
+        if ((obj = remap(static_cast <XGL_PIPELINE> (object))) != XGL_NULL_HANDLE)
+            return obj;
+        if ((obj = remap(static_cast <XGL_PIPELINE_DELTA> (object))) != XGL_NULL_HANDLE)
+            return obj;
+        if ((obj = remap(static_cast <XGL_SAMPLER> (object))) != XGL_NULL_HANDLE)
+            return obj;
+        if ((obj = remap(static_cast <XGL_DESCRIPTOR_SET> (object))) != XGL_NULL_HANDLE)
+            return obj;
+        if ((obj = remap(static_cast <XGL_DESCRIPTOR_SET_LAYOUT> (object))) != XGL_NULL_HANDLE)
+            return obj;
+        if ((obj = remap(static_cast <XGL_DESCRIPTOR_REGION> (object))) != XGL_NULL_HANDLE)
+            return obj;
+        if ((obj = remap(static_cast <XGL_DYNAMIC_STATE_OBJECT> (object))) != XGL_NULL_HANDLE)
+            return obj;
+        if ((obj = remap(static_cast <XGL_CMD_BUFFER> (object))) != XGL_NULL_HANDLE)
+            return obj;
+        if ((obj = remap(static_cast <XGL_FENCE> (object))) != XGL_NULL_HANDLE)
+            return obj;
+        if ((obj = remap(static_cast <XGL_QUEUE_SEMAPHORE> (object))) != XGL_NULL_HANDLE)
+            return obj;
+        if ((obj = remap(static_cast <XGL_EVENT> (object))) != XGL_NULL_HANDLE)
+            return obj;
+        if ((obj = remap(static_cast <XGL_QUERY_POOL> (object))) != XGL_NULL_HANDLE)
+            return obj;
+        if ((obj = remap(static_cast <XGL_FRAMEBUFFER> (object))) != XGL_NULL_HANDLE)
+            return obj;
+        if ((obj = remap(static_cast <XGL_RENDER_PASS> (object))) != XGL_NULL_HANDLE)
+            return obj;
+        return XGL_NULL_HANDLE;
+    }
+    void rm_from_map(const XGL_OBJECT & objKey)
+    {
+        rm_from_map(static_cast <XGL_BUFFER> (objKey));
+        rm_from_map(static_cast <XGL_BUFFER_VIEW> (objKey));
+        rm_from_map(static_cast <XGL_IMAGE> (objKey));
+        rm_from_map(static_cast <XGL_IMAGE_VIEW> (objKey));
+        rm_from_map(static_cast <XGL_COLOR_ATTACHMENT_VIEW> (objKey));
+        rm_from_map(static_cast <XGL_DEPTH_STENCIL_VIEW> (objKey));
+        rm_from_map(static_cast <XGL_SHADER> (objKey));
+        rm_from_map(static_cast <XGL_PIPELINE> (objKey));
+        rm_from_map(static_cast <XGL_PIPELINE_DELTA> (objKey));
+        rm_from_map(static_cast <XGL_SAMPLER> (objKey));
+        rm_from_map(static_cast <XGL_DESCRIPTOR_SET> (objKey));
+        rm_from_map(static_cast <XGL_DESCRIPTOR_SET_LAYOUT> (objKey));
+        rm_from_map(static_cast <XGL_DESCRIPTOR_REGION> (objKey));
+        rm_from_map(static_cast <XGL_DYNAMIC_STATE_OBJECT> (objKey));
+        rm_from_map(static_cast <XGL_CMD_BUFFER> (objKey));
+        rm_from_map(static_cast <XGL_FENCE> (objKey));
+        rm_from_map(static_cast <XGL_QUEUE_SEMAPHORE> (objKey));
+        rm_from_map(static_cast <XGL_EVENT> (objKey));
+        rm_from_map(static_cast <XGL_QUERY_POOL> (objKey));
+        rm_from_map(static_cast <XGL_FRAMEBUFFER> (objKey));
+        rm_from_map(static_cast <XGL_RENDER_PASS> (objKey));
+    }
+    XGL_BASE_OBJECT remap(const XGL_BASE_OBJECT& object)
+    {
+        XGL_BASE_OBJECT obj;
+        if ((obj = remap(static_cast <XGL_DEVICE> (object))) != XGL_NULL_HANDLE)
+            return obj;
+        if ((obj = remap(static_cast <XGL_QUEUE> (object))) != XGL_NULL_HANDLE)
+            return obj;
+        if ((obj = remap(static_cast <XGL_GPU_MEMORY> (object))) != XGL_NULL_HANDLE)
+            return obj;
+        if ((obj = remap(static_cast <XGL_OBJECT> (object))) != XGL_NULL_HANDLE)
+            return obj;
+        return XGL_NULL_HANDLE;
+    }
+void process_screenshot_list(const char *list)
+{
+    std::string spec(list), word;
+    size_t start = 0, comma = 0;
+
+    while (start < spec.size()) {
+        comma = spec.find(',', start);
+
+        if (comma == std::string::npos)
+            word = std::string(spec, start);
+        else
+            word = std::string(spec, start, comma - start);
+
+        m_screenshotFrames.push_back(atoi(word.c_str()));
+        if (comma == std::string::npos)
+            break;
+
+        start = comma + 1;
+
+    }
+}
+};
diff --git a/tools/glave/src/glv_extensions/glvreplay_xgl/codegen/glvtrace_xgl_packet_id.h b/tools/glave/src/glv_extensions/glvreplay_xgl/codegen/glvtrace_xgl_packet_id.h
new file mode 100644
index 0000000..d1dded3
--- /dev/null
+++ b/tools/glave/src/glv_extensions/glvreplay_xgl/codegen/glvtrace_xgl_packet_id.h
@@ -0,0 +1,1475 @@
+/* THIS FILE IS GENERATED.  DO NOT EDIT. */
+
+/*
+ * XGL
+ *
+ * Copyright (C) 2014 LunarG, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+#pragma once
+
+#include "glv_trace_packet_utils.h"
+#include "glv_trace_packet_identifiers.h"
+#include "glv_interconnect.h"
+#include "glvtrace_xgl_xgl_structs.h"
+#include "glvtrace_xgl_xgldbg_structs.h"
+#include "glvtrace_xgl_xglwsix11ext_structs.h"
+#include "xgl_enum_string_helper.h"
+#if defined(WIN32)
+#define snprintf _snprintf
+#endif
+#define SEND_ENTRYPOINT_ID(entrypoint) ;
+//#define SEND_ENTRYPOINT_ID(entrypoint) glv_TraceInfo(#entrypoint "\n");
+
+#define SEND_ENTRYPOINT_PARAMS(entrypoint, ...) ;
+//#define SEND_ENTRYPOINT_PARAMS(entrypoint, ...) glv_TraceInfo(entrypoint, __VA_ARGS__);
+
+#define CREATE_TRACE_PACKET(entrypoint, buffer_bytes_needed) \
+    pHeader = glv_create_trace_packet(GLV_TID_XGL, GLV_TPI_XGL_##entrypoint, sizeof(struct_##entrypoint), buffer_bytes_needed);
+
+#define FINISH_TRACE_PACKET() \
+    glv_finalize_trace_packet(pHeader); \
+    glv_write_trace_packet(pHeader, glv_trace_get_trace_file()); \
+    glv_delete_trace_packet(&pHeader);
+
+enum GLV_TRACE_PACKET_ID_XGL
+{
+    GLV_TPI_XGL_xglApiVersion = GLV_TPI_BEGIN_API_HERE,
+    GLV_TPI_XGL_xglCreateInstance,
+    GLV_TPI_XGL_xglDestroyInstance,
+    GLV_TPI_XGL_xglEnumerateGpus,
+    GLV_TPI_XGL_xglGetGpuInfo,
+    GLV_TPI_XGL_xglGetProcAddr,
+    GLV_TPI_XGL_xglCreateDevice,
+    GLV_TPI_XGL_xglDestroyDevice,
+    GLV_TPI_XGL_xglGetExtensionSupport,
+    GLV_TPI_XGL_xglEnumerateLayers,
+    GLV_TPI_XGL_xglGetDeviceQueue,
+    GLV_TPI_XGL_xglQueueSubmit,
+    GLV_TPI_XGL_xglQueueSetGlobalMemReferences,
+    GLV_TPI_XGL_xglQueueWaitIdle,
+    GLV_TPI_XGL_xglDeviceWaitIdle,
+    GLV_TPI_XGL_xglAllocMemory,
+    GLV_TPI_XGL_xglFreeMemory,
+    GLV_TPI_XGL_xglSetMemoryPriority,
+    GLV_TPI_XGL_xglMapMemory,
+    GLV_TPI_XGL_xglUnmapMemory,
+    GLV_TPI_XGL_xglPinSystemMemory,
+    GLV_TPI_XGL_xglGetMultiGpuCompatibility,
+    GLV_TPI_XGL_xglOpenSharedMemory,
+    GLV_TPI_XGL_xglOpenSharedQueueSemaphore,
+    GLV_TPI_XGL_xglOpenPeerMemory,
+    GLV_TPI_XGL_xglOpenPeerImage,
+    GLV_TPI_XGL_xglDestroyObject,
+    GLV_TPI_XGL_xglGetObjectInfo,
+    GLV_TPI_XGL_xglBindObjectMemory,
+    GLV_TPI_XGL_xglBindObjectMemoryRange,
+    GLV_TPI_XGL_xglBindImageMemoryRange,
+    GLV_TPI_XGL_xglCreateFence,
+    GLV_TPI_XGL_xglGetFenceStatus,
+    GLV_TPI_XGL_xglWaitForFences,
+    GLV_TPI_XGL_xglCreateQueueSemaphore,
+    GLV_TPI_XGL_xglSignalQueueSemaphore,
+    GLV_TPI_XGL_xglWaitQueueSemaphore,
+    GLV_TPI_XGL_xglCreateEvent,
+    GLV_TPI_XGL_xglGetEventStatus,
+    GLV_TPI_XGL_xglSetEvent,
+    GLV_TPI_XGL_xglResetEvent,
+    GLV_TPI_XGL_xglCreateQueryPool,
+    GLV_TPI_XGL_xglGetQueryPoolResults,
+    GLV_TPI_XGL_xglGetFormatInfo,
+    GLV_TPI_XGL_xglCreateBuffer,
+    GLV_TPI_XGL_xglCreateBufferView,
+    GLV_TPI_XGL_xglCreateImage,
+    GLV_TPI_XGL_xglSetFastClearColor,
+    GLV_TPI_XGL_xglSetFastClearDepth,
+    GLV_TPI_XGL_xglGetImageSubresourceInfo,
+    GLV_TPI_XGL_xglCreateImageView,
+    GLV_TPI_XGL_xglCreateColorAttachmentView,
+    GLV_TPI_XGL_xglCreateDepthStencilView,
+    GLV_TPI_XGL_xglCreateShader,
+    GLV_TPI_XGL_xglCreateGraphicsPipeline,
+    GLV_TPI_XGL_xglCreateComputePipeline,
+    GLV_TPI_XGL_xglStorePipeline,
+    GLV_TPI_XGL_xglLoadPipeline,
+    GLV_TPI_XGL_xglCreatePipelineDelta,
+    GLV_TPI_XGL_xglCreateSampler,
+    GLV_TPI_XGL_xglCreateDescriptorSetLayout,
+    GLV_TPI_XGL_xglBeginDescriptorRegionUpdate,
+    GLV_TPI_XGL_xglEndDescriptorRegionUpdate,
+    GLV_TPI_XGL_xglCreateDescriptorRegion,
+    GLV_TPI_XGL_xglClearDescriptorRegion,
+    GLV_TPI_XGL_xglAllocDescriptorSets,
+    GLV_TPI_XGL_xglClearDescriptorSets,
+    GLV_TPI_XGL_xglUpdateDescriptors,
+    GLV_TPI_XGL_xglCreateDynamicViewportState,
+    GLV_TPI_XGL_xglCreateDynamicRasterState,
+    GLV_TPI_XGL_xglCreateDynamicColorBlendState,
+    GLV_TPI_XGL_xglCreateDynamicDepthStencilState,
+    GLV_TPI_XGL_xglCreateCommandBuffer,
+    GLV_TPI_XGL_xglBeginCommandBuffer,
+    GLV_TPI_XGL_xglEndCommandBuffer,
+    GLV_TPI_XGL_xglResetCommandBuffer,
+    GLV_TPI_XGL_xglCmdBindPipeline,
+    GLV_TPI_XGL_xglCmdBindPipelineDelta,
+    GLV_TPI_XGL_xglCmdBindDynamicStateObject,
+    GLV_TPI_XGL_xglCmdBindDescriptorSet,
+    GLV_TPI_XGL_xglCmdBindVertexBuffer,
+    GLV_TPI_XGL_xglCmdBindIndexBuffer,
+    GLV_TPI_XGL_xglCmdDraw,
+    GLV_TPI_XGL_xglCmdDrawIndexed,
+    GLV_TPI_XGL_xglCmdDrawIndirect,
+    GLV_TPI_XGL_xglCmdDrawIndexedIndirect,
+    GLV_TPI_XGL_xglCmdDispatch,
+    GLV_TPI_XGL_xglCmdDispatchIndirect,
+    GLV_TPI_XGL_xglCmdCopyBuffer,
+    GLV_TPI_XGL_xglCmdCopyImage,
+    GLV_TPI_XGL_xglCmdCopyBufferToImage,
+    GLV_TPI_XGL_xglCmdCopyImageToBuffer,
+    GLV_TPI_XGL_xglCmdCloneImageData,
+    GLV_TPI_XGL_xglCmdUpdateBuffer,
+    GLV_TPI_XGL_xglCmdFillBuffer,
+    GLV_TPI_XGL_xglCmdClearColorImage,
+    GLV_TPI_XGL_xglCmdClearColorImageRaw,
+    GLV_TPI_XGL_xglCmdClearDepthStencil,
+    GLV_TPI_XGL_xglCmdResolveImage,
+    GLV_TPI_XGL_xglCmdSetEvent,
+    GLV_TPI_XGL_xglCmdResetEvent,
+    GLV_TPI_XGL_xglCmdWaitEvents,
+    GLV_TPI_XGL_xglCmdPipelineBarrier,
+    GLV_TPI_XGL_xglCmdBeginQuery,
+    GLV_TPI_XGL_xglCmdEndQuery,
+    GLV_TPI_XGL_xglCmdResetQueryPool,
+    GLV_TPI_XGL_xglCmdWriteTimestamp,
+    GLV_TPI_XGL_xglCmdInitAtomicCounters,
+    GLV_TPI_XGL_xglCmdLoadAtomicCounters,
+    GLV_TPI_XGL_xglCmdSaveAtomicCounters,
+    GLV_TPI_XGL_xglCreateFramebuffer,
+    GLV_TPI_XGL_xglCreateRenderPass,
+    GLV_TPI_XGL_xglCmdBeginRenderPass,
+    GLV_TPI_XGL_xglCmdEndRenderPass,
+    GLV_TPI_XGL_xglDbgSetValidationLevel,
+    GLV_TPI_XGL_xglDbgRegisterMsgCallback,
+    GLV_TPI_XGL_xglDbgUnregisterMsgCallback,
+    GLV_TPI_XGL_xglDbgSetMessageFilter,
+    GLV_TPI_XGL_xglDbgSetObjectTag,
+    GLV_TPI_XGL_xglDbgSetGlobalOption,
+    GLV_TPI_XGL_xglDbgSetDeviceOption,
+    GLV_TPI_XGL_xglCmdDbgMarkerBegin,
+    GLV_TPI_XGL_xglCmdDbgMarkerEnd,
+    GLV_TPI_XGL_xglWsiX11AssociateConnection,
+    GLV_TPI_XGL_xglWsiX11GetMSC,
+    GLV_TPI_XGL_xglWsiX11CreatePresentableImage,
+    GLV_TPI_XGL_xglWsiX11QueuePresent,
+};
+
+static const char *stringify_xgl_packet_id(const enum GLV_TRACE_PACKET_ID_XGL id, const glv_trace_packet_header* pHeader)
+{
+    static char str[1024];
+    switch(id) {
+    case GLV_TPI_XGL_xglApiVersion:
+    {
+        struct_xglApiVersion* pPacket = (struct_xglApiVersion*)(pHeader->pBody);
+        snprintf(str, 1024, "xglApiVersion = 0x%x", pPacket->version);
+        return str;
+    }
+    case GLV_TPI_XGL_xglCreateInstance:
+    {
+        struct_xglCreateInstance* pPacket = (struct_xglCreateInstance*)(pHeader->pBody);
+        snprintf(str, 1024, "xglCreateInstance(pAppInfo = %p, pAllocCb = %p, pInstance = %p)", (void*)(pPacket->pAppInfo), (void*)(pPacket->pAllocCb), (void*)pPacket->pInstance);
+        return str;
+    }
+    case GLV_TPI_XGL_xglDestroyInstance:
+    {
+        struct_xglDestroyInstance* pPacket = (struct_xglDestroyInstance*)(pHeader->pBody);
+        snprintf(str, 1024, "xglDestroyInstance(instance = %p)", (void*)(pPacket->instance));
+        return str;
+    }
+    case GLV_TPI_XGL_xglEnumerateGpus:
+    {
+        struct_xglEnumerateGpus* pPacket = (struct_xglEnumerateGpus*)(pHeader->pBody);
+        snprintf(str, 1024, "xglEnumerateGpus(instance = %p, maxGpus = %i, *pGpuCount = %i, pGpus = %p)", (void*)(pPacket->instance), pPacket->maxGpus, (pPacket->pGpuCount == NULL) ? 0 : *(pPacket->pGpuCount), (void*)(pPacket->pGpus));
+        return str;
+    }
+    case GLV_TPI_XGL_xglGetGpuInfo:
+    {
+        struct_xglGetGpuInfo* pPacket = (struct_xglGetGpuInfo*)(pHeader->pBody);
+        snprintf(str, 1024, "xglGetGpuInfo(gpu = %p, infoType = %s, *pDataSize = %zu, pData = %p)", (void*)(pPacket->gpu), string_XGL_PHYSICAL_GPU_INFO_TYPE(pPacket->infoType), (pPacket->pDataSize == NULL) ? 0 : *(pPacket->pDataSize), (void*)(pPacket->pData));
+        return str;
+    }
+    case GLV_TPI_XGL_xglGetProcAddr:
+    {
+        struct_xglGetProcAddr* pPacket = (struct_xglGetProcAddr*)(pHeader->pBody);
+        snprintf(str, 1024, "xglGetProcAddr(gpu = %p, pName = %p)", (void*)(pPacket->gpu), (void*)(pPacket->pName));
+        return str;
+    }
+    case GLV_TPI_XGL_xglCreateDevice:
+    {
+        struct_xglCreateDevice* pPacket = (struct_xglCreateDevice*)(pHeader->pBody);
+        snprintf(str, 1024, "xglCreateDevice(gpu = %p, pCreateInfo = %p, pDevice = %p)", (void*)(pPacket->gpu), (void*)(pPacket->pCreateInfo), (void*)pPacket->pDevice);
+        return str;
+    }
+    case GLV_TPI_XGL_xglDestroyDevice:
+    {
+        struct_xglDestroyDevice* pPacket = (struct_xglDestroyDevice*)(pHeader->pBody);
+        snprintf(str, 1024, "xglDestroyDevice(device = %p)", (void*)(pPacket->device));
+        return str;
+    }
+    case GLV_TPI_XGL_xglGetExtensionSupport:
+    {
+        struct_xglGetExtensionSupport* pPacket = (struct_xglGetExtensionSupport*)(pHeader->pBody);
+        snprintf(str, 1024, "xglGetExtensionSupport(gpu = %p, pExtName = %p)", (void*)(pPacket->gpu), (void*)(pPacket->pExtName));
+        return str;
+    }
+    case GLV_TPI_XGL_xglEnumerateLayers:
+    {
+        struct_xglEnumerateLayers* pPacket = (struct_xglEnumerateLayers*)(pHeader->pBody);
+        snprintf(str, 1024, "xglEnumerateLayers(gpu = %p, maxLayerCount = %zu, maxStringSize = %zu, *pOutLayerCount = %zu, pOutLayers = %p, pReserved = %p)", (void*)(pPacket->gpu), pPacket->maxLayerCount, pPacket->maxStringSize, (pPacket->pOutLayerCount == NULL) ? 0 : *(pPacket->pOutLayerCount), (void*)(pPacket->pOutLayers), (void*)(pPacket->pReserved));
+        return str;
+    }
+    case GLV_TPI_XGL_xglGetDeviceQueue:
+    {
+        struct_xglGetDeviceQueue* pPacket = (struct_xglGetDeviceQueue*)(pHeader->pBody);
+        snprintf(str, 1024, "xglGetDeviceQueue(device = %p, queueType = %s, queueIndex = %i, pQueue = %p)", (void*)(pPacket->device), string_XGL_QUEUE_TYPE(pPacket->queueType), pPacket->queueIndex, (void*)(pPacket->pQueue));
+        return str;
+    }
+    case GLV_TPI_XGL_xglQueueSubmit:
+    {
+        struct_xglQueueSubmit* pPacket = (struct_xglQueueSubmit*)(pHeader->pBody);
+        snprintf(str, 1024, "xglQueueSubmit(queue = %p, cmdBufferCount = %i, pCmdBuffers = %p, memRefCount = %i, pMemRefs = %p, fence = %p)", (void*)(pPacket->queue), pPacket->cmdBufferCount, (void*)(pPacket->pCmdBuffers), pPacket->memRefCount, (void*)(pPacket->pMemRefs), (void*)(pPacket->fence));
+        return str;
+    }
+    case GLV_TPI_XGL_xglQueueSetGlobalMemReferences:
+    {
+        struct_xglQueueSetGlobalMemReferences* pPacket = (struct_xglQueueSetGlobalMemReferences*)(pHeader->pBody);
+        snprintf(str, 1024, "xglQueueSetGlobalMemReferences(queue = %p, memRefCount = %i, pMemRefs = %p)", (void*)(pPacket->queue), pPacket->memRefCount, (void*)(pPacket->pMemRefs));
+        return str;
+    }
+    case GLV_TPI_XGL_xglQueueWaitIdle:
+    {
+        struct_xglQueueWaitIdle* pPacket = (struct_xglQueueWaitIdle*)(pHeader->pBody);
+        snprintf(str, 1024, "xglQueueWaitIdle(queue = %p)", (void*)(pPacket->queue));
+        return str;
+    }
+    case GLV_TPI_XGL_xglDeviceWaitIdle:
+    {
+        struct_xglDeviceWaitIdle* pPacket = (struct_xglDeviceWaitIdle*)(pHeader->pBody);
+        snprintf(str, 1024, "xglDeviceWaitIdle(device = %p)", (void*)(pPacket->device));
+        return str;
+    }
+    case GLV_TPI_XGL_xglAllocMemory:
+    {
+        struct_xglAllocMemory* pPacket = (struct_xglAllocMemory*)(pHeader->pBody);
+        snprintf(str, 1024, "xglAllocMemory(device = %p, pAllocInfo = %p, pMem = %p)", (void*)(pPacket->device), (void*)(pPacket->pAllocInfo), (void*)pPacket->pMem);
+        return str;
+    }
+    case GLV_TPI_XGL_xglFreeMemory:
+    {
+        struct_xglFreeMemory* pPacket = (struct_xglFreeMemory*)(pHeader->pBody);
+        snprintf(str, 1024, "xglFreeMemory(mem = %p)", (void*)(pPacket->mem));
+        return str;
+    }
+    case GLV_TPI_XGL_xglSetMemoryPriority:
+    {
+        struct_xglSetMemoryPriority* pPacket = (struct_xglSetMemoryPriority*)(pHeader->pBody);
+        snprintf(str, 1024, "xglSetMemoryPriority(mem = %p, priority = %p)", (void*)(pPacket->mem), (void*)(pPacket->priority));
+        return str;
+    }
+    case GLV_TPI_XGL_xglMapMemory:
+    {
+        struct_xglMapMemory* pPacket = (struct_xglMapMemory*)(pHeader->pBody);
+        snprintf(str, 1024, "xglMapMemory(mem = %p, flags = %i, ppData = %p)", (void*)(pPacket->mem), pPacket->flags, (void*)pPacket->ppData);
+        return str;
+    }
+    case GLV_TPI_XGL_xglUnmapMemory:
+    {
+        struct_xglUnmapMemory* pPacket = (struct_xglUnmapMemory*)(pHeader->pBody);
+        snprintf(str, 1024, "xglUnmapMemory(mem = %p)", (void*)(pPacket->mem));
+        return str;
+    }
+    case GLV_TPI_XGL_xglPinSystemMemory:
+    {
+        struct_xglPinSystemMemory* pPacket = (struct_xglPinSystemMemory*)(pHeader->pBody);
+        snprintf(str, 1024, "xglPinSystemMemory(device = %p, pSysMem = %p, memSize = %zu, pMem = %p)", (void*)(pPacket->device), (void*)(pPacket->pSysMem), pPacket->memSize, (void*)(pPacket->pMem));
+        return str;
+    }
+    case GLV_TPI_XGL_xglGetMultiGpuCompatibility:
+    {
+        struct_xglGetMultiGpuCompatibility* pPacket = (struct_xglGetMultiGpuCompatibility*)(pHeader->pBody);
+        snprintf(str, 1024, "xglGetMultiGpuCompatibility(gpu0 = %p, gpu1 = %p, pInfo = %p)", (void*)(pPacket->gpu0), (void*)(pPacket->gpu1), (void*)(pPacket->pInfo));
+        return str;
+    }
+    case GLV_TPI_XGL_xglOpenSharedMemory:
+    {
+        struct_xglOpenSharedMemory* pPacket = (struct_xglOpenSharedMemory*)(pHeader->pBody);
+        snprintf(str, 1024, "xglOpenSharedMemory(device = %p, pOpenInfo = %p, pMem = %p)", (void*)(pPacket->device), (void*)(pPacket->pOpenInfo), (void*)(pPacket->pMem));
+        return str;
+    }
+    case GLV_TPI_XGL_xglOpenSharedQueueSemaphore:
+    {
+        struct_xglOpenSharedQueueSemaphore* pPacket = (struct_xglOpenSharedQueueSemaphore*)(pHeader->pBody);
+        snprintf(str, 1024, "xglOpenSharedQueueSemaphore(device = %p, pOpenInfo = %p, pSemaphore = %p)", (void*)(pPacket->device), (void*)(pPacket->pOpenInfo), (void*)(pPacket->pSemaphore));
+        return str;
+    }
+    case GLV_TPI_XGL_xglOpenPeerMemory:
+    {
+        struct_xglOpenPeerMemory* pPacket = (struct_xglOpenPeerMemory*)(pHeader->pBody);
+        snprintf(str, 1024, "xglOpenPeerMemory(device = %p, pOpenInfo = %p, pMem = %p)", (void*)(pPacket->device), (void*)(pPacket->pOpenInfo), (void*)(pPacket->pMem));
+        return str;
+    }
+    case GLV_TPI_XGL_xglOpenPeerImage:
+    {
+        struct_xglOpenPeerImage* pPacket = (struct_xglOpenPeerImage*)(pHeader->pBody);
+        snprintf(str, 1024, "xglOpenPeerImage(device = %p, pOpenInfo = %p, pImage = %p, pMem = %p)", (void*)(pPacket->device), (void*)(pPacket->pOpenInfo), (void*)(pPacket->pImage), (void*)(pPacket->pMem));
+        return str;
+    }
+    case GLV_TPI_XGL_xglDestroyObject:
+    {
+        struct_xglDestroyObject* pPacket = (struct_xglDestroyObject*)(pHeader->pBody);
+        snprintf(str, 1024, "xglDestroyObject(object = %p)", (void*)(pPacket->object));
+        return str;
+    }
+    case GLV_TPI_XGL_xglGetObjectInfo:
+    {
+        struct_xglGetObjectInfo* pPacket = (struct_xglGetObjectInfo*)(pHeader->pBody);
+        snprintf(str, 1024, "xglGetObjectInfo(object = %p, infoType = %s, *pDataSize = %zu, pData = %p)", (void*)(pPacket->object), string_XGL_OBJECT_INFO_TYPE(pPacket->infoType), (pPacket->pDataSize == NULL) ? 0 : *(pPacket->pDataSize), (void*)(pPacket->pData));
+        return str;
+    }
+    case GLV_TPI_XGL_xglBindObjectMemory:
+    {
+        struct_xglBindObjectMemory* pPacket = (struct_xglBindObjectMemory*)(pHeader->pBody);
+        snprintf(str, 1024, "xglBindObjectMemory(object = %p, allocationIdx = %i, mem = %p, offset = %p)", (void*)(pPacket->object), pPacket->allocationIdx, (void*)(pPacket->mem), (void*)(pPacket->offset));
+        return str;
+    }
+    case GLV_TPI_XGL_xglBindObjectMemoryRange:
+    {
+        struct_xglBindObjectMemoryRange* pPacket = (struct_xglBindObjectMemoryRange*)(pHeader->pBody);
+        snprintf(str, 1024, "xglBindObjectMemoryRange(object = %p, allocationIdx = %i, rangeOffset = %p, rangeSize = %p, mem = %p, memOffset = %p)", (void*)(pPacket->object), pPacket->allocationIdx, (void*)(pPacket->rangeOffset), (void*)(pPacket->rangeSize), (void*)(pPacket->mem), (void*)(pPacket->memOffset));
+        return str;
+    }
+    case GLV_TPI_XGL_xglBindImageMemoryRange:
+    {
+        struct_xglBindImageMemoryRange* pPacket = (struct_xglBindImageMemoryRange*)(pHeader->pBody);
+        snprintf(str, 1024, "xglBindImageMemoryRange(image = %p, allocationIdx = %i, bindInfo = %p, mem = %p, memOffset = %p)", (void*)(pPacket->image), pPacket->allocationIdx, (void*)(pPacket->bindInfo), (void*)(pPacket->mem), (void*)(pPacket->memOffset));
+        return str;
+    }
+    case GLV_TPI_XGL_xglCreateFence:
+    {
+        struct_xglCreateFence* pPacket = (struct_xglCreateFence*)(pHeader->pBody);
+        snprintf(str, 1024, "xglCreateFence(device = %p, pCreateInfo = %p, pFence = %p)", (void*)(pPacket->device), (void*)(pPacket->pCreateInfo), (void*)pPacket->pFence);
+        return str;
+    }
+    case GLV_TPI_XGL_xglGetFenceStatus:
+    {
+        struct_xglGetFenceStatus* pPacket = (struct_xglGetFenceStatus*)(pHeader->pBody);
+        snprintf(str, 1024, "xglGetFenceStatus(fence = %p)", (void*)(pPacket->fence));
+        return str;
+    }
+    case GLV_TPI_XGL_xglWaitForFences:
+    {
+        struct_xglWaitForFences* pPacket = (struct_xglWaitForFences*)(pHeader->pBody);
+        snprintf(str, 1024, "xglWaitForFences(device = %p, fenceCount = %i, pFences = %p, waitAll = %u, timeout = %lu)", (void*)(pPacket->device), pPacket->fenceCount, (void*)(pPacket->pFences), pPacket->waitAll, pPacket->timeout);
+        return str;
+    }
+    case GLV_TPI_XGL_xglCreateQueueSemaphore:
+    {
+        struct_xglCreateQueueSemaphore* pPacket = (struct_xglCreateQueueSemaphore*)(pHeader->pBody);
+        snprintf(str, 1024, "xglCreateQueueSemaphore(device = %p, pCreateInfo = %p, pSemaphore = %p)", (void*)(pPacket->device), (void*)(pPacket->pCreateInfo), (void*)pPacket->pSemaphore);
+        return str;
+    }
+    case GLV_TPI_XGL_xglSignalQueueSemaphore:
+    {
+        struct_xglSignalQueueSemaphore* pPacket = (struct_xglSignalQueueSemaphore*)(pHeader->pBody);
+        snprintf(str, 1024, "xglSignalQueueSemaphore(queue = %p, semaphore = %p)", (void*)(pPacket->queue), (void*)(pPacket->semaphore));
+        return str;
+    }
+    case GLV_TPI_XGL_xglWaitQueueSemaphore:
+    {
+        struct_xglWaitQueueSemaphore* pPacket = (struct_xglWaitQueueSemaphore*)(pHeader->pBody);
+        snprintf(str, 1024, "xglWaitQueueSemaphore(queue = %p, semaphore = %p)", (void*)(pPacket->queue), (void*)(pPacket->semaphore));
+        return str;
+    }
+    case GLV_TPI_XGL_xglCreateEvent:
+    {
+        struct_xglCreateEvent* pPacket = (struct_xglCreateEvent*)(pHeader->pBody);
+        snprintf(str, 1024, "xglCreateEvent(device = %p, pCreateInfo = %p, pEvent = %p)", (void*)(pPacket->device), (void*)(pPacket->pCreateInfo), (void*)pPacket->pEvent);
+        return str;
+    }
+    case GLV_TPI_XGL_xglGetEventStatus:
+    {
+        struct_xglGetEventStatus* pPacket = (struct_xglGetEventStatus*)(pHeader->pBody);
+        snprintf(str, 1024, "xglGetEventStatus(event = %p)", (void*)(pPacket->event));
+        return str;
+    }
+    case GLV_TPI_XGL_xglSetEvent:
+    {
+        struct_xglSetEvent* pPacket = (struct_xglSetEvent*)(pHeader->pBody);
+        snprintf(str, 1024, "xglSetEvent(event = %p)", (void*)(pPacket->event));
+        return str;
+    }
+    case GLV_TPI_XGL_xglResetEvent:
+    {
+        struct_xglResetEvent* pPacket = (struct_xglResetEvent*)(pHeader->pBody);
+        snprintf(str, 1024, "xglResetEvent(event = %p)", (void*)(pPacket->event));
+        return str;
+    }
+    case GLV_TPI_XGL_xglCreateQueryPool:
+    {
+        struct_xglCreateQueryPool* pPacket = (struct_xglCreateQueryPool*)(pHeader->pBody);
+        snprintf(str, 1024, "xglCreateQueryPool(device = %p, pCreateInfo = %p, pQueryPool = %p)", (void*)(pPacket->device), (void*)(pPacket->pCreateInfo), (void*)pPacket->pQueryPool);
+        return str;
+    }
+    case GLV_TPI_XGL_xglGetQueryPoolResults:
+    {
+        struct_xglGetQueryPoolResults* pPacket = (struct_xglGetQueryPoolResults*)(pHeader->pBody);
+        snprintf(str, 1024, "xglGetQueryPoolResults(queryPool = %p, startQuery = %i, queryCount = %i, *pDataSize = %zu, pData = %p)", (void*)(pPacket->queryPool), pPacket->startQuery, pPacket->queryCount, (pPacket->pDataSize == NULL) ? 0 : *(pPacket->pDataSize), (void*)(pPacket->pData));
+        return str;
+    }
+    case GLV_TPI_XGL_xglGetFormatInfo:
+    {
+        struct_xglGetFormatInfo* pPacket = (struct_xglGetFormatInfo*)(pHeader->pBody);
+        snprintf(str, 1024, "xglGetFormatInfo(device = %p, format = %p, infoType = %s, *pDataSize = %zu, pData = %p)", (void*)(pPacket->device), (void*)(pPacket->format), string_XGL_FORMAT_INFO_TYPE(pPacket->infoType), (pPacket->pDataSize == NULL) ? 0 : *(pPacket->pDataSize), (void*)(pPacket->pData));
+        return str;
+    }
+    case GLV_TPI_XGL_xglCreateBuffer:
+    {
+        struct_xglCreateBuffer* pPacket = (struct_xglCreateBuffer*)(pHeader->pBody);
+        snprintf(str, 1024, "xglCreateBuffer(device = %p, pCreateInfo = %p, pBuffer = %p)", (void*)(pPacket->device), (void*)(pPacket->pCreateInfo), (void*)pPacket->pBuffer);
+        return str;
+    }
+    case GLV_TPI_XGL_xglCreateBufferView:
+    {
+        struct_xglCreateBufferView* pPacket = (struct_xglCreateBufferView*)(pHeader->pBody);
+        snprintf(str, 1024, "xglCreateBufferView(device = %p, pCreateInfo = %p, pView = %p)", (void*)(pPacket->device), (void*)(pPacket->pCreateInfo), (void*)pPacket->pView);
+        return str;
+    }
+    case GLV_TPI_XGL_xglCreateImage:
+    {
+        struct_xglCreateImage* pPacket = (struct_xglCreateImage*)(pHeader->pBody);
+        snprintf(str, 1024, "xglCreateImage(device = %p, pCreateInfo = %p, pImage = %p)", (void*)(pPacket->device), (void*)(pPacket->pCreateInfo), (void*)pPacket->pImage);
+        return str;
+    }
+    case GLV_TPI_XGL_xglSetFastClearColor:
+    {
+        struct_xglSetFastClearColor* pPacket = (struct_xglSetFastClearColor*)(pHeader->pBody);
+        snprintf(str, 1024, "xglSetFastClearColor(image = %p, color = [%f, %f, %f, %f])", (void*)(pPacket->image), pPacket->color[0], pPacket->color[1], pPacket->color[2], pPacket->color[3]);
+        return str;
+    }
+    case GLV_TPI_XGL_xglSetFastClearDepth:
+    {
+        struct_xglSetFastClearDepth* pPacket = (struct_xglSetFastClearDepth*)(pHeader->pBody);
+        snprintf(str, 1024, "xglSetFastClearDepth(image = %p, depth = %f)", (void*)(pPacket->image), pPacket->depth);
+        return str;
+    }
+    case GLV_TPI_XGL_xglGetImageSubresourceInfo:
+    {
+        struct_xglGetImageSubresourceInfo* pPacket = (struct_xglGetImageSubresourceInfo*)(pHeader->pBody);
+        snprintf(str, 1024, "xglGetImageSubresourceInfo(image = %p, pSubresource = %p, infoType = %s, *pDataSize = %zu, pData = %p)", (void*)(pPacket->image), (void*)(pPacket->pSubresource), string_XGL_SUBRESOURCE_INFO_TYPE(pPacket->infoType), (pPacket->pDataSize == NULL) ? 0 : *(pPacket->pDataSize), (void*)(pPacket->pData));
+        return str;
+    }
+    case GLV_TPI_XGL_xglCreateImageView:
+    {
+        struct_xglCreateImageView* pPacket = (struct_xglCreateImageView*)(pHeader->pBody);
+        snprintf(str, 1024, "xglCreateImageView(device = %p, pCreateInfo = %p, pView = %p)", (void*)(pPacket->device), (void*)(pPacket->pCreateInfo), (void*)pPacket->pView);
+        return str;
+    }
+    case GLV_TPI_XGL_xglCreateColorAttachmentView:
+    {
+        struct_xglCreateColorAttachmentView* pPacket = (struct_xglCreateColorAttachmentView*)(pHeader->pBody);
+        snprintf(str, 1024, "xglCreateColorAttachmentView(device = %p, pCreateInfo = %p, pView = %p)", (void*)(pPacket->device), (void*)(pPacket->pCreateInfo), (void*)pPacket->pView);
+        return str;
+    }
+    case GLV_TPI_XGL_xglCreateDepthStencilView:
+    {
+        struct_xglCreateDepthStencilView* pPacket = (struct_xglCreateDepthStencilView*)(pHeader->pBody);
+        snprintf(str, 1024, "xglCreateDepthStencilView(device = %p, pCreateInfo = %p, pView = %p)", (void*)(pPacket->device), (void*)(pPacket->pCreateInfo), (void*)pPacket->pView);
+        return str;
+    }
+    case GLV_TPI_XGL_xglCreateShader:
+    {
+        struct_xglCreateShader* pPacket = (struct_xglCreateShader*)(pHeader->pBody);
+        snprintf(str, 1024, "xglCreateShader(device = %p, pCreateInfo = %p, pShader = %p)", (void*)(pPacket->device), (void*)(pPacket->pCreateInfo), (void*)pPacket->pShader);
+        return str;
+    }
+    case GLV_TPI_XGL_xglCreateGraphicsPipeline:
+    {
+        struct_xglCreateGraphicsPipeline* pPacket = (struct_xglCreateGraphicsPipeline*)(pHeader->pBody);
+        snprintf(str, 1024, "xglCreateGraphicsPipeline(device = %p, pCreateInfo = %p, pPipeline = %p)", (void*)(pPacket->device), (void*)(pPacket->pCreateInfo), (void*)pPacket->pPipeline);
+        return str;
+    }
+    case GLV_TPI_XGL_xglCreateComputePipeline:
+    {
+        struct_xglCreateComputePipeline* pPacket = (struct_xglCreateComputePipeline*)(pHeader->pBody);
+        snprintf(str, 1024, "xglCreateComputePipeline(device = %p, pCreateInfo = %p, pPipeline = %p)", (void*)(pPacket->device), (void*)(pPacket->pCreateInfo), (void*)pPacket->pPipeline);
+        return str;
+    }
+    case GLV_TPI_XGL_xglStorePipeline:
+    {
+        struct_xglStorePipeline* pPacket = (struct_xglStorePipeline*)(pHeader->pBody);
+        snprintf(str, 1024, "xglStorePipeline(pipeline = %p, *pDataSize = %zu, pData = %p)", (void*)(pPacket->pipeline), (pPacket->pDataSize == NULL) ? 0 : *(pPacket->pDataSize), (void*)(pPacket->pData));
+        return str;
+    }
+    case GLV_TPI_XGL_xglLoadPipeline:
+    {
+        struct_xglLoadPipeline* pPacket = (struct_xglLoadPipeline*)(pHeader->pBody);
+        snprintf(str, 1024, "xglLoadPipeline(device = %p, dataSize = %zu, pData = %p, pPipeline = %p)", (void*)(pPacket->device), pPacket->dataSize, (void*)(pPacket->pData), (void*)(pPacket->pPipeline));
+        return str;
+    }
+    case GLV_TPI_XGL_xglCreatePipelineDelta:
+    {
+        struct_xglCreatePipelineDelta* pPacket = (struct_xglCreatePipelineDelta*)(pHeader->pBody);
+        snprintf(str, 1024, "xglCreatePipelineDelta(device = %p, p1 = %p, p2 = %p, delta = %p)", (void*)(pPacket->device), (void*)(pPacket->p1), (void*)(pPacket->p2), (void*)pPacket->delta);
+        return str;
+    }
+    case GLV_TPI_XGL_xglCreateSampler:
+    {
+        struct_xglCreateSampler* pPacket = (struct_xglCreateSampler*)(pHeader->pBody);
+        snprintf(str, 1024, "xglCreateSampler(device = %p, pCreateInfo = %p, pSampler = %p)", (void*)(pPacket->device), (void*)(pPacket->pCreateInfo), (void*)pPacket->pSampler);
+        return str;
+    }
+    case GLV_TPI_XGL_xglCreateDescriptorSetLayout:
+    {
+        struct_xglCreateDescriptorSetLayout* pPacket = (struct_xglCreateDescriptorSetLayout*)(pHeader->pBody);
+        snprintf(str, 1024, "xglCreateDescriptorSetLayout(device = %p, stageFlags = %i, *pSetBindPoints = %i, priorSetLayout = %p, pSetLayoutInfoList = %p, pSetLayout = %p)", (void*)(pPacket->device), pPacket->stageFlags, (pPacket->pSetBindPoints == NULL) ? 0 : *(pPacket->pSetBindPoints), (void*)(pPacket->priorSetLayout), (void*)(pPacket->pSetLayoutInfoList), (void*)pPacket->pSetLayout);
+        return str;
+    }
+    case GLV_TPI_XGL_xglBeginDescriptorRegionUpdate:
+    {
+        struct_xglBeginDescriptorRegionUpdate* pPacket = (struct_xglBeginDescriptorRegionUpdate*)(pHeader->pBody);
+        snprintf(str, 1024, "xglBeginDescriptorRegionUpdate(device = %p, updateMode = %p)", (void*)(pPacket->device), (void*)(pPacket->updateMode));
+        return str;
+    }
+    case GLV_TPI_XGL_xglEndDescriptorRegionUpdate:
+    {
+        struct_xglEndDescriptorRegionUpdate* pPacket = (struct_xglEndDescriptorRegionUpdate*)(pHeader->pBody);
+        snprintf(str, 1024, "xglEndDescriptorRegionUpdate(device = %p, cmd = %p)", (void*)(pPacket->device), (void*)(pPacket->cmd));
+        return str;
+    }
+    case GLV_TPI_XGL_xglCreateDescriptorRegion:
+    {
+        struct_xglCreateDescriptorRegion* pPacket = (struct_xglCreateDescriptorRegion*)(pHeader->pBody);
+        snprintf(str, 1024, "xglCreateDescriptorRegion(device = %p, regionUsage = %p, maxSets = %i, pCreateInfo = %p, pDescriptorRegion = %p)", (void*)(pPacket->device), (void*)(pPacket->regionUsage), pPacket->maxSets, (void*)(pPacket->pCreateInfo), (void*)pPacket->pDescriptorRegion);
+        return str;
+    }
+    case GLV_TPI_XGL_xglClearDescriptorRegion:
+    {
+        struct_xglClearDescriptorRegion* pPacket = (struct_xglClearDescriptorRegion*)(pHeader->pBody);
+        snprintf(str, 1024, "xglClearDescriptorRegion(descriptorRegion = %p)", (void*)(pPacket->descriptorRegion));
+        return str;
+    }
+    case GLV_TPI_XGL_xglAllocDescriptorSets:
+    {
+        struct_xglAllocDescriptorSets* pPacket = (struct_xglAllocDescriptorSets*)(pHeader->pBody);
+        snprintf(str, 1024, "xglAllocDescriptorSets(descriptorRegion = %p, setUsage = %p, count = %i, pSetLayouts = %p, pDescriptorSets = %p, *pCount = %i)", (void*)(pPacket->descriptorRegion), (void*)(pPacket->setUsage), pPacket->count, (void*)(pPacket->pSetLayouts), (void*)(pPacket->pDescriptorSets), (pPacket->pCount == NULL) ? 0 : *(pPacket->pCount));
+        return str;
+    }
+    case GLV_TPI_XGL_xglClearDescriptorSets:
+    {
+        struct_xglClearDescriptorSets* pPacket = (struct_xglClearDescriptorSets*)(pHeader->pBody);
+        snprintf(str, 1024, "xglClearDescriptorSets(descriptorRegion = %p, count = %i, pDescriptorSets = %p)", (void*)(pPacket->descriptorRegion), pPacket->count, (void*)(pPacket->pDescriptorSets));
+        return str;
+    }
+    case GLV_TPI_XGL_xglUpdateDescriptors:
+    {
+        struct_xglUpdateDescriptors* pPacket = (struct_xglUpdateDescriptors*)(pHeader->pBody);
+        snprintf(str, 1024, "xglUpdateDescriptors(descriptorSet = %p, pUpdateChain = %p)", (void*)(pPacket->descriptorSet), (void*)(pPacket->pUpdateChain));
+        return str;
+    }
+    case GLV_TPI_XGL_xglCreateDynamicViewportState:
+    {
+        struct_xglCreateDynamicViewportState* pPacket = (struct_xglCreateDynamicViewportState*)(pHeader->pBody);
+        snprintf(str, 1024, "xglCreateDynamicViewportState(device = %p, pCreateInfo = %p, pState = %p)", (void*)(pPacket->device), (void*)(pPacket->pCreateInfo), (void*)pPacket->pState);
+        return str;
+    }
+    case GLV_TPI_XGL_xglCreateDynamicRasterState:
+    {
+        struct_xglCreateDynamicRasterState* pPacket = (struct_xglCreateDynamicRasterState*)(pHeader->pBody);
+        snprintf(str, 1024, "xglCreateDynamicRasterState(device = %p, pCreateInfo = %p, pState = %p)", (void*)(pPacket->device), (void*)(pPacket->pCreateInfo), (void*)pPacket->pState);
+        return str;
+    }
+    case GLV_TPI_XGL_xglCreateDynamicColorBlendState:
+    {
+        struct_xglCreateDynamicColorBlendState* pPacket = (struct_xglCreateDynamicColorBlendState*)(pHeader->pBody);
+        snprintf(str, 1024, "xglCreateDynamicColorBlendState(device = %p, pCreateInfo = %p, pState = %p)", (void*)(pPacket->device), (void*)(pPacket->pCreateInfo), (void*)pPacket->pState);
+        return str;
+    }
+    case GLV_TPI_XGL_xglCreateDynamicDepthStencilState:
+    {
+        struct_xglCreateDynamicDepthStencilState* pPacket = (struct_xglCreateDynamicDepthStencilState*)(pHeader->pBody);
+        snprintf(str, 1024, "xglCreateDynamicDepthStencilState(device = %p, pCreateInfo = %p, pState = %p)", (void*)(pPacket->device), (void*)(pPacket->pCreateInfo), (void*)pPacket->pState);
+        return str;
+    }
+    case GLV_TPI_XGL_xglCreateCommandBuffer:
+    {
+        struct_xglCreateCommandBuffer* pPacket = (struct_xglCreateCommandBuffer*)(pHeader->pBody);
+        snprintf(str, 1024, "xglCreateCommandBuffer(device = %p, pCreateInfo = %p, pCmdBuffer = %p)", (void*)(pPacket->device), (void*)(pPacket->pCreateInfo), (void*)pPacket->pCmdBuffer);
+        return str;
+    }
+    case GLV_TPI_XGL_xglBeginCommandBuffer:
+    {
+        struct_xglBeginCommandBuffer* pPacket = (struct_xglBeginCommandBuffer*)(pHeader->pBody);
+        snprintf(str, 1024, "xglBeginCommandBuffer(cmdBuffer = %p, pBeginInfo = %p)", (void*)(pPacket->cmdBuffer), (void*)(pPacket->pBeginInfo));
+        return str;
+    }
+    case GLV_TPI_XGL_xglEndCommandBuffer:
+    {
+        struct_xglEndCommandBuffer* pPacket = (struct_xglEndCommandBuffer*)(pHeader->pBody);
+        snprintf(str, 1024, "xglEndCommandBuffer(cmdBuffer = %p)", (void*)(pPacket->cmdBuffer));
+        return str;
+    }
+    case GLV_TPI_XGL_xglResetCommandBuffer:
+    {
+        struct_xglResetCommandBuffer* pPacket = (struct_xglResetCommandBuffer*)(pHeader->pBody);
+        snprintf(str, 1024, "xglResetCommandBuffer(cmdBuffer = %p)", (void*)(pPacket->cmdBuffer));
+        return str;
+    }
+    case GLV_TPI_XGL_xglCmdBindPipeline:
+    {
+        struct_xglCmdBindPipeline* pPacket = (struct_xglCmdBindPipeline*)(pHeader->pBody);
+        snprintf(str, 1024, "xglCmdBindPipeline(cmdBuffer = %p, pipelineBindPoint = %p, pipeline = %p)", (void*)(pPacket->cmdBuffer), (void*)(pPacket->pipelineBindPoint), (void*)(pPacket->pipeline));
+        return str;
+    }
+    case GLV_TPI_XGL_xglCmdBindPipelineDelta:
+    {
+        struct_xglCmdBindPipelineDelta* pPacket = (struct_xglCmdBindPipelineDelta*)(pHeader->pBody);
+        snprintf(str, 1024, "xglCmdBindPipelineDelta(cmdBuffer = %p, pipelineBindPoint = %p, delta = %p)", (void*)(pPacket->cmdBuffer), (void*)(pPacket->pipelineBindPoint), (void*)(pPacket->delta));
+        return str;
+    }
+    case GLV_TPI_XGL_xglCmdBindDynamicStateObject:
+    {
+        struct_xglCmdBindDynamicStateObject* pPacket = (struct_xglCmdBindDynamicStateObject*)(pHeader->pBody);
+        snprintf(str, 1024, "xglCmdBindDynamicStateObject(cmdBuffer = %p, stateBindPoint = %p, state = %p)", (void*)(pPacket->cmdBuffer), (void*)(pPacket->stateBindPoint), (void*)(pPacket->state));
+        return str;
+    }
+    case GLV_TPI_XGL_xglCmdBindDescriptorSet:
+    {
+        struct_xglCmdBindDescriptorSet* pPacket = (struct_xglCmdBindDescriptorSet*)(pHeader->pBody);
+        snprintf(str, 1024, "xglCmdBindDescriptorSet(cmdBuffer = %p, pipelineBindPoint = %p, descriptorSet = %p, *pUserData = %i)", (void*)(pPacket->cmdBuffer), (void*)(pPacket->pipelineBindPoint), (void*)(pPacket->descriptorSet), (pPacket->pUserData == NULL) ? 0 : *(pPacket->pUserData));
+        return str;
+    }
+    case GLV_TPI_XGL_xglCmdBindVertexBuffer:
+    {
+        struct_xglCmdBindVertexBuffer* pPacket = (struct_xglCmdBindVertexBuffer*)(pHeader->pBody);
+        snprintf(str, 1024, "xglCmdBindVertexBuffer(cmdBuffer = %p, buffer = %p, offset = %p, binding = %i)", (void*)(pPacket->cmdBuffer), (void*)(pPacket->buffer), (void*)(pPacket->offset), pPacket->binding);
+        return str;
+    }
+    case GLV_TPI_XGL_xglCmdBindIndexBuffer:
+    {
+        struct_xglCmdBindIndexBuffer* pPacket = (struct_xglCmdBindIndexBuffer*)(pHeader->pBody);
+        snprintf(str, 1024, "xglCmdBindIndexBuffer(cmdBuffer = %p, buffer = %p, offset = %p, indexType = %s)", (void*)(pPacket->cmdBuffer), (void*)(pPacket->buffer), (void*)(pPacket->offset), string_XGL_INDEX_TYPE(pPacket->indexType));
+        return str;
+    }
+    case GLV_TPI_XGL_xglCmdDraw:
+    {
+        struct_xglCmdDraw* pPacket = (struct_xglCmdDraw*)(pHeader->pBody);
+        snprintf(str, 1024, "xglCmdDraw(cmdBuffer = %p, firstVertex = %i, vertexCount = %i, firstInstance = %i, instanceCount = %i)", (void*)(pPacket->cmdBuffer), pPacket->firstVertex, pPacket->vertexCount, pPacket->firstInstance, pPacket->instanceCount);
+        return str;
+    }
+    case GLV_TPI_XGL_xglCmdDrawIndexed:
+    {
+        struct_xglCmdDrawIndexed* pPacket = (struct_xglCmdDrawIndexed*)(pHeader->pBody);
+        snprintf(str, 1024, "xglCmdDrawIndexed(cmdBuffer = %p, firstIndex = %i, indexCount = %i, vertexOffset = %i, firstInstance = %i, instanceCount = %i)", (void*)(pPacket->cmdBuffer), pPacket->firstIndex, pPacket->indexCount, pPacket->vertexOffset, pPacket->firstInstance, pPacket->instanceCount);
+        return str;
+    }
+    case GLV_TPI_XGL_xglCmdDrawIndirect:
+    {
+        struct_xglCmdDrawIndirect* pPacket = (struct_xglCmdDrawIndirect*)(pHeader->pBody);
+        snprintf(str, 1024, "xglCmdDrawIndirect(cmdBuffer = %p, buffer = %p, offset = %p, count = %i, stride = %i)", (void*)(pPacket->cmdBuffer), (void*)(pPacket->buffer), (void*)(pPacket->offset), pPacket->count, pPacket->stride);
+        return str;
+    }
+    case GLV_TPI_XGL_xglCmdDrawIndexedIndirect:
+    {
+        struct_xglCmdDrawIndexedIndirect* pPacket = (struct_xglCmdDrawIndexedIndirect*)(pHeader->pBody);
+        snprintf(str, 1024, "xglCmdDrawIndexedIndirect(cmdBuffer = %p, buffer = %p, offset = %p, count = %i, stride = %i)", (void*)(pPacket->cmdBuffer), (void*)(pPacket->buffer), (void*)(pPacket->offset), pPacket->count, pPacket->stride);
+        return str;
+    }
+    case GLV_TPI_XGL_xglCmdDispatch:
+    {
+        struct_xglCmdDispatch* pPacket = (struct_xglCmdDispatch*)(pHeader->pBody);
+        snprintf(str, 1024, "xglCmdDispatch(cmdBuffer = %p, x = %i, y = %i, z = %i)", (void*)(pPacket->cmdBuffer), pPacket->x, pPacket->y, pPacket->z);
+        return str;
+    }
+    case GLV_TPI_XGL_xglCmdDispatchIndirect:
+    {
+        struct_xglCmdDispatchIndirect* pPacket = (struct_xglCmdDispatchIndirect*)(pHeader->pBody);
+        snprintf(str, 1024, "xglCmdDispatchIndirect(cmdBuffer = %p, buffer = %p, offset = %p)", (void*)(pPacket->cmdBuffer), (void*)(pPacket->buffer), (void*)(pPacket->offset));
+        return str;
+    }
+    case GLV_TPI_XGL_xglCmdCopyBuffer:
+    {
+        struct_xglCmdCopyBuffer* pPacket = (struct_xglCmdCopyBuffer*)(pHeader->pBody);
+        snprintf(str, 1024, "xglCmdCopyBuffer(cmdBuffer = %p, srcBuffer = %p, destBuffer = %p, regionCount = %i, pRegions = %p)", (void*)(pPacket->cmdBuffer), (void*)(pPacket->srcBuffer), (void*)(pPacket->destBuffer), pPacket->regionCount, (void*)(pPacket->pRegions));
+        return str;
+    }
+    case GLV_TPI_XGL_xglCmdCopyImage:
+    {
+        struct_xglCmdCopyImage* pPacket = (struct_xglCmdCopyImage*)(pHeader->pBody);
+        snprintf(str, 1024, "xglCmdCopyImage(cmdBuffer = %p, srcImage = %p, destImage = %p, regionCount = %i, pRegions = %p)", (void*)(pPacket->cmdBuffer), (void*)(pPacket->srcImage), (void*)(pPacket->destImage), pPacket->regionCount, (void*)(pPacket->pRegions));
+        return str;
+    }
+    case GLV_TPI_XGL_xglCmdCopyBufferToImage:
+    {
+        struct_xglCmdCopyBufferToImage* pPacket = (struct_xglCmdCopyBufferToImage*)(pHeader->pBody);
+        snprintf(str, 1024, "xglCmdCopyBufferToImage(cmdBuffer = %p, srcBuffer = %p, destImage = %p, regionCount = %i, pRegions = %p)", (void*)(pPacket->cmdBuffer), (void*)(pPacket->srcBuffer), (void*)(pPacket->destImage), pPacket->regionCount, (void*)(pPacket->pRegions));
+        return str;
+    }
+    case GLV_TPI_XGL_xglCmdCopyImageToBuffer:
+    {
+        struct_xglCmdCopyImageToBuffer* pPacket = (struct_xglCmdCopyImageToBuffer*)(pHeader->pBody);
+        snprintf(str, 1024, "xglCmdCopyImageToBuffer(cmdBuffer = %p, srcImage = %p, destBuffer = %p, regionCount = %i, pRegions = %p)", (void*)(pPacket->cmdBuffer), (void*)(pPacket->srcImage), (void*)(pPacket->destBuffer), pPacket->regionCount, (void*)(pPacket->pRegions));
+        return str;
+    }
+    case GLV_TPI_XGL_xglCmdCloneImageData:
+    {
+        struct_xglCmdCloneImageData* pPacket = (struct_xglCmdCloneImageData*)(pHeader->pBody);
+        snprintf(str, 1024, "xglCmdCloneImageData(cmdBuffer = %p, srcImage = %p, srcImageLayout = %p, destImage = %p, destImageLayout = %p)", (void*)(pPacket->cmdBuffer), (void*)(pPacket->srcImage), (void*)(pPacket->srcImageLayout), (void*)(pPacket->destImage), (void*)(pPacket->destImageLayout));
+        return str;
+    }
+    case GLV_TPI_XGL_xglCmdUpdateBuffer:
+    {
+        struct_xglCmdUpdateBuffer* pPacket = (struct_xglCmdUpdateBuffer*)(pHeader->pBody);
+        snprintf(str, 1024, "xglCmdUpdateBuffer(cmdBuffer = %p, destBuffer = %p, destOffset = %p, dataSize = %p, *pData = %i)", (void*)(pPacket->cmdBuffer), (void*)(pPacket->destBuffer), (void*)(pPacket->destOffset), (void*)(pPacket->dataSize), (pPacket->pData == NULL) ? 0 : *(pPacket->pData));
+        return str;
+    }
+    case GLV_TPI_XGL_xglCmdFillBuffer:
+    {
+        struct_xglCmdFillBuffer* pPacket = (struct_xglCmdFillBuffer*)(pHeader->pBody);
+        snprintf(str, 1024, "xglCmdFillBuffer(cmdBuffer = %p, destBuffer = %p, destOffset = %p, fillSize = %p, data = %i)", (void*)(pPacket->cmdBuffer), (void*)(pPacket->destBuffer), (void*)(pPacket->destOffset), (void*)(pPacket->fillSize), pPacket->data);
+        return str;
+    }
+    case GLV_TPI_XGL_xglCmdClearColorImage:
+    {
+        struct_xglCmdClearColorImage* pPacket = (struct_xglCmdClearColorImage*)(pHeader->pBody);
+        snprintf(str, 1024, "xglCmdClearColorImage(cmdBuffer = %p, image = %p, color = [%f, %f, %f, %f], rangeCount = %i, pRanges = %p)", (void*)(pPacket->cmdBuffer), (void*)(pPacket->image), pPacket->color[0], pPacket->color[1], pPacket->color[2], pPacket->color[3], pPacket->rangeCount, (void*)(pPacket->pRanges));
+        return str;
+    }
+    case GLV_TPI_XGL_xglCmdClearColorImageRaw:
+    {
+        struct_xglCmdClearColorImageRaw* pPacket = (struct_xglCmdClearColorImageRaw*)(pHeader->pBody);
+        snprintf(str, 1024, "xglCmdClearColorImageRaw(cmdBuffer = %p, image = %p, color = [%i, %i, %i, %i], rangeCount = %i, pRanges = %p)", (void*)(pPacket->cmdBuffer), (void*)(pPacket->image), pPacket->color[0], pPacket->color[1], pPacket->color[2], pPacket->color[3], pPacket->rangeCount, (void*)(pPacket->pRanges));
+        return str;
+    }
+    case GLV_TPI_XGL_xglCmdClearDepthStencil:
+    {
+        struct_xglCmdClearDepthStencil* pPacket = (struct_xglCmdClearDepthStencil*)(pHeader->pBody);
+        snprintf(str, 1024, "xglCmdClearDepthStencil(cmdBuffer = %p, image = %p, depth = %f, stencil = %i, rangeCount = %i, pRanges = %p)", (void*)(pPacket->cmdBuffer), (void*)(pPacket->image), pPacket->depth, pPacket->stencil, pPacket->rangeCount, (void*)(pPacket->pRanges));
+        return str;
+    }
+    case GLV_TPI_XGL_xglCmdResolveImage:
+    {
+        struct_xglCmdResolveImage* pPacket = (struct_xglCmdResolveImage*)(pHeader->pBody);
+        snprintf(str, 1024, "xglCmdResolveImage(cmdBuffer = %p, srcImage = %p, destImage = %p, rectCount = %i, pRects = %p)", (void*)(pPacket->cmdBuffer), (void*)(pPacket->srcImage), (void*)(pPacket->destImage), pPacket->rectCount, (void*)(pPacket->pRects));
+        return str;
+    }
+    case GLV_TPI_XGL_xglCmdSetEvent:
+    {
+        struct_xglCmdSetEvent* pPacket = (struct_xglCmdSetEvent*)(pHeader->pBody);
+        snprintf(str, 1024, "xglCmdSetEvent(cmdBuffer = %p, event = %p, pipeEvent = %p)", (void*)(pPacket->cmdBuffer), (void*)(pPacket->event), (void*)(pPacket->pipeEvent));
+        return str;
+    }
+    case GLV_TPI_XGL_xglCmdResetEvent:
+    {
+        struct_xglCmdResetEvent* pPacket = (struct_xglCmdResetEvent*)(pHeader->pBody);
+        snprintf(str, 1024, "xglCmdResetEvent(cmdBuffer = %p, event = %p)", (void*)(pPacket->cmdBuffer), (void*)(pPacket->event));
+        return str;
+    }
+    case GLV_TPI_XGL_xglCmdWaitEvents:
+    {
+        struct_xglCmdWaitEvents* pPacket = (struct_xglCmdWaitEvents*)(pHeader->pBody);
+        snprintf(str, 1024, "xglCmdWaitEvents(cmdBuffer = %p, pWaitInfo = %p)", (void*)(pPacket->cmdBuffer), (void*)(pPacket->pWaitInfo));
+        return str;
+    }
+    case GLV_TPI_XGL_xglCmdPipelineBarrier:
+    {
+        struct_xglCmdPipelineBarrier* pPacket = (struct_xglCmdPipelineBarrier*)(pHeader->pBody);
+        snprintf(str, 1024, "xglCmdPipelineBarrier(cmdBuffer = %p, pBarrier = %p)", (void*)(pPacket->cmdBuffer), (void*)(pPacket->pBarrier));
+        return str;
+    }
+    case GLV_TPI_XGL_xglCmdBeginQuery:
+    {
+        struct_xglCmdBeginQuery* pPacket = (struct_xglCmdBeginQuery*)(pHeader->pBody);
+        snprintf(str, 1024, "xglCmdBeginQuery(cmdBuffer = %p, queryPool = %p, slot = %i, flags = %i)", (void*)(pPacket->cmdBuffer), (void*)(pPacket->queryPool), pPacket->slot, pPacket->flags);
+        return str;
+    }
+    case GLV_TPI_XGL_xglCmdEndQuery:
+    {
+        struct_xglCmdEndQuery* pPacket = (struct_xglCmdEndQuery*)(pHeader->pBody);
+        snprintf(str, 1024, "xglCmdEndQuery(cmdBuffer = %p, queryPool = %p, slot = %i)", (void*)(pPacket->cmdBuffer), (void*)(pPacket->queryPool), pPacket->slot);
+        return str;
+    }
+    case GLV_TPI_XGL_xglCmdResetQueryPool:
+    {
+        struct_xglCmdResetQueryPool* pPacket = (struct_xglCmdResetQueryPool*)(pHeader->pBody);
+        snprintf(str, 1024, "xglCmdResetQueryPool(cmdBuffer = %p, queryPool = %p, startQuery = %i, queryCount = %i)", (void*)(pPacket->cmdBuffer), (void*)(pPacket->queryPool), pPacket->startQuery, pPacket->queryCount);
+        return str;
+    }
+    case GLV_TPI_XGL_xglCmdWriteTimestamp:
+    {
+        struct_xglCmdWriteTimestamp* pPacket = (struct_xglCmdWriteTimestamp*)(pHeader->pBody);
+        snprintf(str, 1024, "xglCmdWriteTimestamp(cmdBuffer = %p, timestampType = %s, destBuffer = %p, destOffset = %p)", (void*)(pPacket->cmdBuffer), string_XGL_TIMESTAMP_TYPE(pPacket->timestampType), (void*)(pPacket->destBuffer), (void*)(pPacket->destOffset));
+        return str;
+    }
+    case GLV_TPI_XGL_xglCmdInitAtomicCounters:
+    {
+        struct_xglCmdInitAtomicCounters* pPacket = (struct_xglCmdInitAtomicCounters*)(pHeader->pBody);
+        snprintf(str, 1024, "xglCmdInitAtomicCounters(cmdBuffer = %p, pipelineBindPoint = %p, startCounter = %i, counterCount = %i, *pData = %i)", (void*)(pPacket->cmdBuffer), (void*)(pPacket->pipelineBindPoint), pPacket->startCounter, pPacket->counterCount, (pPacket->pData == NULL) ? 0 : *(pPacket->pData));
+        return str;
+    }
+    case GLV_TPI_XGL_xglCmdLoadAtomicCounters:
+    {
+        struct_xglCmdLoadAtomicCounters* pPacket = (struct_xglCmdLoadAtomicCounters*)(pHeader->pBody);
+        snprintf(str, 1024, "xglCmdLoadAtomicCounters(cmdBuffer = %p, pipelineBindPoint = %p, startCounter = %i, counterCount = %i, srcBuffer = %p, srcOffset = %p)", (void*)(pPacket->cmdBuffer), (void*)(pPacket->pipelineBindPoint), pPacket->startCounter, pPacket->counterCount, (void*)(pPacket->srcBuffer), (void*)(pPacket->srcOffset));
+        return str;
+    }
+    case GLV_TPI_XGL_xglCmdSaveAtomicCounters:
+    {
+        struct_xglCmdSaveAtomicCounters* pPacket = (struct_xglCmdSaveAtomicCounters*)(pHeader->pBody);
+        snprintf(str, 1024, "xglCmdSaveAtomicCounters(cmdBuffer = %p, pipelineBindPoint = %p, startCounter = %i, counterCount = %i, destBuffer = %p, destOffset = %p)", (void*)(pPacket->cmdBuffer), (void*)(pPacket->pipelineBindPoint), pPacket->startCounter, pPacket->counterCount, (void*)(pPacket->destBuffer), (void*)(pPacket->destOffset));
+        return str;
+    }
+    case GLV_TPI_XGL_xglCreateFramebuffer:
+    {
+        struct_xglCreateFramebuffer* pPacket = (struct_xglCreateFramebuffer*)(pHeader->pBody);
+        snprintf(str, 1024, "xglCreateFramebuffer(device = %p, pCreateInfo = %p, pFramebuffer = %p)", (void*)(pPacket->device), (void*)(pPacket->pCreateInfo), (void*)pPacket->pFramebuffer);
+        return str;
+    }
+    case GLV_TPI_XGL_xglCreateRenderPass:
+    {
+        struct_xglCreateRenderPass* pPacket = (struct_xglCreateRenderPass*)(pHeader->pBody);
+        snprintf(str, 1024, "xglCreateRenderPass(device = %p, pCreateInfo = %p, pRenderPass = %p)", (void*)(pPacket->device), (void*)(pPacket->pCreateInfo), (void*)pPacket->pRenderPass);
+        return str;
+    }
+    case GLV_TPI_XGL_xglCmdBeginRenderPass:
+    {
+        struct_xglCmdBeginRenderPass* pPacket = (struct_xglCmdBeginRenderPass*)(pHeader->pBody);
+        snprintf(str, 1024, "xglCmdBeginRenderPass(cmdBuffer = %p, renderPass = %p)", (void*)(pPacket->cmdBuffer), (void*)(pPacket->renderPass));
+        return str;
+    }
+    case GLV_TPI_XGL_xglCmdEndRenderPass:
+    {
+        struct_xglCmdEndRenderPass* pPacket = (struct_xglCmdEndRenderPass*)(pHeader->pBody);
+        snprintf(str, 1024, "xglCmdEndRenderPass(cmdBuffer = %p, renderPass = %p)", (void*)(pPacket->cmdBuffer), (void*)(pPacket->renderPass));
+        return str;
+    }
+    case GLV_TPI_XGL_xglDbgSetValidationLevel:
+    {
+        struct_xglDbgSetValidationLevel* pPacket = (struct_xglDbgSetValidationLevel*)(pHeader->pBody);
+        snprintf(str, 1024, "xglDbgSetValidationLevel(device = %p, validationLevel = %p)", (void*)(pPacket->device), (void*)(pPacket->validationLevel));
+        return str;
+    }
+    case GLV_TPI_XGL_xglDbgRegisterMsgCallback:
+    {
+        struct_xglDbgRegisterMsgCallback* pPacket = (struct_xglDbgRegisterMsgCallback*)(pHeader->pBody);
+        snprintf(str, 1024, "xglDbgRegisterMsgCallback(pfnMsgCallback = %p, pUserData = %p)", (void*)(pPacket->pfnMsgCallback), (void*)(pPacket->pUserData));
+        return str;
+    }
+    case GLV_TPI_XGL_xglDbgUnregisterMsgCallback:
+    {
+        struct_xglDbgUnregisterMsgCallback* pPacket = (struct_xglDbgUnregisterMsgCallback*)(pHeader->pBody);
+        snprintf(str, 1024, "xglDbgUnregisterMsgCallback(pfnMsgCallback = %p)", (void*)(pPacket->pfnMsgCallback));
+        return str;
+    }
+    case GLV_TPI_XGL_xglDbgSetMessageFilter:
+    {
+        struct_xglDbgSetMessageFilter* pPacket = (struct_xglDbgSetMessageFilter*)(pHeader->pBody);
+        snprintf(str, 1024, "xglDbgSetMessageFilter(device = %p, msgCode = %i, filter = %p)", (void*)(pPacket->device), pPacket->msgCode, (void*)(pPacket->filter));
+        return str;
+    }
+    case GLV_TPI_XGL_xglDbgSetObjectTag:
+    {
+        struct_xglDbgSetObjectTag* pPacket = (struct_xglDbgSetObjectTag*)(pHeader->pBody);
+        snprintf(str, 1024, "xglDbgSetObjectTag(object = %p, tagSize = %zu, pTag = %p)", (void*)(pPacket->object), pPacket->tagSize, (void*)(pPacket->pTag));
+        return str;
+    }
+    case GLV_TPI_XGL_xglDbgSetGlobalOption:
+    {
+        struct_xglDbgSetGlobalOption* pPacket = (struct_xglDbgSetGlobalOption*)(pHeader->pBody);
+        snprintf(str, 1024, "xglDbgSetGlobalOption(dbgOption = %p, dataSize = %zu, pData = %p)", (void*)(pPacket->dbgOption), pPacket->dataSize, (void*)(pPacket->pData));
+        return str;
+    }
+    case GLV_TPI_XGL_xglDbgSetDeviceOption:
+    {
+        struct_xglDbgSetDeviceOption* pPacket = (struct_xglDbgSetDeviceOption*)(pHeader->pBody);
+        snprintf(str, 1024, "xglDbgSetDeviceOption(device = %p, dbgOption = %p, dataSize = %zu, pData = %p)", (void*)(pPacket->device), (void*)(pPacket->dbgOption), pPacket->dataSize, (void*)(pPacket->pData));
+        return str;
+    }
+    case GLV_TPI_XGL_xglCmdDbgMarkerBegin:
+    {
+        struct_xglCmdDbgMarkerBegin* pPacket = (struct_xglCmdDbgMarkerBegin*)(pHeader->pBody);
+        snprintf(str, 1024, "xglCmdDbgMarkerBegin(cmdBuffer = %p, pMarker = %p)", (void*)(pPacket->cmdBuffer), (void*)(pPacket->pMarker));
+        return str;
+    }
+    case GLV_TPI_XGL_xglCmdDbgMarkerEnd:
+    {
+        struct_xglCmdDbgMarkerEnd* pPacket = (struct_xglCmdDbgMarkerEnd*)(pHeader->pBody);
+        snprintf(str, 1024, "xglCmdDbgMarkerEnd(cmdBuffer = %p)", (void*)(pPacket->cmdBuffer));
+        return str;
+    }
+    case GLV_TPI_XGL_xglWsiX11AssociateConnection:
+    {
+        struct_xglWsiX11AssociateConnection* pPacket = (struct_xglWsiX11AssociateConnection*)(pHeader->pBody);
+        snprintf(str, 1024, "xglWsiX11AssociateConnection(gpu = %p, pConnectionInfo = %p)", (void*)(pPacket->gpu), (void*)(pPacket->pConnectionInfo));
+        return str;
+    }
+    case GLV_TPI_XGL_xglWsiX11GetMSC:
+    {
+        struct_xglWsiX11GetMSC* pPacket = (struct_xglWsiX11GetMSC*)(pHeader->pBody);
+        snprintf(str, 1024, "xglWsiX11GetMSC(device = %p, window = %i, crtc = %u, *pMsc = %lu)", (void*)(pPacket->device), pPacket->window, pPacket->crtc, (pPacket->pMsc == NULL) ? 0 : *(pPacket->pMsc));
+        return str;
+    }
+    case GLV_TPI_XGL_xglWsiX11CreatePresentableImage:
+    {
+        struct_xglWsiX11CreatePresentableImage* pPacket = (struct_xglWsiX11CreatePresentableImage*)(pHeader->pBody);
+        snprintf(str, 1024, "xglWsiX11CreatePresentableImage(device = %p, pCreateInfo = %p, pImage = %p, pMem = %p)", (void*)(pPacket->device), (void*)(pPacket->pCreateInfo), (void*)(pPacket->pImage), (void*)pPacket->pMem);
+        return str;
+    }
+    case GLV_TPI_XGL_xglWsiX11QueuePresent:
+    {
+        struct_xglWsiX11QueuePresent* pPacket = (struct_xglWsiX11QueuePresent*)(pHeader->pBody);
+        snprintf(str, 1024, "xglWsiX11QueuePresent(queue = %p, pPresentInfo = %p, fence = %p)", (void*)(pPacket->queue), (void*)(pPacket->pPresentInfo), (void*)(pPacket->fence));
+        return str;
+    }
+    default:
+        return NULL;
+    }
+};
+
+static glv_trace_packet_header* interpret_trace_packet_xgl(glv_trace_packet_header* pHeader)
+{
+    if (pHeader == NULL)
+    {
+        return NULL;
+    }
+    switch (pHeader->packet_id)
+    {
+        case GLV_TPI_XGL_xglApiVersion:
+        {
+            return interpret_body_as_xglApiVersion(pHeader, TRUE)->header;
+        }
+        case GLV_TPI_XGL_xglCreateInstance:
+        {
+            return interpret_body_as_xglCreateInstance(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglDestroyInstance:
+        {
+            return interpret_body_as_xglDestroyInstance(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglEnumerateGpus:
+        {
+            return interpret_body_as_xglEnumerateGpus(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglGetGpuInfo:
+        {
+            return interpret_body_as_xglGetGpuInfo(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglGetProcAddr:
+        {
+            return interpret_body_as_xglGetProcAddr(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglCreateDevice:
+        {
+            return interpret_body_as_xglCreateDevice(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglDestroyDevice:
+        {
+            return interpret_body_as_xglDestroyDevice(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglGetExtensionSupport:
+        {
+            return interpret_body_as_xglGetExtensionSupport(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglEnumerateLayers:
+        {
+            return interpret_body_as_xglEnumerateLayers(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglGetDeviceQueue:
+        {
+            return interpret_body_as_xglGetDeviceQueue(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglQueueSubmit:
+        {
+            return interpret_body_as_xglQueueSubmit(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglQueueSetGlobalMemReferences:
+        {
+            return interpret_body_as_xglQueueSetGlobalMemReferences(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglQueueWaitIdle:
+        {
+            return interpret_body_as_xglQueueWaitIdle(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglDeviceWaitIdle:
+        {
+            return interpret_body_as_xglDeviceWaitIdle(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglAllocMemory:
+        {
+            return interpret_body_as_xglAllocMemory(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglFreeMemory:
+        {
+            return interpret_body_as_xglFreeMemory(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglSetMemoryPriority:
+        {
+            return interpret_body_as_xglSetMemoryPriority(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglMapMemory:
+        {
+            return interpret_body_as_xglMapMemory(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglUnmapMemory:
+        {
+            return interpret_body_as_xglUnmapMemory(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglPinSystemMemory:
+        {
+            return interpret_body_as_xglPinSystemMemory(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglGetMultiGpuCompatibility:
+        {
+            return interpret_body_as_xglGetMultiGpuCompatibility(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglOpenSharedMemory:
+        {
+            return interpret_body_as_xglOpenSharedMemory(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglOpenSharedQueueSemaphore:
+        {
+            return interpret_body_as_xglOpenSharedQueueSemaphore(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglOpenPeerMemory:
+        {
+            return interpret_body_as_xglOpenPeerMemory(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglOpenPeerImage:
+        {
+            return interpret_body_as_xglOpenPeerImage(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglDestroyObject:
+        {
+            return interpret_body_as_xglDestroyObject(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglGetObjectInfo:
+        {
+            return interpret_body_as_xglGetObjectInfo(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglBindObjectMemory:
+        {
+            return interpret_body_as_xglBindObjectMemory(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglBindObjectMemoryRange:
+        {
+            return interpret_body_as_xglBindObjectMemoryRange(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglBindImageMemoryRange:
+        {
+            return interpret_body_as_xglBindImageMemoryRange(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglCreateFence:
+        {
+            return interpret_body_as_xglCreateFence(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglGetFenceStatus:
+        {
+            return interpret_body_as_xglGetFenceStatus(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglWaitForFences:
+        {
+            return interpret_body_as_xglWaitForFences(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglCreateQueueSemaphore:
+        {
+            return interpret_body_as_xglCreateQueueSemaphore(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglSignalQueueSemaphore:
+        {
+            return interpret_body_as_xglSignalQueueSemaphore(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglWaitQueueSemaphore:
+        {
+            return interpret_body_as_xglWaitQueueSemaphore(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglCreateEvent:
+        {
+            return interpret_body_as_xglCreateEvent(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglGetEventStatus:
+        {
+            return interpret_body_as_xglGetEventStatus(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglSetEvent:
+        {
+            return interpret_body_as_xglSetEvent(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglResetEvent:
+        {
+            return interpret_body_as_xglResetEvent(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglCreateQueryPool:
+        {
+            return interpret_body_as_xglCreateQueryPool(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglGetQueryPoolResults:
+        {
+            return interpret_body_as_xglGetQueryPoolResults(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglGetFormatInfo:
+        {
+            return interpret_body_as_xglGetFormatInfo(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglCreateBuffer:
+        {
+            return interpret_body_as_xglCreateBuffer(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglCreateBufferView:
+        {
+            return interpret_body_as_xglCreateBufferView(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglCreateImage:
+        {
+            return interpret_body_as_xglCreateImage(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglSetFastClearColor:
+        {
+            return interpret_body_as_xglSetFastClearColor(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglSetFastClearDepth:
+        {
+            return interpret_body_as_xglSetFastClearDepth(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglGetImageSubresourceInfo:
+        {
+            return interpret_body_as_xglGetImageSubresourceInfo(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglCreateImageView:
+        {
+            return interpret_body_as_xglCreateImageView(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglCreateColorAttachmentView:
+        {
+            return interpret_body_as_xglCreateColorAttachmentView(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglCreateDepthStencilView:
+        {
+            return interpret_body_as_xglCreateDepthStencilView(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglCreateShader:
+        {
+            return interpret_body_as_xglCreateShader(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglCreateGraphicsPipeline:
+        {
+            return interpret_body_as_xglCreateGraphicsPipeline(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglCreateComputePipeline:
+        {
+            return interpret_body_as_xglCreateComputePipeline(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglStorePipeline:
+        {
+            return interpret_body_as_xglStorePipeline(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglLoadPipeline:
+        {
+            return interpret_body_as_xglLoadPipeline(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglCreatePipelineDelta:
+        {
+            return interpret_body_as_xglCreatePipelineDelta(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglCreateSampler:
+        {
+            return interpret_body_as_xglCreateSampler(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglCreateDescriptorSetLayout:
+        {
+            return interpret_body_as_xglCreateDescriptorSetLayout(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglBeginDescriptorRegionUpdate:
+        {
+            return interpret_body_as_xglBeginDescriptorRegionUpdate(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglEndDescriptorRegionUpdate:
+        {
+            return interpret_body_as_xglEndDescriptorRegionUpdate(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglCreateDescriptorRegion:
+        {
+            return interpret_body_as_xglCreateDescriptorRegion(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglClearDescriptorRegion:
+        {
+            return interpret_body_as_xglClearDescriptorRegion(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglAllocDescriptorSets:
+        {
+            return interpret_body_as_xglAllocDescriptorSets(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglClearDescriptorSets:
+        {
+            return interpret_body_as_xglClearDescriptorSets(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglUpdateDescriptors:
+        {
+            return interpret_body_as_xglUpdateDescriptors(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglCreateDynamicViewportState:
+        {
+            return interpret_body_as_xglCreateDynamicViewportState(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglCreateDynamicRasterState:
+        {
+            return interpret_body_as_xglCreateDynamicRasterState(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglCreateDynamicColorBlendState:
+        {
+            return interpret_body_as_xglCreateDynamicColorBlendState(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglCreateDynamicDepthStencilState:
+        {
+            return interpret_body_as_xglCreateDynamicDepthStencilState(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglCreateCommandBuffer:
+        {
+            return interpret_body_as_xglCreateCommandBuffer(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglBeginCommandBuffer:
+        {
+            return interpret_body_as_xglBeginCommandBuffer(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglEndCommandBuffer:
+        {
+            return interpret_body_as_xglEndCommandBuffer(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglResetCommandBuffer:
+        {
+            return interpret_body_as_xglResetCommandBuffer(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglCmdBindPipeline:
+        {
+            return interpret_body_as_xglCmdBindPipeline(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglCmdBindPipelineDelta:
+        {
+            return interpret_body_as_xglCmdBindPipelineDelta(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglCmdBindDynamicStateObject:
+        {
+            return interpret_body_as_xglCmdBindDynamicStateObject(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglCmdBindDescriptorSet:
+        {
+            return interpret_body_as_xglCmdBindDescriptorSet(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglCmdBindVertexBuffer:
+        {
+            return interpret_body_as_xglCmdBindVertexBuffer(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglCmdBindIndexBuffer:
+        {
+            return interpret_body_as_xglCmdBindIndexBuffer(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglCmdDraw:
+        {
+            return interpret_body_as_xglCmdDraw(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglCmdDrawIndexed:
+        {
+            return interpret_body_as_xglCmdDrawIndexed(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglCmdDrawIndirect:
+        {
+            return interpret_body_as_xglCmdDrawIndirect(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglCmdDrawIndexedIndirect:
+        {
+            return interpret_body_as_xglCmdDrawIndexedIndirect(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglCmdDispatch:
+        {
+            return interpret_body_as_xglCmdDispatch(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglCmdDispatchIndirect:
+        {
+            return interpret_body_as_xglCmdDispatchIndirect(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglCmdCopyBuffer:
+        {
+            return interpret_body_as_xglCmdCopyBuffer(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglCmdCopyImage:
+        {
+            return interpret_body_as_xglCmdCopyImage(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglCmdCopyBufferToImage:
+        {
+            return interpret_body_as_xglCmdCopyBufferToImage(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglCmdCopyImageToBuffer:
+        {
+            return interpret_body_as_xglCmdCopyImageToBuffer(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglCmdCloneImageData:
+        {
+            return interpret_body_as_xglCmdCloneImageData(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglCmdUpdateBuffer:
+        {
+            return interpret_body_as_xglCmdUpdateBuffer(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglCmdFillBuffer:
+        {
+            return interpret_body_as_xglCmdFillBuffer(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglCmdClearColorImage:
+        {
+            return interpret_body_as_xglCmdClearColorImage(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglCmdClearColorImageRaw:
+        {
+            return interpret_body_as_xglCmdClearColorImageRaw(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglCmdClearDepthStencil:
+        {
+            return interpret_body_as_xglCmdClearDepthStencil(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglCmdResolveImage:
+        {
+            return interpret_body_as_xglCmdResolveImage(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglCmdSetEvent:
+        {
+            return interpret_body_as_xglCmdSetEvent(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglCmdResetEvent:
+        {
+            return interpret_body_as_xglCmdResetEvent(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglCmdWaitEvents:
+        {
+            return interpret_body_as_xglCmdWaitEvents(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglCmdPipelineBarrier:
+        {
+            return interpret_body_as_xglCmdPipelineBarrier(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglCmdBeginQuery:
+        {
+            return interpret_body_as_xglCmdBeginQuery(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglCmdEndQuery:
+        {
+            return interpret_body_as_xglCmdEndQuery(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglCmdResetQueryPool:
+        {
+            return interpret_body_as_xglCmdResetQueryPool(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglCmdWriteTimestamp:
+        {
+            return interpret_body_as_xglCmdWriteTimestamp(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglCmdInitAtomicCounters:
+        {
+            return interpret_body_as_xglCmdInitAtomicCounters(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglCmdLoadAtomicCounters:
+        {
+            return interpret_body_as_xglCmdLoadAtomicCounters(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglCmdSaveAtomicCounters:
+        {
+            return interpret_body_as_xglCmdSaveAtomicCounters(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglCreateFramebuffer:
+        {
+            return interpret_body_as_xglCreateFramebuffer(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglCreateRenderPass:
+        {
+            return interpret_body_as_xglCreateRenderPass(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglCmdBeginRenderPass:
+        {
+            return interpret_body_as_xglCmdBeginRenderPass(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglCmdEndRenderPass:
+        {
+            return interpret_body_as_xglCmdEndRenderPass(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglDbgSetValidationLevel:
+        {
+            return interpret_body_as_xglDbgSetValidationLevel(pHeader)->pHeader;
+        }
+        case GLV_TPI_XGL_xglDbgRegisterMsgCallback:
+        {
+            return interpret_body_as_xglDbgRegisterMsgCallback(pHeader)->pHeader;
+        }
+        case GLV_TPI_XGL_xglDbgUnregisterMsgCallback:
+        {
+            return interpret_body_as_xglDbgUnregisterMsgCallback(pHeader)->pHeader;
+        }
+        case GLV_TPI_XGL_xglDbgSetMessageFilter:
+        {
+            return interpret_body_as_xglDbgSetMessageFilter(pHeader)->pHeader;
+        }
+        case GLV_TPI_XGL_xglDbgSetObjectTag:
+        {
+            return interpret_body_as_xglDbgSetObjectTag(pHeader)->pHeader;
+        }
+        case GLV_TPI_XGL_xglDbgSetGlobalOption:
+        {
+            return interpret_body_as_xglDbgSetGlobalOption(pHeader)->pHeader;
+        }
+        case GLV_TPI_XGL_xglDbgSetDeviceOption:
+        {
+            return interpret_body_as_xglDbgSetDeviceOption(pHeader)->pHeader;
+        }
+        case GLV_TPI_XGL_xglCmdDbgMarkerBegin:
+        {
+            return interpret_body_as_xglCmdDbgMarkerBegin(pHeader)->pHeader;
+        }
+        case GLV_TPI_XGL_xglCmdDbgMarkerEnd:
+        {
+            return interpret_body_as_xglCmdDbgMarkerEnd(pHeader)->pHeader;
+        }
+        case GLV_TPI_XGL_xglWsiX11AssociateConnection:
+        {
+            return interpret_body_as_xglWsiX11AssociateConnection(pHeader)->pHeader;
+        }
+        case GLV_TPI_XGL_xglWsiX11GetMSC:
+        {
+            return interpret_body_as_xglWsiX11GetMSC(pHeader)->pHeader;
+        }
+        case GLV_TPI_XGL_xglWsiX11CreatePresentableImage:
+        {
+            return interpret_body_as_xglWsiX11CreatePresentableImage(pHeader)->pHeader;
+        }
+        case GLV_TPI_XGL_xglWsiX11QueuePresent:
+        {
+            return interpret_body_as_xglWsiX11QueuePresent(pHeader)->pHeader;
+        }
+        default:
+            return NULL;
+    }
+    return NULL;
+}
diff --git a/tools/glave/src/glv_extensions/glvreplay_xgl/codegen/glvtrace_xgl_xgl_structs.h b/tools/glave/src/glv_extensions/glvreplay_xgl/codegen/glvtrace_xgl_xgl_structs.h
new file mode 100644
index 0000000..c61f718
--- /dev/null
+++ b/tools/glave/src/glv_extensions/glvreplay_xgl/codegen/glvtrace_xgl_xgl_structs.h
@@ -0,0 +1,2259 @@
+/* THIS FILE IS GENERATED.  DO NOT EDIT. */
+
+/*
+ * XGL
+ *
+ * Copyright (C) 2014 LunarG, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+#pragma once
+
+#include "xgl.h"
+#include "glv_trace_packet_utils.h"
+
+
+//=============================================================================
+static void add_XGL_APPLICATION_INFO_to_packet(glv_trace_packet_header*  pHeader, XGL_APPLICATION_INFO** ppStruct, const XGL_APPLICATION_INFO *pInStruct)
+{
+    glv_add_buffer_to_trace_packet(pHeader, (void**)ppStruct, sizeof(XGL_APPLICATION_INFO), pInStruct);
+    glv_add_buffer_to_trace_packet(pHeader, (void**)&((*ppStruct)->pAppName), strlen(pInStruct->pAppName) + 1, pInStruct->pAppName);
+    glv_add_buffer_to_trace_packet(pHeader, (void**)&((*ppStruct)->pEngineName), strlen(pInStruct->pEngineName) + 1, pInStruct->pEngineName);
+    glv_finalize_buffer_address(pHeader, (void**)&((*ppStruct)->pAppName));
+    glv_finalize_buffer_address(pHeader, (void**)&((*ppStruct)->pEngineName));
+    glv_finalize_buffer_address(pHeader, (void**)&*ppStruct);
+};
+
+//=============================================================================
+
+static void add_XGL_DEVICE_CREATE_INFO_to_packet(glv_trace_packet_header*  pHeader, XGL_DEVICE_CREATE_INFO** ppStruct, const XGL_DEVICE_CREATE_INFO *pInStruct)
+{
+    uint32_t i;
+    glv_add_buffer_to_trace_packet(pHeader, (void**)ppStruct, sizeof(XGL_DEVICE_CREATE_INFO), pInStruct);
+    glv_add_buffer_to_trace_packet(pHeader, (void**)&(*ppStruct)->pRequestedQueues, pInStruct->queueRecordCount*sizeof(XGL_DEVICE_QUEUE_CREATE_INFO), pInStruct->pRequestedQueues);
+    glv_finalize_buffer_address(pHeader, (void**)&(*ppStruct)->pRequestedQueues);
+    if (pInStruct->extensionCount > 0) 
+    {
+        glv_add_buffer_to_trace_packet(pHeader, (void**)(&(*ppStruct)->ppEnabledExtensionNames), pInStruct->extensionCount * sizeof(char *), pInStruct->ppEnabledExtensionNames);
+        for (i = 0; i < pInStruct->extensionCount; i++)
+        {
+            glv_add_buffer_to_trace_packet(pHeader, (void**)(&((*ppStruct)->ppEnabledExtensionNames[i])), strlen(pInStruct->ppEnabledExtensionNames[i]) + 1, pInStruct->ppEnabledExtensionNames[i]);
+            glv_finalize_buffer_address(pHeader, (void**)(&((*ppStruct)->ppEnabledExtensionNames[i])));
+        }
+        glv_finalize_buffer_address(pHeader, (void **)&(*ppStruct)->ppEnabledExtensionNames);
+    }
+    XGL_LAYER_CREATE_INFO *pNext = ( XGL_LAYER_CREATE_INFO *) pInStruct->pNext;
+    while (pNext != NULL)
+    {
+        if ((pNext->sType == XGL_STRUCTURE_TYPE_LAYER_CREATE_INFO) && pNext->layerCount > 0)
+        {
+            glv_add_buffer_to_trace_packet(pHeader, (void**)(&((*ppStruct)->pNext)), sizeof(XGL_LAYER_CREATE_INFO), pNext);
+            glv_finalize_buffer_address(pHeader, (void**)(&((*ppStruct)->pNext)));
+            XGL_LAYER_CREATE_INFO **ppOutStruct = (XGL_LAYER_CREATE_INFO **) &((*ppStruct)->pNext);
+            glv_add_buffer_to_trace_packet(pHeader, (void**)(&(*ppOutStruct)->ppActiveLayerNames), pNext->layerCount * sizeof(char *), pNext->ppActiveLayerNames);
+            for (i = 0; i < pNext->layerCount; i++)
+            {
+                glv_add_buffer_to_trace_packet(pHeader, (void**)(&((*ppOutStruct)->ppActiveLayerNames[i])), strlen(pNext->ppActiveLayerNames[i]) + 1, pNext->ppActiveLayerNames[i]);
+                glv_finalize_buffer_address(pHeader, (void**)(&((*ppOutStruct)->ppActiveLayerNames[i])));
+            }
+            glv_finalize_buffer_address(pHeader, (void **)&(*ppOutStruct)->ppActiveLayerNames);
+        }
+        pNext = ( XGL_LAYER_CREATE_INFO *) pNext->pNext;
+    }
+    glv_finalize_buffer_address(pHeader, (void**)ppStruct);
+}
+
+static XGL_DEVICE_CREATE_INFO* interpret_XGL_DEVICE_CREATE_INFO(glv_trace_packet_header*  pHeader, intptr_t ptr_variable)
+{
+    XGL_DEVICE_CREATE_INFO* pXGL_DEVICE_CREATE_INFO = (XGL_DEVICE_CREATE_INFO*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)ptr_variable);
+
+    if (pXGL_DEVICE_CREATE_INFO != NULL)
+    {
+            uint32_t i;
+            const char** pNames;
+        pXGL_DEVICE_CREATE_INFO->pRequestedQueues = (const XGL_DEVICE_QUEUE_CREATE_INFO*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pXGL_DEVICE_CREATE_INFO->pRequestedQueues);
+
+        if (pXGL_DEVICE_CREATE_INFO->extensionCount > 0)
+        {
+            pXGL_DEVICE_CREATE_INFO->ppEnabledExtensionNames = (const char *const*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pXGL_DEVICE_CREATE_INFO->ppEnabledExtensionNames);
+            pNames = (const char**)pXGL_DEVICE_CREATE_INFO->ppEnabledExtensionNames;
+            for (i = 0; i < pXGL_DEVICE_CREATE_INFO->extensionCount; i++)
+            {
+                pNames[i] = (const char*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)(pXGL_DEVICE_CREATE_INFO->ppEnabledExtensionNames[i]));
+            }
+        }
+        XGL_LAYER_CREATE_INFO *pNext = ( XGL_LAYER_CREATE_INFO *) glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pXGL_DEVICE_CREATE_INFO->pNext);
+        while (pNext != NULL)
+        {
+            if ((pNext->sType == XGL_STRUCTURE_TYPE_LAYER_CREATE_INFO) && pNext->layerCount > 0)
+            {
+                pNext->ppActiveLayerNames = (const char**) glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)(pNext->ppActiveLayerNames));
+                pNames = (const char**)pNext->ppActiveLayerNames;
+                for (i = 0; i < pNext->layerCount; i++)
+                {
+                    pNames[i] = (const char*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)(pNext->ppActiveLayerNames[i]));
+                }
+            }
+            pNext = ( XGL_LAYER_CREATE_INFO *) glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pNext->pNext);
+        }
+    }
+
+    return pXGL_DEVICE_CREATE_INFO;
+}
+
+static void interpret_pipeline_shader(glv_trace_packet_header*  pHeader, XGL_PIPELINE_SHADER* pShader)
+{
+    if (pShader != NULL)
+    {
+        // constant buffers
+        if (pShader->linkConstBufferCount > 0)
+        {
+            uint32_t i;
+            pShader->pLinkConstBufferInfo = (const XGL_LINK_CONST_BUFFER*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pShader->pLinkConstBufferInfo);
+            for (i = 0; i < pShader->linkConstBufferCount; i++)
+            {
+                XGL_LINK_CONST_BUFFER* pBuffer = (XGL_LINK_CONST_BUFFER*)pShader->pLinkConstBufferInfo;
+                pBuffer[i].pBufferData = (const void*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pShader->pLinkConstBufferInfo[i].pBufferData);
+            }
+        }
+    }
+}
+
+//=============================================================================
+typedef struct struct_xglApiVersion {
+    glv_trace_packet_header* header;
+    uint32_t version;
+} struct_xglApiVersion;
+
+static struct_xglApiVersion* interpret_body_as_xglApiVersion(glv_trace_packet_header* pHeader, BOOL check_version)
+{
+    struct_xglApiVersion* pPacket = (struct_xglApiVersion*)pHeader->pBody;
+    pPacket->header = pHeader;
+    if (check_version && pPacket->version != XGL_API_VERSION)
+        glv_LogError("Trace file from older XGL version 0x%x, xgl replayer built from version 0x%x, replayer may fail\n", pPacket->version, XGL_API_VERSION);
+    return pPacket;
+}
+
+typedef struct struct_xglCreateInstance {
+    glv_trace_packet_header* header;
+    const XGL_APPLICATION_INFO* pAppInfo;
+    const XGL_ALLOC_CALLBACKS* pAllocCb;
+    XGL_INSTANCE* pInstance;
+    XGL_RESULT result;
+} struct_xglCreateInstance;
+
+static struct_xglCreateInstance* interpret_body_as_xglCreateInstance(glv_trace_packet_header* pHeader)
+{
+    struct_xglCreateInstance* pPacket = (struct_xglCreateInstance*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->pAppInfo = (const XGL_APPLICATION_INFO*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pAppInfo);
+    if (pPacket->pAppInfo != NULL)
+    {
+        XGL_APPLICATION_INFO* pInfo = (XGL_APPLICATION_INFO*)pPacket->pAppInfo;
+        pInfo->pAppName = (const char*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pAppInfo->pAppName);
+        pInfo->pEngineName = (const char*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pAppInfo->pEngineName);
+    }
+    pPacket->pAllocCb = (const XGL_ALLOC_CALLBACKS*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pAllocCb);
+    pPacket->pInstance = (XGL_INSTANCE*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pInstance);
+    return pPacket;
+}
+
+typedef struct struct_xglDestroyInstance {
+    glv_trace_packet_header* header;
+    XGL_INSTANCE instance;
+    XGL_RESULT result;
+} struct_xglDestroyInstance;
+
+static struct_xglDestroyInstance* interpret_body_as_xglDestroyInstance(glv_trace_packet_header* pHeader)
+{
+    struct_xglDestroyInstance* pPacket = (struct_xglDestroyInstance*)pHeader->pBody;
+    pPacket->header = pHeader;
+    return pPacket;
+}
+
+typedef struct struct_xglEnumerateGpus {
+    glv_trace_packet_header* header;
+    XGL_INSTANCE instance;
+    uint32_t maxGpus;
+    uint32_t* pGpuCount;
+    XGL_PHYSICAL_GPU* pGpus;
+    XGL_RESULT result;
+} struct_xglEnumerateGpus;
+
+static struct_xglEnumerateGpus* interpret_body_as_xglEnumerateGpus(glv_trace_packet_header* pHeader)
+{
+    struct_xglEnumerateGpus* pPacket = (struct_xglEnumerateGpus*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->pGpuCount = (uint32_t*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pGpuCount);
+    pPacket->pGpus = (XGL_PHYSICAL_GPU*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pGpus);
+    return pPacket;
+}
+
+typedef struct struct_xglGetGpuInfo {
+    glv_trace_packet_header* header;
+    XGL_PHYSICAL_GPU gpu;
+    XGL_PHYSICAL_GPU_INFO_TYPE infoType;
+    size_t* pDataSize;
+    void* pData;
+    XGL_RESULT result;
+} struct_xglGetGpuInfo;
+
+static struct_xglGetGpuInfo* interpret_body_as_xglGetGpuInfo(glv_trace_packet_header* pHeader)
+{
+    struct_xglGetGpuInfo* pPacket = (struct_xglGetGpuInfo*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->pDataSize = (size_t*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pDataSize);
+    pPacket->pData = (void*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pData);
+    return pPacket;
+}
+
+typedef struct struct_xglGetProcAddr {
+    glv_trace_packet_header* header;
+    XGL_PHYSICAL_GPU gpu;
+    const char* pName;
+    void* result;
+} struct_xglGetProcAddr;
+
+static struct_xglGetProcAddr* interpret_body_as_xglGetProcAddr(glv_trace_packet_header* pHeader)
+{
+    struct_xglGetProcAddr* pPacket = (struct_xglGetProcAddr*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->pName = (const char*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pName);
+    return pPacket;
+}
+
+typedef struct struct_xglCreateDevice {
+    glv_trace_packet_header* header;
+    XGL_PHYSICAL_GPU gpu;
+    const XGL_DEVICE_CREATE_INFO* pCreateInfo;
+    XGL_DEVICE* pDevice;
+    XGL_RESULT result;
+} struct_xglCreateDevice;
+
+static struct_xglCreateDevice* interpret_body_as_xglCreateDevice(glv_trace_packet_header* pHeader)
+{
+    struct_xglCreateDevice* pPacket = (struct_xglCreateDevice*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->pCreateInfo = interpret_XGL_DEVICE_CREATE_INFO(pHeader, (intptr_t)pPacket->pCreateInfo);
+    pPacket->pDevice = (XGL_DEVICE*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pDevice);
+    return pPacket;
+}
+
+typedef struct struct_xglDestroyDevice {
+    glv_trace_packet_header* header;
+    XGL_DEVICE device;
+    XGL_RESULT result;
+} struct_xglDestroyDevice;
+
+static struct_xglDestroyDevice* interpret_body_as_xglDestroyDevice(glv_trace_packet_header* pHeader)
+{
+    struct_xglDestroyDevice* pPacket = (struct_xglDestroyDevice*)pHeader->pBody;
+    pPacket->header = pHeader;
+    return pPacket;
+}
+
+typedef struct struct_xglGetExtensionSupport {
+    glv_trace_packet_header* header;
+    XGL_PHYSICAL_GPU gpu;
+    const char* pExtName;
+    XGL_RESULT result;
+} struct_xglGetExtensionSupport;
+
+static struct_xglGetExtensionSupport* interpret_body_as_xglGetExtensionSupport(glv_trace_packet_header* pHeader)
+{
+    struct_xglGetExtensionSupport* pPacket = (struct_xglGetExtensionSupport*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->pExtName = (const char*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pExtName);
+    return pPacket;
+}
+
+typedef struct struct_xglEnumerateLayers {
+    glv_trace_packet_header* header;
+    XGL_PHYSICAL_GPU gpu;
+    size_t maxLayerCount;
+    size_t maxStringSize;
+    size_t* pOutLayerCount;
+    char* const* pOutLayers;
+    void* pReserved;
+    XGL_RESULT result;
+} struct_xglEnumerateLayers;
+
+static struct_xglEnumerateLayers* interpret_body_as_xglEnumerateLayers(glv_trace_packet_header* pHeader)
+{
+    struct_xglEnumerateLayers* pPacket = (struct_xglEnumerateLayers*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->pOutLayerCount = (size_t*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pOutLayerCount);
+    pPacket->pOutLayers = (char* const*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pOutLayers);
+    pPacket->pReserved = (void*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pReserved);
+    return pPacket;
+}
+
+typedef struct struct_xglGetDeviceQueue {
+    glv_trace_packet_header* header;
+    XGL_DEVICE device;
+    XGL_QUEUE_TYPE queueType;
+    uint32_t queueIndex;
+    XGL_QUEUE* pQueue;
+    XGL_RESULT result;
+} struct_xglGetDeviceQueue;
+
+static struct_xglGetDeviceQueue* interpret_body_as_xglGetDeviceQueue(glv_trace_packet_header* pHeader)
+{
+    struct_xglGetDeviceQueue* pPacket = (struct_xglGetDeviceQueue*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->pQueue = (XGL_QUEUE*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pQueue);
+    return pPacket;
+}
+
+typedef struct struct_xglQueueSubmit {
+    glv_trace_packet_header* header;
+    XGL_QUEUE queue;
+    uint32_t cmdBufferCount;
+    const XGL_CMD_BUFFER* pCmdBuffers;
+    uint32_t memRefCount;
+    const XGL_MEMORY_REF* pMemRefs;
+    XGL_FENCE fence;
+    XGL_RESULT result;
+} struct_xglQueueSubmit;
+
+static struct_xglQueueSubmit* interpret_body_as_xglQueueSubmit(glv_trace_packet_header* pHeader)
+{
+    struct_xglQueueSubmit* pPacket = (struct_xglQueueSubmit*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->pCmdBuffers = (const XGL_CMD_BUFFER*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pCmdBuffers);
+    pPacket->pMemRefs = (const XGL_MEMORY_REF*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pMemRefs);
+    return pPacket;
+}
+
+typedef struct struct_xglQueueSetGlobalMemReferences {
+    glv_trace_packet_header* header;
+    XGL_QUEUE queue;
+    uint32_t memRefCount;
+    const XGL_MEMORY_REF* pMemRefs;
+    XGL_RESULT result;
+} struct_xglQueueSetGlobalMemReferences;
+
+static struct_xglQueueSetGlobalMemReferences* interpret_body_as_xglQueueSetGlobalMemReferences(glv_trace_packet_header* pHeader)
+{
+    struct_xglQueueSetGlobalMemReferences* pPacket = (struct_xglQueueSetGlobalMemReferences*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->pMemRefs = (const XGL_MEMORY_REF*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pMemRefs);
+    return pPacket;
+}
+
+typedef struct struct_xglQueueWaitIdle {
+    glv_trace_packet_header* header;
+    XGL_QUEUE queue;
+    XGL_RESULT result;
+} struct_xglQueueWaitIdle;
+
+static struct_xglQueueWaitIdle* interpret_body_as_xglQueueWaitIdle(glv_trace_packet_header* pHeader)
+{
+    struct_xglQueueWaitIdle* pPacket = (struct_xglQueueWaitIdle*)pHeader->pBody;
+    pPacket->header = pHeader;
+    return pPacket;
+}
+
+typedef struct struct_xglDeviceWaitIdle {
+    glv_trace_packet_header* header;
+    XGL_DEVICE device;
+    XGL_RESULT result;
+} struct_xglDeviceWaitIdle;
+
+static struct_xglDeviceWaitIdle* interpret_body_as_xglDeviceWaitIdle(glv_trace_packet_header* pHeader)
+{
+    struct_xglDeviceWaitIdle* pPacket = (struct_xglDeviceWaitIdle*)pHeader->pBody;
+    pPacket->header = pHeader;
+    return pPacket;
+}
+
+typedef struct struct_xglAllocMemory {
+    glv_trace_packet_header* header;
+    XGL_DEVICE device;
+    const XGL_MEMORY_ALLOC_INFO* pAllocInfo;
+    XGL_GPU_MEMORY* pMem;
+    XGL_RESULT result;
+} struct_xglAllocMemory;
+
+static struct_xglAllocMemory* interpret_body_as_xglAllocMemory(glv_trace_packet_header* pHeader)
+{
+    struct_xglAllocMemory* pPacket = (struct_xglAllocMemory*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->pAllocInfo = (const XGL_MEMORY_ALLOC_INFO*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pAllocInfo);
+    if (pPacket->pAllocInfo != NULL)
+    {
+        if (pPacket->pAllocInfo->sType == XGL_STRUCTURE_TYPE_MEMORY_ALLOC_INFO) {
+            XGL_MEMORY_ALLOC_INFO** ppNext = (XGL_MEMORY_ALLOC_INFO**) &(pPacket->pAllocInfo->pNext);
+            *ppNext = (XGL_MEMORY_ALLOC_INFO*) glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pAllocInfo->pNext);
+            XGL_MEMORY_ALLOC_INFO* pNext = (XGL_MEMORY_ALLOC_INFO*) *ppNext;
+            while (NULL != pNext)
+            {
+                switch(pNext->sType)
+                {
+                    case XGL_STRUCTURE_TYPE_MEMORY_ALLOC_BUFFER_INFO:
+                    case XGL_STRUCTURE_TYPE_MEMORY_ALLOC_IMAGE_INFO:
+                    {
+                        ppNext = (XGL_MEMORY_ALLOC_INFO **) &(pNext->pNext);
+                        *ppNext = (XGL_MEMORY_ALLOC_INFO*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pNext->pNext);
+                        break;
+                    }
+                    default:
+                    {
+                       glv_LogError("Encountered an unexpected type alloc memory list.\n");
+                       pPacket->header = NULL;
+                       pNext->pNext = NULL;
+                    }
+                }
+                pNext = (XGL_MEMORY_ALLOC_INFO*)pNext->pNext;
+            }
+        } else {
+            // This is unexpected.
+            glv_LogError("AllocMemory must have AllocInfo stype of XGL_STRUCTURE_TYPE_MEMORY_ALLOC_INFO.\n");
+            pPacket->header = NULL;
+        }
+    }
+    pPacket->pMem = (XGL_GPU_MEMORY*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pMem);
+    return pPacket;
+}
+
+typedef struct struct_xglFreeMemory {
+    glv_trace_packet_header* header;
+    XGL_GPU_MEMORY mem;
+    XGL_RESULT result;
+} struct_xglFreeMemory;
+
+static struct_xglFreeMemory* interpret_body_as_xglFreeMemory(glv_trace_packet_header* pHeader)
+{
+    struct_xglFreeMemory* pPacket = (struct_xglFreeMemory*)pHeader->pBody;
+    pPacket->header = pHeader;
+    return pPacket;
+}
+
+typedef struct struct_xglSetMemoryPriority {
+    glv_trace_packet_header* header;
+    XGL_GPU_MEMORY mem;
+    XGL_MEMORY_PRIORITY priority;
+    XGL_RESULT result;
+} struct_xglSetMemoryPriority;
+
+static struct_xglSetMemoryPriority* interpret_body_as_xglSetMemoryPriority(glv_trace_packet_header* pHeader)
+{
+    struct_xglSetMemoryPriority* pPacket = (struct_xglSetMemoryPriority*)pHeader->pBody;
+    pPacket->header = pHeader;
+    return pPacket;
+}
+
+typedef struct struct_xglMapMemory {
+    glv_trace_packet_header* header;
+    XGL_GPU_MEMORY mem;
+    XGL_FLAGS flags;
+    void** ppData;
+    XGL_RESULT result;
+} struct_xglMapMemory;
+
+static struct_xglMapMemory* interpret_body_as_xglMapMemory(glv_trace_packet_header* pHeader)
+{
+    struct_xglMapMemory* pPacket = (struct_xglMapMemory*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->ppData = (void**)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->ppData);
+    return pPacket;
+}
+
+typedef struct struct_xglUnmapMemory {
+    glv_trace_packet_header* header;
+    XGL_GPU_MEMORY mem;
+    void* pData;
+    XGL_RESULT result;
+} struct_xglUnmapMemory;
+
+static struct_xglUnmapMemory* interpret_body_as_xglUnmapMemory(glv_trace_packet_header* pHeader)
+{
+    struct_xglUnmapMemory* pPacket = (struct_xglUnmapMemory*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->pData = (void*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pData);
+    return pPacket;
+}
+
+typedef struct struct_xglPinSystemMemory {
+    glv_trace_packet_header* header;
+    XGL_DEVICE device;
+    const void* pSysMem;
+    size_t memSize;
+    XGL_GPU_MEMORY* pMem;
+    XGL_RESULT result;
+} struct_xglPinSystemMemory;
+
+static struct_xglPinSystemMemory* interpret_body_as_xglPinSystemMemory(glv_trace_packet_header* pHeader)
+{
+    struct_xglPinSystemMemory* pPacket = (struct_xglPinSystemMemory*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->pSysMem = (const void*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pSysMem);
+    pPacket->pMem = (XGL_GPU_MEMORY*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pMem);
+    return pPacket;
+}
+
+typedef struct struct_xglGetMultiGpuCompatibility {
+    glv_trace_packet_header* header;
+    XGL_PHYSICAL_GPU gpu0;
+    XGL_PHYSICAL_GPU gpu1;
+    XGL_GPU_COMPATIBILITY_INFO* pInfo;
+    XGL_RESULT result;
+} struct_xglGetMultiGpuCompatibility;
+
+static struct_xglGetMultiGpuCompatibility* interpret_body_as_xglGetMultiGpuCompatibility(glv_trace_packet_header* pHeader)
+{
+    struct_xglGetMultiGpuCompatibility* pPacket = (struct_xglGetMultiGpuCompatibility*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->pInfo = (XGL_GPU_COMPATIBILITY_INFO*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pInfo);
+    return pPacket;
+}
+
+typedef struct struct_xglOpenSharedMemory {
+    glv_trace_packet_header* header;
+    XGL_DEVICE device;
+    const XGL_MEMORY_OPEN_INFO* pOpenInfo;
+    XGL_GPU_MEMORY* pMem;
+    XGL_RESULT result;
+} struct_xglOpenSharedMemory;
+
+static struct_xglOpenSharedMemory* interpret_body_as_xglOpenSharedMemory(glv_trace_packet_header* pHeader)
+{
+    struct_xglOpenSharedMemory* pPacket = (struct_xglOpenSharedMemory*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->pOpenInfo = (const XGL_MEMORY_OPEN_INFO*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pOpenInfo);
+    pPacket->pMem = (XGL_GPU_MEMORY*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pMem);
+    return pPacket;
+}
+
+typedef struct struct_xglOpenSharedQueueSemaphore {
+    glv_trace_packet_header* header;
+    XGL_DEVICE device;
+    const XGL_QUEUE_SEMAPHORE_OPEN_INFO* pOpenInfo;
+    XGL_QUEUE_SEMAPHORE* pSemaphore;
+    XGL_RESULT result;
+} struct_xglOpenSharedQueueSemaphore;
+
+static struct_xglOpenSharedQueueSemaphore* interpret_body_as_xglOpenSharedQueueSemaphore(glv_trace_packet_header* pHeader)
+{
+    struct_xglOpenSharedQueueSemaphore* pPacket = (struct_xglOpenSharedQueueSemaphore*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->pOpenInfo = (const XGL_QUEUE_SEMAPHORE_OPEN_INFO*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pOpenInfo);
+    pPacket->pSemaphore = (XGL_QUEUE_SEMAPHORE*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pSemaphore);
+    return pPacket;
+}
+
+typedef struct struct_xglOpenPeerMemory {
+    glv_trace_packet_header* header;
+    XGL_DEVICE device;
+    const XGL_PEER_MEMORY_OPEN_INFO* pOpenInfo;
+    XGL_GPU_MEMORY* pMem;
+    XGL_RESULT result;
+} struct_xglOpenPeerMemory;
+
+static struct_xglOpenPeerMemory* interpret_body_as_xglOpenPeerMemory(glv_trace_packet_header* pHeader)
+{
+    struct_xglOpenPeerMemory* pPacket = (struct_xglOpenPeerMemory*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->pOpenInfo = (const XGL_PEER_MEMORY_OPEN_INFO*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pOpenInfo);
+    pPacket->pMem = (XGL_GPU_MEMORY*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pMem);
+    return pPacket;
+}
+
+typedef struct struct_xglOpenPeerImage {
+    glv_trace_packet_header* header;
+    XGL_DEVICE device;
+    const XGL_PEER_IMAGE_OPEN_INFO* pOpenInfo;
+    XGL_IMAGE* pImage;
+    XGL_GPU_MEMORY* pMem;
+    XGL_RESULT result;
+} struct_xglOpenPeerImage;
+
+static struct_xglOpenPeerImage* interpret_body_as_xglOpenPeerImage(glv_trace_packet_header* pHeader)
+{
+    struct_xglOpenPeerImage* pPacket = (struct_xglOpenPeerImage*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->pOpenInfo = (const XGL_PEER_IMAGE_OPEN_INFO*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pOpenInfo);
+    pPacket->pImage = (XGL_IMAGE*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pImage);
+    pPacket->pMem = (XGL_GPU_MEMORY*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pMem);
+    return pPacket;
+}
+
+typedef struct struct_xglDestroyObject {
+    glv_trace_packet_header* header;
+    XGL_OBJECT object;
+    XGL_RESULT result;
+} struct_xglDestroyObject;
+
+static struct_xglDestroyObject* interpret_body_as_xglDestroyObject(glv_trace_packet_header* pHeader)
+{
+    struct_xglDestroyObject* pPacket = (struct_xglDestroyObject*)pHeader->pBody;
+    pPacket->header = pHeader;
+    return pPacket;
+}
+
+typedef struct struct_xglGetObjectInfo {
+    glv_trace_packet_header* header;
+    XGL_BASE_OBJECT object;
+    XGL_OBJECT_INFO_TYPE infoType;
+    size_t* pDataSize;
+    void* pData;
+    XGL_RESULT result;
+} struct_xglGetObjectInfo;
+
+static struct_xglGetObjectInfo* interpret_body_as_xglGetObjectInfo(glv_trace_packet_header* pHeader)
+{
+    struct_xglGetObjectInfo* pPacket = (struct_xglGetObjectInfo*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->pDataSize = (size_t*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pDataSize);
+    pPacket->pData = (void*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pData);
+    return pPacket;
+}
+
+typedef struct struct_xglBindObjectMemory {
+    glv_trace_packet_header* header;
+    XGL_OBJECT object;
+    uint32_t allocationIdx;
+    XGL_GPU_MEMORY mem;
+    XGL_GPU_SIZE offset;
+    XGL_RESULT result;
+} struct_xglBindObjectMemory;
+
+static struct_xglBindObjectMemory* interpret_body_as_xglBindObjectMemory(glv_trace_packet_header* pHeader)
+{
+    struct_xglBindObjectMemory* pPacket = (struct_xglBindObjectMemory*)pHeader->pBody;
+    pPacket->header = pHeader;
+    return pPacket;
+}
+
+typedef struct struct_xglBindObjectMemoryRange {
+    glv_trace_packet_header* header;
+    XGL_OBJECT object;
+    uint32_t allocationIdx;
+    XGL_GPU_SIZE rangeOffset;
+    XGL_GPU_SIZE rangeSize;
+    XGL_GPU_MEMORY mem;
+    XGL_GPU_SIZE memOffset;
+    XGL_RESULT result;
+} struct_xglBindObjectMemoryRange;
+
+static struct_xglBindObjectMemoryRange* interpret_body_as_xglBindObjectMemoryRange(glv_trace_packet_header* pHeader)
+{
+    struct_xglBindObjectMemoryRange* pPacket = (struct_xglBindObjectMemoryRange*)pHeader->pBody;
+    pPacket->header = pHeader;
+    return pPacket;
+}
+
+typedef struct struct_xglBindImageMemoryRange {
+    glv_trace_packet_header* header;
+    XGL_IMAGE image;
+    uint32_t allocationIdx;
+    const XGL_IMAGE_MEMORY_BIND_INFO* bindInfo;
+    XGL_GPU_MEMORY mem;
+    XGL_GPU_SIZE memOffset;
+    XGL_RESULT result;
+} struct_xglBindImageMemoryRange;
+
+static struct_xglBindImageMemoryRange* interpret_body_as_xglBindImageMemoryRange(glv_trace_packet_header* pHeader)
+{
+    struct_xglBindImageMemoryRange* pPacket = (struct_xglBindImageMemoryRange*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->bindInfo = (const XGL_IMAGE_MEMORY_BIND_INFO*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->bindInfo);
+    return pPacket;
+}
+
+typedef struct struct_xglCreateFence {
+    glv_trace_packet_header* header;
+    XGL_DEVICE device;
+    const XGL_FENCE_CREATE_INFO* pCreateInfo;
+    XGL_FENCE* pFence;
+    XGL_RESULT result;
+} struct_xglCreateFence;
+
+static struct_xglCreateFence* interpret_body_as_xglCreateFence(glv_trace_packet_header* pHeader)
+{
+    struct_xglCreateFence* pPacket = (struct_xglCreateFence*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->pCreateInfo = (const XGL_FENCE_CREATE_INFO*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pCreateInfo);
+    pPacket->pFence = (XGL_FENCE*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pFence);
+    return pPacket;
+}
+
+typedef struct struct_xglGetFenceStatus {
+    glv_trace_packet_header* header;
+    XGL_FENCE fence;
+    XGL_RESULT result;
+} struct_xglGetFenceStatus;
+
+static struct_xglGetFenceStatus* interpret_body_as_xglGetFenceStatus(glv_trace_packet_header* pHeader)
+{
+    struct_xglGetFenceStatus* pPacket = (struct_xglGetFenceStatus*)pHeader->pBody;
+    pPacket->header = pHeader;
+    return pPacket;
+}
+
+typedef struct struct_xglWaitForFences {
+    glv_trace_packet_header* header;
+    XGL_DEVICE device;
+    uint32_t fenceCount;
+    const XGL_FENCE* pFences;
+    bool32_t waitAll;
+    uint64_t timeout;
+    XGL_RESULT result;
+} struct_xglWaitForFences;
+
+static struct_xglWaitForFences* interpret_body_as_xglWaitForFences(glv_trace_packet_header* pHeader)
+{
+    struct_xglWaitForFences* pPacket = (struct_xglWaitForFences*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->pFences = (const XGL_FENCE*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pFences);
+    return pPacket;
+}
+
+typedef struct struct_xglCreateQueueSemaphore {
+    glv_trace_packet_header* header;
+    XGL_DEVICE device;
+    const XGL_QUEUE_SEMAPHORE_CREATE_INFO* pCreateInfo;
+    XGL_QUEUE_SEMAPHORE* pSemaphore;
+    XGL_RESULT result;
+} struct_xglCreateQueueSemaphore;
+
+static struct_xglCreateQueueSemaphore* interpret_body_as_xglCreateQueueSemaphore(glv_trace_packet_header* pHeader)
+{
+    struct_xglCreateQueueSemaphore* pPacket = (struct_xglCreateQueueSemaphore*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->pCreateInfo = (const XGL_QUEUE_SEMAPHORE_CREATE_INFO*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pCreateInfo);
+    pPacket->pSemaphore = (XGL_QUEUE_SEMAPHORE*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pSemaphore);
+    return pPacket;
+}
+
+typedef struct struct_xglSignalQueueSemaphore {
+    glv_trace_packet_header* header;
+    XGL_QUEUE queue;
+    XGL_QUEUE_SEMAPHORE semaphore;
+    XGL_RESULT result;
+} struct_xglSignalQueueSemaphore;
+
+static struct_xglSignalQueueSemaphore* interpret_body_as_xglSignalQueueSemaphore(glv_trace_packet_header* pHeader)
+{
+    struct_xglSignalQueueSemaphore* pPacket = (struct_xglSignalQueueSemaphore*)pHeader->pBody;
+    pPacket->header = pHeader;
+    return pPacket;
+}
+
+typedef struct struct_xglWaitQueueSemaphore {
+    glv_trace_packet_header* header;
+    XGL_QUEUE queue;
+    XGL_QUEUE_SEMAPHORE semaphore;
+    XGL_RESULT result;
+} struct_xglWaitQueueSemaphore;
+
+static struct_xglWaitQueueSemaphore* interpret_body_as_xglWaitQueueSemaphore(glv_trace_packet_header* pHeader)
+{
+    struct_xglWaitQueueSemaphore* pPacket = (struct_xglWaitQueueSemaphore*)pHeader->pBody;
+    pPacket->header = pHeader;
+    return pPacket;
+}
+
+typedef struct struct_xglCreateEvent {
+    glv_trace_packet_header* header;
+    XGL_DEVICE device;
+    const XGL_EVENT_CREATE_INFO* pCreateInfo;
+    XGL_EVENT* pEvent;
+    XGL_RESULT result;
+} struct_xglCreateEvent;
+
+static struct_xglCreateEvent* interpret_body_as_xglCreateEvent(glv_trace_packet_header* pHeader)
+{
+    struct_xglCreateEvent* pPacket = (struct_xglCreateEvent*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->pCreateInfo = (const XGL_EVENT_CREATE_INFO*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pCreateInfo);
+    pPacket->pEvent = (XGL_EVENT*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pEvent);
+    return pPacket;
+}
+
+typedef struct struct_xglGetEventStatus {
+    glv_trace_packet_header* header;
+    XGL_EVENT event;
+    XGL_RESULT result;
+} struct_xglGetEventStatus;
+
+static struct_xglGetEventStatus* interpret_body_as_xglGetEventStatus(glv_trace_packet_header* pHeader)
+{
+    struct_xglGetEventStatus* pPacket = (struct_xglGetEventStatus*)pHeader->pBody;
+    pPacket->header = pHeader;
+    return pPacket;
+}
+
+typedef struct struct_xglSetEvent {
+    glv_trace_packet_header* header;
+    XGL_EVENT event;
+    XGL_RESULT result;
+} struct_xglSetEvent;
+
+static struct_xglSetEvent* interpret_body_as_xglSetEvent(glv_trace_packet_header* pHeader)
+{
+    struct_xglSetEvent* pPacket = (struct_xglSetEvent*)pHeader->pBody;
+    pPacket->header = pHeader;
+    return pPacket;
+}
+
+typedef struct struct_xglResetEvent {
+    glv_trace_packet_header* header;
+    XGL_EVENT event;
+    XGL_RESULT result;
+} struct_xglResetEvent;
+
+static struct_xglResetEvent* interpret_body_as_xglResetEvent(glv_trace_packet_header* pHeader)
+{
+    struct_xglResetEvent* pPacket = (struct_xglResetEvent*)pHeader->pBody;
+    pPacket->header = pHeader;
+    return pPacket;
+}
+
+typedef struct struct_xglCreateQueryPool {
+    glv_trace_packet_header* header;
+    XGL_DEVICE device;
+    const XGL_QUERY_POOL_CREATE_INFO* pCreateInfo;
+    XGL_QUERY_POOL* pQueryPool;
+    XGL_RESULT result;
+} struct_xglCreateQueryPool;
+
+static struct_xglCreateQueryPool* interpret_body_as_xglCreateQueryPool(glv_trace_packet_header* pHeader)
+{
+    struct_xglCreateQueryPool* pPacket = (struct_xglCreateQueryPool*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->pCreateInfo = (const XGL_QUERY_POOL_CREATE_INFO*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pCreateInfo);
+    pPacket->pQueryPool = (XGL_QUERY_POOL*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pQueryPool);
+    return pPacket;
+}
+
+typedef struct struct_xglGetQueryPoolResults {
+    glv_trace_packet_header* header;
+    XGL_QUERY_POOL queryPool;
+    uint32_t startQuery;
+    uint32_t queryCount;
+    size_t* pDataSize;
+    void* pData;
+    XGL_RESULT result;
+} struct_xglGetQueryPoolResults;
+
+static struct_xglGetQueryPoolResults* interpret_body_as_xglGetQueryPoolResults(glv_trace_packet_header* pHeader)
+{
+    struct_xglGetQueryPoolResults* pPacket = (struct_xglGetQueryPoolResults*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->pDataSize = (size_t*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pDataSize);
+    pPacket->pData = (void*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pData);
+    return pPacket;
+}
+
+typedef struct struct_xglGetFormatInfo {
+    glv_trace_packet_header* header;
+    XGL_DEVICE device;
+    XGL_FORMAT format;
+    XGL_FORMAT_INFO_TYPE infoType;
+    size_t* pDataSize;
+    void* pData;
+    XGL_RESULT result;
+} struct_xglGetFormatInfo;
+
+static struct_xglGetFormatInfo* interpret_body_as_xglGetFormatInfo(glv_trace_packet_header* pHeader)
+{
+    struct_xglGetFormatInfo* pPacket = (struct_xglGetFormatInfo*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->pDataSize = (size_t*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pDataSize);
+    pPacket->pData = (void*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pData);
+    return pPacket;
+}
+
+typedef struct struct_xglCreateBuffer {
+    glv_trace_packet_header* header;
+    XGL_DEVICE device;
+    const XGL_BUFFER_CREATE_INFO* pCreateInfo;
+    XGL_BUFFER* pBuffer;
+    XGL_RESULT result;
+} struct_xglCreateBuffer;
+
+static struct_xglCreateBuffer* interpret_body_as_xglCreateBuffer(glv_trace_packet_header* pHeader)
+{
+    struct_xglCreateBuffer* pPacket = (struct_xglCreateBuffer*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->pCreateInfo = (const XGL_BUFFER_CREATE_INFO*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pCreateInfo);
+    pPacket->pBuffer = (XGL_BUFFER*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pBuffer);
+    return pPacket;
+}
+
+typedef struct struct_xglCreateBufferView {
+    glv_trace_packet_header* header;
+    XGL_DEVICE device;
+    const XGL_BUFFER_VIEW_CREATE_INFO* pCreateInfo;
+    XGL_BUFFER_VIEW* pView;
+    XGL_RESULT result;
+} struct_xglCreateBufferView;
+
+static struct_xglCreateBufferView* interpret_body_as_xglCreateBufferView(glv_trace_packet_header* pHeader)
+{
+    struct_xglCreateBufferView* pPacket = (struct_xglCreateBufferView*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->pCreateInfo = (const XGL_BUFFER_VIEW_CREATE_INFO*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pCreateInfo);
+    pPacket->pView = (XGL_BUFFER_VIEW*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pView);
+    return pPacket;
+}
+
+typedef struct struct_xglCreateImage {
+    glv_trace_packet_header* header;
+    XGL_DEVICE device;
+    const XGL_IMAGE_CREATE_INFO* pCreateInfo;
+    XGL_IMAGE* pImage;
+    XGL_RESULT result;
+} struct_xglCreateImage;
+
+static struct_xglCreateImage* interpret_body_as_xglCreateImage(glv_trace_packet_header* pHeader)
+{
+    struct_xglCreateImage* pPacket = (struct_xglCreateImage*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->pCreateInfo = (const XGL_IMAGE_CREATE_INFO*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pCreateInfo);
+    pPacket->pImage = (XGL_IMAGE*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pImage);
+    return pPacket;
+}
+
+typedef struct struct_xglSetFastClearColor {
+    glv_trace_packet_header* header;
+    XGL_IMAGE image;
+    const float color[4];
+    XGL_RESULT result;
+} struct_xglSetFastClearColor;
+
+static struct_xglSetFastClearColor* interpret_body_as_xglSetFastClearColor(glv_trace_packet_header* pHeader)
+{
+    struct_xglSetFastClearColor* pPacket = (struct_xglSetFastClearColor*)pHeader->pBody;
+    pPacket->header = pHeader;
+    return pPacket;
+}
+
+typedef struct struct_xglSetFastClearDepth {
+    glv_trace_packet_header* header;
+    XGL_IMAGE image;
+    float depth;
+    XGL_RESULT result;
+} struct_xglSetFastClearDepth;
+
+static struct_xglSetFastClearDepth* interpret_body_as_xglSetFastClearDepth(glv_trace_packet_header* pHeader)
+{
+    struct_xglSetFastClearDepth* pPacket = (struct_xglSetFastClearDepth*)pHeader->pBody;
+    pPacket->header = pHeader;
+    return pPacket;
+}
+
+typedef struct struct_xglGetImageSubresourceInfo {
+    glv_trace_packet_header* header;
+    XGL_IMAGE image;
+    const XGL_IMAGE_SUBRESOURCE* pSubresource;
+    XGL_SUBRESOURCE_INFO_TYPE infoType;
+    size_t* pDataSize;
+    void* pData;
+    XGL_RESULT result;
+} struct_xglGetImageSubresourceInfo;
+
+static struct_xglGetImageSubresourceInfo* interpret_body_as_xglGetImageSubresourceInfo(glv_trace_packet_header* pHeader)
+{
+    struct_xglGetImageSubresourceInfo* pPacket = (struct_xglGetImageSubresourceInfo*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->pSubresource = (const XGL_IMAGE_SUBRESOURCE*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pSubresource);
+    pPacket->pDataSize = (size_t*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pDataSize);
+    pPacket->pData = (void*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pData);
+    return pPacket;
+}
+
+typedef struct struct_xglCreateImageView {
+    glv_trace_packet_header* header;
+    XGL_DEVICE device;
+    const XGL_IMAGE_VIEW_CREATE_INFO* pCreateInfo;
+    XGL_IMAGE_VIEW* pView;
+    XGL_RESULT result;
+} struct_xglCreateImageView;
+
+static struct_xglCreateImageView* interpret_body_as_xglCreateImageView(glv_trace_packet_header* pHeader)
+{
+    struct_xglCreateImageView* pPacket = (struct_xglCreateImageView*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->pCreateInfo = (const XGL_IMAGE_VIEW_CREATE_INFO*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pCreateInfo);
+    pPacket->pView = (XGL_IMAGE_VIEW*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pView);
+    return pPacket;
+}
+
+typedef struct struct_xglCreateColorAttachmentView {
+    glv_trace_packet_header* header;
+    XGL_DEVICE device;
+    const XGL_COLOR_ATTACHMENT_VIEW_CREATE_INFO* pCreateInfo;
+    XGL_COLOR_ATTACHMENT_VIEW* pView;
+    XGL_RESULT result;
+} struct_xglCreateColorAttachmentView;
+
+static struct_xglCreateColorAttachmentView* interpret_body_as_xglCreateColorAttachmentView(glv_trace_packet_header* pHeader)
+{
+    struct_xglCreateColorAttachmentView* pPacket = (struct_xglCreateColorAttachmentView*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->pCreateInfo = (const XGL_COLOR_ATTACHMENT_VIEW_CREATE_INFO*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pCreateInfo);
+    pPacket->pView = (XGL_COLOR_ATTACHMENT_VIEW*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pView);
+    return pPacket;
+}
+
+typedef struct struct_xglCreateDepthStencilView {
+    glv_trace_packet_header* header;
+    XGL_DEVICE device;
+    const XGL_DEPTH_STENCIL_VIEW_CREATE_INFO* pCreateInfo;
+    XGL_DEPTH_STENCIL_VIEW* pView;
+    XGL_RESULT result;
+} struct_xglCreateDepthStencilView;
+
+static struct_xglCreateDepthStencilView* interpret_body_as_xglCreateDepthStencilView(glv_trace_packet_header* pHeader)
+{
+    struct_xglCreateDepthStencilView* pPacket = (struct_xglCreateDepthStencilView*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->pCreateInfo = (const XGL_DEPTH_STENCIL_VIEW_CREATE_INFO*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pCreateInfo);
+    pPacket->pView = (XGL_DEPTH_STENCIL_VIEW*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pView);
+    return pPacket;
+}
+
+typedef struct struct_xglCreateShader {
+    glv_trace_packet_header* header;
+    XGL_DEVICE device;
+    const XGL_SHADER_CREATE_INFO* pCreateInfo;
+    XGL_SHADER* pShader;
+    XGL_RESULT result;
+} struct_xglCreateShader;
+
+static struct_xglCreateShader* interpret_body_as_xglCreateShader(glv_trace_packet_header* pHeader)
+{
+    struct_xglCreateShader* pPacket = (struct_xglCreateShader*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->pCreateInfo = (const XGL_SHADER_CREATE_INFO*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pCreateInfo);
+    if (pPacket->pCreateInfo != NULL)
+    {
+        XGL_SHADER_CREATE_INFO* pInfo = (XGL_SHADER_CREATE_INFO*)pPacket->pCreateInfo;
+        pInfo->pCode = glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pCreateInfo->pCode);
+    }
+    pPacket->pShader = (XGL_SHADER*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pShader);
+    return pPacket;
+}
+
+typedef struct struct_xglCreateGraphicsPipeline {
+    glv_trace_packet_header* header;
+    XGL_DEVICE device;
+    const XGL_GRAPHICS_PIPELINE_CREATE_INFO* pCreateInfo;
+    XGL_PIPELINE* pPipeline;
+    XGL_RESULT result;
+} struct_xglCreateGraphicsPipeline;
+
+static struct_xglCreateGraphicsPipeline* interpret_body_as_xglCreateGraphicsPipeline(glv_trace_packet_header* pHeader)
+{
+    struct_xglCreateGraphicsPipeline* pPacket = (struct_xglCreateGraphicsPipeline*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->pCreateInfo = (const XGL_GRAPHICS_PIPELINE_CREATE_INFO*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pCreateInfo);
+    if (pPacket->pCreateInfo != NULL)
+    {
+        if (pPacket->pCreateInfo->sType == XGL_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO) {
+            // need to make a non-const pointer to the pointer so that we can properly change the original pointer to the interpretted one
+            void** ppNextVoidPtr = (void**)&pPacket->pCreateInfo->pNext;
+            *ppNextVoidPtr = (void*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pCreateInfo->pNext);
+            XGL_PIPELINE_SHADER_STAGE_CREATE_INFO* pNext = (XGL_PIPELINE_SHADER_STAGE_CREATE_INFO*)pPacket->pCreateInfo->pNext;
+            while ((NULL != pNext) && (XGL_NULL_HANDLE != pNext))
+        {
+                switch(pNext->sType)
+            {
+                    case XGL_STRUCTURE_TYPE_PIPELINE_IA_STATE_CREATE_INFO:
+                    case XGL_STRUCTURE_TYPE_PIPELINE_TESS_STATE_CREATE_INFO:
+                    case XGL_STRUCTURE_TYPE_PIPELINE_RS_STATE_CREATE_INFO:
+                    case XGL_STRUCTURE_TYPE_PIPELINE_VP_STATE_CREATE_INFO:
+                    case XGL_STRUCTURE_TYPE_PIPELINE_MS_STATE_CREATE_INFO:
+                    case XGL_STRUCTURE_TYPE_PIPELINE_DS_STATE_CREATE_INFO:
+                    {
+                        void** ppNextVoidPtr = (void**)&pNext->pNext;
+                        *ppNextVoidPtr = (void*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pNext->pNext);
+                        break;
+                    }
+                    case XGL_STRUCTURE_TYPE_PIPELINE_CB_STATE_CREATE_INFO:
+                    {
+                        void** ppNextVoidPtr = (void**)&pNext->pNext;
+                        XGL_PIPELINE_CB_STATE_CREATE_INFO *pCb = (XGL_PIPELINE_CB_STATE_CREATE_INFO *) pNext;
+                        *ppNextVoidPtr = (void*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pNext->pNext);
+                        pCb->pAttachments = (XGL_PIPELINE_CB_ATTACHMENT_STATE*) glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pCb->pAttachments);
+                        break;
+                    }
+                    case XGL_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO:
+                    {
+                        void** ppNextVoidPtr = (void**)&pNext->pNext;
+                        *ppNextVoidPtr = (void*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pNext->pNext);
+                        interpret_pipeline_shader(pHeader, &pNext->shader);
+                        break;
+                    }
+                    case XGL_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_CREATE_INFO:
+                    {
+                        void** ppNextVoidPtr = (void**)&pNext->pNext;
+                        XGL_PIPELINE_VERTEX_INPUT_CREATE_INFO *pVi = (XGL_PIPELINE_VERTEX_INPUT_CREATE_INFO *) pNext;
+                        *ppNextVoidPtr = (void*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pNext->pNext);
+                        pVi->pVertexBindingDescriptions = (XGL_VERTEX_INPUT_BINDING_DESCRIPTION*) glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pVi->pVertexBindingDescriptions);
+                        pVi->pVertexAttributeDescriptions = (XGL_VERTEX_INPUT_ATTRIBUTE_DESCRIPTION*) glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pVi->pVertexAttributeDescriptions);
+                        break;
+                    }
+                    default:
+                    {
+                       glv_LogError("Encountered an unexpected type in pipeline state list.\n");
+                       pPacket->header = NULL;
+                       pNext->pNext = NULL;
+                    }
+                }
+                pNext = (XGL_PIPELINE_SHADER_STAGE_CREATE_INFO*)pNext->pNext;
+            }
+        } else {
+            // This is unexpected.
+            glv_LogError("CreateGraphicsPipeline must have CreateInfo stype of XGL_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO.\n");
+            pPacket->header = NULL;
+        }
+    }
+    pPacket->pPipeline = (XGL_PIPELINE*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pPipeline);
+    return pPacket;
+}
+
+typedef struct struct_xglCreateComputePipeline {
+    glv_trace_packet_header* header;
+    XGL_DEVICE device;
+    const XGL_COMPUTE_PIPELINE_CREATE_INFO* pCreateInfo;
+    XGL_PIPELINE* pPipeline;
+    XGL_RESULT result;
+} struct_xglCreateComputePipeline;
+
+static struct_xglCreateComputePipeline* interpret_body_as_xglCreateComputePipeline(glv_trace_packet_header* pHeader)
+{
+    struct_xglCreateComputePipeline* pPacket = (struct_xglCreateComputePipeline*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->pCreateInfo = (const XGL_COMPUTE_PIPELINE_CREATE_INFO*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pCreateInfo);
+    if (pPacket->pCreateInfo != NULL)
+    {
+        interpret_pipeline_shader(pHeader, (XGL_PIPELINE_SHADER*)(&pPacket->pCreateInfo->cs));
+    }
+    pPacket->pPipeline = (XGL_PIPELINE*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pPipeline);
+    return pPacket;
+}
+
+typedef struct struct_xglStorePipeline {
+    glv_trace_packet_header* header;
+    XGL_PIPELINE pipeline;
+    size_t* pDataSize;
+    void* pData;
+    XGL_RESULT result;
+} struct_xglStorePipeline;
+
+static struct_xglStorePipeline* interpret_body_as_xglStorePipeline(glv_trace_packet_header* pHeader)
+{
+    struct_xglStorePipeline* pPacket = (struct_xglStorePipeline*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->pDataSize = (size_t*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pDataSize);
+    pPacket->pData = (void*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pData);
+    return pPacket;
+}
+
+typedef struct struct_xglLoadPipeline {
+    glv_trace_packet_header* header;
+    XGL_DEVICE device;
+    size_t dataSize;
+    const void* pData;
+    XGL_PIPELINE* pPipeline;
+    XGL_RESULT result;
+} struct_xglLoadPipeline;
+
+static struct_xglLoadPipeline* interpret_body_as_xglLoadPipeline(glv_trace_packet_header* pHeader)
+{
+    struct_xglLoadPipeline* pPacket = (struct_xglLoadPipeline*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->pData = (const void*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pData);
+    pPacket->pPipeline = (XGL_PIPELINE*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pPipeline);
+    return pPacket;
+}
+
+typedef struct struct_xglCreatePipelineDelta {
+    glv_trace_packet_header* header;
+    XGL_DEVICE device;
+    XGL_PIPELINE p1;
+    XGL_PIPELINE p2;
+    XGL_PIPELINE_DELTA* delta;
+    XGL_RESULT result;
+} struct_xglCreatePipelineDelta;
+
+static struct_xglCreatePipelineDelta* interpret_body_as_xglCreatePipelineDelta(glv_trace_packet_header* pHeader)
+{
+    struct_xglCreatePipelineDelta* pPacket = (struct_xglCreatePipelineDelta*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->delta = (XGL_PIPELINE_DELTA*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->delta);
+    return pPacket;
+}
+
+typedef struct struct_xglCreateSampler {
+    glv_trace_packet_header* header;
+    XGL_DEVICE device;
+    const XGL_SAMPLER_CREATE_INFO* pCreateInfo;
+    XGL_SAMPLER* pSampler;
+    XGL_RESULT result;
+} struct_xglCreateSampler;
+
+static struct_xglCreateSampler* interpret_body_as_xglCreateSampler(glv_trace_packet_header* pHeader)
+{
+    struct_xglCreateSampler* pPacket = (struct_xglCreateSampler*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->pCreateInfo = (const XGL_SAMPLER_CREATE_INFO*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pCreateInfo);
+    pPacket->pSampler = (XGL_SAMPLER*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pSampler);
+    return pPacket;
+}
+
+typedef struct struct_xglCreateDescriptorSetLayout {
+    glv_trace_packet_header* header;
+    XGL_DEVICE device;
+    XGL_FLAGS stageFlags;
+    const uint32_t* pSetBindPoints;
+    XGL_DESCRIPTOR_SET_LAYOUT priorSetLayout;
+    const XGL_DESCRIPTOR_SET_LAYOUT_CREATE_INFO* pSetLayoutInfoList;
+    XGL_DESCRIPTOR_SET_LAYOUT* pSetLayout;
+    XGL_RESULT result;
+} struct_xglCreateDescriptorSetLayout;
+
+static struct_xglCreateDescriptorSetLayout* interpret_body_as_xglCreateDescriptorSetLayout(glv_trace_packet_header* pHeader)
+{
+    struct_xglCreateDescriptorSetLayout* pPacket = (struct_xglCreateDescriptorSetLayout*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->pSetBindPoints = (const uint32_t*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pSetBindPoints);
+    pPacket->pSetLayoutInfoList = (const XGL_DESCRIPTOR_SET_LAYOUT_CREATE_INFO*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pSetLayoutInfoList);
+    if (pPacket->pSetLayoutInfoList != NULL)
+    {
+        if (pPacket->pSetLayoutInfoList->sType == XGL_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO) {
+            // need to make a non-const pointer to the pointer so that we can properly change the original pointer to the interpretted one
+            void** ppNextVoidPtr = (void**)&(pPacket->pSetLayoutInfoList->pNext);
+            *ppNextVoidPtr = (void*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pSetLayoutInfoList->pNext);
+            XGL_DESCRIPTOR_SET_LAYOUT_CREATE_INFO* pNext = (XGL_DESCRIPTOR_SET_LAYOUT_CREATE_INFO*)pPacket->pSetLayoutInfoList->pNext;
+            while (NULL != pNext)
+            {
+                switch(pNext->sType)
+                {
+                    case XGL_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO:
+                    {
+                        void** ppNextVoidPtr = (void**)&pNext->pNext;
+                        *ppNextVoidPtr = (void*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pNext->pNext);
+                        break;
+                    }
+                    default:
+                    {
+                        glv_LogError("Encountered an unexpected type in descriptor set layout create list.\n");
+                        pPacket->header = NULL;
+                        pNext->pNext = NULL;
+                    }
+                }
+                pNext = (XGL_DESCRIPTOR_SET_LAYOUT_CREATE_INFO*)pNext->pNext;
+             }
+        } else {
+             // This is unexpected.
+             glv_LogError("CreateDescriptorSetLayout must have LayoutInfoList stype of XGL_STRCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO\n");
+             pPacket->header = NULL;
+        }
+    }
+    pPacket->pSetLayout = (XGL_DESCRIPTOR_SET_LAYOUT*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pSetLayout);
+    return pPacket;
+}
+
+typedef struct struct_xglBeginDescriptorRegionUpdate {
+    glv_trace_packet_header* header;
+    XGL_DEVICE device;
+    XGL_DESCRIPTOR_UPDATE_MODE updateMode;
+    XGL_RESULT result;
+} struct_xglBeginDescriptorRegionUpdate;
+
+static struct_xglBeginDescriptorRegionUpdate* interpret_body_as_xglBeginDescriptorRegionUpdate(glv_trace_packet_header* pHeader)
+{
+    struct_xglBeginDescriptorRegionUpdate* pPacket = (struct_xglBeginDescriptorRegionUpdate*)pHeader->pBody;
+    pPacket->header = pHeader;
+    return pPacket;
+}
+
+typedef struct struct_xglEndDescriptorRegionUpdate {
+    glv_trace_packet_header* header;
+    XGL_DEVICE device;
+    XGL_CMD_BUFFER cmd;
+    XGL_RESULT result;
+} struct_xglEndDescriptorRegionUpdate;
+
+static struct_xglEndDescriptorRegionUpdate* interpret_body_as_xglEndDescriptorRegionUpdate(glv_trace_packet_header* pHeader)
+{
+    struct_xglEndDescriptorRegionUpdate* pPacket = (struct_xglEndDescriptorRegionUpdate*)pHeader->pBody;
+    pPacket->header = pHeader;
+    return pPacket;
+}
+
+typedef struct struct_xglCreateDescriptorRegion {
+    glv_trace_packet_header* header;
+    XGL_DEVICE device;
+    XGL_DESCRIPTOR_REGION_USAGE regionUsage;
+    uint32_t maxSets;
+    const XGL_DESCRIPTOR_REGION_CREATE_INFO* pCreateInfo;
+    XGL_DESCRIPTOR_REGION* pDescriptorRegion;
+    XGL_RESULT result;
+} struct_xglCreateDescriptorRegion;
+
+static struct_xglCreateDescriptorRegion* interpret_body_as_xglCreateDescriptorRegion(glv_trace_packet_header* pHeader)
+{
+    struct_xglCreateDescriptorRegion* pPacket = (struct_xglCreateDescriptorRegion*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->pCreateInfo = (const XGL_DESCRIPTOR_REGION_CREATE_INFO*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pCreateInfo);
+    if (pPacket->pCreateInfo != NULL)
+    {
+        XGL_DESCRIPTOR_REGION_CREATE_INFO* pInfo = (XGL_DESCRIPTOR_REGION_CREATE_INFO*)pPacket->pCreateInfo;
+        pInfo->pTypeCount = (XGL_DESCRIPTOR_TYPE_COUNT*) glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pCreateInfo->pTypeCount);
+
+    }
+    pPacket->pDescriptorRegion = (XGL_DESCRIPTOR_REGION*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pDescriptorRegion);
+    return pPacket;
+}
+
+typedef struct struct_xglClearDescriptorRegion {
+    glv_trace_packet_header* header;
+    XGL_DESCRIPTOR_REGION descriptorRegion;
+    XGL_RESULT result;
+} struct_xglClearDescriptorRegion;
+
+static struct_xglClearDescriptorRegion* interpret_body_as_xglClearDescriptorRegion(glv_trace_packet_header* pHeader)
+{
+    struct_xglClearDescriptorRegion* pPacket = (struct_xglClearDescriptorRegion*)pHeader->pBody;
+    pPacket->header = pHeader;
+    return pPacket;
+}
+
+typedef struct struct_xglAllocDescriptorSets {
+    glv_trace_packet_header* header;
+    XGL_DESCRIPTOR_REGION descriptorRegion;
+    XGL_DESCRIPTOR_SET_USAGE setUsage;
+    uint32_t count;
+    const XGL_DESCRIPTOR_SET_LAYOUT* pSetLayouts;
+    XGL_DESCRIPTOR_SET* pDescriptorSets;
+    uint32_t* pCount;
+    XGL_RESULT result;
+} struct_xglAllocDescriptorSets;
+
+static struct_xglAllocDescriptorSets* interpret_body_as_xglAllocDescriptorSets(glv_trace_packet_header* pHeader)
+{
+    struct_xglAllocDescriptorSets* pPacket = (struct_xglAllocDescriptorSets*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->pSetLayouts = (const XGL_DESCRIPTOR_SET_LAYOUT*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pSetLayouts);
+    pPacket->pDescriptorSets = (XGL_DESCRIPTOR_SET*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pDescriptorSets);
+    pPacket->pCount = (uint32_t*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pCount);
+    return pPacket;
+}
+
+typedef struct struct_xglClearDescriptorSets {
+    glv_trace_packet_header* header;
+    XGL_DESCRIPTOR_REGION descriptorRegion;
+    uint32_t count;
+    const XGL_DESCRIPTOR_SET* pDescriptorSets;
+} struct_xglClearDescriptorSets;
+
+static struct_xglClearDescriptorSets* interpret_body_as_xglClearDescriptorSets(glv_trace_packet_header* pHeader)
+{
+    struct_xglClearDescriptorSets* pPacket = (struct_xglClearDescriptorSets*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->pDescriptorSets = (const XGL_DESCRIPTOR_SET*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pDescriptorSets);
+    return pPacket;
+}
+
+typedef struct struct_xglUpdateDescriptors {
+    glv_trace_packet_header* header;
+    XGL_DESCRIPTOR_SET descriptorSet;
+    const void* pUpdateChain;
+} struct_xglUpdateDescriptors;
+
+static struct_xglUpdateDescriptors* interpret_body_as_xglUpdateDescriptors(glv_trace_packet_header* pHeader)
+{
+    struct_xglUpdateDescriptors* pPacket = (struct_xglUpdateDescriptors*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->pUpdateChain = (const void*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pUpdateChain);
+    if (pPacket->pUpdateChain != NULL)
+    {
+        XGL_UPDATE_SAMPLERS* pNext = (XGL_UPDATE_SAMPLERS*)pPacket->pUpdateChain;
+        while ((NULL != pNext) && (XGL_NULL_HANDLE != pNext))
+        {
+            switch(pNext->sType)
+            {
+                case XGL_STRUCTURE_TYPE_UPDATE_AS_COPY:
+                {
+                    void** ppNextVoidPtr = (void**)&pNext->pNext;
+                    *ppNextVoidPtr = (void*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pNext->pNext);
+                    break;
+                }
+                case XGL_STRUCTURE_TYPE_UPDATE_SAMPLERS:
+                {
+                    void** ppNextVoidPtr = (void**)&pNext->pNext;
+                    XGL_UPDATE_SAMPLERS* pUS = (XGL_UPDATE_SAMPLERS*)pNext;
+                    *ppNextVoidPtr = (void*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pNext->pNext);
+                    pUS->pSamplers = (XGL_SAMPLER*) glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pUS->pSamplers);
+                    break;
+                }
+                case XGL_STRUCTURE_TYPE_UPDATE_SAMPLER_TEXTURES:
+                {
+                    void** ppNextVoidPtr = (void**)&pNext->pNext;
+                    XGL_UPDATE_SAMPLER_TEXTURES* pUST = (XGL_UPDATE_SAMPLER_TEXTURES*)pNext;
+                    *ppNextVoidPtr = (void*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pNext->pNext);
+                    pUST->pSamplerImageViews = (XGL_SAMPLER_IMAGE_VIEW_INFO*) glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pUST->pSamplerImageViews);
+                    uint32_t i;
+                    for (i = 0; i < pUST->count; i++) {
+                        XGL_IMAGE_VIEW_ATTACH_INFO** ppLocalImageView = (XGL_IMAGE_VIEW_ATTACH_INFO**)&pUST->pSamplerImageViews[i].pImageView;
+                        *ppLocalImageView = (XGL_IMAGE_VIEW_ATTACH_INFO*) glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pUST->pSamplerImageViews[i].pImageView);
+                    }
+                    break;
+                }
+                case XGL_STRUCTURE_TYPE_UPDATE_IMAGES:
+                {
+                    void** ppNextVoidPtr = (void**)&pNext->pNext;
+                    XGL_UPDATE_IMAGES* pUI = (XGL_UPDATE_IMAGES*)pNext;
+                    *ppNextVoidPtr = (void*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pNext->pNext);
+                    XGL_IMAGE_VIEW_ATTACH_INFO** ppLocalImageView = (XGL_IMAGE_VIEW_ATTACH_INFO**)&pUI->pImageViews;
+                    *ppLocalImageView = (XGL_IMAGE_VIEW_ATTACH_INFO*) glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pUI->pImageViews);
+                    uint32_t i;
+                    for (i = 0; i < pUI->count; i++) {
+                        XGL_IMAGE_VIEW_ATTACH_INFO** ppLocalImageViews = (XGL_IMAGE_VIEW_ATTACH_INFO**)&pUI->pImageViews[i];
+                        *ppLocalImageViews = (XGL_IMAGE_VIEW_ATTACH_INFO*) glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pUI->pImageViews[i]);
+                    }
+                    break;
+                }
+                case XGL_STRUCTURE_TYPE_UPDATE_BUFFERS:
+                {
+                    void** ppNextVoidPtr = (void**)&pNext->pNext;
+                    XGL_UPDATE_BUFFERS* pUB = (XGL_UPDATE_BUFFERS*)pNext;
+                    *ppNextVoidPtr = (void*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pNext->pNext);
+                    XGL_BUFFER_VIEW_ATTACH_INFO** ppLocalBufferView = (XGL_BUFFER_VIEW_ATTACH_INFO**)&pUB->pBufferViews;
+                    *ppLocalBufferView = (XGL_BUFFER_VIEW_ATTACH_INFO*) glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pUB->pBufferViews);
+                    uint32_t i;
+                    for (i = 0; i < pUB->count; i++) {
+                        XGL_BUFFER_VIEW_ATTACH_INFO** ppLocalBufferViews = (XGL_BUFFER_VIEW_ATTACH_INFO**)&pUB->pBufferViews[i];
+                        *ppLocalBufferViews = (XGL_BUFFER_VIEW_ATTACH_INFO*) glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pUB->pBufferViews[i]);
+                    }
+                    break;
+                }
+                default:
+                {
+                   glv_LogError("Encountered an unexpected type in update descriptors pUpdateChain.\n");
+                   pPacket->header = NULL;
+                   pNext->pNext = NULL;
+                }
+            }
+            pNext = (XGL_UPDATE_SAMPLERS*)pNext->pNext;
+        }
+    }
+    return pPacket;
+}
+
+typedef struct struct_xglCreateDynamicViewportState {
+    glv_trace_packet_header* header;
+    XGL_DEVICE device;
+    const XGL_DYNAMIC_VP_STATE_CREATE_INFO* pCreateInfo;
+    XGL_DYNAMIC_VP_STATE_OBJECT* pState;
+    XGL_RESULT result;
+} struct_xglCreateDynamicViewportState;
+
+static struct_xglCreateDynamicViewportState* interpret_body_as_xglCreateDynamicViewportState(glv_trace_packet_header* pHeader)
+{
+    struct_xglCreateDynamicViewportState* pPacket = (struct_xglCreateDynamicViewportState*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->pCreateInfo = (const XGL_DYNAMIC_VP_STATE_CREATE_INFO*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pCreateInfo);
+    if (pPacket->pCreateInfo != NULL)
+    {
+        XGL_DYNAMIC_VP_STATE_CREATE_INFO* pInfo = (XGL_DYNAMIC_VP_STATE_CREATE_INFO*)pPacket->pCreateInfo;
+        pInfo->pViewports = (XGL_VIEWPORT*) glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pCreateInfo->pViewports);
+        pInfo->pScissors = (XGL_RECT*) glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pCreateInfo->pScissors);
+    }
+    pPacket->pState = (XGL_DYNAMIC_VP_STATE_OBJECT*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pState);
+    return pPacket;
+}
+
+typedef struct struct_xglCreateDynamicRasterState {
+    glv_trace_packet_header* header;
+    XGL_DEVICE device;
+    const XGL_DYNAMIC_RS_STATE_CREATE_INFO* pCreateInfo;
+    XGL_DYNAMIC_RS_STATE_OBJECT* pState;
+    XGL_RESULT result;
+} struct_xglCreateDynamicRasterState;
+
+static struct_xglCreateDynamicRasterState* interpret_body_as_xglCreateDynamicRasterState(glv_trace_packet_header* pHeader)
+{
+    struct_xglCreateDynamicRasterState* pPacket = (struct_xglCreateDynamicRasterState*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->pCreateInfo = (const XGL_DYNAMIC_RS_STATE_CREATE_INFO*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pCreateInfo);
+    pPacket->pState = (XGL_DYNAMIC_RS_STATE_OBJECT*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pState);
+    return pPacket;
+}
+
+typedef struct struct_xglCreateDynamicColorBlendState {
+    glv_trace_packet_header* header;
+    XGL_DEVICE device;
+    const XGL_DYNAMIC_CB_STATE_CREATE_INFO* pCreateInfo;
+    XGL_DYNAMIC_CB_STATE_OBJECT* pState;
+    XGL_RESULT result;
+} struct_xglCreateDynamicColorBlendState;
+
+static struct_xglCreateDynamicColorBlendState* interpret_body_as_xglCreateDynamicColorBlendState(glv_trace_packet_header* pHeader)
+{
+    struct_xglCreateDynamicColorBlendState* pPacket = (struct_xglCreateDynamicColorBlendState*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->pCreateInfo = (const XGL_DYNAMIC_CB_STATE_CREATE_INFO*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pCreateInfo);
+    pPacket->pState = (XGL_DYNAMIC_CB_STATE_OBJECT*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pState);
+    return pPacket;
+}
+
+typedef struct struct_xglCreateDynamicDepthStencilState {
+    glv_trace_packet_header* header;
+    XGL_DEVICE device;
+    const XGL_DYNAMIC_DS_STATE_CREATE_INFO* pCreateInfo;
+    XGL_DYNAMIC_DS_STATE_OBJECT* pState;
+    XGL_RESULT result;
+} struct_xglCreateDynamicDepthStencilState;
+
+static struct_xglCreateDynamicDepthStencilState* interpret_body_as_xglCreateDynamicDepthStencilState(glv_trace_packet_header* pHeader)
+{
+    struct_xglCreateDynamicDepthStencilState* pPacket = (struct_xglCreateDynamicDepthStencilState*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->pCreateInfo = (const XGL_DYNAMIC_DS_STATE_CREATE_INFO*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pCreateInfo);
+    pPacket->pState = (XGL_DYNAMIC_DS_STATE_OBJECT*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pState);
+    return pPacket;
+}
+
+typedef struct struct_xglCreateCommandBuffer {
+    glv_trace_packet_header* header;
+    XGL_DEVICE device;
+    const XGL_CMD_BUFFER_CREATE_INFO* pCreateInfo;
+    XGL_CMD_BUFFER* pCmdBuffer;
+    XGL_RESULT result;
+} struct_xglCreateCommandBuffer;
+
+static struct_xglCreateCommandBuffer* interpret_body_as_xglCreateCommandBuffer(glv_trace_packet_header* pHeader)
+{
+    struct_xglCreateCommandBuffer* pPacket = (struct_xglCreateCommandBuffer*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->pCreateInfo = (const XGL_CMD_BUFFER_CREATE_INFO*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pCreateInfo);
+    pPacket->pCmdBuffer = (XGL_CMD_BUFFER*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pCmdBuffer);
+    return pPacket;
+}
+
+typedef struct struct_xglBeginCommandBuffer {
+    glv_trace_packet_header* header;
+    XGL_CMD_BUFFER cmdBuffer;
+    const XGL_CMD_BUFFER_BEGIN_INFO* pBeginInfo;
+    XGL_RESULT result;
+} struct_xglBeginCommandBuffer;
+
+static struct_xglBeginCommandBuffer* interpret_body_as_xglBeginCommandBuffer(glv_trace_packet_header* pHeader)
+{
+    struct_xglBeginCommandBuffer* pPacket = (struct_xglBeginCommandBuffer*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->pBeginInfo = (const XGL_CMD_BUFFER_BEGIN_INFO*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pBeginInfo);
+    if (pPacket->pBeginInfo != NULL)
+    {
+        if (pPacket->pBeginInfo->sType == XGL_STRUCTURE_TYPE_CMD_BUFFER_BEGIN_INFO) {
+            // need to make a non-const pointer to the pointer so that we can properly change the original pointer to the interpretted one
+            XGL_CMD_BUFFER_GRAPHICS_BEGIN_INFO** ppNext = (XGL_CMD_BUFFER_GRAPHICS_BEGIN_INFO**)&(pPacket->pBeginInfo->pNext);
+            *ppNext = (XGL_CMD_BUFFER_GRAPHICS_BEGIN_INFO*) glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pBeginInfo->pNext);
+            XGL_CMD_BUFFER_GRAPHICS_BEGIN_INFO* pNext = *ppNext;
+            while (NULL != pNext)
+            {
+                switch(pNext->sType)
+                {
+                    case XGL_STRUCTURE_TYPE_CMD_BUFFER_GRAPHICS_BEGIN_INFO:
+                    {
+                        ppNext = (XGL_CMD_BUFFER_GRAPHICS_BEGIN_INFO**) &pNext->pNext;
+                        *ppNext = (XGL_CMD_BUFFER_GRAPHICS_BEGIN_INFO*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pNext->pNext);
+                        break;
+                    }
+                    default:
+                    {
+                        glv_LogError("Encountered an unexpected type in begin command buffer list.\n");
+                        pPacket->header = NULL;
+                        pNext->pNext = NULL;
+                    }
+                }
+                pNext = (XGL_CMD_BUFFER_GRAPHICS_BEGIN_INFO*)pNext->pNext;
+            }
+        } else {
+            // This is unexpected.
+            glv_LogError("BeginCommandBuffer must have BeginInfo stype of XGL_STRUCTURE_TYPE_CMD_BUFFER_BEGIN_INFO.\n");
+            pPacket->header = NULL;
+        }
+    }
+    return pPacket;
+}
+
+typedef struct struct_xglEndCommandBuffer {
+    glv_trace_packet_header* header;
+    XGL_CMD_BUFFER cmdBuffer;
+    XGL_RESULT result;
+} struct_xglEndCommandBuffer;
+
+static struct_xglEndCommandBuffer* interpret_body_as_xglEndCommandBuffer(glv_trace_packet_header* pHeader)
+{
+    struct_xglEndCommandBuffer* pPacket = (struct_xglEndCommandBuffer*)pHeader->pBody;
+    pPacket->header = pHeader;
+    return pPacket;
+}
+
+typedef struct struct_xglResetCommandBuffer {
+    glv_trace_packet_header* header;
+    XGL_CMD_BUFFER cmdBuffer;
+    XGL_RESULT result;
+} struct_xglResetCommandBuffer;
+
+static struct_xglResetCommandBuffer* interpret_body_as_xglResetCommandBuffer(glv_trace_packet_header* pHeader)
+{
+    struct_xglResetCommandBuffer* pPacket = (struct_xglResetCommandBuffer*)pHeader->pBody;
+    pPacket->header = pHeader;
+    return pPacket;
+}
+
+typedef struct struct_xglCmdBindPipeline {
+    glv_trace_packet_header* header;
+    XGL_CMD_BUFFER cmdBuffer;
+    XGL_PIPELINE_BIND_POINT pipelineBindPoint;
+    XGL_PIPELINE pipeline;
+} struct_xglCmdBindPipeline;
+
+static struct_xglCmdBindPipeline* interpret_body_as_xglCmdBindPipeline(glv_trace_packet_header* pHeader)
+{
+    struct_xglCmdBindPipeline* pPacket = (struct_xglCmdBindPipeline*)pHeader->pBody;
+    pPacket->header = pHeader;
+    return pPacket;
+}
+
+typedef struct struct_xglCmdBindPipelineDelta {
+    glv_trace_packet_header* header;
+    XGL_CMD_BUFFER cmdBuffer;
+    XGL_PIPELINE_BIND_POINT pipelineBindPoint;
+    XGL_PIPELINE_DELTA delta;
+} struct_xglCmdBindPipelineDelta;
+
+static struct_xglCmdBindPipelineDelta* interpret_body_as_xglCmdBindPipelineDelta(glv_trace_packet_header* pHeader)
+{
+    struct_xglCmdBindPipelineDelta* pPacket = (struct_xglCmdBindPipelineDelta*)pHeader->pBody;
+    pPacket->header = pHeader;
+    return pPacket;
+}
+
+typedef struct struct_xglCmdBindDynamicStateObject {
+    glv_trace_packet_header* header;
+    XGL_CMD_BUFFER cmdBuffer;
+    XGL_STATE_BIND_POINT stateBindPoint;
+    XGL_DYNAMIC_STATE_OBJECT state;
+} struct_xglCmdBindDynamicStateObject;
+
+static struct_xglCmdBindDynamicStateObject* interpret_body_as_xglCmdBindDynamicStateObject(glv_trace_packet_header* pHeader)
+{
+    struct_xglCmdBindDynamicStateObject* pPacket = (struct_xglCmdBindDynamicStateObject*)pHeader->pBody;
+    pPacket->header = pHeader;
+    return pPacket;
+}
+
+typedef struct struct_xglCmdBindDescriptorSet {
+    glv_trace_packet_header* header;
+    XGL_CMD_BUFFER cmdBuffer;
+    XGL_PIPELINE_BIND_POINT pipelineBindPoint;
+    XGL_DESCRIPTOR_SET descriptorSet;
+    const uint32_t* pUserData;
+} struct_xglCmdBindDescriptorSet;
+
+static struct_xglCmdBindDescriptorSet* interpret_body_as_xglCmdBindDescriptorSet(glv_trace_packet_header* pHeader)
+{
+    struct_xglCmdBindDescriptorSet* pPacket = (struct_xglCmdBindDescriptorSet*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->pUserData = (const uint32_t*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pUserData);
+    return pPacket;
+}
+
+typedef struct struct_xglCmdBindVertexBuffer {
+    glv_trace_packet_header* header;
+    XGL_CMD_BUFFER cmdBuffer;
+    XGL_BUFFER buffer;
+    XGL_GPU_SIZE offset;
+    uint32_t binding;
+} struct_xglCmdBindVertexBuffer;
+
+static struct_xglCmdBindVertexBuffer* interpret_body_as_xglCmdBindVertexBuffer(glv_trace_packet_header* pHeader)
+{
+    struct_xglCmdBindVertexBuffer* pPacket = (struct_xglCmdBindVertexBuffer*)pHeader->pBody;
+    pPacket->header = pHeader;
+    return pPacket;
+}
+
+typedef struct struct_xglCmdBindIndexBuffer {
+    glv_trace_packet_header* header;
+    XGL_CMD_BUFFER cmdBuffer;
+    XGL_BUFFER buffer;
+    XGL_GPU_SIZE offset;
+    XGL_INDEX_TYPE indexType;
+} struct_xglCmdBindIndexBuffer;
+
+static struct_xglCmdBindIndexBuffer* interpret_body_as_xglCmdBindIndexBuffer(glv_trace_packet_header* pHeader)
+{
+    struct_xglCmdBindIndexBuffer* pPacket = (struct_xglCmdBindIndexBuffer*)pHeader->pBody;
+    pPacket->header = pHeader;
+    return pPacket;
+}
+
+typedef struct struct_xglCmdDraw {
+    glv_trace_packet_header* header;
+    XGL_CMD_BUFFER cmdBuffer;
+    uint32_t firstVertex;
+    uint32_t vertexCount;
+    uint32_t firstInstance;
+    uint32_t instanceCount;
+} struct_xglCmdDraw;
+
+static struct_xglCmdDraw* interpret_body_as_xglCmdDraw(glv_trace_packet_header* pHeader)
+{
+    struct_xglCmdDraw* pPacket = (struct_xglCmdDraw*)pHeader->pBody;
+    pPacket->header = pHeader;
+    return pPacket;
+}
+
+typedef struct struct_xglCmdDrawIndexed {
+    glv_trace_packet_header* header;
+    XGL_CMD_BUFFER cmdBuffer;
+    uint32_t firstIndex;
+    uint32_t indexCount;
+    int32_t vertexOffset;
+    uint32_t firstInstance;
+    uint32_t instanceCount;
+} struct_xglCmdDrawIndexed;
+
+static struct_xglCmdDrawIndexed* interpret_body_as_xglCmdDrawIndexed(glv_trace_packet_header* pHeader)
+{
+    struct_xglCmdDrawIndexed* pPacket = (struct_xglCmdDrawIndexed*)pHeader->pBody;
+    pPacket->header = pHeader;
+    return pPacket;
+}
+
+typedef struct struct_xglCmdDrawIndirect {
+    glv_trace_packet_header* header;
+    XGL_CMD_BUFFER cmdBuffer;
+    XGL_BUFFER buffer;
+    XGL_GPU_SIZE offset;
+    uint32_t count;
+    uint32_t stride;
+} struct_xglCmdDrawIndirect;
+
+static struct_xglCmdDrawIndirect* interpret_body_as_xglCmdDrawIndirect(glv_trace_packet_header* pHeader)
+{
+    struct_xglCmdDrawIndirect* pPacket = (struct_xglCmdDrawIndirect*)pHeader->pBody;
+    pPacket->header = pHeader;
+    return pPacket;
+}
+
+typedef struct struct_xglCmdDrawIndexedIndirect {
+    glv_trace_packet_header* header;
+    XGL_CMD_BUFFER cmdBuffer;
+    XGL_BUFFER buffer;
+    XGL_GPU_SIZE offset;
+    uint32_t count;
+    uint32_t stride;
+} struct_xglCmdDrawIndexedIndirect;
+
+static struct_xglCmdDrawIndexedIndirect* interpret_body_as_xglCmdDrawIndexedIndirect(glv_trace_packet_header* pHeader)
+{
+    struct_xglCmdDrawIndexedIndirect* pPacket = (struct_xglCmdDrawIndexedIndirect*)pHeader->pBody;
+    pPacket->header = pHeader;
+    return pPacket;
+}
+
+typedef struct struct_xglCmdDispatch {
+    glv_trace_packet_header* header;
+    XGL_CMD_BUFFER cmdBuffer;
+    uint32_t x;
+    uint32_t y;
+    uint32_t z;
+} struct_xglCmdDispatch;
+
+static struct_xglCmdDispatch* interpret_body_as_xglCmdDispatch(glv_trace_packet_header* pHeader)
+{
+    struct_xglCmdDispatch* pPacket = (struct_xglCmdDispatch*)pHeader->pBody;
+    pPacket->header = pHeader;
+    return pPacket;
+}
+
+typedef struct struct_xglCmdDispatchIndirect {
+    glv_trace_packet_header* header;
+    XGL_CMD_BUFFER cmdBuffer;
+    XGL_BUFFER buffer;
+    XGL_GPU_SIZE offset;
+} struct_xglCmdDispatchIndirect;
+
+static struct_xglCmdDispatchIndirect* interpret_body_as_xglCmdDispatchIndirect(glv_trace_packet_header* pHeader)
+{
+    struct_xglCmdDispatchIndirect* pPacket = (struct_xglCmdDispatchIndirect*)pHeader->pBody;
+    pPacket->header = pHeader;
+    return pPacket;
+}
+
+typedef struct struct_xglCmdCopyBuffer {
+    glv_trace_packet_header* header;
+    XGL_CMD_BUFFER cmdBuffer;
+    XGL_BUFFER srcBuffer;
+    XGL_BUFFER destBuffer;
+    uint32_t regionCount;
+    const XGL_BUFFER_COPY* pRegions;
+} struct_xglCmdCopyBuffer;
+
+static struct_xglCmdCopyBuffer* interpret_body_as_xglCmdCopyBuffer(glv_trace_packet_header* pHeader)
+{
+    struct_xglCmdCopyBuffer* pPacket = (struct_xglCmdCopyBuffer*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->pRegions = (const XGL_BUFFER_COPY*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pRegions);
+    return pPacket;
+}
+
+typedef struct struct_xglCmdCopyImage {
+    glv_trace_packet_header* header;
+    XGL_CMD_BUFFER cmdBuffer;
+    XGL_IMAGE srcImage;
+    XGL_IMAGE destImage;
+    uint32_t regionCount;
+    const XGL_IMAGE_COPY* pRegions;
+} struct_xglCmdCopyImage;
+
+static struct_xglCmdCopyImage* interpret_body_as_xglCmdCopyImage(glv_trace_packet_header* pHeader)
+{
+    struct_xglCmdCopyImage* pPacket = (struct_xglCmdCopyImage*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->pRegions = (const XGL_IMAGE_COPY*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pRegions);
+    return pPacket;
+}
+
+typedef struct struct_xglCmdCopyBufferToImage {
+    glv_trace_packet_header* header;
+    XGL_CMD_BUFFER cmdBuffer;
+    XGL_BUFFER srcBuffer;
+    XGL_IMAGE destImage;
+    uint32_t regionCount;
+    const XGL_BUFFER_IMAGE_COPY* pRegions;
+} struct_xglCmdCopyBufferToImage;
+
+static struct_xglCmdCopyBufferToImage* interpret_body_as_xglCmdCopyBufferToImage(glv_trace_packet_header* pHeader)
+{
+    struct_xglCmdCopyBufferToImage* pPacket = (struct_xglCmdCopyBufferToImage*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->pRegions = (const XGL_BUFFER_IMAGE_COPY*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pRegions);
+    return pPacket;
+}
+
+typedef struct struct_xglCmdCopyImageToBuffer {
+    glv_trace_packet_header* header;
+    XGL_CMD_BUFFER cmdBuffer;
+    XGL_IMAGE srcImage;
+    XGL_BUFFER destBuffer;
+    uint32_t regionCount;
+    const XGL_BUFFER_IMAGE_COPY* pRegions;
+} struct_xglCmdCopyImageToBuffer;
+
+static struct_xglCmdCopyImageToBuffer* interpret_body_as_xglCmdCopyImageToBuffer(glv_trace_packet_header* pHeader)
+{
+    struct_xglCmdCopyImageToBuffer* pPacket = (struct_xglCmdCopyImageToBuffer*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->pRegions = (const XGL_BUFFER_IMAGE_COPY*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pRegions);
+    return pPacket;
+}
+
+typedef struct struct_xglCmdCloneImageData {
+    glv_trace_packet_header* header;
+    XGL_CMD_BUFFER cmdBuffer;
+    XGL_IMAGE srcImage;
+    XGL_IMAGE_LAYOUT srcImageLayout;
+    XGL_IMAGE destImage;
+    XGL_IMAGE_LAYOUT destImageLayout;
+} struct_xglCmdCloneImageData;
+
+static struct_xglCmdCloneImageData* interpret_body_as_xglCmdCloneImageData(glv_trace_packet_header* pHeader)
+{
+    struct_xglCmdCloneImageData* pPacket = (struct_xglCmdCloneImageData*)pHeader->pBody;
+    pPacket->header = pHeader;
+    return pPacket;
+}
+
+typedef struct struct_xglCmdUpdateBuffer {
+    glv_trace_packet_header* header;
+    XGL_CMD_BUFFER cmdBuffer;
+    XGL_BUFFER destBuffer;
+    XGL_GPU_SIZE destOffset;
+    XGL_GPU_SIZE dataSize;
+    const uint32_t* pData;
+} struct_xglCmdUpdateBuffer;
+
+static struct_xglCmdUpdateBuffer* interpret_body_as_xglCmdUpdateBuffer(glv_trace_packet_header* pHeader)
+{
+    struct_xglCmdUpdateBuffer* pPacket = (struct_xglCmdUpdateBuffer*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->pData = (const uint32_t*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pData);
+    return pPacket;
+}
+
+typedef struct struct_xglCmdFillBuffer {
+    glv_trace_packet_header* header;
+    XGL_CMD_BUFFER cmdBuffer;
+    XGL_BUFFER destBuffer;
+    XGL_GPU_SIZE destOffset;
+    XGL_GPU_SIZE fillSize;
+    uint32_t data;
+} struct_xglCmdFillBuffer;
+
+static struct_xglCmdFillBuffer* interpret_body_as_xglCmdFillBuffer(glv_trace_packet_header* pHeader)
+{
+    struct_xglCmdFillBuffer* pPacket = (struct_xglCmdFillBuffer*)pHeader->pBody;
+    pPacket->header = pHeader;
+    return pPacket;
+}
+
+typedef struct struct_xglCmdClearColorImage {
+    glv_trace_packet_header* header;
+    XGL_CMD_BUFFER cmdBuffer;
+    XGL_IMAGE image;
+    const float color[4];
+    uint32_t rangeCount;
+    const XGL_IMAGE_SUBRESOURCE_RANGE* pRanges;
+} struct_xglCmdClearColorImage;
+
+static struct_xglCmdClearColorImage* interpret_body_as_xglCmdClearColorImage(glv_trace_packet_header* pHeader)
+{
+    struct_xglCmdClearColorImage* pPacket = (struct_xglCmdClearColorImage*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->pRanges = (const XGL_IMAGE_SUBRESOURCE_RANGE*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pRanges);
+    return pPacket;
+}
+
+typedef struct struct_xglCmdClearColorImageRaw {
+    glv_trace_packet_header* header;
+    XGL_CMD_BUFFER cmdBuffer;
+    XGL_IMAGE image;
+    const uint32_t color[4];
+    uint32_t rangeCount;
+    const XGL_IMAGE_SUBRESOURCE_RANGE* pRanges;
+} struct_xglCmdClearColorImageRaw;
+
+static struct_xglCmdClearColorImageRaw* interpret_body_as_xglCmdClearColorImageRaw(glv_trace_packet_header* pHeader)
+{
+    struct_xglCmdClearColorImageRaw* pPacket = (struct_xglCmdClearColorImageRaw*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->pRanges = (const XGL_IMAGE_SUBRESOURCE_RANGE*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pRanges);
+    return pPacket;
+}
+
+typedef struct struct_xglCmdClearDepthStencil {
+    glv_trace_packet_header* header;
+    XGL_CMD_BUFFER cmdBuffer;
+    XGL_IMAGE image;
+    float depth;
+    uint32_t stencil;
+    uint32_t rangeCount;
+    const XGL_IMAGE_SUBRESOURCE_RANGE* pRanges;
+} struct_xglCmdClearDepthStencil;
+
+static struct_xglCmdClearDepthStencil* interpret_body_as_xglCmdClearDepthStencil(glv_trace_packet_header* pHeader)
+{
+    struct_xglCmdClearDepthStencil* pPacket = (struct_xglCmdClearDepthStencil*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->pRanges = (const XGL_IMAGE_SUBRESOURCE_RANGE*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pRanges);
+    return pPacket;
+}
+
+typedef struct struct_xglCmdResolveImage {
+    glv_trace_packet_header* header;
+    XGL_CMD_BUFFER cmdBuffer;
+    XGL_IMAGE srcImage;
+    XGL_IMAGE destImage;
+    uint32_t rectCount;
+    const XGL_IMAGE_RESOLVE* pRects;
+} struct_xglCmdResolveImage;
+
+static struct_xglCmdResolveImage* interpret_body_as_xglCmdResolveImage(glv_trace_packet_header* pHeader)
+{
+    struct_xglCmdResolveImage* pPacket = (struct_xglCmdResolveImage*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->pRects = (const XGL_IMAGE_RESOLVE*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pRects);
+    return pPacket;
+}
+
+typedef struct struct_xglCmdSetEvent {
+    glv_trace_packet_header* header;
+    XGL_CMD_BUFFER cmdBuffer;
+    XGL_EVENT event;
+    XGL_SET_EVENT pipeEvent;
+} struct_xglCmdSetEvent;
+
+static struct_xglCmdSetEvent* interpret_body_as_xglCmdSetEvent(glv_trace_packet_header* pHeader)
+{
+    struct_xglCmdSetEvent* pPacket = (struct_xglCmdSetEvent*)pHeader->pBody;
+    pPacket->header = pHeader;
+    return pPacket;
+}
+
+typedef struct struct_xglCmdResetEvent {
+    glv_trace_packet_header* header;
+    XGL_CMD_BUFFER cmdBuffer;
+    XGL_EVENT event;
+} struct_xglCmdResetEvent;
+
+static struct_xglCmdResetEvent* interpret_body_as_xglCmdResetEvent(glv_trace_packet_header* pHeader)
+{
+    struct_xglCmdResetEvent* pPacket = (struct_xglCmdResetEvent*)pHeader->pBody;
+    pPacket->header = pHeader;
+    return pPacket;
+}
+
+typedef struct struct_xglCmdWaitEvents {
+    glv_trace_packet_header* header;
+    XGL_CMD_BUFFER cmdBuffer;
+    const XGL_EVENT_WAIT_INFO* pWaitInfo;
+} struct_xglCmdWaitEvents;
+
+static struct_xglCmdWaitEvents* interpret_body_as_xglCmdWaitEvents(glv_trace_packet_header* pHeader)
+{
+    struct_xglCmdWaitEvents* pPacket = (struct_xglCmdWaitEvents*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->pWaitInfo = (const XGL_EVENT_WAIT_INFO*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pWaitInfo);
+    if (pPacket->pWaitInfo != NULL)
+    {
+        XGL_EVENT_WAIT_INFO* pInfo = (XGL_EVENT_WAIT_INFO*)pPacket->pWaitInfo;
+        pInfo->pEvents = (XGL_EVENT*) glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pWaitInfo->pEvents);
+        pInfo->ppMemBarriers = (const void**) glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pWaitInfo->ppMemBarriers);
+        uint32_t i;
+        for (i = 0; i < pInfo->memBarrierCount; i++) {
+            void** ppLocalMemBarriers = (void**)&pInfo->ppMemBarriers[i];
+            *ppLocalMemBarriers = (void*) glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pInfo->ppMemBarriers[i]);
+        }
+    }
+    return pPacket;
+}
+
+typedef struct struct_xglCmdPipelineBarrier {
+    glv_trace_packet_header* header;
+    XGL_CMD_BUFFER cmdBuffer;
+    const XGL_PIPELINE_BARRIER* pBarrier;
+} struct_xglCmdPipelineBarrier;
+
+static struct_xglCmdPipelineBarrier* interpret_body_as_xglCmdPipelineBarrier(glv_trace_packet_header* pHeader)
+{
+    struct_xglCmdPipelineBarrier* pPacket = (struct_xglCmdPipelineBarrier*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->pBarrier = (const XGL_PIPELINE_BARRIER*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pBarrier);
+    if (pPacket->pBarrier != NULL)
+    {
+        XGL_PIPELINE_BARRIER* pBarrier = (XGL_PIPELINE_BARRIER*)pPacket->pBarrier;
+        pBarrier->pEvents = (XGL_SET_EVENT*) glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pBarrier->pEvents);
+        pBarrier->ppMemBarriers = (const void**) glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pBarrier->ppMemBarriers);
+        uint32_t i;
+        for (i = 0; i < pBarrier->memBarrierCount; i++) {
+            void** ppLocalMemBarriers = (void**)&pBarrier->ppMemBarriers[i];
+            *ppLocalMemBarriers = (void*) glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pBarrier->ppMemBarriers[i]);
+        }
+    }
+    return pPacket;
+}
+
+typedef struct struct_xglCmdBeginQuery {
+    glv_trace_packet_header* header;
+    XGL_CMD_BUFFER cmdBuffer;
+    XGL_QUERY_POOL queryPool;
+    uint32_t slot;
+    XGL_FLAGS flags;
+} struct_xglCmdBeginQuery;
+
+static struct_xglCmdBeginQuery* interpret_body_as_xglCmdBeginQuery(glv_trace_packet_header* pHeader)
+{
+    struct_xglCmdBeginQuery* pPacket = (struct_xglCmdBeginQuery*)pHeader->pBody;
+    pPacket->header = pHeader;
+    return pPacket;
+}
+
+typedef struct struct_xglCmdEndQuery {
+    glv_trace_packet_header* header;
+    XGL_CMD_BUFFER cmdBuffer;
+    XGL_QUERY_POOL queryPool;
+    uint32_t slot;
+} struct_xglCmdEndQuery;
+
+static struct_xglCmdEndQuery* interpret_body_as_xglCmdEndQuery(glv_trace_packet_header* pHeader)
+{
+    struct_xglCmdEndQuery* pPacket = (struct_xglCmdEndQuery*)pHeader->pBody;
+    pPacket->header = pHeader;
+    return pPacket;
+}
+
+typedef struct struct_xglCmdResetQueryPool {
+    glv_trace_packet_header* header;
+    XGL_CMD_BUFFER cmdBuffer;
+    XGL_QUERY_POOL queryPool;
+    uint32_t startQuery;
+    uint32_t queryCount;
+} struct_xglCmdResetQueryPool;
+
+static struct_xglCmdResetQueryPool* interpret_body_as_xglCmdResetQueryPool(glv_trace_packet_header* pHeader)
+{
+    struct_xglCmdResetQueryPool* pPacket = (struct_xglCmdResetQueryPool*)pHeader->pBody;
+    pPacket->header = pHeader;
+    return pPacket;
+}
+
+typedef struct struct_xglCmdWriteTimestamp {
+    glv_trace_packet_header* header;
+    XGL_CMD_BUFFER cmdBuffer;
+    XGL_TIMESTAMP_TYPE timestampType;
+    XGL_BUFFER destBuffer;
+    XGL_GPU_SIZE destOffset;
+} struct_xglCmdWriteTimestamp;
+
+static struct_xglCmdWriteTimestamp* interpret_body_as_xglCmdWriteTimestamp(glv_trace_packet_header* pHeader)
+{
+    struct_xglCmdWriteTimestamp* pPacket = (struct_xglCmdWriteTimestamp*)pHeader->pBody;
+    pPacket->header = pHeader;
+    return pPacket;
+}
+
+typedef struct struct_xglCmdInitAtomicCounters {
+    glv_trace_packet_header* header;
+    XGL_CMD_BUFFER cmdBuffer;
+    XGL_PIPELINE_BIND_POINT pipelineBindPoint;
+    uint32_t startCounter;
+    uint32_t counterCount;
+    const uint32_t* pData;
+} struct_xglCmdInitAtomicCounters;
+
+static struct_xglCmdInitAtomicCounters* interpret_body_as_xglCmdInitAtomicCounters(glv_trace_packet_header* pHeader)
+{
+    struct_xglCmdInitAtomicCounters* pPacket = (struct_xglCmdInitAtomicCounters*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->pData = (const uint32_t*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pData);
+    return pPacket;
+}
+
+typedef struct struct_xglCmdLoadAtomicCounters {
+    glv_trace_packet_header* header;
+    XGL_CMD_BUFFER cmdBuffer;
+    XGL_PIPELINE_BIND_POINT pipelineBindPoint;
+    uint32_t startCounter;
+    uint32_t counterCount;
+    XGL_BUFFER srcBuffer;
+    XGL_GPU_SIZE srcOffset;
+} struct_xglCmdLoadAtomicCounters;
+
+static struct_xglCmdLoadAtomicCounters* interpret_body_as_xglCmdLoadAtomicCounters(glv_trace_packet_header* pHeader)
+{
+    struct_xglCmdLoadAtomicCounters* pPacket = (struct_xglCmdLoadAtomicCounters*)pHeader->pBody;
+    pPacket->header = pHeader;
+    return pPacket;
+}
+
+typedef struct struct_xglCmdSaveAtomicCounters {
+    glv_trace_packet_header* header;
+    XGL_CMD_BUFFER cmdBuffer;
+    XGL_PIPELINE_BIND_POINT pipelineBindPoint;
+    uint32_t startCounter;
+    uint32_t counterCount;
+    XGL_BUFFER destBuffer;
+    XGL_GPU_SIZE destOffset;
+} struct_xglCmdSaveAtomicCounters;
+
+static struct_xglCmdSaveAtomicCounters* interpret_body_as_xglCmdSaveAtomicCounters(glv_trace_packet_header* pHeader)
+{
+    struct_xglCmdSaveAtomicCounters* pPacket = (struct_xglCmdSaveAtomicCounters*)pHeader->pBody;
+    pPacket->header = pHeader;
+    return pPacket;
+}
+
+typedef struct struct_xglCreateFramebuffer {
+    glv_trace_packet_header* header;
+    XGL_DEVICE device;
+    const XGL_FRAMEBUFFER_CREATE_INFO* pCreateInfo;
+    XGL_FRAMEBUFFER* pFramebuffer;
+    XGL_RESULT result;
+} struct_xglCreateFramebuffer;
+
+static struct_xglCreateFramebuffer* interpret_body_as_xglCreateFramebuffer(glv_trace_packet_header* pHeader)
+{
+    struct_xglCreateFramebuffer* pPacket = (struct_xglCreateFramebuffer*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->pCreateInfo = (const XGL_FRAMEBUFFER_CREATE_INFO*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pCreateInfo);
+    if (pPacket->pCreateInfo != NULL)
+    {
+        XGL_FRAMEBUFFER_CREATE_INFO* pInfo = (XGL_FRAMEBUFFER_CREATE_INFO*)pPacket->pCreateInfo;
+        pInfo->pColorAttachments = (XGL_COLOR_ATTACHMENT_BIND_INFO*) glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pCreateInfo->pColorAttachments);
+        pInfo->pDepthStencilAttachment = (XGL_DEPTH_STENCIL_BIND_INFO*) glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pCreateInfo->pDepthStencilAttachment);
+
+    }
+    pPacket->pFramebuffer = (XGL_FRAMEBUFFER*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pFramebuffer);
+    return pPacket;
+}
+
+typedef struct struct_xglCreateRenderPass {
+    glv_trace_packet_header* header;
+    XGL_DEVICE device;
+    const XGL_RENDER_PASS_CREATE_INFO* pCreateInfo;
+    XGL_RENDER_PASS* pRenderPass;
+    XGL_RESULT result;
+} struct_xglCreateRenderPass;
+
+static struct_xglCreateRenderPass* interpret_body_as_xglCreateRenderPass(glv_trace_packet_header* pHeader)
+{
+    struct_xglCreateRenderPass* pPacket = (struct_xglCreateRenderPass*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->pCreateInfo = (const XGL_RENDER_PASS_CREATE_INFO*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pCreateInfo);
+    if (pPacket->pCreateInfo != NULL)
+    {
+        XGL_RENDER_PASS_CREATE_INFO* pInfo = (XGL_RENDER_PASS_CREATE_INFO*)pPacket->pCreateInfo;
+        pInfo->pColorLoadOps = (XGL_ATTACHMENT_LOAD_OP*) glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pCreateInfo->pColorLoadOps);
+        pInfo->pColorStoreOps = (XGL_ATTACHMENT_STORE_OP*) glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pCreateInfo->pColorStoreOps);
+        pInfo->pColorLoadClearValues = (XGL_CLEAR_COLOR*) glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pCreateInfo->pColorLoadClearValues);
+
+    }
+    pPacket->pRenderPass = (XGL_RENDER_PASS*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pRenderPass);
+    return pPacket;
+}
+
+typedef struct struct_xglCmdBeginRenderPass {
+    glv_trace_packet_header* header;
+    XGL_CMD_BUFFER cmdBuffer;
+    XGL_RENDER_PASS renderPass;
+} struct_xglCmdBeginRenderPass;
+
+static struct_xglCmdBeginRenderPass* interpret_body_as_xglCmdBeginRenderPass(glv_trace_packet_header* pHeader)
+{
+    struct_xglCmdBeginRenderPass* pPacket = (struct_xglCmdBeginRenderPass*)pHeader->pBody;
+    pPacket->header = pHeader;
+    return pPacket;
+}
+
+typedef struct struct_xglCmdEndRenderPass {
+    glv_trace_packet_header* header;
+    XGL_CMD_BUFFER cmdBuffer;
+    XGL_RENDER_PASS renderPass;
+} struct_xglCmdEndRenderPass;
+
+static struct_xglCmdEndRenderPass* interpret_body_as_xglCmdEndRenderPass(glv_trace_packet_header* pHeader)
+{
+    struct_xglCmdEndRenderPass* pPacket = (struct_xglCmdEndRenderPass*)pHeader->pBody;
+    pPacket->header = pHeader;
+    return pPacket;
+}
+
diff --git a/tools/glave/src/glv_extensions/glvreplay_xgl/codegen/glvtrace_xgl_xgldbg_structs.h b/tools/glave/src/glv_extensions/glvreplay_xgl/codegen/glvtrace_xgl_xgldbg_structs.h
new file mode 100644
index 0000000..cfe77e6
--- /dev/null
+++ b/tools/glave/src/glv_extensions/glvreplay_xgl/codegen/glvtrace_xgl_xgldbg_structs.h
@@ -0,0 +1,164 @@
+/* THIS FILE IS GENERATED.  DO NOT EDIT. */
+
+/*
+ * XGL
+ *
+ * Copyright (C) 2014 LunarG, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+#pragma once
+
+#include "xglDbg.h"
+#include "glv_trace_packet_utils.h"
+
+
+typedef struct struct_xglDbgSetValidationLevel {
+    glv_trace_packet_header* pHeader;
+    XGL_DEVICE device;
+    XGL_VALIDATION_LEVEL validationLevel;
+    XGL_RESULT result;
+} struct_xglDbgSetValidationLevel;
+
+static struct_xglDbgSetValidationLevel* interpret_body_as_xglDbgSetValidationLevel(glv_trace_packet_header* pHeader)
+{
+    struct_xglDbgSetValidationLevel* pPacket = (struct_xglDbgSetValidationLevel*)pHeader->pBody;
+    pPacket->pHeader = pHeader;
+    return pPacket;
+}
+
+typedef struct struct_xglDbgRegisterMsgCallback {
+    glv_trace_packet_header* pHeader;
+    XGL_DBG_MSG_CALLBACK_FUNCTION pfnMsgCallback;
+    void* pUserData;
+    XGL_RESULT result;
+} struct_xglDbgRegisterMsgCallback;
+
+static struct_xglDbgRegisterMsgCallback* interpret_body_as_xglDbgRegisterMsgCallback(glv_trace_packet_header* pHeader)
+{
+    struct_xglDbgRegisterMsgCallback* pPacket = (struct_xglDbgRegisterMsgCallback*)pHeader->pBody;
+    pPacket->pHeader = pHeader;
+    pPacket->pUserData = (void*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pUserData);
+    return pPacket;
+}
+
+typedef struct struct_xglDbgUnregisterMsgCallback {
+    glv_trace_packet_header* pHeader;
+    XGL_DBG_MSG_CALLBACK_FUNCTION pfnMsgCallback;
+    XGL_RESULT result;
+} struct_xglDbgUnregisterMsgCallback;
+
+static struct_xglDbgUnregisterMsgCallback* interpret_body_as_xglDbgUnregisterMsgCallback(glv_trace_packet_header* pHeader)
+{
+    struct_xglDbgUnregisterMsgCallback* pPacket = (struct_xglDbgUnregisterMsgCallback*)pHeader->pBody;
+    pPacket->pHeader = pHeader;
+    return pPacket;
+}
+
+typedef struct struct_xglDbgSetMessageFilter {
+    glv_trace_packet_header* pHeader;
+    XGL_DEVICE device;
+    int32_t msgCode;
+    XGL_DBG_MSG_FILTER filter;
+    XGL_RESULT result;
+} struct_xglDbgSetMessageFilter;
+
+static struct_xglDbgSetMessageFilter* interpret_body_as_xglDbgSetMessageFilter(glv_trace_packet_header* pHeader)
+{
+    struct_xglDbgSetMessageFilter* pPacket = (struct_xglDbgSetMessageFilter*)pHeader->pBody;
+    pPacket->pHeader = pHeader;
+    return pPacket;
+}
+
+typedef struct struct_xglDbgSetObjectTag {
+    glv_trace_packet_header* pHeader;
+    XGL_BASE_OBJECT object;
+    size_t tagSize;
+    const void* pTag;
+    XGL_RESULT result;
+} struct_xglDbgSetObjectTag;
+
+static struct_xglDbgSetObjectTag* interpret_body_as_xglDbgSetObjectTag(glv_trace_packet_header* pHeader)
+{
+    struct_xglDbgSetObjectTag* pPacket = (struct_xglDbgSetObjectTag*)pHeader->pBody;
+    pPacket->pHeader = pHeader;
+    pPacket->pTag = (const void*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pTag);
+    return pPacket;
+}
+
+typedef struct struct_xglDbgSetGlobalOption {
+    glv_trace_packet_header* pHeader;
+    XGL_DBG_GLOBAL_OPTION dbgOption;
+    size_t dataSize;
+    const void* pData;
+    XGL_RESULT result;
+} struct_xglDbgSetGlobalOption;
+
+static struct_xglDbgSetGlobalOption* interpret_body_as_xglDbgSetGlobalOption(glv_trace_packet_header* pHeader)
+{
+    struct_xglDbgSetGlobalOption* pPacket = (struct_xglDbgSetGlobalOption*)pHeader->pBody;
+    pPacket->pHeader = pHeader;
+    pPacket->pData = (const void*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pData);
+    return pPacket;
+}
+
+typedef struct struct_xglDbgSetDeviceOption {
+    glv_trace_packet_header* pHeader;
+    XGL_DEVICE device;
+    XGL_DBG_DEVICE_OPTION dbgOption;
+    size_t dataSize;
+    const void* pData;
+    XGL_RESULT result;
+} struct_xglDbgSetDeviceOption;
+
+static struct_xglDbgSetDeviceOption* interpret_body_as_xglDbgSetDeviceOption(glv_trace_packet_header* pHeader)
+{
+    struct_xglDbgSetDeviceOption* pPacket = (struct_xglDbgSetDeviceOption*)pHeader->pBody;
+    pPacket->pHeader = pHeader;
+    pPacket->pData = (const void*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pData);
+    return pPacket;
+}
+
+typedef struct struct_xglCmdDbgMarkerBegin {
+    glv_trace_packet_header* pHeader;
+    XGL_CMD_BUFFER cmdBuffer;
+    const char* pMarker;
+} struct_xglCmdDbgMarkerBegin;
+
+static struct_xglCmdDbgMarkerBegin* interpret_body_as_xglCmdDbgMarkerBegin(glv_trace_packet_header* pHeader)
+{
+    struct_xglCmdDbgMarkerBegin* pPacket = (struct_xglCmdDbgMarkerBegin*)pHeader->pBody;
+    pPacket->pHeader = pHeader;
+    pPacket->pMarker = (const char*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pMarker);
+    return pPacket;
+}
+
+typedef struct struct_xglCmdDbgMarkerEnd {
+    glv_trace_packet_header* pHeader;
+    XGL_CMD_BUFFER cmdBuffer;
+} struct_xglCmdDbgMarkerEnd;
+
+static struct_xglCmdDbgMarkerEnd* interpret_body_as_xglCmdDbgMarkerEnd(glv_trace_packet_header* pHeader)
+{
+    struct_xglCmdDbgMarkerEnd* pPacket = (struct_xglCmdDbgMarkerEnd*)pHeader->pBody;
+    pPacket->pHeader = pHeader;
+    return pPacket;
+}
+
diff --git a/tools/glave/src/glv_extensions/glvreplay_xgl/codegen/glvtrace_xgl_xglwsix11ext_structs.h b/tools/glave/src/glv_extensions/glvreplay_xgl/codegen/glvtrace_xgl_xglwsix11ext_structs.h
new file mode 100644
index 0000000..9dd4da1
--- /dev/null
+++ b/tools/glave/src/glv_extensions/glvreplay_xgl/codegen/glvtrace_xgl_xglwsix11ext_structs.h
@@ -0,0 +1,103 @@
+/* THIS FILE IS GENERATED.  DO NOT EDIT. */
+
+/*
+ * XGL
+ *
+ * Copyright (C) 2014 LunarG, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+#pragma once
+
+#if defined(PLATFORM_LINUX) || defined(XCB_NVIDIA)
+#include "xglWsiX11Ext.h"
+#else
+#include "xglWsiWinExt.h"
+#endif
+#include "glv_trace_packet_utils.h"
+
+
+typedef struct struct_xglWsiX11AssociateConnection {
+    glv_trace_packet_header* pHeader;
+    XGL_PHYSICAL_GPU gpu;
+    const XGL_WSI_X11_CONNECTION_INFO* pConnectionInfo;
+    XGL_RESULT result;
+} struct_xglWsiX11AssociateConnection;
+
+static struct_xglWsiX11AssociateConnection* interpret_body_as_xglWsiX11AssociateConnection(glv_trace_packet_header* pHeader)
+{
+    struct_xglWsiX11AssociateConnection* pPacket = (struct_xglWsiX11AssociateConnection*)pHeader->pBody;
+    pPacket->pHeader = pHeader;
+    pPacket->pConnectionInfo = (const XGL_WSI_X11_CONNECTION_INFO*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pConnectionInfo);
+    return pPacket;
+}
+
+typedef struct struct_xglWsiX11GetMSC {
+    glv_trace_packet_header* pHeader;
+    XGL_DEVICE device;
+    xcb_window_t window;
+    xcb_randr_crtc_t crtc;
+    uint64_t* pMsc;
+    XGL_RESULT result;
+} struct_xglWsiX11GetMSC;
+
+static struct_xglWsiX11GetMSC* interpret_body_as_xglWsiX11GetMSC(glv_trace_packet_header* pHeader)
+{
+    struct_xglWsiX11GetMSC* pPacket = (struct_xglWsiX11GetMSC*)pHeader->pBody;
+    pPacket->pHeader = pHeader;
+    pPacket->pMsc = (uint64_t*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pMsc);
+    return pPacket;
+}
+
+typedef struct struct_xglWsiX11CreatePresentableImage {
+    glv_trace_packet_header* pHeader;
+    XGL_DEVICE device;
+    const XGL_WSI_X11_PRESENTABLE_IMAGE_CREATE_INFO* pCreateInfo;
+    XGL_IMAGE* pImage;
+    XGL_GPU_MEMORY* pMem;
+    XGL_RESULT result;
+} struct_xglWsiX11CreatePresentableImage;
+
+static struct_xglWsiX11CreatePresentableImage* interpret_body_as_xglWsiX11CreatePresentableImage(glv_trace_packet_header* pHeader)
+{
+    struct_xglWsiX11CreatePresentableImage* pPacket = (struct_xglWsiX11CreatePresentableImage*)pHeader->pBody;
+    pPacket->pHeader = pHeader;
+    pPacket->pCreateInfo = (const XGL_WSI_X11_PRESENTABLE_IMAGE_CREATE_INFO*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pCreateInfo);
+    pPacket->pImage = (XGL_IMAGE*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pImage);
+    pPacket->pMem = (XGL_GPU_MEMORY*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pMem);
+    return pPacket;
+}
+
+typedef struct struct_xglWsiX11QueuePresent {
+    glv_trace_packet_header* pHeader;
+    XGL_QUEUE queue;
+    const XGL_WSI_X11_PRESENT_INFO* pPresentInfo;
+    XGL_FENCE fence;
+    XGL_RESULT result;
+} struct_xglWsiX11QueuePresent;
+
+static struct_xglWsiX11QueuePresent* interpret_body_as_xglWsiX11QueuePresent(glv_trace_packet_header* pHeader)
+{
+    struct_xglWsiX11QueuePresent* pPacket = (struct_xglWsiX11QueuePresent*)pHeader->pBody;
+    pPacket->pHeader = pHeader;
+    pPacket->pPresentInfo = (const XGL_WSI_X11_PRESENT_INFO*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pPresentInfo);
+    return pPacket;
+}
+
diff --git a/tools/glave/src/glv_extensions/glvtrace_xgl/CMakeLists.txt b/tools/glave/src/glv_extensions/glvtrace_xgl/CMakeLists.txt
index 2e3b476..5de203d 100644
--- a/tools/glave/src/glv_extensions/glvtrace_xgl/CMakeLists.txt
+++ b/tools/glave/src/glv_extensions/glvtrace_xgl/CMakeLists.txt
@@ -7,45 +7,60 @@
 
 include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR} ${SRC_DIR}/../../../include)
 
-add_custom_command(OUTPUT glvtrace_xgl_xgl.h glvtrace_xgl_xgl.c glvtrace_xgl_packet_id.h glvtrace_xgl_xgl_structs.h glvtrace_xgl_xglwsix11ext.h glvtrace_xgl_xglwsix11ext.c glvtrace_xgl_xglwsix11ext_structs.h glvtrace_xgl_xgldbg.h glvtrace_xgl_xgldbg.c glvtrace_xgl_xgldbg_structs.h xgl_struct_size_helper.h xgl_enum_string_helper.h
-	COMMAND ${PYTHON_CMD} ${SRC_DIR}/../../../glave-generate.py glave-trace-h > glvtrace_xgl_xgl.h
-        COMMAND ${PYTHON_CMD} ${SRC_DIR}/../../../glave-generate.py glave-trace-c > glvtrace_xgl_xgl.c
-        COMMAND ${PYTHON_CMD} ${SRC_DIR}/../../../glave-generate.py glave-packet-id > glvtrace_xgl_packet_id.h
-        COMMAND ${PYTHON_CMD} ${SRC_DIR}/../../../glave-generate.py glave-core-structs > glvtrace_xgl_xgl_structs.h
-        COMMAND ${PYTHON_CMD} ${SRC_DIR}/../../../glave-generate.py glave-wsi-trace-h > glvtrace_xgl_xglwsix11ext.h
-        COMMAND ${PYTHON_CMD} ${SRC_DIR}/../../../glave-generate.py glave-wsi-trace-c > glvtrace_xgl_xglwsix11ext.c
-        COMMAND ${PYTHON_CMD} ${SRC_DIR}/../../../glave-generate.py glave-wsi-trace-structs > glvtrace_xgl_xglwsix11ext_structs.h
-        COMMAND ${PYTHON_CMD} ${SRC_DIR}/../../../glave-generate.py glave-dbg-trace-h > glvtrace_xgl_xgldbg.h
-        COMMAND ${PYTHON_CMD} ${SRC_DIR}/../../../glave-generate.py glave-dbg-trace-c > glvtrace_xgl_xgldbg.c
-        COMMAND ${PYTHON_CMD} ${SRC_DIR}/../../../glave-generate.py glave-dbg-trace-structs > glvtrace_xgl_xgldbg_structs.h
-        COMMAND ${PYTHON_CMD} ${SRC_DIR}/../../../xgl_helper.py --gen_struct_wrappers ${SRC_DIR}/../../../include/xgl.h --abs_out_dir ${CMAKE_CURRENT_BINARY_DIR}
-        COMMAND ${PYTHON_CMD} ${SRC_DIR}/../../../xgl_helper.py --gen_enum_string_helper ${SRC_DIR}/../../../include/xgl.h --abs_out_dir ${CMAKE_CURRENT_BINARY_DIR}
-	           DEPENDS ${SRC_DIR}/../../../xgl_helper.py
-                           ${SRC_DIR}/../../../glave-generate.py)
+file(MAKE_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/codegen)
+
+add_custom_command(OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/codegen/glvtrace_xgl_xgl.h
+                          ${CMAKE_CURRENT_SOURCE_DIR}/codegen/glvtrace_xgl_xgl.c
+                          ${CMAKE_CURRENT_SOURCE_DIR}/codegen/glvtrace_xgl_packet_id.h
+                          ${CMAKE_CURRENT_SOURCE_DIR}/codegen/glvtrace_xgl_xgl_structs.h
+                          ${CMAKE_CURRENT_SOURCE_DIR}/codegen/glvtrace_xgl_xglwsix11ext.h
+                          ${CMAKE_CURRENT_SOURCE_DIR}/codegen/glvtrace_xgl_xglwsix11ext.c
+                          ${CMAKE_CURRENT_SOURCE_DIR}/codegen/glvtrace_xgl_xglwsix11ext_structs.h
+                          ${CMAKE_CURRENT_SOURCE_DIR}/codegen/glvtrace_xgl_xgldbg.h
+                          ${CMAKE_CURRENT_SOURCE_DIR}/codegen/glvtrace_xgl_xgldbg.c
+                          ${CMAKE_CURRENT_SOURCE_DIR}/codegen/glvtrace_xgl_xgldbg_structs.h
+                          ${CMAKE_CURRENT_SOURCE_DIR}/codegen/xgl_struct_size_helper.h
+                          ${CMAKE_CURRENT_SOURCE_DIR}/codegen/xgl_enum_string_helper.h
+        COMMAND ${PYTHON_CMD} ${SRC_DIR}/../scripts/vk_generate.py glave-trace-h > glvtrace_xgl_xgl.h
+        COMMAND ${PYTHON_CMD} ${SRC_DIR}/../scripts/vk_generate.py glave-trace-c > glvtrace_xgl_xgl.c
+        COMMAND ${PYTHON_CMD} ${SRC_DIR}/../scripts/vk_generate.py glave-packet-id > glvtrace_xgl_packet_id.h
+        COMMAND ${PYTHON_CMD} ${SRC_DIR}/../scripts/vk_generate.py glave-core-structs > glvtrace_xgl_xgl_structs.h
+        COMMAND ${PYTHON_CMD} ${SRC_DIR}/../scripts/vk_generate.py glave-wsi-trace-h > glvtrace_xgl_xglwsix11ext.h
+        COMMAND ${PYTHON_CMD} ${SRC_DIR}/../scripts/vk_generate.py glave-wsi-trace-c > glvtrace_xgl_xglwsix11ext.c
+        COMMAND ${PYTHON_CMD} ${SRC_DIR}/../scripts/vk_generate.py glave-wsi-trace-structs > glvtrace_xgl_xglwsix11ext_structs.h
+        COMMAND ${PYTHON_CMD} ${SRC_DIR}/../scripts/vk_generate.py glave-dbg-trace-h > glvtrace_xgl_xgldbg.h
+        COMMAND ${PYTHON_CMD} ${SRC_DIR}/../scripts/vk_generate.py glave-dbg-trace-c > glvtrace_xgl_xgldbg.c
+        COMMAND ${PYTHON_CMD} ${SRC_DIR}/../scripts/vk_generate.py glave-dbg-trace-structs > glvtrace_xgl_xgldbg_structs.h
+        COMMAND ${PYTHON_CMD} ${SRC_DIR}/../../../xgl_helper.py --gen_struct_wrappers ${SRC_DIR}/../../../include/xgl.h --abs_out_dir ${CMAKE_CURRENT_SOURCE_DIR}/codegen
+        COMMAND ${PYTHON_CMD} ${SRC_DIR}/../../../xgl_helper.py --gen_enum_string_helper ${SRC_DIR}/../../../include/xgl.h --abs_out_dir ${CMAKE_CURRENT_SOURCE_DIR}/codegen
+                   DEPENDS ${SRC_DIR}/../../../xgl_helper.py
+                           ${SRC_DIR}/../scripts/vk_generate.py
+                   WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/codegen)
 
 set(SRC_LIST
     ${SRC_LIST}
     glvtrace_xgl.c
-    glvtrace_xgl_xgl.c
-    glvtrace_xgl_xgldbg.c
-    glvtrace_xgl_xglwsix11ext.c
+    codegen/glvtrace_xgl_xgl.c
+    codegen/glvtrace_xgl_xgldbg.c
+    codegen/glvtrace_xgl_xglwsix11ext.c
 )
 
 set_source_files_properties( ${SRC_LIST} PROPERTIES LANGUAGE C)
 
 set (HDR_LIST
-    glvtrace_xgl_packet_id.h
-    glvtrace_xgl_xgl.h
-    glvtrace_xgl_xgl_structs.h
-    glvtrace_xgl_xgldbg.h
-    glvtrace_xgl_xgldbg_structs.h
-    glvtrace_xgl_xglwsix11ext.h
-    glvtrace_xgl_xglwsix11ext_structs.h
-    xgl_struct_size_helper.h
-    xgl_enum_string_helper.h
+    codegen/glvtrace_xgl_packet_id.h
+    codegen/glvtrace_xgl_xgl.h
+    codegen/glvtrace_xgl_xgl_structs.h
+    codegen/glvtrace_xgl_xgldbg.h
+    codegen/glvtrace_xgl_xgldbg_structs.h
+    codegen/glvtrace_xgl_xglwsix11ext.h
+    codegen/glvtrace_xgl_xglwsix11ext_structs.h
+    codegen/xgl_struct_size_helper.h
+    codegen/xgl_enum_string_helper.h
 )
 
 include_directories(
+    codegen
     ${SRC_DIR}
     ${SRC_DIR}/glvcommon
     ${SRC_DIR}/glvtrace
diff --git a/tools/glave/src/glv_extensions/glvtrace_xgl/codegen/glvtrace_xgl_packet_id.h b/tools/glave/src/glv_extensions/glvtrace_xgl/codegen/glvtrace_xgl_packet_id.h
new file mode 100644
index 0000000..d1dded3
--- /dev/null
+++ b/tools/glave/src/glv_extensions/glvtrace_xgl/codegen/glvtrace_xgl_packet_id.h
@@ -0,0 +1,1475 @@
+/* THIS FILE IS GENERATED.  DO NOT EDIT. */
+
+/*
+ * XGL
+ *
+ * Copyright (C) 2014 LunarG, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+#pragma once
+
+#include "glv_trace_packet_utils.h"
+#include "glv_trace_packet_identifiers.h"
+#include "glv_interconnect.h"
+#include "glvtrace_xgl_xgl_structs.h"
+#include "glvtrace_xgl_xgldbg_structs.h"
+#include "glvtrace_xgl_xglwsix11ext_structs.h"
+#include "xgl_enum_string_helper.h"
+#if defined(WIN32)
+#define snprintf _snprintf
+#endif
+#define SEND_ENTRYPOINT_ID(entrypoint) ;
+//#define SEND_ENTRYPOINT_ID(entrypoint) glv_TraceInfo(#entrypoint "\n");
+
+#define SEND_ENTRYPOINT_PARAMS(entrypoint, ...) ;
+//#define SEND_ENTRYPOINT_PARAMS(entrypoint, ...) glv_TraceInfo(entrypoint, __VA_ARGS__);
+
+#define CREATE_TRACE_PACKET(entrypoint, buffer_bytes_needed) \
+    pHeader = glv_create_trace_packet(GLV_TID_XGL, GLV_TPI_XGL_##entrypoint, sizeof(struct_##entrypoint), buffer_bytes_needed);
+
+#define FINISH_TRACE_PACKET() \
+    glv_finalize_trace_packet(pHeader); \
+    glv_write_trace_packet(pHeader, glv_trace_get_trace_file()); \
+    glv_delete_trace_packet(&pHeader);
+
+enum GLV_TRACE_PACKET_ID_XGL
+{
+    GLV_TPI_XGL_xglApiVersion = GLV_TPI_BEGIN_API_HERE,
+    GLV_TPI_XGL_xglCreateInstance,
+    GLV_TPI_XGL_xglDestroyInstance,
+    GLV_TPI_XGL_xglEnumerateGpus,
+    GLV_TPI_XGL_xglGetGpuInfo,
+    GLV_TPI_XGL_xglGetProcAddr,
+    GLV_TPI_XGL_xglCreateDevice,
+    GLV_TPI_XGL_xglDestroyDevice,
+    GLV_TPI_XGL_xglGetExtensionSupport,
+    GLV_TPI_XGL_xglEnumerateLayers,
+    GLV_TPI_XGL_xglGetDeviceQueue,
+    GLV_TPI_XGL_xglQueueSubmit,
+    GLV_TPI_XGL_xglQueueSetGlobalMemReferences,
+    GLV_TPI_XGL_xglQueueWaitIdle,
+    GLV_TPI_XGL_xglDeviceWaitIdle,
+    GLV_TPI_XGL_xglAllocMemory,
+    GLV_TPI_XGL_xglFreeMemory,
+    GLV_TPI_XGL_xglSetMemoryPriority,
+    GLV_TPI_XGL_xglMapMemory,
+    GLV_TPI_XGL_xglUnmapMemory,
+    GLV_TPI_XGL_xglPinSystemMemory,
+    GLV_TPI_XGL_xglGetMultiGpuCompatibility,
+    GLV_TPI_XGL_xglOpenSharedMemory,
+    GLV_TPI_XGL_xglOpenSharedQueueSemaphore,
+    GLV_TPI_XGL_xglOpenPeerMemory,
+    GLV_TPI_XGL_xglOpenPeerImage,
+    GLV_TPI_XGL_xglDestroyObject,
+    GLV_TPI_XGL_xglGetObjectInfo,
+    GLV_TPI_XGL_xglBindObjectMemory,
+    GLV_TPI_XGL_xglBindObjectMemoryRange,
+    GLV_TPI_XGL_xglBindImageMemoryRange,
+    GLV_TPI_XGL_xglCreateFence,
+    GLV_TPI_XGL_xglGetFenceStatus,
+    GLV_TPI_XGL_xglWaitForFences,
+    GLV_TPI_XGL_xglCreateQueueSemaphore,
+    GLV_TPI_XGL_xglSignalQueueSemaphore,
+    GLV_TPI_XGL_xglWaitQueueSemaphore,
+    GLV_TPI_XGL_xglCreateEvent,
+    GLV_TPI_XGL_xglGetEventStatus,
+    GLV_TPI_XGL_xglSetEvent,
+    GLV_TPI_XGL_xglResetEvent,
+    GLV_TPI_XGL_xglCreateQueryPool,
+    GLV_TPI_XGL_xglGetQueryPoolResults,
+    GLV_TPI_XGL_xglGetFormatInfo,
+    GLV_TPI_XGL_xglCreateBuffer,
+    GLV_TPI_XGL_xglCreateBufferView,
+    GLV_TPI_XGL_xglCreateImage,
+    GLV_TPI_XGL_xglSetFastClearColor,
+    GLV_TPI_XGL_xglSetFastClearDepth,
+    GLV_TPI_XGL_xglGetImageSubresourceInfo,
+    GLV_TPI_XGL_xglCreateImageView,
+    GLV_TPI_XGL_xglCreateColorAttachmentView,
+    GLV_TPI_XGL_xglCreateDepthStencilView,
+    GLV_TPI_XGL_xglCreateShader,
+    GLV_TPI_XGL_xglCreateGraphicsPipeline,
+    GLV_TPI_XGL_xglCreateComputePipeline,
+    GLV_TPI_XGL_xglStorePipeline,
+    GLV_TPI_XGL_xglLoadPipeline,
+    GLV_TPI_XGL_xglCreatePipelineDelta,
+    GLV_TPI_XGL_xglCreateSampler,
+    GLV_TPI_XGL_xglCreateDescriptorSetLayout,
+    GLV_TPI_XGL_xglBeginDescriptorRegionUpdate,
+    GLV_TPI_XGL_xglEndDescriptorRegionUpdate,
+    GLV_TPI_XGL_xglCreateDescriptorRegion,
+    GLV_TPI_XGL_xglClearDescriptorRegion,
+    GLV_TPI_XGL_xglAllocDescriptorSets,
+    GLV_TPI_XGL_xglClearDescriptorSets,
+    GLV_TPI_XGL_xglUpdateDescriptors,
+    GLV_TPI_XGL_xglCreateDynamicViewportState,
+    GLV_TPI_XGL_xglCreateDynamicRasterState,
+    GLV_TPI_XGL_xglCreateDynamicColorBlendState,
+    GLV_TPI_XGL_xglCreateDynamicDepthStencilState,
+    GLV_TPI_XGL_xglCreateCommandBuffer,
+    GLV_TPI_XGL_xglBeginCommandBuffer,
+    GLV_TPI_XGL_xglEndCommandBuffer,
+    GLV_TPI_XGL_xglResetCommandBuffer,
+    GLV_TPI_XGL_xglCmdBindPipeline,
+    GLV_TPI_XGL_xglCmdBindPipelineDelta,
+    GLV_TPI_XGL_xglCmdBindDynamicStateObject,
+    GLV_TPI_XGL_xglCmdBindDescriptorSet,
+    GLV_TPI_XGL_xglCmdBindVertexBuffer,
+    GLV_TPI_XGL_xglCmdBindIndexBuffer,
+    GLV_TPI_XGL_xglCmdDraw,
+    GLV_TPI_XGL_xglCmdDrawIndexed,
+    GLV_TPI_XGL_xglCmdDrawIndirect,
+    GLV_TPI_XGL_xglCmdDrawIndexedIndirect,
+    GLV_TPI_XGL_xglCmdDispatch,
+    GLV_TPI_XGL_xglCmdDispatchIndirect,
+    GLV_TPI_XGL_xglCmdCopyBuffer,
+    GLV_TPI_XGL_xglCmdCopyImage,
+    GLV_TPI_XGL_xglCmdCopyBufferToImage,
+    GLV_TPI_XGL_xglCmdCopyImageToBuffer,
+    GLV_TPI_XGL_xglCmdCloneImageData,
+    GLV_TPI_XGL_xglCmdUpdateBuffer,
+    GLV_TPI_XGL_xglCmdFillBuffer,
+    GLV_TPI_XGL_xglCmdClearColorImage,
+    GLV_TPI_XGL_xglCmdClearColorImageRaw,
+    GLV_TPI_XGL_xglCmdClearDepthStencil,
+    GLV_TPI_XGL_xglCmdResolveImage,
+    GLV_TPI_XGL_xglCmdSetEvent,
+    GLV_TPI_XGL_xglCmdResetEvent,
+    GLV_TPI_XGL_xglCmdWaitEvents,
+    GLV_TPI_XGL_xglCmdPipelineBarrier,
+    GLV_TPI_XGL_xglCmdBeginQuery,
+    GLV_TPI_XGL_xglCmdEndQuery,
+    GLV_TPI_XGL_xglCmdResetQueryPool,
+    GLV_TPI_XGL_xglCmdWriteTimestamp,
+    GLV_TPI_XGL_xglCmdInitAtomicCounters,
+    GLV_TPI_XGL_xglCmdLoadAtomicCounters,
+    GLV_TPI_XGL_xglCmdSaveAtomicCounters,
+    GLV_TPI_XGL_xglCreateFramebuffer,
+    GLV_TPI_XGL_xglCreateRenderPass,
+    GLV_TPI_XGL_xglCmdBeginRenderPass,
+    GLV_TPI_XGL_xglCmdEndRenderPass,
+    GLV_TPI_XGL_xglDbgSetValidationLevel,
+    GLV_TPI_XGL_xglDbgRegisterMsgCallback,
+    GLV_TPI_XGL_xglDbgUnregisterMsgCallback,
+    GLV_TPI_XGL_xglDbgSetMessageFilter,
+    GLV_TPI_XGL_xglDbgSetObjectTag,
+    GLV_TPI_XGL_xglDbgSetGlobalOption,
+    GLV_TPI_XGL_xglDbgSetDeviceOption,
+    GLV_TPI_XGL_xglCmdDbgMarkerBegin,
+    GLV_TPI_XGL_xglCmdDbgMarkerEnd,
+    GLV_TPI_XGL_xglWsiX11AssociateConnection,
+    GLV_TPI_XGL_xglWsiX11GetMSC,
+    GLV_TPI_XGL_xglWsiX11CreatePresentableImage,
+    GLV_TPI_XGL_xglWsiX11QueuePresent,
+};
+
+static const char *stringify_xgl_packet_id(const enum GLV_TRACE_PACKET_ID_XGL id, const glv_trace_packet_header* pHeader)
+{
+    static char str[1024];
+    switch(id) {
+    case GLV_TPI_XGL_xglApiVersion:
+    {
+        struct_xglApiVersion* pPacket = (struct_xglApiVersion*)(pHeader->pBody);
+        snprintf(str, 1024, "xglApiVersion = 0x%x", pPacket->version);
+        return str;
+    }
+    case GLV_TPI_XGL_xglCreateInstance:
+    {
+        struct_xglCreateInstance* pPacket = (struct_xglCreateInstance*)(pHeader->pBody);
+        snprintf(str, 1024, "xglCreateInstance(pAppInfo = %p, pAllocCb = %p, pInstance = %p)", (void*)(pPacket->pAppInfo), (void*)(pPacket->pAllocCb), (void*)pPacket->pInstance);
+        return str;
+    }
+    case GLV_TPI_XGL_xglDestroyInstance:
+    {
+        struct_xglDestroyInstance* pPacket = (struct_xglDestroyInstance*)(pHeader->pBody);
+        snprintf(str, 1024, "xglDestroyInstance(instance = %p)", (void*)(pPacket->instance));
+        return str;
+    }
+    case GLV_TPI_XGL_xglEnumerateGpus:
+    {
+        struct_xglEnumerateGpus* pPacket = (struct_xglEnumerateGpus*)(pHeader->pBody);
+        snprintf(str, 1024, "xglEnumerateGpus(instance = %p, maxGpus = %i, *pGpuCount = %i, pGpus = %p)", (void*)(pPacket->instance), pPacket->maxGpus, (pPacket->pGpuCount == NULL) ? 0 : *(pPacket->pGpuCount), (void*)(pPacket->pGpus));
+        return str;
+    }
+    case GLV_TPI_XGL_xglGetGpuInfo:
+    {
+        struct_xglGetGpuInfo* pPacket = (struct_xglGetGpuInfo*)(pHeader->pBody);
+        snprintf(str, 1024, "xglGetGpuInfo(gpu = %p, infoType = %s, *pDataSize = %zu, pData = %p)", (void*)(pPacket->gpu), string_XGL_PHYSICAL_GPU_INFO_TYPE(pPacket->infoType), (pPacket->pDataSize == NULL) ? 0 : *(pPacket->pDataSize), (void*)(pPacket->pData));
+        return str;
+    }
+    case GLV_TPI_XGL_xglGetProcAddr:
+    {
+        struct_xglGetProcAddr* pPacket = (struct_xglGetProcAddr*)(pHeader->pBody);
+        snprintf(str, 1024, "xglGetProcAddr(gpu = %p, pName = %p)", (void*)(pPacket->gpu), (void*)(pPacket->pName));
+        return str;
+    }
+    case GLV_TPI_XGL_xglCreateDevice:
+    {
+        struct_xglCreateDevice* pPacket = (struct_xglCreateDevice*)(pHeader->pBody);
+        snprintf(str, 1024, "xglCreateDevice(gpu = %p, pCreateInfo = %p, pDevice = %p)", (void*)(pPacket->gpu), (void*)(pPacket->pCreateInfo), (void*)pPacket->pDevice);
+        return str;
+    }
+    case GLV_TPI_XGL_xglDestroyDevice:
+    {
+        struct_xglDestroyDevice* pPacket = (struct_xglDestroyDevice*)(pHeader->pBody);
+        snprintf(str, 1024, "xglDestroyDevice(device = %p)", (void*)(pPacket->device));
+        return str;
+    }
+    case GLV_TPI_XGL_xglGetExtensionSupport:
+    {
+        struct_xglGetExtensionSupport* pPacket = (struct_xglGetExtensionSupport*)(pHeader->pBody);
+        snprintf(str, 1024, "xglGetExtensionSupport(gpu = %p, pExtName = %p)", (void*)(pPacket->gpu), (void*)(pPacket->pExtName));
+        return str;
+    }
+    case GLV_TPI_XGL_xglEnumerateLayers:
+    {
+        struct_xglEnumerateLayers* pPacket = (struct_xglEnumerateLayers*)(pHeader->pBody);
+        snprintf(str, 1024, "xglEnumerateLayers(gpu = %p, maxLayerCount = %zu, maxStringSize = %zu, *pOutLayerCount = %zu, pOutLayers = %p, pReserved = %p)", (void*)(pPacket->gpu), pPacket->maxLayerCount, pPacket->maxStringSize, (pPacket->pOutLayerCount == NULL) ? 0 : *(pPacket->pOutLayerCount), (void*)(pPacket->pOutLayers), (void*)(pPacket->pReserved));
+        return str;
+    }
+    case GLV_TPI_XGL_xglGetDeviceQueue:
+    {
+        struct_xglGetDeviceQueue* pPacket = (struct_xglGetDeviceQueue*)(pHeader->pBody);
+        snprintf(str, 1024, "xglGetDeviceQueue(device = %p, queueType = %s, queueIndex = %i, pQueue = %p)", (void*)(pPacket->device), string_XGL_QUEUE_TYPE(pPacket->queueType), pPacket->queueIndex, (void*)(pPacket->pQueue));
+        return str;
+    }
+    case GLV_TPI_XGL_xglQueueSubmit:
+    {
+        struct_xglQueueSubmit* pPacket = (struct_xglQueueSubmit*)(pHeader->pBody);
+        snprintf(str, 1024, "xglQueueSubmit(queue = %p, cmdBufferCount = %i, pCmdBuffers = %p, memRefCount = %i, pMemRefs = %p, fence = %p)", (void*)(pPacket->queue), pPacket->cmdBufferCount, (void*)(pPacket->pCmdBuffers), pPacket->memRefCount, (void*)(pPacket->pMemRefs), (void*)(pPacket->fence));
+        return str;
+    }
+    case GLV_TPI_XGL_xglQueueSetGlobalMemReferences:
+    {
+        struct_xglQueueSetGlobalMemReferences* pPacket = (struct_xglQueueSetGlobalMemReferences*)(pHeader->pBody);
+        snprintf(str, 1024, "xglQueueSetGlobalMemReferences(queue = %p, memRefCount = %i, pMemRefs = %p)", (void*)(pPacket->queue), pPacket->memRefCount, (void*)(pPacket->pMemRefs));
+        return str;
+    }
+    case GLV_TPI_XGL_xglQueueWaitIdle:
+    {
+        struct_xglQueueWaitIdle* pPacket = (struct_xglQueueWaitIdle*)(pHeader->pBody);
+        snprintf(str, 1024, "xglQueueWaitIdle(queue = %p)", (void*)(pPacket->queue));
+        return str;
+    }
+    case GLV_TPI_XGL_xglDeviceWaitIdle:
+    {
+        struct_xglDeviceWaitIdle* pPacket = (struct_xglDeviceWaitIdle*)(pHeader->pBody);
+        snprintf(str, 1024, "xglDeviceWaitIdle(device = %p)", (void*)(pPacket->device));
+        return str;
+    }
+    case GLV_TPI_XGL_xglAllocMemory:
+    {
+        struct_xglAllocMemory* pPacket = (struct_xglAllocMemory*)(pHeader->pBody);
+        snprintf(str, 1024, "xglAllocMemory(device = %p, pAllocInfo = %p, pMem = %p)", (void*)(pPacket->device), (void*)(pPacket->pAllocInfo), (void*)pPacket->pMem);
+        return str;
+    }
+    case GLV_TPI_XGL_xglFreeMemory:
+    {
+        struct_xglFreeMemory* pPacket = (struct_xglFreeMemory*)(pHeader->pBody);
+        snprintf(str, 1024, "xglFreeMemory(mem = %p)", (void*)(pPacket->mem));
+        return str;
+    }
+    case GLV_TPI_XGL_xglSetMemoryPriority:
+    {
+        struct_xglSetMemoryPriority* pPacket = (struct_xglSetMemoryPriority*)(pHeader->pBody);
+        snprintf(str, 1024, "xglSetMemoryPriority(mem = %p, priority = %p)", (void*)(pPacket->mem), (void*)(pPacket->priority));
+        return str;
+    }
+    case GLV_TPI_XGL_xglMapMemory:
+    {
+        struct_xglMapMemory* pPacket = (struct_xglMapMemory*)(pHeader->pBody);
+        snprintf(str, 1024, "xglMapMemory(mem = %p, flags = %i, ppData = %p)", (void*)(pPacket->mem), pPacket->flags, (void*)pPacket->ppData);
+        return str;
+    }
+    case GLV_TPI_XGL_xglUnmapMemory:
+    {
+        struct_xglUnmapMemory* pPacket = (struct_xglUnmapMemory*)(pHeader->pBody);
+        snprintf(str, 1024, "xglUnmapMemory(mem = %p)", (void*)(pPacket->mem));
+        return str;
+    }
+    case GLV_TPI_XGL_xglPinSystemMemory:
+    {
+        struct_xglPinSystemMemory* pPacket = (struct_xglPinSystemMemory*)(pHeader->pBody);
+        snprintf(str, 1024, "xglPinSystemMemory(device = %p, pSysMem = %p, memSize = %zu, pMem = %p)", (void*)(pPacket->device), (void*)(pPacket->pSysMem), pPacket->memSize, (void*)(pPacket->pMem));
+        return str;
+    }
+    case GLV_TPI_XGL_xglGetMultiGpuCompatibility:
+    {
+        struct_xglGetMultiGpuCompatibility* pPacket = (struct_xglGetMultiGpuCompatibility*)(pHeader->pBody);
+        snprintf(str, 1024, "xglGetMultiGpuCompatibility(gpu0 = %p, gpu1 = %p, pInfo = %p)", (void*)(pPacket->gpu0), (void*)(pPacket->gpu1), (void*)(pPacket->pInfo));
+        return str;
+    }
+    case GLV_TPI_XGL_xglOpenSharedMemory:
+    {
+        struct_xglOpenSharedMemory* pPacket = (struct_xglOpenSharedMemory*)(pHeader->pBody);
+        snprintf(str, 1024, "xglOpenSharedMemory(device = %p, pOpenInfo = %p, pMem = %p)", (void*)(pPacket->device), (void*)(pPacket->pOpenInfo), (void*)(pPacket->pMem));
+        return str;
+    }
+    case GLV_TPI_XGL_xglOpenSharedQueueSemaphore:
+    {
+        struct_xglOpenSharedQueueSemaphore* pPacket = (struct_xglOpenSharedQueueSemaphore*)(pHeader->pBody);
+        snprintf(str, 1024, "xglOpenSharedQueueSemaphore(device = %p, pOpenInfo = %p, pSemaphore = %p)", (void*)(pPacket->device), (void*)(pPacket->pOpenInfo), (void*)(pPacket->pSemaphore));
+        return str;
+    }
+    case GLV_TPI_XGL_xglOpenPeerMemory:
+    {
+        struct_xglOpenPeerMemory* pPacket = (struct_xglOpenPeerMemory*)(pHeader->pBody);
+        snprintf(str, 1024, "xglOpenPeerMemory(device = %p, pOpenInfo = %p, pMem = %p)", (void*)(pPacket->device), (void*)(pPacket->pOpenInfo), (void*)(pPacket->pMem));
+        return str;
+    }
+    case GLV_TPI_XGL_xglOpenPeerImage:
+    {
+        struct_xglOpenPeerImage* pPacket = (struct_xglOpenPeerImage*)(pHeader->pBody);
+        snprintf(str, 1024, "xglOpenPeerImage(device = %p, pOpenInfo = %p, pImage = %p, pMem = %p)", (void*)(pPacket->device), (void*)(pPacket->pOpenInfo), (void*)(pPacket->pImage), (void*)(pPacket->pMem));
+        return str;
+    }
+    case GLV_TPI_XGL_xglDestroyObject:
+    {
+        struct_xglDestroyObject* pPacket = (struct_xglDestroyObject*)(pHeader->pBody);
+        snprintf(str, 1024, "xglDestroyObject(object = %p)", (void*)(pPacket->object));
+        return str;
+    }
+    case GLV_TPI_XGL_xglGetObjectInfo:
+    {
+        struct_xglGetObjectInfo* pPacket = (struct_xglGetObjectInfo*)(pHeader->pBody);
+        snprintf(str, 1024, "xglGetObjectInfo(object = %p, infoType = %s, *pDataSize = %zu, pData = %p)", (void*)(pPacket->object), string_XGL_OBJECT_INFO_TYPE(pPacket->infoType), (pPacket->pDataSize == NULL) ? 0 : *(pPacket->pDataSize), (void*)(pPacket->pData));
+        return str;
+    }
+    case GLV_TPI_XGL_xglBindObjectMemory:
+    {
+        struct_xglBindObjectMemory* pPacket = (struct_xglBindObjectMemory*)(pHeader->pBody);
+        snprintf(str, 1024, "xglBindObjectMemory(object = %p, allocationIdx = %i, mem = %p, offset = %p)", (void*)(pPacket->object), pPacket->allocationIdx, (void*)(pPacket->mem), (void*)(pPacket->offset));
+        return str;
+    }
+    case GLV_TPI_XGL_xglBindObjectMemoryRange:
+    {
+        struct_xglBindObjectMemoryRange* pPacket = (struct_xglBindObjectMemoryRange*)(pHeader->pBody);
+        snprintf(str, 1024, "xglBindObjectMemoryRange(object = %p, allocationIdx = %i, rangeOffset = %p, rangeSize = %p, mem = %p, memOffset = %p)", (void*)(pPacket->object), pPacket->allocationIdx, (void*)(pPacket->rangeOffset), (void*)(pPacket->rangeSize), (void*)(pPacket->mem), (void*)(pPacket->memOffset));
+        return str;
+    }
+    case GLV_TPI_XGL_xglBindImageMemoryRange:
+    {
+        struct_xglBindImageMemoryRange* pPacket = (struct_xglBindImageMemoryRange*)(pHeader->pBody);
+        snprintf(str, 1024, "xglBindImageMemoryRange(image = %p, allocationIdx = %i, bindInfo = %p, mem = %p, memOffset = %p)", (void*)(pPacket->image), pPacket->allocationIdx, (void*)(pPacket->bindInfo), (void*)(pPacket->mem), (void*)(pPacket->memOffset));
+        return str;
+    }
+    case GLV_TPI_XGL_xglCreateFence:
+    {
+        struct_xglCreateFence* pPacket = (struct_xglCreateFence*)(pHeader->pBody);
+        snprintf(str, 1024, "xglCreateFence(device = %p, pCreateInfo = %p, pFence = %p)", (void*)(pPacket->device), (void*)(pPacket->pCreateInfo), (void*)pPacket->pFence);
+        return str;
+    }
+    case GLV_TPI_XGL_xglGetFenceStatus:
+    {
+        struct_xglGetFenceStatus* pPacket = (struct_xglGetFenceStatus*)(pHeader->pBody);
+        snprintf(str, 1024, "xglGetFenceStatus(fence = %p)", (void*)(pPacket->fence));
+        return str;
+    }
+    case GLV_TPI_XGL_xglWaitForFences:
+    {
+        struct_xglWaitForFences* pPacket = (struct_xglWaitForFences*)(pHeader->pBody);
+        snprintf(str, 1024, "xglWaitForFences(device = %p, fenceCount = %i, pFences = %p, waitAll = %u, timeout = %lu)", (void*)(pPacket->device), pPacket->fenceCount, (void*)(pPacket->pFences), pPacket->waitAll, pPacket->timeout);
+        return str;
+    }
+    case GLV_TPI_XGL_xglCreateQueueSemaphore:
+    {
+        struct_xglCreateQueueSemaphore* pPacket = (struct_xglCreateQueueSemaphore*)(pHeader->pBody);
+        snprintf(str, 1024, "xglCreateQueueSemaphore(device = %p, pCreateInfo = %p, pSemaphore = %p)", (void*)(pPacket->device), (void*)(pPacket->pCreateInfo), (void*)pPacket->pSemaphore);
+        return str;
+    }
+    case GLV_TPI_XGL_xglSignalQueueSemaphore:
+    {
+        struct_xglSignalQueueSemaphore* pPacket = (struct_xglSignalQueueSemaphore*)(pHeader->pBody);
+        snprintf(str, 1024, "xglSignalQueueSemaphore(queue = %p, semaphore = %p)", (void*)(pPacket->queue), (void*)(pPacket->semaphore));
+        return str;
+    }
+    case GLV_TPI_XGL_xglWaitQueueSemaphore:
+    {
+        struct_xglWaitQueueSemaphore* pPacket = (struct_xglWaitQueueSemaphore*)(pHeader->pBody);
+        snprintf(str, 1024, "xglWaitQueueSemaphore(queue = %p, semaphore = %p)", (void*)(pPacket->queue), (void*)(pPacket->semaphore));
+        return str;
+    }
+    case GLV_TPI_XGL_xglCreateEvent:
+    {
+        struct_xglCreateEvent* pPacket = (struct_xglCreateEvent*)(pHeader->pBody);
+        snprintf(str, 1024, "xglCreateEvent(device = %p, pCreateInfo = %p, pEvent = %p)", (void*)(pPacket->device), (void*)(pPacket->pCreateInfo), (void*)pPacket->pEvent);
+        return str;
+    }
+    case GLV_TPI_XGL_xglGetEventStatus:
+    {
+        struct_xglGetEventStatus* pPacket = (struct_xglGetEventStatus*)(pHeader->pBody);
+        snprintf(str, 1024, "xglGetEventStatus(event = %p)", (void*)(pPacket->event));
+        return str;
+    }
+    case GLV_TPI_XGL_xglSetEvent:
+    {
+        struct_xglSetEvent* pPacket = (struct_xglSetEvent*)(pHeader->pBody);
+        snprintf(str, 1024, "xglSetEvent(event = %p)", (void*)(pPacket->event));
+        return str;
+    }
+    case GLV_TPI_XGL_xglResetEvent:
+    {
+        struct_xglResetEvent* pPacket = (struct_xglResetEvent*)(pHeader->pBody);
+        snprintf(str, 1024, "xglResetEvent(event = %p)", (void*)(pPacket->event));
+        return str;
+    }
+    case GLV_TPI_XGL_xglCreateQueryPool:
+    {
+        struct_xglCreateQueryPool* pPacket = (struct_xglCreateQueryPool*)(pHeader->pBody);
+        snprintf(str, 1024, "xglCreateQueryPool(device = %p, pCreateInfo = %p, pQueryPool = %p)", (void*)(pPacket->device), (void*)(pPacket->pCreateInfo), (void*)pPacket->pQueryPool);
+        return str;
+    }
+    case GLV_TPI_XGL_xglGetQueryPoolResults:
+    {
+        struct_xglGetQueryPoolResults* pPacket = (struct_xglGetQueryPoolResults*)(pHeader->pBody);
+        snprintf(str, 1024, "xglGetQueryPoolResults(queryPool = %p, startQuery = %i, queryCount = %i, *pDataSize = %zu, pData = %p)", (void*)(pPacket->queryPool), pPacket->startQuery, pPacket->queryCount, (pPacket->pDataSize == NULL) ? 0 : *(pPacket->pDataSize), (void*)(pPacket->pData));
+        return str;
+    }
+    case GLV_TPI_XGL_xglGetFormatInfo:
+    {
+        struct_xglGetFormatInfo* pPacket = (struct_xglGetFormatInfo*)(pHeader->pBody);
+        snprintf(str, 1024, "xglGetFormatInfo(device = %p, format = %p, infoType = %s, *pDataSize = %zu, pData = %p)", (void*)(pPacket->device), (void*)(pPacket->format), string_XGL_FORMAT_INFO_TYPE(pPacket->infoType), (pPacket->pDataSize == NULL) ? 0 : *(pPacket->pDataSize), (void*)(pPacket->pData));
+        return str;
+    }
+    case GLV_TPI_XGL_xglCreateBuffer:
+    {
+        struct_xglCreateBuffer* pPacket = (struct_xglCreateBuffer*)(pHeader->pBody);
+        snprintf(str, 1024, "xglCreateBuffer(device = %p, pCreateInfo = %p, pBuffer = %p)", (void*)(pPacket->device), (void*)(pPacket->pCreateInfo), (void*)pPacket->pBuffer);
+        return str;
+    }
+    case GLV_TPI_XGL_xglCreateBufferView:
+    {
+        struct_xglCreateBufferView* pPacket = (struct_xglCreateBufferView*)(pHeader->pBody);
+        snprintf(str, 1024, "xglCreateBufferView(device = %p, pCreateInfo = %p, pView = %p)", (void*)(pPacket->device), (void*)(pPacket->pCreateInfo), (void*)pPacket->pView);
+        return str;
+    }
+    case GLV_TPI_XGL_xglCreateImage:
+    {
+        struct_xglCreateImage* pPacket = (struct_xglCreateImage*)(pHeader->pBody);
+        snprintf(str, 1024, "xglCreateImage(device = %p, pCreateInfo = %p, pImage = %p)", (void*)(pPacket->device), (void*)(pPacket->pCreateInfo), (void*)pPacket->pImage);
+        return str;
+    }
+    case GLV_TPI_XGL_xglSetFastClearColor:
+    {
+        struct_xglSetFastClearColor* pPacket = (struct_xglSetFastClearColor*)(pHeader->pBody);
+        snprintf(str, 1024, "xglSetFastClearColor(image = %p, color = [%f, %f, %f, %f])", (void*)(pPacket->image), pPacket->color[0], pPacket->color[1], pPacket->color[2], pPacket->color[3]);
+        return str;
+    }
+    case GLV_TPI_XGL_xglSetFastClearDepth:
+    {
+        struct_xglSetFastClearDepth* pPacket = (struct_xglSetFastClearDepth*)(pHeader->pBody);
+        snprintf(str, 1024, "xglSetFastClearDepth(image = %p, depth = %f)", (void*)(pPacket->image), pPacket->depth);
+        return str;
+    }
+    case GLV_TPI_XGL_xglGetImageSubresourceInfo:
+    {
+        struct_xglGetImageSubresourceInfo* pPacket = (struct_xglGetImageSubresourceInfo*)(pHeader->pBody);
+        snprintf(str, 1024, "xglGetImageSubresourceInfo(image = %p, pSubresource = %p, infoType = %s, *pDataSize = %zu, pData = %p)", (void*)(pPacket->image), (void*)(pPacket->pSubresource), string_XGL_SUBRESOURCE_INFO_TYPE(pPacket->infoType), (pPacket->pDataSize == NULL) ? 0 : *(pPacket->pDataSize), (void*)(pPacket->pData));
+        return str;
+    }
+    case GLV_TPI_XGL_xglCreateImageView:
+    {
+        struct_xglCreateImageView* pPacket = (struct_xglCreateImageView*)(pHeader->pBody);
+        snprintf(str, 1024, "xglCreateImageView(device = %p, pCreateInfo = %p, pView = %p)", (void*)(pPacket->device), (void*)(pPacket->pCreateInfo), (void*)pPacket->pView);
+        return str;
+    }
+    case GLV_TPI_XGL_xglCreateColorAttachmentView:
+    {
+        struct_xglCreateColorAttachmentView* pPacket = (struct_xglCreateColorAttachmentView*)(pHeader->pBody);
+        snprintf(str, 1024, "xglCreateColorAttachmentView(device = %p, pCreateInfo = %p, pView = %p)", (void*)(pPacket->device), (void*)(pPacket->pCreateInfo), (void*)pPacket->pView);
+        return str;
+    }
+    case GLV_TPI_XGL_xglCreateDepthStencilView:
+    {
+        struct_xglCreateDepthStencilView* pPacket = (struct_xglCreateDepthStencilView*)(pHeader->pBody);
+        snprintf(str, 1024, "xglCreateDepthStencilView(device = %p, pCreateInfo = %p, pView = %p)", (void*)(pPacket->device), (void*)(pPacket->pCreateInfo), (void*)pPacket->pView);
+        return str;
+    }
+    case GLV_TPI_XGL_xglCreateShader:
+    {
+        struct_xglCreateShader* pPacket = (struct_xglCreateShader*)(pHeader->pBody);
+        snprintf(str, 1024, "xglCreateShader(device = %p, pCreateInfo = %p, pShader = %p)", (void*)(pPacket->device), (void*)(pPacket->pCreateInfo), (void*)pPacket->pShader);
+        return str;
+    }
+    case GLV_TPI_XGL_xglCreateGraphicsPipeline:
+    {
+        struct_xglCreateGraphicsPipeline* pPacket = (struct_xglCreateGraphicsPipeline*)(pHeader->pBody);
+        snprintf(str, 1024, "xglCreateGraphicsPipeline(device = %p, pCreateInfo = %p, pPipeline = %p)", (void*)(pPacket->device), (void*)(pPacket->pCreateInfo), (void*)pPacket->pPipeline);
+        return str;
+    }
+    case GLV_TPI_XGL_xglCreateComputePipeline:
+    {
+        struct_xglCreateComputePipeline* pPacket = (struct_xglCreateComputePipeline*)(pHeader->pBody);
+        snprintf(str, 1024, "xglCreateComputePipeline(device = %p, pCreateInfo = %p, pPipeline = %p)", (void*)(pPacket->device), (void*)(pPacket->pCreateInfo), (void*)pPacket->pPipeline);
+        return str;
+    }
+    case GLV_TPI_XGL_xglStorePipeline:
+    {
+        struct_xglStorePipeline* pPacket = (struct_xglStorePipeline*)(pHeader->pBody);
+        snprintf(str, 1024, "xglStorePipeline(pipeline = %p, *pDataSize = %zu, pData = %p)", (void*)(pPacket->pipeline), (pPacket->pDataSize == NULL) ? 0 : *(pPacket->pDataSize), (void*)(pPacket->pData));
+        return str;
+    }
+    case GLV_TPI_XGL_xglLoadPipeline:
+    {
+        struct_xglLoadPipeline* pPacket = (struct_xglLoadPipeline*)(pHeader->pBody);
+        snprintf(str, 1024, "xglLoadPipeline(device = %p, dataSize = %zu, pData = %p, pPipeline = %p)", (void*)(pPacket->device), pPacket->dataSize, (void*)(pPacket->pData), (void*)(pPacket->pPipeline));
+        return str;
+    }
+    case GLV_TPI_XGL_xglCreatePipelineDelta:
+    {
+        struct_xglCreatePipelineDelta* pPacket = (struct_xglCreatePipelineDelta*)(pHeader->pBody);
+        snprintf(str, 1024, "xglCreatePipelineDelta(device = %p, p1 = %p, p2 = %p, delta = %p)", (void*)(pPacket->device), (void*)(pPacket->p1), (void*)(pPacket->p2), (void*)pPacket->delta);
+        return str;
+    }
+    case GLV_TPI_XGL_xglCreateSampler:
+    {
+        struct_xglCreateSampler* pPacket = (struct_xglCreateSampler*)(pHeader->pBody);
+        snprintf(str, 1024, "xglCreateSampler(device = %p, pCreateInfo = %p, pSampler = %p)", (void*)(pPacket->device), (void*)(pPacket->pCreateInfo), (void*)pPacket->pSampler);
+        return str;
+    }
+    case GLV_TPI_XGL_xglCreateDescriptorSetLayout:
+    {
+        struct_xglCreateDescriptorSetLayout* pPacket = (struct_xglCreateDescriptorSetLayout*)(pHeader->pBody);
+        snprintf(str, 1024, "xglCreateDescriptorSetLayout(device = %p, stageFlags = %i, *pSetBindPoints = %i, priorSetLayout = %p, pSetLayoutInfoList = %p, pSetLayout = %p)", (void*)(pPacket->device), pPacket->stageFlags, (pPacket->pSetBindPoints == NULL) ? 0 : *(pPacket->pSetBindPoints), (void*)(pPacket->priorSetLayout), (void*)(pPacket->pSetLayoutInfoList), (void*)pPacket->pSetLayout);
+        return str;
+    }
+    case GLV_TPI_XGL_xglBeginDescriptorRegionUpdate:
+    {
+        struct_xglBeginDescriptorRegionUpdate* pPacket = (struct_xglBeginDescriptorRegionUpdate*)(pHeader->pBody);
+        snprintf(str, 1024, "xglBeginDescriptorRegionUpdate(device = %p, updateMode = %p)", (void*)(pPacket->device), (void*)(pPacket->updateMode));
+        return str;
+    }
+    case GLV_TPI_XGL_xglEndDescriptorRegionUpdate:
+    {
+        struct_xglEndDescriptorRegionUpdate* pPacket = (struct_xglEndDescriptorRegionUpdate*)(pHeader->pBody);
+        snprintf(str, 1024, "xglEndDescriptorRegionUpdate(device = %p, cmd = %p)", (void*)(pPacket->device), (void*)(pPacket->cmd));
+        return str;
+    }
+    case GLV_TPI_XGL_xglCreateDescriptorRegion:
+    {
+        struct_xglCreateDescriptorRegion* pPacket = (struct_xglCreateDescriptorRegion*)(pHeader->pBody);
+        snprintf(str, 1024, "xglCreateDescriptorRegion(device = %p, regionUsage = %p, maxSets = %i, pCreateInfo = %p, pDescriptorRegion = %p)", (void*)(pPacket->device), (void*)(pPacket->regionUsage), pPacket->maxSets, (void*)(pPacket->pCreateInfo), (void*)pPacket->pDescriptorRegion);
+        return str;
+    }
+    case GLV_TPI_XGL_xglClearDescriptorRegion:
+    {
+        struct_xglClearDescriptorRegion* pPacket = (struct_xglClearDescriptorRegion*)(pHeader->pBody);
+        snprintf(str, 1024, "xglClearDescriptorRegion(descriptorRegion = %p)", (void*)(pPacket->descriptorRegion));
+        return str;
+    }
+    case GLV_TPI_XGL_xglAllocDescriptorSets:
+    {
+        struct_xglAllocDescriptorSets* pPacket = (struct_xglAllocDescriptorSets*)(pHeader->pBody);
+        snprintf(str, 1024, "xglAllocDescriptorSets(descriptorRegion = %p, setUsage = %p, count = %i, pSetLayouts = %p, pDescriptorSets = %p, *pCount = %i)", (void*)(pPacket->descriptorRegion), (void*)(pPacket->setUsage), pPacket->count, (void*)(pPacket->pSetLayouts), (void*)(pPacket->pDescriptorSets), (pPacket->pCount == NULL) ? 0 : *(pPacket->pCount));
+        return str;
+    }
+    case GLV_TPI_XGL_xglClearDescriptorSets:
+    {
+        struct_xglClearDescriptorSets* pPacket = (struct_xglClearDescriptorSets*)(pHeader->pBody);
+        snprintf(str, 1024, "xglClearDescriptorSets(descriptorRegion = %p, count = %i, pDescriptorSets = %p)", (void*)(pPacket->descriptorRegion), pPacket->count, (void*)(pPacket->pDescriptorSets));
+        return str;
+    }
+    case GLV_TPI_XGL_xglUpdateDescriptors:
+    {
+        struct_xglUpdateDescriptors* pPacket = (struct_xglUpdateDescriptors*)(pHeader->pBody);
+        snprintf(str, 1024, "xglUpdateDescriptors(descriptorSet = %p, pUpdateChain = %p)", (void*)(pPacket->descriptorSet), (void*)(pPacket->pUpdateChain));
+        return str;
+    }
+    case GLV_TPI_XGL_xglCreateDynamicViewportState:
+    {
+        struct_xglCreateDynamicViewportState* pPacket = (struct_xglCreateDynamicViewportState*)(pHeader->pBody);
+        snprintf(str, 1024, "xglCreateDynamicViewportState(device = %p, pCreateInfo = %p, pState = %p)", (void*)(pPacket->device), (void*)(pPacket->pCreateInfo), (void*)pPacket->pState);
+        return str;
+    }
+    case GLV_TPI_XGL_xglCreateDynamicRasterState:
+    {
+        struct_xglCreateDynamicRasterState* pPacket = (struct_xglCreateDynamicRasterState*)(pHeader->pBody);
+        snprintf(str, 1024, "xglCreateDynamicRasterState(device = %p, pCreateInfo = %p, pState = %p)", (void*)(pPacket->device), (void*)(pPacket->pCreateInfo), (void*)pPacket->pState);
+        return str;
+    }
+    case GLV_TPI_XGL_xglCreateDynamicColorBlendState:
+    {
+        struct_xglCreateDynamicColorBlendState* pPacket = (struct_xglCreateDynamicColorBlendState*)(pHeader->pBody);
+        snprintf(str, 1024, "xglCreateDynamicColorBlendState(device = %p, pCreateInfo = %p, pState = %p)", (void*)(pPacket->device), (void*)(pPacket->pCreateInfo), (void*)pPacket->pState);
+        return str;
+    }
+    case GLV_TPI_XGL_xglCreateDynamicDepthStencilState:
+    {
+        struct_xglCreateDynamicDepthStencilState* pPacket = (struct_xglCreateDynamicDepthStencilState*)(pHeader->pBody);
+        snprintf(str, 1024, "xglCreateDynamicDepthStencilState(device = %p, pCreateInfo = %p, pState = %p)", (void*)(pPacket->device), (void*)(pPacket->pCreateInfo), (void*)pPacket->pState);
+        return str;
+    }
+    case GLV_TPI_XGL_xglCreateCommandBuffer:
+    {
+        struct_xglCreateCommandBuffer* pPacket = (struct_xglCreateCommandBuffer*)(pHeader->pBody);
+        snprintf(str, 1024, "xglCreateCommandBuffer(device = %p, pCreateInfo = %p, pCmdBuffer = %p)", (void*)(pPacket->device), (void*)(pPacket->pCreateInfo), (void*)pPacket->pCmdBuffer);
+        return str;
+    }
+    case GLV_TPI_XGL_xglBeginCommandBuffer:
+    {
+        struct_xglBeginCommandBuffer* pPacket = (struct_xglBeginCommandBuffer*)(pHeader->pBody);
+        snprintf(str, 1024, "xglBeginCommandBuffer(cmdBuffer = %p, pBeginInfo = %p)", (void*)(pPacket->cmdBuffer), (void*)(pPacket->pBeginInfo));
+        return str;
+    }
+    case GLV_TPI_XGL_xglEndCommandBuffer:
+    {
+        struct_xglEndCommandBuffer* pPacket = (struct_xglEndCommandBuffer*)(pHeader->pBody);
+        snprintf(str, 1024, "xglEndCommandBuffer(cmdBuffer = %p)", (void*)(pPacket->cmdBuffer));
+        return str;
+    }
+    case GLV_TPI_XGL_xglResetCommandBuffer:
+    {
+        struct_xglResetCommandBuffer* pPacket = (struct_xglResetCommandBuffer*)(pHeader->pBody);
+        snprintf(str, 1024, "xglResetCommandBuffer(cmdBuffer = %p)", (void*)(pPacket->cmdBuffer));
+        return str;
+    }
+    case GLV_TPI_XGL_xglCmdBindPipeline:
+    {
+        struct_xglCmdBindPipeline* pPacket = (struct_xglCmdBindPipeline*)(pHeader->pBody);
+        snprintf(str, 1024, "xglCmdBindPipeline(cmdBuffer = %p, pipelineBindPoint = %p, pipeline = %p)", (void*)(pPacket->cmdBuffer), (void*)(pPacket->pipelineBindPoint), (void*)(pPacket->pipeline));
+        return str;
+    }
+    case GLV_TPI_XGL_xglCmdBindPipelineDelta:
+    {
+        struct_xglCmdBindPipelineDelta* pPacket = (struct_xglCmdBindPipelineDelta*)(pHeader->pBody);
+        snprintf(str, 1024, "xglCmdBindPipelineDelta(cmdBuffer = %p, pipelineBindPoint = %p, delta = %p)", (void*)(pPacket->cmdBuffer), (void*)(pPacket->pipelineBindPoint), (void*)(pPacket->delta));
+        return str;
+    }
+    case GLV_TPI_XGL_xglCmdBindDynamicStateObject:
+    {
+        struct_xglCmdBindDynamicStateObject* pPacket = (struct_xglCmdBindDynamicStateObject*)(pHeader->pBody);
+        snprintf(str, 1024, "xglCmdBindDynamicStateObject(cmdBuffer = %p, stateBindPoint = %p, state = %p)", (void*)(pPacket->cmdBuffer), (void*)(pPacket->stateBindPoint), (void*)(pPacket->state));
+        return str;
+    }
+    case GLV_TPI_XGL_xglCmdBindDescriptorSet:
+    {
+        struct_xglCmdBindDescriptorSet* pPacket = (struct_xglCmdBindDescriptorSet*)(pHeader->pBody);
+        snprintf(str, 1024, "xglCmdBindDescriptorSet(cmdBuffer = %p, pipelineBindPoint = %p, descriptorSet = %p, *pUserData = %i)", (void*)(pPacket->cmdBuffer), (void*)(pPacket->pipelineBindPoint), (void*)(pPacket->descriptorSet), (pPacket->pUserData == NULL) ? 0 : *(pPacket->pUserData));
+        return str;
+    }
+    case GLV_TPI_XGL_xglCmdBindVertexBuffer:
+    {
+        struct_xglCmdBindVertexBuffer* pPacket = (struct_xglCmdBindVertexBuffer*)(pHeader->pBody);
+        snprintf(str, 1024, "xglCmdBindVertexBuffer(cmdBuffer = %p, buffer = %p, offset = %p, binding = %i)", (void*)(pPacket->cmdBuffer), (void*)(pPacket->buffer), (void*)(pPacket->offset), pPacket->binding);
+        return str;
+    }
+    case GLV_TPI_XGL_xglCmdBindIndexBuffer:
+    {
+        struct_xglCmdBindIndexBuffer* pPacket = (struct_xglCmdBindIndexBuffer*)(pHeader->pBody);
+        snprintf(str, 1024, "xglCmdBindIndexBuffer(cmdBuffer = %p, buffer = %p, offset = %p, indexType = %s)", (void*)(pPacket->cmdBuffer), (void*)(pPacket->buffer), (void*)(pPacket->offset), string_XGL_INDEX_TYPE(pPacket->indexType));
+        return str;
+    }
+    case GLV_TPI_XGL_xglCmdDraw:
+    {
+        struct_xglCmdDraw* pPacket = (struct_xglCmdDraw*)(pHeader->pBody);
+        snprintf(str, 1024, "xglCmdDraw(cmdBuffer = %p, firstVertex = %i, vertexCount = %i, firstInstance = %i, instanceCount = %i)", (void*)(pPacket->cmdBuffer), pPacket->firstVertex, pPacket->vertexCount, pPacket->firstInstance, pPacket->instanceCount);
+        return str;
+    }
+    case GLV_TPI_XGL_xglCmdDrawIndexed:
+    {
+        struct_xglCmdDrawIndexed* pPacket = (struct_xglCmdDrawIndexed*)(pHeader->pBody);
+        snprintf(str, 1024, "xglCmdDrawIndexed(cmdBuffer = %p, firstIndex = %i, indexCount = %i, vertexOffset = %i, firstInstance = %i, instanceCount = %i)", (void*)(pPacket->cmdBuffer), pPacket->firstIndex, pPacket->indexCount, pPacket->vertexOffset, pPacket->firstInstance, pPacket->instanceCount);
+        return str;
+    }
+    case GLV_TPI_XGL_xglCmdDrawIndirect:
+    {
+        struct_xglCmdDrawIndirect* pPacket = (struct_xglCmdDrawIndirect*)(pHeader->pBody);
+        snprintf(str, 1024, "xglCmdDrawIndirect(cmdBuffer = %p, buffer = %p, offset = %p, count = %i, stride = %i)", (void*)(pPacket->cmdBuffer), (void*)(pPacket->buffer), (void*)(pPacket->offset), pPacket->count, pPacket->stride);
+        return str;
+    }
+    case GLV_TPI_XGL_xglCmdDrawIndexedIndirect:
+    {
+        struct_xglCmdDrawIndexedIndirect* pPacket = (struct_xglCmdDrawIndexedIndirect*)(pHeader->pBody);
+        snprintf(str, 1024, "xglCmdDrawIndexedIndirect(cmdBuffer = %p, buffer = %p, offset = %p, count = %i, stride = %i)", (void*)(pPacket->cmdBuffer), (void*)(pPacket->buffer), (void*)(pPacket->offset), pPacket->count, pPacket->stride);
+        return str;
+    }
+    case GLV_TPI_XGL_xglCmdDispatch:
+    {
+        struct_xglCmdDispatch* pPacket = (struct_xglCmdDispatch*)(pHeader->pBody);
+        snprintf(str, 1024, "xglCmdDispatch(cmdBuffer = %p, x = %i, y = %i, z = %i)", (void*)(pPacket->cmdBuffer), pPacket->x, pPacket->y, pPacket->z);
+        return str;
+    }
+    case GLV_TPI_XGL_xglCmdDispatchIndirect:
+    {
+        struct_xglCmdDispatchIndirect* pPacket = (struct_xglCmdDispatchIndirect*)(pHeader->pBody);
+        snprintf(str, 1024, "xglCmdDispatchIndirect(cmdBuffer = %p, buffer = %p, offset = %p)", (void*)(pPacket->cmdBuffer), (void*)(pPacket->buffer), (void*)(pPacket->offset));
+        return str;
+    }
+    case GLV_TPI_XGL_xglCmdCopyBuffer:
+    {
+        struct_xglCmdCopyBuffer* pPacket = (struct_xglCmdCopyBuffer*)(pHeader->pBody);
+        snprintf(str, 1024, "xglCmdCopyBuffer(cmdBuffer = %p, srcBuffer = %p, destBuffer = %p, regionCount = %i, pRegions = %p)", (void*)(pPacket->cmdBuffer), (void*)(pPacket->srcBuffer), (void*)(pPacket->destBuffer), pPacket->regionCount, (void*)(pPacket->pRegions));
+        return str;
+    }
+    case GLV_TPI_XGL_xglCmdCopyImage:
+    {
+        struct_xglCmdCopyImage* pPacket = (struct_xglCmdCopyImage*)(pHeader->pBody);
+        snprintf(str, 1024, "xglCmdCopyImage(cmdBuffer = %p, srcImage = %p, destImage = %p, regionCount = %i, pRegions = %p)", (void*)(pPacket->cmdBuffer), (void*)(pPacket->srcImage), (void*)(pPacket->destImage), pPacket->regionCount, (void*)(pPacket->pRegions));
+        return str;
+    }
+    case GLV_TPI_XGL_xglCmdCopyBufferToImage:
+    {
+        struct_xglCmdCopyBufferToImage* pPacket = (struct_xglCmdCopyBufferToImage*)(pHeader->pBody);
+        snprintf(str, 1024, "xglCmdCopyBufferToImage(cmdBuffer = %p, srcBuffer = %p, destImage = %p, regionCount = %i, pRegions = %p)", (void*)(pPacket->cmdBuffer), (void*)(pPacket->srcBuffer), (void*)(pPacket->destImage), pPacket->regionCount, (void*)(pPacket->pRegions));
+        return str;
+    }
+    case GLV_TPI_XGL_xglCmdCopyImageToBuffer:
+    {
+        struct_xglCmdCopyImageToBuffer* pPacket = (struct_xglCmdCopyImageToBuffer*)(pHeader->pBody);
+        snprintf(str, 1024, "xglCmdCopyImageToBuffer(cmdBuffer = %p, srcImage = %p, destBuffer = %p, regionCount = %i, pRegions = %p)", (void*)(pPacket->cmdBuffer), (void*)(pPacket->srcImage), (void*)(pPacket->destBuffer), pPacket->regionCount, (void*)(pPacket->pRegions));
+        return str;
+    }
+    case GLV_TPI_XGL_xglCmdCloneImageData:
+    {
+        struct_xglCmdCloneImageData* pPacket = (struct_xglCmdCloneImageData*)(pHeader->pBody);
+        snprintf(str, 1024, "xglCmdCloneImageData(cmdBuffer = %p, srcImage = %p, srcImageLayout = %p, destImage = %p, destImageLayout = %p)", (void*)(pPacket->cmdBuffer), (void*)(pPacket->srcImage), (void*)(pPacket->srcImageLayout), (void*)(pPacket->destImage), (void*)(pPacket->destImageLayout));
+        return str;
+    }
+    case GLV_TPI_XGL_xglCmdUpdateBuffer:
+    {
+        struct_xglCmdUpdateBuffer* pPacket = (struct_xglCmdUpdateBuffer*)(pHeader->pBody);
+        snprintf(str, 1024, "xglCmdUpdateBuffer(cmdBuffer = %p, destBuffer = %p, destOffset = %p, dataSize = %p, *pData = %i)", (void*)(pPacket->cmdBuffer), (void*)(pPacket->destBuffer), (void*)(pPacket->destOffset), (void*)(pPacket->dataSize), (pPacket->pData == NULL) ? 0 : *(pPacket->pData));
+        return str;
+    }
+    case GLV_TPI_XGL_xglCmdFillBuffer:
+    {
+        struct_xglCmdFillBuffer* pPacket = (struct_xglCmdFillBuffer*)(pHeader->pBody);
+        snprintf(str, 1024, "xglCmdFillBuffer(cmdBuffer = %p, destBuffer = %p, destOffset = %p, fillSize = %p, data = %i)", (void*)(pPacket->cmdBuffer), (void*)(pPacket->destBuffer), (void*)(pPacket->destOffset), (void*)(pPacket->fillSize), pPacket->data);
+        return str;
+    }
+    case GLV_TPI_XGL_xglCmdClearColorImage:
+    {
+        struct_xglCmdClearColorImage* pPacket = (struct_xglCmdClearColorImage*)(pHeader->pBody);
+        snprintf(str, 1024, "xglCmdClearColorImage(cmdBuffer = %p, image = %p, color = [%f, %f, %f, %f], rangeCount = %i, pRanges = %p)", (void*)(pPacket->cmdBuffer), (void*)(pPacket->image), pPacket->color[0], pPacket->color[1], pPacket->color[2], pPacket->color[3], pPacket->rangeCount, (void*)(pPacket->pRanges));
+        return str;
+    }
+    case GLV_TPI_XGL_xglCmdClearColorImageRaw:
+    {
+        struct_xglCmdClearColorImageRaw* pPacket = (struct_xglCmdClearColorImageRaw*)(pHeader->pBody);
+        snprintf(str, 1024, "xglCmdClearColorImageRaw(cmdBuffer = %p, image = %p, color = [%i, %i, %i, %i], rangeCount = %i, pRanges = %p)", (void*)(pPacket->cmdBuffer), (void*)(pPacket->image), pPacket->color[0], pPacket->color[1], pPacket->color[2], pPacket->color[3], pPacket->rangeCount, (void*)(pPacket->pRanges));
+        return str;
+    }
+    case GLV_TPI_XGL_xglCmdClearDepthStencil:
+    {
+        struct_xglCmdClearDepthStencil* pPacket = (struct_xglCmdClearDepthStencil*)(pHeader->pBody);
+        snprintf(str, 1024, "xglCmdClearDepthStencil(cmdBuffer = %p, image = %p, depth = %f, stencil = %i, rangeCount = %i, pRanges = %p)", (void*)(pPacket->cmdBuffer), (void*)(pPacket->image), pPacket->depth, pPacket->stencil, pPacket->rangeCount, (void*)(pPacket->pRanges));
+        return str;
+    }
+    case GLV_TPI_XGL_xglCmdResolveImage:
+    {
+        struct_xglCmdResolveImage* pPacket = (struct_xglCmdResolveImage*)(pHeader->pBody);
+        snprintf(str, 1024, "xglCmdResolveImage(cmdBuffer = %p, srcImage = %p, destImage = %p, rectCount = %i, pRects = %p)", (void*)(pPacket->cmdBuffer), (void*)(pPacket->srcImage), (void*)(pPacket->destImage), pPacket->rectCount, (void*)(pPacket->pRects));
+        return str;
+    }
+    case GLV_TPI_XGL_xglCmdSetEvent:
+    {
+        struct_xglCmdSetEvent* pPacket = (struct_xglCmdSetEvent*)(pHeader->pBody);
+        snprintf(str, 1024, "xglCmdSetEvent(cmdBuffer = %p, event = %p, pipeEvent = %p)", (void*)(pPacket->cmdBuffer), (void*)(pPacket->event), (void*)(pPacket->pipeEvent));
+        return str;
+    }
+    case GLV_TPI_XGL_xglCmdResetEvent:
+    {
+        struct_xglCmdResetEvent* pPacket = (struct_xglCmdResetEvent*)(pHeader->pBody);
+        snprintf(str, 1024, "xglCmdResetEvent(cmdBuffer = %p, event = %p)", (void*)(pPacket->cmdBuffer), (void*)(pPacket->event));
+        return str;
+    }
+    case GLV_TPI_XGL_xglCmdWaitEvents:
+    {
+        struct_xglCmdWaitEvents* pPacket = (struct_xglCmdWaitEvents*)(pHeader->pBody);
+        snprintf(str, 1024, "xglCmdWaitEvents(cmdBuffer = %p, pWaitInfo = %p)", (void*)(pPacket->cmdBuffer), (void*)(pPacket->pWaitInfo));
+        return str;
+    }
+    case GLV_TPI_XGL_xglCmdPipelineBarrier:
+    {
+        struct_xglCmdPipelineBarrier* pPacket = (struct_xglCmdPipelineBarrier*)(pHeader->pBody);
+        snprintf(str, 1024, "xglCmdPipelineBarrier(cmdBuffer = %p, pBarrier = %p)", (void*)(pPacket->cmdBuffer), (void*)(pPacket->pBarrier));
+        return str;
+    }
+    case GLV_TPI_XGL_xglCmdBeginQuery:
+    {
+        struct_xglCmdBeginQuery* pPacket = (struct_xglCmdBeginQuery*)(pHeader->pBody);
+        snprintf(str, 1024, "xglCmdBeginQuery(cmdBuffer = %p, queryPool = %p, slot = %i, flags = %i)", (void*)(pPacket->cmdBuffer), (void*)(pPacket->queryPool), pPacket->slot, pPacket->flags);
+        return str;
+    }
+    case GLV_TPI_XGL_xglCmdEndQuery:
+    {
+        struct_xglCmdEndQuery* pPacket = (struct_xglCmdEndQuery*)(pHeader->pBody);
+        snprintf(str, 1024, "xglCmdEndQuery(cmdBuffer = %p, queryPool = %p, slot = %i)", (void*)(pPacket->cmdBuffer), (void*)(pPacket->queryPool), pPacket->slot);
+        return str;
+    }
+    case GLV_TPI_XGL_xglCmdResetQueryPool:
+    {
+        struct_xglCmdResetQueryPool* pPacket = (struct_xglCmdResetQueryPool*)(pHeader->pBody);
+        snprintf(str, 1024, "xglCmdResetQueryPool(cmdBuffer = %p, queryPool = %p, startQuery = %i, queryCount = %i)", (void*)(pPacket->cmdBuffer), (void*)(pPacket->queryPool), pPacket->startQuery, pPacket->queryCount);
+        return str;
+    }
+    case GLV_TPI_XGL_xglCmdWriteTimestamp:
+    {
+        struct_xglCmdWriteTimestamp* pPacket = (struct_xglCmdWriteTimestamp*)(pHeader->pBody);
+        snprintf(str, 1024, "xglCmdWriteTimestamp(cmdBuffer = %p, timestampType = %s, destBuffer = %p, destOffset = %p)", (void*)(pPacket->cmdBuffer), string_XGL_TIMESTAMP_TYPE(pPacket->timestampType), (void*)(pPacket->destBuffer), (void*)(pPacket->destOffset));
+        return str;
+    }
+    case GLV_TPI_XGL_xglCmdInitAtomicCounters:
+    {
+        struct_xglCmdInitAtomicCounters* pPacket = (struct_xglCmdInitAtomicCounters*)(pHeader->pBody);
+        snprintf(str, 1024, "xglCmdInitAtomicCounters(cmdBuffer = %p, pipelineBindPoint = %p, startCounter = %i, counterCount = %i, *pData = %i)", (void*)(pPacket->cmdBuffer), (void*)(pPacket->pipelineBindPoint), pPacket->startCounter, pPacket->counterCount, (pPacket->pData == NULL) ? 0 : *(pPacket->pData));
+        return str;
+    }
+    case GLV_TPI_XGL_xglCmdLoadAtomicCounters:
+    {
+        struct_xglCmdLoadAtomicCounters* pPacket = (struct_xglCmdLoadAtomicCounters*)(pHeader->pBody);
+        snprintf(str, 1024, "xglCmdLoadAtomicCounters(cmdBuffer = %p, pipelineBindPoint = %p, startCounter = %i, counterCount = %i, srcBuffer = %p, srcOffset = %p)", (void*)(pPacket->cmdBuffer), (void*)(pPacket->pipelineBindPoint), pPacket->startCounter, pPacket->counterCount, (void*)(pPacket->srcBuffer), (void*)(pPacket->srcOffset));
+        return str;
+    }
+    case GLV_TPI_XGL_xglCmdSaveAtomicCounters:
+    {
+        struct_xglCmdSaveAtomicCounters* pPacket = (struct_xglCmdSaveAtomicCounters*)(pHeader->pBody);
+        snprintf(str, 1024, "xglCmdSaveAtomicCounters(cmdBuffer = %p, pipelineBindPoint = %p, startCounter = %i, counterCount = %i, destBuffer = %p, destOffset = %p)", (void*)(pPacket->cmdBuffer), (void*)(pPacket->pipelineBindPoint), pPacket->startCounter, pPacket->counterCount, (void*)(pPacket->destBuffer), (void*)(pPacket->destOffset));
+        return str;
+    }
+    case GLV_TPI_XGL_xglCreateFramebuffer:
+    {
+        struct_xglCreateFramebuffer* pPacket = (struct_xglCreateFramebuffer*)(pHeader->pBody);
+        snprintf(str, 1024, "xglCreateFramebuffer(device = %p, pCreateInfo = %p, pFramebuffer = %p)", (void*)(pPacket->device), (void*)(pPacket->pCreateInfo), (void*)pPacket->pFramebuffer);
+        return str;
+    }
+    case GLV_TPI_XGL_xglCreateRenderPass:
+    {
+        struct_xglCreateRenderPass* pPacket = (struct_xglCreateRenderPass*)(pHeader->pBody);
+        snprintf(str, 1024, "xglCreateRenderPass(device = %p, pCreateInfo = %p, pRenderPass = %p)", (void*)(pPacket->device), (void*)(pPacket->pCreateInfo), (void*)pPacket->pRenderPass);
+        return str;
+    }
+    case GLV_TPI_XGL_xglCmdBeginRenderPass:
+    {
+        struct_xglCmdBeginRenderPass* pPacket = (struct_xglCmdBeginRenderPass*)(pHeader->pBody);
+        snprintf(str, 1024, "xglCmdBeginRenderPass(cmdBuffer = %p, renderPass = %p)", (void*)(pPacket->cmdBuffer), (void*)(pPacket->renderPass));
+        return str;
+    }
+    case GLV_TPI_XGL_xglCmdEndRenderPass:
+    {
+        struct_xglCmdEndRenderPass* pPacket = (struct_xglCmdEndRenderPass*)(pHeader->pBody);
+        snprintf(str, 1024, "xglCmdEndRenderPass(cmdBuffer = %p, renderPass = %p)", (void*)(pPacket->cmdBuffer), (void*)(pPacket->renderPass));
+        return str;
+    }
+    case GLV_TPI_XGL_xglDbgSetValidationLevel:
+    {
+        struct_xglDbgSetValidationLevel* pPacket = (struct_xglDbgSetValidationLevel*)(pHeader->pBody);
+        snprintf(str, 1024, "xglDbgSetValidationLevel(device = %p, validationLevel = %p)", (void*)(pPacket->device), (void*)(pPacket->validationLevel));
+        return str;
+    }
+    case GLV_TPI_XGL_xglDbgRegisterMsgCallback:
+    {
+        struct_xglDbgRegisterMsgCallback* pPacket = (struct_xglDbgRegisterMsgCallback*)(pHeader->pBody);
+        snprintf(str, 1024, "xglDbgRegisterMsgCallback(pfnMsgCallback = %p, pUserData = %p)", (void*)(pPacket->pfnMsgCallback), (void*)(pPacket->pUserData));
+        return str;
+    }
+    case GLV_TPI_XGL_xglDbgUnregisterMsgCallback:
+    {
+        struct_xglDbgUnregisterMsgCallback* pPacket = (struct_xglDbgUnregisterMsgCallback*)(pHeader->pBody);
+        snprintf(str, 1024, "xglDbgUnregisterMsgCallback(pfnMsgCallback = %p)", (void*)(pPacket->pfnMsgCallback));
+        return str;
+    }
+    case GLV_TPI_XGL_xglDbgSetMessageFilter:
+    {
+        struct_xglDbgSetMessageFilter* pPacket = (struct_xglDbgSetMessageFilter*)(pHeader->pBody);
+        snprintf(str, 1024, "xglDbgSetMessageFilter(device = %p, msgCode = %i, filter = %p)", (void*)(pPacket->device), pPacket->msgCode, (void*)(pPacket->filter));
+        return str;
+    }
+    case GLV_TPI_XGL_xglDbgSetObjectTag:
+    {
+        struct_xglDbgSetObjectTag* pPacket = (struct_xglDbgSetObjectTag*)(pHeader->pBody);
+        snprintf(str, 1024, "xglDbgSetObjectTag(object = %p, tagSize = %zu, pTag = %p)", (void*)(pPacket->object), pPacket->tagSize, (void*)(pPacket->pTag));
+        return str;
+    }
+    case GLV_TPI_XGL_xglDbgSetGlobalOption:
+    {
+        struct_xglDbgSetGlobalOption* pPacket = (struct_xglDbgSetGlobalOption*)(pHeader->pBody);
+        snprintf(str, 1024, "xglDbgSetGlobalOption(dbgOption = %p, dataSize = %zu, pData = %p)", (void*)(pPacket->dbgOption), pPacket->dataSize, (void*)(pPacket->pData));
+        return str;
+    }
+    case GLV_TPI_XGL_xglDbgSetDeviceOption:
+    {
+        struct_xglDbgSetDeviceOption* pPacket = (struct_xglDbgSetDeviceOption*)(pHeader->pBody);
+        snprintf(str, 1024, "xglDbgSetDeviceOption(device = %p, dbgOption = %p, dataSize = %zu, pData = %p)", (void*)(pPacket->device), (void*)(pPacket->dbgOption), pPacket->dataSize, (void*)(pPacket->pData));
+        return str;
+    }
+    case GLV_TPI_XGL_xglCmdDbgMarkerBegin:
+    {
+        struct_xglCmdDbgMarkerBegin* pPacket = (struct_xglCmdDbgMarkerBegin*)(pHeader->pBody);
+        snprintf(str, 1024, "xglCmdDbgMarkerBegin(cmdBuffer = %p, pMarker = %p)", (void*)(pPacket->cmdBuffer), (void*)(pPacket->pMarker));
+        return str;
+    }
+    case GLV_TPI_XGL_xglCmdDbgMarkerEnd:
+    {
+        struct_xglCmdDbgMarkerEnd* pPacket = (struct_xglCmdDbgMarkerEnd*)(pHeader->pBody);
+        snprintf(str, 1024, "xglCmdDbgMarkerEnd(cmdBuffer = %p)", (void*)(pPacket->cmdBuffer));
+        return str;
+    }
+    case GLV_TPI_XGL_xglWsiX11AssociateConnection:
+    {
+        struct_xglWsiX11AssociateConnection* pPacket = (struct_xglWsiX11AssociateConnection*)(pHeader->pBody);
+        snprintf(str, 1024, "xglWsiX11AssociateConnection(gpu = %p, pConnectionInfo = %p)", (void*)(pPacket->gpu), (void*)(pPacket->pConnectionInfo));
+        return str;
+    }
+    case GLV_TPI_XGL_xglWsiX11GetMSC:
+    {
+        struct_xglWsiX11GetMSC* pPacket = (struct_xglWsiX11GetMSC*)(pHeader->pBody);
+        snprintf(str, 1024, "xglWsiX11GetMSC(device = %p, window = %i, crtc = %u, *pMsc = %lu)", (void*)(pPacket->device), pPacket->window, pPacket->crtc, (pPacket->pMsc == NULL) ? 0 : *(pPacket->pMsc));
+        return str;
+    }
+    case GLV_TPI_XGL_xglWsiX11CreatePresentableImage:
+    {
+        struct_xglWsiX11CreatePresentableImage* pPacket = (struct_xglWsiX11CreatePresentableImage*)(pHeader->pBody);
+        snprintf(str, 1024, "xglWsiX11CreatePresentableImage(device = %p, pCreateInfo = %p, pImage = %p, pMem = %p)", (void*)(pPacket->device), (void*)(pPacket->pCreateInfo), (void*)(pPacket->pImage), (void*)pPacket->pMem);
+        return str;
+    }
+    case GLV_TPI_XGL_xglWsiX11QueuePresent:
+    {
+        struct_xglWsiX11QueuePresent* pPacket = (struct_xglWsiX11QueuePresent*)(pHeader->pBody);
+        snprintf(str, 1024, "xglWsiX11QueuePresent(queue = %p, pPresentInfo = %p, fence = %p)", (void*)(pPacket->queue), (void*)(pPacket->pPresentInfo), (void*)(pPacket->fence));
+        return str;
+    }
+    default:
+        return NULL;
+    }
+};
+
+static glv_trace_packet_header* interpret_trace_packet_xgl(glv_trace_packet_header* pHeader)
+{
+    if (pHeader == NULL)
+    {
+        return NULL;
+    }
+    switch (pHeader->packet_id)
+    {
+        case GLV_TPI_XGL_xglApiVersion:
+        {
+            return interpret_body_as_xglApiVersion(pHeader, TRUE)->header;
+        }
+        case GLV_TPI_XGL_xglCreateInstance:
+        {
+            return interpret_body_as_xglCreateInstance(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglDestroyInstance:
+        {
+            return interpret_body_as_xglDestroyInstance(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglEnumerateGpus:
+        {
+            return interpret_body_as_xglEnumerateGpus(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglGetGpuInfo:
+        {
+            return interpret_body_as_xglGetGpuInfo(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglGetProcAddr:
+        {
+            return interpret_body_as_xglGetProcAddr(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglCreateDevice:
+        {
+            return interpret_body_as_xglCreateDevice(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglDestroyDevice:
+        {
+            return interpret_body_as_xglDestroyDevice(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglGetExtensionSupport:
+        {
+            return interpret_body_as_xglGetExtensionSupport(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglEnumerateLayers:
+        {
+            return interpret_body_as_xglEnumerateLayers(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglGetDeviceQueue:
+        {
+            return interpret_body_as_xglGetDeviceQueue(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglQueueSubmit:
+        {
+            return interpret_body_as_xglQueueSubmit(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglQueueSetGlobalMemReferences:
+        {
+            return interpret_body_as_xglQueueSetGlobalMemReferences(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglQueueWaitIdle:
+        {
+            return interpret_body_as_xglQueueWaitIdle(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglDeviceWaitIdle:
+        {
+            return interpret_body_as_xglDeviceWaitIdle(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglAllocMemory:
+        {
+            return interpret_body_as_xglAllocMemory(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglFreeMemory:
+        {
+            return interpret_body_as_xglFreeMemory(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglSetMemoryPriority:
+        {
+            return interpret_body_as_xglSetMemoryPriority(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglMapMemory:
+        {
+            return interpret_body_as_xglMapMemory(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglUnmapMemory:
+        {
+            return interpret_body_as_xglUnmapMemory(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglPinSystemMemory:
+        {
+            return interpret_body_as_xglPinSystemMemory(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglGetMultiGpuCompatibility:
+        {
+            return interpret_body_as_xglGetMultiGpuCompatibility(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglOpenSharedMemory:
+        {
+            return interpret_body_as_xglOpenSharedMemory(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglOpenSharedQueueSemaphore:
+        {
+            return interpret_body_as_xglOpenSharedQueueSemaphore(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglOpenPeerMemory:
+        {
+            return interpret_body_as_xglOpenPeerMemory(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglOpenPeerImage:
+        {
+            return interpret_body_as_xglOpenPeerImage(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglDestroyObject:
+        {
+            return interpret_body_as_xglDestroyObject(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglGetObjectInfo:
+        {
+            return interpret_body_as_xglGetObjectInfo(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglBindObjectMemory:
+        {
+            return interpret_body_as_xglBindObjectMemory(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglBindObjectMemoryRange:
+        {
+            return interpret_body_as_xglBindObjectMemoryRange(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglBindImageMemoryRange:
+        {
+            return interpret_body_as_xglBindImageMemoryRange(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglCreateFence:
+        {
+            return interpret_body_as_xglCreateFence(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglGetFenceStatus:
+        {
+            return interpret_body_as_xglGetFenceStatus(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglWaitForFences:
+        {
+            return interpret_body_as_xglWaitForFences(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglCreateQueueSemaphore:
+        {
+            return interpret_body_as_xglCreateQueueSemaphore(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglSignalQueueSemaphore:
+        {
+            return interpret_body_as_xglSignalQueueSemaphore(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglWaitQueueSemaphore:
+        {
+            return interpret_body_as_xglWaitQueueSemaphore(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglCreateEvent:
+        {
+            return interpret_body_as_xglCreateEvent(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglGetEventStatus:
+        {
+            return interpret_body_as_xglGetEventStatus(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglSetEvent:
+        {
+            return interpret_body_as_xglSetEvent(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglResetEvent:
+        {
+            return interpret_body_as_xglResetEvent(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglCreateQueryPool:
+        {
+            return interpret_body_as_xglCreateQueryPool(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglGetQueryPoolResults:
+        {
+            return interpret_body_as_xglGetQueryPoolResults(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglGetFormatInfo:
+        {
+            return interpret_body_as_xglGetFormatInfo(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglCreateBuffer:
+        {
+            return interpret_body_as_xglCreateBuffer(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglCreateBufferView:
+        {
+            return interpret_body_as_xglCreateBufferView(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglCreateImage:
+        {
+            return interpret_body_as_xglCreateImage(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglSetFastClearColor:
+        {
+            return interpret_body_as_xglSetFastClearColor(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglSetFastClearDepth:
+        {
+            return interpret_body_as_xglSetFastClearDepth(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglGetImageSubresourceInfo:
+        {
+            return interpret_body_as_xglGetImageSubresourceInfo(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglCreateImageView:
+        {
+            return interpret_body_as_xglCreateImageView(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglCreateColorAttachmentView:
+        {
+            return interpret_body_as_xglCreateColorAttachmentView(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglCreateDepthStencilView:
+        {
+            return interpret_body_as_xglCreateDepthStencilView(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglCreateShader:
+        {
+            return interpret_body_as_xglCreateShader(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglCreateGraphicsPipeline:
+        {
+            return interpret_body_as_xglCreateGraphicsPipeline(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglCreateComputePipeline:
+        {
+            return interpret_body_as_xglCreateComputePipeline(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglStorePipeline:
+        {
+            return interpret_body_as_xglStorePipeline(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglLoadPipeline:
+        {
+            return interpret_body_as_xglLoadPipeline(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglCreatePipelineDelta:
+        {
+            return interpret_body_as_xglCreatePipelineDelta(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglCreateSampler:
+        {
+            return interpret_body_as_xglCreateSampler(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglCreateDescriptorSetLayout:
+        {
+            return interpret_body_as_xglCreateDescriptorSetLayout(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglBeginDescriptorRegionUpdate:
+        {
+            return interpret_body_as_xglBeginDescriptorRegionUpdate(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglEndDescriptorRegionUpdate:
+        {
+            return interpret_body_as_xglEndDescriptorRegionUpdate(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglCreateDescriptorRegion:
+        {
+            return interpret_body_as_xglCreateDescriptorRegion(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglClearDescriptorRegion:
+        {
+            return interpret_body_as_xglClearDescriptorRegion(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglAllocDescriptorSets:
+        {
+            return interpret_body_as_xglAllocDescriptorSets(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglClearDescriptorSets:
+        {
+            return interpret_body_as_xglClearDescriptorSets(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglUpdateDescriptors:
+        {
+            return interpret_body_as_xglUpdateDescriptors(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglCreateDynamicViewportState:
+        {
+            return interpret_body_as_xglCreateDynamicViewportState(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglCreateDynamicRasterState:
+        {
+            return interpret_body_as_xglCreateDynamicRasterState(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglCreateDynamicColorBlendState:
+        {
+            return interpret_body_as_xglCreateDynamicColorBlendState(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglCreateDynamicDepthStencilState:
+        {
+            return interpret_body_as_xglCreateDynamicDepthStencilState(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglCreateCommandBuffer:
+        {
+            return interpret_body_as_xglCreateCommandBuffer(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglBeginCommandBuffer:
+        {
+            return interpret_body_as_xglBeginCommandBuffer(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglEndCommandBuffer:
+        {
+            return interpret_body_as_xglEndCommandBuffer(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglResetCommandBuffer:
+        {
+            return interpret_body_as_xglResetCommandBuffer(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglCmdBindPipeline:
+        {
+            return interpret_body_as_xglCmdBindPipeline(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglCmdBindPipelineDelta:
+        {
+            return interpret_body_as_xglCmdBindPipelineDelta(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglCmdBindDynamicStateObject:
+        {
+            return interpret_body_as_xglCmdBindDynamicStateObject(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglCmdBindDescriptorSet:
+        {
+            return interpret_body_as_xglCmdBindDescriptorSet(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglCmdBindVertexBuffer:
+        {
+            return interpret_body_as_xglCmdBindVertexBuffer(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglCmdBindIndexBuffer:
+        {
+            return interpret_body_as_xglCmdBindIndexBuffer(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglCmdDraw:
+        {
+            return interpret_body_as_xglCmdDraw(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglCmdDrawIndexed:
+        {
+            return interpret_body_as_xglCmdDrawIndexed(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglCmdDrawIndirect:
+        {
+            return interpret_body_as_xglCmdDrawIndirect(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglCmdDrawIndexedIndirect:
+        {
+            return interpret_body_as_xglCmdDrawIndexedIndirect(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglCmdDispatch:
+        {
+            return interpret_body_as_xglCmdDispatch(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglCmdDispatchIndirect:
+        {
+            return interpret_body_as_xglCmdDispatchIndirect(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglCmdCopyBuffer:
+        {
+            return interpret_body_as_xglCmdCopyBuffer(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglCmdCopyImage:
+        {
+            return interpret_body_as_xglCmdCopyImage(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglCmdCopyBufferToImage:
+        {
+            return interpret_body_as_xglCmdCopyBufferToImage(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglCmdCopyImageToBuffer:
+        {
+            return interpret_body_as_xglCmdCopyImageToBuffer(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglCmdCloneImageData:
+        {
+            return interpret_body_as_xglCmdCloneImageData(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglCmdUpdateBuffer:
+        {
+            return interpret_body_as_xglCmdUpdateBuffer(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglCmdFillBuffer:
+        {
+            return interpret_body_as_xglCmdFillBuffer(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglCmdClearColorImage:
+        {
+            return interpret_body_as_xglCmdClearColorImage(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglCmdClearColorImageRaw:
+        {
+            return interpret_body_as_xglCmdClearColorImageRaw(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglCmdClearDepthStencil:
+        {
+            return interpret_body_as_xglCmdClearDepthStencil(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglCmdResolveImage:
+        {
+            return interpret_body_as_xglCmdResolveImage(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglCmdSetEvent:
+        {
+            return interpret_body_as_xglCmdSetEvent(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglCmdResetEvent:
+        {
+            return interpret_body_as_xglCmdResetEvent(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglCmdWaitEvents:
+        {
+            return interpret_body_as_xglCmdWaitEvents(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglCmdPipelineBarrier:
+        {
+            return interpret_body_as_xglCmdPipelineBarrier(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglCmdBeginQuery:
+        {
+            return interpret_body_as_xglCmdBeginQuery(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglCmdEndQuery:
+        {
+            return interpret_body_as_xglCmdEndQuery(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglCmdResetQueryPool:
+        {
+            return interpret_body_as_xglCmdResetQueryPool(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglCmdWriteTimestamp:
+        {
+            return interpret_body_as_xglCmdWriteTimestamp(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglCmdInitAtomicCounters:
+        {
+            return interpret_body_as_xglCmdInitAtomicCounters(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglCmdLoadAtomicCounters:
+        {
+            return interpret_body_as_xglCmdLoadAtomicCounters(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglCmdSaveAtomicCounters:
+        {
+            return interpret_body_as_xglCmdSaveAtomicCounters(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglCreateFramebuffer:
+        {
+            return interpret_body_as_xglCreateFramebuffer(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglCreateRenderPass:
+        {
+            return interpret_body_as_xglCreateRenderPass(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglCmdBeginRenderPass:
+        {
+            return interpret_body_as_xglCmdBeginRenderPass(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglCmdEndRenderPass:
+        {
+            return interpret_body_as_xglCmdEndRenderPass(pHeader)->header;
+        }
+        case GLV_TPI_XGL_xglDbgSetValidationLevel:
+        {
+            return interpret_body_as_xglDbgSetValidationLevel(pHeader)->pHeader;
+        }
+        case GLV_TPI_XGL_xglDbgRegisterMsgCallback:
+        {
+            return interpret_body_as_xglDbgRegisterMsgCallback(pHeader)->pHeader;
+        }
+        case GLV_TPI_XGL_xglDbgUnregisterMsgCallback:
+        {
+            return interpret_body_as_xglDbgUnregisterMsgCallback(pHeader)->pHeader;
+        }
+        case GLV_TPI_XGL_xglDbgSetMessageFilter:
+        {
+            return interpret_body_as_xglDbgSetMessageFilter(pHeader)->pHeader;
+        }
+        case GLV_TPI_XGL_xglDbgSetObjectTag:
+        {
+            return interpret_body_as_xglDbgSetObjectTag(pHeader)->pHeader;
+        }
+        case GLV_TPI_XGL_xglDbgSetGlobalOption:
+        {
+            return interpret_body_as_xglDbgSetGlobalOption(pHeader)->pHeader;
+        }
+        case GLV_TPI_XGL_xglDbgSetDeviceOption:
+        {
+            return interpret_body_as_xglDbgSetDeviceOption(pHeader)->pHeader;
+        }
+        case GLV_TPI_XGL_xglCmdDbgMarkerBegin:
+        {
+            return interpret_body_as_xglCmdDbgMarkerBegin(pHeader)->pHeader;
+        }
+        case GLV_TPI_XGL_xglCmdDbgMarkerEnd:
+        {
+            return interpret_body_as_xglCmdDbgMarkerEnd(pHeader)->pHeader;
+        }
+        case GLV_TPI_XGL_xglWsiX11AssociateConnection:
+        {
+            return interpret_body_as_xglWsiX11AssociateConnection(pHeader)->pHeader;
+        }
+        case GLV_TPI_XGL_xglWsiX11GetMSC:
+        {
+            return interpret_body_as_xglWsiX11GetMSC(pHeader)->pHeader;
+        }
+        case GLV_TPI_XGL_xglWsiX11CreatePresentableImage:
+        {
+            return interpret_body_as_xglWsiX11CreatePresentableImage(pHeader)->pHeader;
+        }
+        case GLV_TPI_XGL_xglWsiX11QueuePresent:
+        {
+            return interpret_body_as_xglWsiX11QueuePresent(pHeader)->pHeader;
+        }
+        default:
+            return NULL;
+    }
+    return NULL;
+}
diff --git a/tools/glave/src/glv_extensions/glvtrace_xgl/codegen/glvtrace_xgl_xgl.c b/tools/glave/src/glv_extensions/glvtrace_xgl/codegen/glvtrace_xgl_xgl.c
new file mode 100644
index 0000000..e97eb2a
--- /dev/null
+++ b/tools/glave/src/glv_extensions/glvtrace_xgl/codegen/glvtrace_xgl_xgl.c
@@ -0,0 +1,3929 @@
+/* THIS FILE IS GENERATED.  DO NOT EDIT. */
+
+/*
+ * XGL
+ *
+ * Copyright (C) 2014 LunarG, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+#include "glv_platform.h"
+#include "glv_common.h"
+#include "glvtrace_xgl_xgl.h"
+#include "glvtrace_xgl_xgldbg.h"
+#include "glvtrace_xgl_xglwsix11ext.h"
+#include "glv_interconnect.h"
+#include "glv_filelike.h"
+#include "xgl_struct_size_helper.h"
+#ifdef WIN32
+#include "mhook/mhook-lib/mhook.h"
+#endif
+#include "glv_trace_packet_utils.h"
+#include <stdio.h>
+
+
+static XGL_RESULT( XGLAPI * real_xglCreateInstance)(
+    const XGL_APPLICATION_INFO* pAppInfo,
+    const XGL_ALLOC_CALLBACKS* pAllocCb,
+    XGL_INSTANCE* pInstance) = xglCreateInstance;
+
+static XGL_RESULT( XGLAPI * real_xglDestroyInstance)(
+    XGL_INSTANCE instance) = xglDestroyInstance;
+
+static XGL_RESULT( XGLAPI * real_xglEnumerateGpus)(
+    XGL_INSTANCE instance,
+    uint32_t maxGpus,
+    uint32_t* pGpuCount,
+    XGL_PHYSICAL_GPU* pGpus) = xglEnumerateGpus;
+
+static XGL_RESULT( XGLAPI * real_xglGetGpuInfo)(
+    XGL_PHYSICAL_GPU gpu,
+    XGL_PHYSICAL_GPU_INFO_TYPE infoType,
+    size_t* pDataSize,
+    void* pData) = xglGetGpuInfo;
+
+static void*( XGLAPI * real_xglGetProcAddr)(
+    XGL_PHYSICAL_GPU gpu,
+    const char* pName) = xglGetProcAddr;
+
+static XGL_RESULT( XGLAPI * real_xglCreateDevice)(
+    XGL_PHYSICAL_GPU gpu,
+    const XGL_DEVICE_CREATE_INFO* pCreateInfo,
+    XGL_DEVICE* pDevice) = xglCreateDevice;
+
+static XGL_RESULT( XGLAPI * real_xglDestroyDevice)(
+    XGL_DEVICE device) = xglDestroyDevice;
+
+static XGL_RESULT( XGLAPI * real_xglGetExtensionSupport)(
+    XGL_PHYSICAL_GPU gpu,
+    const char* pExtName) = xglGetExtensionSupport;
+
+static XGL_RESULT( XGLAPI * real_xglEnumerateLayers)(
+    XGL_PHYSICAL_GPU gpu,
+    size_t maxLayerCount,
+    size_t maxStringSize,
+    size_t* pOutLayerCount,
+    char* const* pOutLayers,
+    void* pReserved) = xglEnumerateLayers;
+
+static XGL_RESULT( XGLAPI * real_xglGetDeviceQueue)(
+    XGL_DEVICE device,
+    XGL_QUEUE_TYPE queueType,
+    uint32_t queueIndex,
+    XGL_QUEUE* pQueue) = xglGetDeviceQueue;
+
+static XGL_RESULT( XGLAPI * real_xglQueueSubmit)(
+    XGL_QUEUE queue,
+    uint32_t cmdBufferCount,
+    const XGL_CMD_BUFFER* pCmdBuffers,
+    uint32_t memRefCount,
+    const XGL_MEMORY_REF* pMemRefs,
+    XGL_FENCE fence) = xglQueueSubmit;
+
+static XGL_RESULT( XGLAPI * real_xglQueueSetGlobalMemReferences)(
+    XGL_QUEUE queue,
+    uint32_t memRefCount,
+    const XGL_MEMORY_REF* pMemRefs) = xglQueueSetGlobalMemReferences;
+
+static XGL_RESULT( XGLAPI * real_xglQueueWaitIdle)(
+    XGL_QUEUE queue) = xglQueueWaitIdle;
+
+static XGL_RESULT( XGLAPI * real_xglDeviceWaitIdle)(
+    XGL_DEVICE device) = xglDeviceWaitIdle;
+
+static XGL_RESULT( XGLAPI * real_xglAllocMemory)(
+    XGL_DEVICE device,
+    const XGL_MEMORY_ALLOC_INFO* pAllocInfo,
+    XGL_GPU_MEMORY* pMem) = xglAllocMemory;
+
+static XGL_RESULT( XGLAPI * real_xglFreeMemory)(
+    XGL_GPU_MEMORY mem) = xglFreeMemory;
+
+static XGL_RESULT( XGLAPI * real_xglSetMemoryPriority)(
+    XGL_GPU_MEMORY mem,
+    XGL_MEMORY_PRIORITY priority) = xglSetMemoryPriority;
+
+static XGL_RESULT( XGLAPI * real_xglMapMemory)(
+    XGL_GPU_MEMORY mem,
+    XGL_FLAGS flags,
+    void** ppData) = xglMapMemory;
+
+static XGL_RESULT( XGLAPI * real_xglUnmapMemory)(
+    XGL_GPU_MEMORY mem) = xglUnmapMemory;
+
+static XGL_RESULT( XGLAPI * real_xglPinSystemMemory)(
+    XGL_DEVICE device,
+    const void* pSysMem,
+    size_t memSize,
+    XGL_GPU_MEMORY* pMem) = xglPinSystemMemory;
+
+static XGL_RESULT( XGLAPI * real_xglGetMultiGpuCompatibility)(
+    XGL_PHYSICAL_GPU gpu0,
+    XGL_PHYSICAL_GPU gpu1,
+    XGL_GPU_COMPATIBILITY_INFO* pInfo) = xglGetMultiGpuCompatibility;
+
+static XGL_RESULT( XGLAPI * real_xglOpenSharedMemory)(
+    XGL_DEVICE device,
+    const XGL_MEMORY_OPEN_INFO* pOpenInfo,
+    XGL_GPU_MEMORY* pMem) = xglOpenSharedMemory;
+
+static XGL_RESULT( XGLAPI * real_xglOpenSharedQueueSemaphore)(
+    XGL_DEVICE device,
+    const XGL_QUEUE_SEMAPHORE_OPEN_INFO* pOpenInfo,
+    XGL_QUEUE_SEMAPHORE* pSemaphore) = xglOpenSharedQueueSemaphore;
+
+static XGL_RESULT( XGLAPI * real_xglOpenPeerMemory)(
+    XGL_DEVICE device,
+    const XGL_PEER_MEMORY_OPEN_INFO* pOpenInfo,
+    XGL_GPU_MEMORY* pMem) = xglOpenPeerMemory;
+
+static XGL_RESULT( XGLAPI * real_xglOpenPeerImage)(
+    XGL_DEVICE device,
+    const XGL_PEER_IMAGE_OPEN_INFO* pOpenInfo,
+    XGL_IMAGE* pImage,
+    XGL_GPU_MEMORY* pMem) = xglOpenPeerImage;
+
+static XGL_RESULT( XGLAPI * real_xglDestroyObject)(
+    XGL_OBJECT object) = xglDestroyObject;
+
+static XGL_RESULT( XGLAPI * real_xglGetObjectInfo)(
+    XGL_BASE_OBJECT object,
+    XGL_OBJECT_INFO_TYPE infoType,
+    size_t* pDataSize,
+    void* pData) = xglGetObjectInfo;
+
+static XGL_RESULT( XGLAPI * real_xglBindObjectMemory)(
+    XGL_OBJECT object,
+    uint32_t allocationIdx,
+    XGL_GPU_MEMORY mem,
+    XGL_GPU_SIZE offset) = xglBindObjectMemory;
+
+static XGL_RESULT( XGLAPI * real_xglBindObjectMemoryRange)(
+    XGL_OBJECT object,
+    uint32_t allocationIdx,
+    XGL_GPU_SIZE rangeOffset,
+    XGL_GPU_SIZE rangeSize,
+    XGL_GPU_MEMORY mem,
+    XGL_GPU_SIZE memOffset) = xglBindObjectMemoryRange;
+
+static XGL_RESULT( XGLAPI * real_xglBindImageMemoryRange)(
+    XGL_IMAGE image,
+    uint32_t allocationIdx,
+    const XGL_IMAGE_MEMORY_BIND_INFO* bindInfo,
+    XGL_GPU_MEMORY mem,
+    XGL_GPU_SIZE memOffset) = xglBindImageMemoryRange;
+
+static XGL_RESULT( XGLAPI * real_xglCreateFence)(
+    XGL_DEVICE device,
+    const XGL_FENCE_CREATE_INFO* pCreateInfo,
+    XGL_FENCE* pFence) = xglCreateFence;
+
+static XGL_RESULT( XGLAPI * real_xglGetFenceStatus)(
+    XGL_FENCE fence) = xglGetFenceStatus;
+
+static XGL_RESULT( XGLAPI * real_xglWaitForFences)(
+    XGL_DEVICE device,
+    uint32_t fenceCount,
+    const XGL_FENCE* pFences,
+    bool32_t waitAll,
+    uint64_t timeout) = xglWaitForFences;
+
+static XGL_RESULT( XGLAPI * real_xglCreateQueueSemaphore)(
+    XGL_DEVICE device,
+    const XGL_QUEUE_SEMAPHORE_CREATE_INFO* pCreateInfo,
+    XGL_QUEUE_SEMAPHORE* pSemaphore) = xglCreateQueueSemaphore;
+
+static XGL_RESULT( XGLAPI * real_xglSignalQueueSemaphore)(
+    XGL_QUEUE queue,
+    XGL_QUEUE_SEMAPHORE semaphore) = xglSignalQueueSemaphore;
+
+static XGL_RESULT( XGLAPI * real_xglWaitQueueSemaphore)(
+    XGL_QUEUE queue,
+    XGL_QUEUE_SEMAPHORE semaphore) = xglWaitQueueSemaphore;
+
+static XGL_RESULT( XGLAPI * real_xglCreateEvent)(
+    XGL_DEVICE device,
+    const XGL_EVENT_CREATE_INFO* pCreateInfo,
+    XGL_EVENT* pEvent) = xglCreateEvent;
+
+static XGL_RESULT( XGLAPI * real_xglGetEventStatus)(
+    XGL_EVENT event) = xglGetEventStatus;
+
+static XGL_RESULT( XGLAPI * real_xglSetEvent)(
+    XGL_EVENT event) = xglSetEvent;
+
+static XGL_RESULT( XGLAPI * real_xglResetEvent)(
+    XGL_EVENT event) = xglResetEvent;
+
+static XGL_RESULT( XGLAPI * real_xglCreateQueryPool)(
+    XGL_DEVICE device,
+    const XGL_QUERY_POOL_CREATE_INFO* pCreateInfo,
+    XGL_QUERY_POOL* pQueryPool) = xglCreateQueryPool;
+
+static XGL_RESULT( XGLAPI * real_xglGetQueryPoolResults)(
+    XGL_QUERY_POOL queryPool,
+    uint32_t startQuery,
+    uint32_t queryCount,
+    size_t* pDataSize,
+    void* pData) = xglGetQueryPoolResults;
+
+static XGL_RESULT( XGLAPI * real_xglGetFormatInfo)(
+    XGL_DEVICE device,
+    XGL_FORMAT format,
+    XGL_FORMAT_INFO_TYPE infoType,
+    size_t* pDataSize,
+    void* pData) = xglGetFormatInfo;
+
+static XGL_RESULT( XGLAPI * real_xglCreateBuffer)(
+    XGL_DEVICE device,
+    const XGL_BUFFER_CREATE_INFO* pCreateInfo,
+    XGL_BUFFER* pBuffer) = xglCreateBuffer;
+
+static XGL_RESULT( XGLAPI * real_xglCreateBufferView)(
+    XGL_DEVICE device,
+    const XGL_BUFFER_VIEW_CREATE_INFO* pCreateInfo,
+    XGL_BUFFER_VIEW* pView) = xglCreateBufferView;
+
+static XGL_RESULT( XGLAPI * real_xglCreateImage)(
+    XGL_DEVICE device,
+    const XGL_IMAGE_CREATE_INFO* pCreateInfo,
+    XGL_IMAGE* pImage) = xglCreateImage;
+
+static XGL_RESULT( XGLAPI * real_xglSetFastClearColor)(
+    XGL_IMAGE image,
+    const float color[4]) = xglSetFastClearColor;
+
+static XGL_RESULT( XGLAPI * real_xglSetFastClearDepth)(
+    XGL_IMAGE image,
+    float depth) = xglSetFastClearDepth;
+
+static XGL_RESULT( XGLAPI * real_xglGetImageSubresourceInfo)(
+    XGL_IMAGE image,
+    const XGL_IMAGE_SUBRESOURCE* pSubresource,
+    XGL_SUBRESOURCE_INFO_TYPE infoType,
+    size_t* pDataSize,
+    void* pData) = xglGetImageSubresourceInfo;
+
+static XGL_RESULT( XGLAPI * real_xglCreateImageView)(
+    XGL_DEVICE device,
+    const XGL_IMAGE_VIEW_CREATE_INFO* pCreateInfo,
+    XGL_IMAGE_VIEW* pView) = xglCreateImageView;
+
+static XGL_RESULT( XGLAPI * real_xglCreateColorAttachmentView)(
+    XGL_DEVICE device,
+    const XGL_COLOR_ATTACHMENT_VIEW_CREATE_INFO* pCreateInfo,
+    XGL_COLOR_ATTACHMENT_VIEW* pView) = xglCreateColorAttachmentView;
+
+static XGL_RESULT( XGLAPI * real_xglCreateDepthStencilView)(
+    XGL_DEVICE device,
+    const XGL_DEPTH_STENCIL_VIEW_CREATE_INFO* pCreateInfo,
+    XGL_DEPTH_STENCIL_VIEW* pView) = xglCreateDepthStencilView;
+
+static XGL_RESULT( XGLAPI * real_xglCreateShader)(
+    XGL_DEVICE device,
+    const XGL_SHADER_CREATE_INFO* pCreateInfo,
+    XGL_SHADER* pShader) = xglCreateShader;
+
+static XGL_RESULT( XGLAPI * real_xglCreateGraphicsPipeline)(
+    XGL_DEVICE device,
+    const XGL_GRAPHICS_PIPELINE_CREATE_INFO* pCreateInfo,
+    XGL_PIPELINE* pPipeline) = xglCreateGraphicsPipeline;
+
+static XGL_RESULT( XGLAPI * real_xglCreateComputePipeline)(
+    XGL_DEVICE device,
+    const XGL_COMPUTE_PIPELINE_CREATE_INFO* pCreateInfo,
+    XGL_PIPELINE* pPipeline) = xglCreateComputePipeline;
+
+static XGL_RESULT( XGLAPI * real_xglStorePipeline)(
+    XGL_PIPELINE pipeline,
+    size_t* pDataSize,
+    void* pData) = xglStorePipeline;
+
+static XGL_RESULT( XGLAPI * real_xglLoadPipeline)(
+    XGL_DEVICE device,
+    size_t dataSize,
+    const void* pData,
+    XGL_PIPELINE* pPipeline) = xglLoadPipeline;
+
+static XGL_RESULT( XGLAPI * real_xglCreatePipelineDelta)(
+    XGL_DEVICE device,
+    XGL_PIPELINE p1,
+    XGL_PIPELINE p2,
+    XGL_PIPELINE_DELTA* delta) = xglCreatePipelineDelta;
+
+static XGL_RESULT( XGLAPI * real_xglCreateSampler)(
+    XGL_DEVICE device,
+    const XGL_SAMPLER_CREATE_INFO* pCreateInfo,
+    XGL_SAMPLER* pSampler) = xglCreateSampler;
+
+static XGL_RESULT( XGLAPI * real_xglCreateDescriptorSetLayout)(
+    XGL_DEVICE device,
+    XGL_FLAGS stageFlags,
+    const uint32_t* pSetBindPoints,
+    XGL_DESCRIPTOR_SET_LAYOUT priorSetLayout,
+    const XGL_DESCRIPTOR_SET_LAYOUT_CREATE_INFO* pSetLayoutInfoList,
+    XGL_DESCRIPTOR_SET_LAYOUT* pSetLayout) = xglCreateDescriptorSetLayout;
+
+static XGL_RESULT( XGLAPI * real_xglBeginDescriptorRegionUpdate)(
+    XGL_DEVICE device,
+    XGL_DESCRIPTOR_UPDATE_MODE updateMode) = xglBeginDescriptorRegionUpdate;
+
+static XGL_RESULT( XGLAPI * real_xglEndDescriptorRegionUpdate)(
+    XGL_DEVICE device,
+    XGL_CMD_BUFFER cmd) = xglEndDescriptorRegionUpdate;
+
+static XGL_RESULT( XGLAPI * real_xglCreateDescriptorRegion)(
+    XGL_DEVICE device,
+    XGL_DESCRIPTOR_REGION_USAGE regionUsage,
+    uint32_t maxSets,
+    const XGL_DESCRIPTOR_REGION_CREATE_INFO* pCreateInfo,
+    XGL_DESCRIPTOR_REGION* pDescriptorRegion) = xglCreateDescriptorRegion;
+
+static XGL_RESULT( XGLAPI * real_xglClearDescriptorRegion)(
+    XGL_DESCRIPTOR_REGION descriptorRegion) = xglClearDescriptorRegion;
+
+static XGL_RESULT( XGLAPI * real_xglAllocDescriptorSets)(
+    XGL_DESCRIPTOR_REGION descriptorRegion,
+    XGL_DESCRIPTOR_SET_USAGE setUsage,
+    uint32_t count,
+    const XGL_DESCRIPTOR_SET_LAYOUT* pSetLayouts,
+    XGL_DESCRIPTOR_SET* pDescriptorSets,
+    uint32_t* pCount) = xglAllocDescriptorSets;
+
+static void( XGLAPI * real_xglClearDescriptorSets)(
+    XGL_DESCRIPTOR_REGION descriptorRegion,
+    uint32_t count,
+    const XGL_DESCRIPTOR_SET* pDescriptorSets) = xglClearDescriptorSets;
+
+static void( XGLAPI * real_xglUpdateDescriptors)(
+    XGL_DESCRIPTOR_SET descriptorSet,
+    const void* pUpdateChain) = xglUpdateDescriptors;
+
+static XGL_RESULT( XGLAPI * real_xglCreateDynamicViewportState)(
+    XGL_DEVICE device,
+    const XGL_DYNAMIC_VP_STATE_CREATE_INFO* pCreateInfo,
+    XGL_DYNAMIC_VP_STATE_OBJECT* pState) = xglCreateDynamicViewportState;
+
+static XGL_RESULT( XGLAPI * real_xglCreateDynamicRasterState)(
+    XGL_DEVICE device,
+    const XGL_DYNAMIC_RS_STATE_CREATE_INFO* pCreateInfo,
+    XGL_DYNAMIC_RS_STATE_OBJECT* pState) = xglCreateDynamicRasterState;
+
+static XGL_RESULT( XGLAPI * real_xglCreateDynamicColorBlendState)(
+    XGL_DEVICE device,
+    const XGL_DYNAMIC_CB_STATE_CREATE_INFO* pCreateInfo,
+    XGL_DYNAMIC_CB_STATE_OBJECT* pState) = xglCreateDynamicColorBlendState;
+
+static XGL_RESULT( XGLAPI * real_xglCreateDynamicDepthStencilState)(
+    XGL_DEVICE device,
+    const XGL_DYNAMIC_DS_STATE_CREATE_INFO* pCreateInfo,
+    XGL_DYNAMIC_DS_STATE_OBJECT* pState) = xglCreateDynamicDepthStencilState;
+
+static XGL_RESULT( XGLAPI * real_xglCreateCommandBuffer)(
+    XGL_DEVICE device,
+    const XGL_CMD_BUFFER_CREATE_INFO* pCreateInfo,
+    XGL_CMD_BUFFER* pCmdBuffer) = xglCreateCommandBuffer;
+
+static XGL_RESULT( XGLAPI * real_xglBeginCommandBuffer)(
+    XGL_CMD_BUFFER cmdBuffer,
+    const XGL_CMD_BUFFER_BEGIN_INFO* pBeginInfo) = xglBeginCommandBuffer;
+
+static XGL_RESULT( XGLAPI * real_xglEndCommandBuffer)(
+    XGL_CMD_BUFFER cmdBuffer) = xglEndCommandBuffer;
+
+static XGL_RESULT( XGLAPI * real_xglResetCommandBuffer)(
+    XGL_CMD_BUFFER cmdBuffer) = xglResetCommandBuffer;
+
+static void( XGLAPI * real_xglCmdBindPipeline)(
+    XGL_CMD_BUFFER cmdBuffer,
+    XGL_PIPELINE_BIND_POINT pipelineBindPoint,
+    XGL_PIPELINE pipeline) = xglCmdBindPipeline;
+
+static void( XGLAPI * real_xglCmdBindPipelineDelta)(
+    XGL_CMD_BUFFER cmdBuffer,
+    XGL_PIPELINE_BIND_POINT pipelineBindPoint,
+    XGL_PIPELINE_DELTA delta) = xglCmdBindPipelineDelta;
+
+static void( XGLAPI * real_xglCmdBindDynamicStateObject)(
+    XGL_CMD_BUFFER cmdBuffer,
+    XGL_STATE_BIND_POINT stateBindPoint,
+    XGL_DYNAMIC_STATE_OBJECT state) = xglCmdBindDynamicStateObject;
+
+static void( XGLAPI * real_xglCmdBindDescriptorSet)(
+    XGL_CMD_BUFFER cmdBuffer,
+    XGL_PIPELINE_BIND_POINT pipelineBindPoint,
+    XGL_DESCRIPTOR_SET descriptorSet,
+    const uint32_t* pUserData) = xglCmdBindDescriptorSet;
+
+static void( XGLAPI * real_xglCmdBindVertexBuffer)(
+    XGL_CMD_BUFFER cmdBuffer,
+    XGL_BUFFER buffer,
+    XGL_GPU_SIZE offset,
+    uint32_t binding) = xglCmdBindVertexBuffer;
+
+static void( XGLAPI * real_xglCmdBindIndexBuffer)(
+    XGL_CMD_BUFFER cmdBuffer,
+    XGL_BUFFER buffer,
+    XGL_GPU_SIZE offset,
+    XGL_INDEX_TYPE indexType) = xglCmdBindIndexBuffer;
+
+static void( XGLAPI * real_xglCmdDraw)(
+    XGL_CMD_BUFFER cmdBuffer,
+    uint32_t firstVertex,
+    uint32_t vertexCount,
+    uint32_t firstInstance,
+    uint32_t instanceCount) = xglCmdDraw;
+
+static void( XGLAPI * real_xglCmdDrawIndexed)(
+    XGL_CMD_BUFFER cmdBuffer,
+    uint32_t firstIndex,
+    uint32_t indexCount,
+    int32_t vertexOffset,
+    uint32_t firstInstance,
+    uint32_t instanceCount) = xglCmdDrawIndexed;
+
+static void( XGLAPI * real_xglCmdDrawIndirect)(
+    XGL_CMD_BUFFER cmdBuffer,
+    XGL_BUFFER buffer,
+    XGL_GPU_SIZE offset,
+    uint32_t count,
+    uint32_t stride) = xglCmdDrawIndirect;
+
+static void( XGLAPI * real_xglCmdDrawIndexedIndirect)(
+    XGL_CMD_BUFFER cmdBuffer,
+    XGL_BUFFER buffer,
+    XGL_GPU_SIZE offset,
+    uint32_t count,
+    uint32_t stride) = xglCmdDrawIndexedIndirect;
+
+static void( XGLAPI * real_xglCmdDispatch)(
+    XGL_CMD_BUFFER cmdBuffer,
+    uint32_t x,
+    uint32_t y,
+    uint32_t z) = xglCmdDispatch;
+
+static void( XGLAPI * real_xglCmdDispatchIndirect)(
+    XGL_CMD_BUFFER cmdBuffer,
+    XGL_BUFFER buffer,
+    XGL_GPU_SIZE offset) = xglCmdDispatchIndirect;
+
+static void( XGLAPI * real_xglCmdCopyBuffer)(
+    XGL_CMD_BUFFER cmdBuffer,
+    XGL_BUFFER srcBuffer,
+    XGL_BUFFER destBuffer,
+    uint32_t regionCount,
+    const XGL_BUFFER_COPY* pRegions) = xglCmdCopyBuffer;
+
+static void( XGLAPI * real_xglCmdCopyImage)(
+    XGL_CMD_BUFFER cmdBuffer,
+    XGL_IMAGE srcImage,
+    XGL_IMAGE destImage,
+    uint32_t regionCount,
+    const XGL_IMAGE_COPY* pRegions) = xglCmdCopyImage;
+
+static void( XGLAPI * real_xglCmdCopyBufferToImage)(
+    XGL_CMD_BUFFER cmdBuffer,
+    XGL_BUFFER srcBuffer,
+    XGL_IMAGE destImage,
+    uint32_t regionCount,
+    const XGL_BUFFER_IMAGE_COPY* pRegions) = xglCmdCopyBufferToImage;
+
+static void( XGLAPI * real_xglCmdCopyImageToBuffer)(
+    XGL_CMD_BUFFER cmdBuffer,
+    XGL_IMAGE srcImage,
+    XGL_BUFFER destBuffer,
+    uint32_t regionCount,
+    const XGL_BUFFER_IMAGE_COPY* pRegions) = xglCmdCopyImageToBuffer;
+
+static void( XGLAPI * real_xglCmdCloneImageData)(
+    XGL_CMD_BUFFER cmdBuffer,
+    XGL_IMAGE srcImage,
+    XGL_IMAGE_LAYOUT srcImageLayout,
+    XGL_IMAGE destImage,
+    XGL_IMAGE_LAYOUT destImageLayout) = xglCmdCloneImageData;
+
+static void( XGLAPI * real_xglCmdUpdateBuffer)(
+    XGL_CMD_BUFFER cmdBuffer,
+    XGL_BUFFER destBuffer,
+    XGL_GPU_SIZE destOffset,
+    XGL_GPU_SIZE dataSize,
+    const uint32_t* pData) = xglCmdUpdateBuffer;
+
+static void( XGLAPI * real_xglCmdFillBuffer)(
+    XGL_CMD_BUFFER cmdBuffer,
+    XGL_BUFFER destBuffer,
+    XGL_GPU_SIZE destOffset,
+    XGL_GPU_SIZE fillSize,
+    uint32_t data) = xglCmdFillBuffer;
+
+static void( XGLAPI * real_xglCmdClearColorImage)(
+    XGL_CMD_BUFFER cmdBuffer,
+    XGL_IMAGE image,
+    const float color[4],
+    uint32_t rangeCount,
+    const XGL_IMAGE_SUBRESOURCE_RANGE* pRanges) = xglCmdClearColorImage;
+
+static void( XGLAPI * real_xglCmdClearColorImageRaw)(
+    XGL_CMD_BUFFER cmdBuffer,
+    XGL_IMAGE image,
+    const uint32_t color[4],
+    uint32_t rangeCount,
+    const XGL_IMAGE_SUBRESOURCE_RANGE* pRanges) = xglCmdClearColorImageRaw;
+
+static void( XGLAPI * real_xglCmdClearDepthStencil)(
+    XGL_CMD_BUFFER cmdBuffer,
+    XGL_IMAGE image,
+    float depth,
+    uint32_t stencil,
+    uint32_t rangeCount,
+    const XGL_IMAGE_SUBRESOURCE_RANGE* pRanges) = xglCmdClearDepthStencil;
+
+static void( XGLAPI * real_xglCmdResolveImage)(
+    XGL_CMD_BUFFER cmdBuffer,
+    XGL_IMAGE srcImage,
+    XGL_IMAGE destImage,
+    uint32_t rectCount,
+    const XGL_IMAGE_RESOLVE* pRects) = xglCmdResolveImage;
+
+static void( XGLAPI * real_xglCmdSetEvent)(
+    XGL_CMD_BUFFER cmdBuffer,
+    XGL_EVENT event,
+    XGL_SET_EVENT pipeEvent) = xglCmdSetEvent;
+
+static void( XGLAPI * real_xglCmdResetEvent)(
+    XGL_CMD_BUFFER cmdBuffer,
+    XGL_EVENT event) = xglCmdResetEvent;
+
+static void( XGLAPI * real_xglCmdWaitEvents)(
+    XGL_CMD_BUFFER cmdBuffer,
+    const XGL_EVENT_WAIT_INFO* pWaitInfo) = xglCmdWaitEvents;
+
+static void( XGLAPI * real_xglCmdPipelineBarrier)(
+    XGL_CMD_BUFFER cmdBuffer,
+    const XGL_PIPELINE_BARRIER* pBarrier) = xglCmdPipelineBarrier;
+
+static void( XGLAPI * real_xglCmdBeginQuery)(
+    XGL_CMD_BUFFER cmdBuffer,
+    XGL_QUERY_POOL queryPool,
+    uint32_t slot,
+    XGL_FLAGS flags) = xglCmdBeginQuery;
+
+static void( XGLAPI * real_xglCmdEndQuery)(
+    XGL_CMD_BUFFER cmdBuffer,
+    XGL_QUERY_POOL queryPool,
+    uint32_t slot) = xglCmdEndQuery;
+
+static void( XGLAPI * real_xglCmdResetQueryPool)(
+    XGL_CMD_BUFFER cmdBuffer,
+    XGL_QUERY_POOL queryPool,
+    uint32_t startQuery,
+    uint32_t queryCount) = xglCmdResetQueryPool;
+
+static void( XGLAPI * real_xglCmdWriteTimestamp)(
+    XGL_CMD_BUFFER cmdBuffer,
+    XGL_TIMESTAMP_TYPE timestampType,
+    XGL_BUFFER destBuffer,
+    XGL_GPU_SIZE destOffset) = xglCmdWriteTimestamp;
+
+static void( XGLAPI * real_xglCmdInitAtomicCounters)(
+    XGL_CMD_BUFFER cmdBuffer,
+    XGL_PIPELINE_BIND_POINT pipelineBindPoint,
+    uint32_t startCounter,
+    uint32_t counterCount,
+    const uint32_t* pData) = xglCmdInitAtomicCounters;
+
+static void( XGLAPI * real_xglCmdLoadAtomicCounters)(
+    XGL_CMD_BUFFER cmdBuffer,
+    XGL_PIPELINE_BIND_POINT pipelineBindPoint,
+    uint32_t startCounter,
+    uint32_t counterCount,
+    XGL_BUFFER srcBuffer,
+    XGL_GPU_SIZE srcOffset) = xglCmdLoadAtomicCounters;
+
+static void( XGLAPI * real_xglCmdSaveAtomicCounters)(
+    XGL_CMD_BUFFER cmdBuffer,
+    XGL_PIPELINE_BIND_POINT pipelineBindPoint,
+    uint32_t startCounter,
+    uint32_t counterCount,
+    XGL_BUFFER destBuffer,
+    XGL_GPU_SIZE destOffset) = xglCmdSaveAtomicCounters;
+
+static XGL_RESULT( XGLAPI * real_xglCreateFramebuffer)(
+    XGL_DEVICE device,
+    const XGL_FRAMEBUFFER_CREATE_INFO* pCreateInfo,
+    XGL_FRAMEBUFFER* pFramebuffer) = xglCreateFramebuffer;
+
+static XGL_RESULT( XGLAPI * real_xglCreateRenderPass)(
+    XGL_DEVICE device,
+    const XGL_RENDER_PASS_CREATE_INFO* pCreateInfo,
+    XGL_RENDER_PASS* pRenderPass) = xglCreateRenderPass;
+
+static void( XGLAPI * real_xglCmdBeginRenderPass)(
+    XGL_CMD_BUFFER cmdBuffer,
+    XGL_RENDER_PASS renderPass) = xglCmdBeginRenderPass;
+
+static void( XGLAPI * real_xglCmdEndRenderPass)(
+    XGL_CMD_BUFFER cmdBuffer,
+    XGL_RENDER_PASS renderPass) = xglCmdEndRenderPass;
+
+static BOOL isHooked = FALSE;
+
+void AttachHooks()
+{
+   BOOL hookSuccess = TRUE;
+#if defined(WIN32)
+    Mhook_BeginMultiOperation(FALSE);
+    if (real_xglCreateInstance != NULL)
+    {
+        isHooked = TRUE;
+        hookSuccess = Mhook_SetHook((PVOID*)&real_xglCreateInstance, hooked_xglCreateInstance);
+        hookSuccess &= Mhook_SetHook((PVOID*)&real_xglDestroyInstance, hooked_xglDestroyInstance);
+        hookSuccess &= Mhook_SetHook((PVOID*)&real_xglEnumerateGpus, hooked_xglEnumerateGpus);
+        hookSuccess &= Mhook_SetHook((PVOID*)&real_xglGetGpuInfo, hooked_xglGetGpuInfo);
+        hookSuccess &= Mhook_SetHook((PVOID*)&real_xglGetProcAddr, hooked_xglGetProcAddr);
+        hookSuccess &= Mhook_SetHook((PVOID*)&real_xglCreateDevice, hooked_xglCreateDevice);
+        hookSuccess &= Mhook_SetHook((PVOID*)&real_xglDestroyDevice, hooked_xglDestroyDevice);
+        hookSuccess &= Mhook_SetHook((PVOID*)&real_xglGetExtensionSupport, hooked_xglGetExtensionSupport);
+        hookSuccess &= Mhook_SetHook((PVOID*)&real_xglEnumerateLayers, hooked_xglEnumerateLayers);
+        hookSuccess &= Mhook_SetHook((PVOID*)&real_xglGetDeviceQueue, hooked_xglGetDeviceQueue);
+        hookSuccess &= Mhook_SetHook((PVOID*)&real_xglQueueSubmit, hooked_xglQueueSubmit);
+        hookSuccess &= Mhook_SetHook((PVOID*)&real_xglQueueSetGlobalMemReferences, hooked_xglQueueSetGlobalMemReferences);
+        hookSuccess &= Mhook_SetHook((PVOID*)&real_xglQueueWaitIdle, hooked_xglQueueWaitIdle);
+        hookSuccess &= Mhook_SetHook((PVOID*)&real_xglDeviceWaitIdle, hooked_xglDeviceWaitIdle);
+        hookSuccess &= Mhook_SetHook((PVOID*)&real_xglAllocMemory, hooked_xglAllocMemory);
+        hookSuccess &= Mhook_SetHook((PVOID*)&real_xglFreeMemory, hooked_xglFreeMemory);
+        hookSuccess &= Mhook_SetHook((PVOID*)&real_xglSetMemoryPriority, hooked_xglSetMemoryPriority);
+        hookSuccess &= Mhook_SetHook((PVOID*)&real_xglMapMemory, hooked_xglMapMemory);
+        hookSuccess &= Mhook_SetHook((PVOID*)&real_xglUnmapMemory, hooked_xglUnmapMemory);
+        hookSuccess &= Mhook_SetHook((PVOID*)&real_xglPinSystemMemory, hooked_xglPinSystemMemory);
+        hookSuccess &= Mhook_SetHook((PVOID*)&real_xglGetMultiGpuCompatibility, hooked_xglGetMultiGpuCompatibility);
+        hookSuccess &= Mhook_SetHook((PVOID*)&real_xglOpenSharedMemory, hooked_xglOpenSharedMemory);
+        hookSuccess &= Mhook_SetHook((PVOID*)&real_xglOpenSharedQueueSemaphore, hooked_xglOpenSharedQueueSemaphore);
+        hookSuccess &= Mhook_SetHook((PVOID*)&real_xglOpenPeerMemory, hooked_xglOpenPeerMemory);
+        hookSuccess &= Mhook_SetHook((PVOID*)&real_xglOpenPeerImage, hooked_xglOpenPeerImage);
+        hookSuccess &= Mhook_SetHook((PVOID*)&real_xglDestroyObject, hooked_xglDestroyObject);
+        hookSuccess &= Mhook_SetHook((PVOID*)&real_xglGetObjectInfo, hooked_xglGetObjectInfo);
+        hookSuccess &= Mhook_SetHook((PVOID*)&real_xglBindObjectMemory, hooked_xglBindObjectMemory);
+        hookSuccess &= Mhook_SetHook((PVOID*)&real_xglBindObjectMemoryRange, hooked_xglBindObjectMemoryRange);
+        hookSuccess &= Mhook_SetHook((PVOID*)&real_xglBindImageMemoryRange, hooked_xglBindImageMemoryRange);
+        hookSuccess &= Mhook_SetHook((PVOID*)&real_xglCreateFence, hooked_xglCreateFence);
+        hookSuccess &= Mhook_SetHook((PVOID*)&real_xglGetFenceStatus, hooked_xglGetFenceStatus);
+        hookSuccess &= Mhook_SetHook((PVOID*)&real_xglWaitForFences, hooked_xglWaitForFences);
+        hookSuccess &= Mhook_SetHook((PVOID*)&real_xglCreateQueueSemaphore, hooked_xglCreateQueueSemaphore);
+        hookSuccess &= Mhook_SetHook((PVOID*)&real_xglSignalQueueSemaphore, hooked_xglSignalQueueSemaphore);
+        hookSuccess &= Mhook_SetHook((PVOID*)&real_xglWaitQueueSemaphore, hooked_xglWaitQueueSemaphore);
+        hookSuccess &= Mhook_SetHook((PVOID*)&real_xglCreateEvent, hooked_xglCreateEvent);
+        hookSuccess &= Mhook_SetHook((PVOID*)&real_xglGetEventStatus, hooked_xglGetEventStatus);
+        hookSuccess &= Mhook_SetHook((PVOID*)&real_xglSetEvent, hooked_xglSetEvent);
+        hookSuccess &= Mhook_SetHook((PVOID*)&real_xglResetEvent, hooked_xglResetEvent);
+        hookSuccess &= Mhook_SetHook((PVOID*)&real_xglCreateQueryPool, hooked_xglCreateQueryPool);
+        hookSuccess &= Mhook_SetHook((PVOID*)&real_xglGetQueryPoolResults, hooked_xglGetQueryPoolResults);
+        hookSuccess &= Mhook_SetHook((PVOID*)&real_xglGetFormatInfo, hooked_xglGetFormatInfo);
+        hookSuccess &= Mhook_SetHook((PVOID*)&real_xglCreateBuffer, hooked_xglCreateBuffer);
+        hookSuccess &= Mhook_SetHook((PVOID*)&real_xglCreateBufferView, hooked_xglCreateBufferView);
+        hookSuccess &= Mhook_SetHook((PVOID*)&real_xglCreateImage, hooked_xglCreateImage);
+        hookSuccess &= Mhook_SetHook((PVOID*)&real_xglSetFastClearColor, hooked_xglSetFastClearColor);
+        hookSuccess &= Mhook_SetHook((PVOID*)&real_xglSetFastClearDepth, hooked_xglSetFastClearDepth);
+        hookSuccess &= Mhook_SetHook((PVOID*)&real_xglGetImageSubresourceInfo, hooked_xglGetImageSubresourceInfo);
+        hookSuccess &= Mhook_SetHook((PVOID*)&real_xglCreateImageView, hooked_xglCreateImageView);
+        hookSuccess &= Mhook_SetHook((PVOID*)&real_xglCreateColorAttachmentView, hooked_xglCreateColorAttachmentView);
+        hookSuccess &= Mhook_SetHook((PVOID*)&real_xglCreateDepthStencilView, hooked_xglCreateDepthStencilView);
+        hookSuccess &= Mhook_SetHook((PVOID*)&real_xglCreateShader, hooked_xglCreateShader);
+        hookSuccess &= Mhook_SetHook((PVOID*)&real_xglCreateGraphicsPipeline, hooked_xglCreateGraphicsPipeline);
+        hookSuccess &= Mhook_SetHook((PVOID*)&real_xglCreateComputePipeline, hooked_xglCreateComputePipeline);
+        hookSuccess &= Mhook_SetHook((PVOID*)&real_xglStorePipeline, hooked_xglStorePipeline);
+        hookSuccess &= Mhook_SetHook((PVOID*)&real_xglLoadPipeline, hooked_xglLoadPipeline);
+        hookSuccess &= Mhook_SetHook((PVOID*)&real_xglCreatePipelineDelta, hooked_xglCreatePipelineDelta);
+        hookSuccess &= Mhook_SetHook((PVOID*)&real_xglCreateSampler, hooked_xglCreateSampler);
+        hookSuccess &= Mhook_SetHook((PVOID*)&real_xglCreateDescriptorSetLayout, hooked_xglCreateDescriptorSetLayout);
+        hookSuccess &= Mhook_SetHook((PVOID*)&real_xglBeginDescriptorRegionUpdate, hooked_xglBeginDescriptorRegionUpdate);
+        hookSuccess &= Mhook_SetHook((PVOID*)&real_xglEndDescriptorRegionUpdate, hooked_xglEndDescriptorRegionUpdate);
+        hookSuccess &= Mhook_SetHook((PVOID*)&real_xglCreateDescriptorRegion, hooked_xglCreateDescriptorRegion);
+        hookSuccess &= Mhook_SetHook((PVOID*)&real_xglClearDescriptorRegion, hooked_xglClearDescriptorRegion);
+        hookSuccess &= Mhook_SetHook((PVOID*)&real_xglAllocDescriptorSets, hooked_xglAllocDescriptorSets);
+        hookSuccess &= Mhook_SetHook((PVOID*)&real_xglClearDescriptorSets, hooked_xglClearDescriptorSets);
+        hookSuccess &= Mhook_SetHook((PVOID*)&real_xglUpdateDescriptors, hooked_xglUpdateDescriptors);
+        hookSuccess &= Mhook_SetHook((PVOID*)&real_xglCreateDynamicViewportState, hooked_xglCreateDynamicViewportState);
+        hookSuccess &= Mhook_SetHook((PVOID*)&real_xglCreateDynamicRasterState, hooked_xglCreateDynamicRasterState);
+        hookSuccess &= Mhook_SetHook((PVOID*)&real_xglCreateDynamicColorBlendState, hooked_xglCreateDynamicColorBlendState);
+        hookSuccess &= Mhook_SetHook((PVOID*)&real_xglCreateDynamicDepthStencilState, hooked_xglCreateDynamicDepthStencilState);
+        hookSuccess &= Mhook_SetHook((PVOID*)&real_xglCreateCommandBuffer, hooked_xglCreateCommandBuffer);
+        hookSuccess &= Mhook_SetHook((PVOID*)&real_xglBeginCommandBuffer, hooked_xglBeginCommandBuffer);
+        hookSuccess &= Mhook_SetHook((PVOID*)&real_xglEndCommandBuffer, hooked_xglEndCommandBuffer);
+        hookSuccess &= Mhook_SetHook((PVOID*)&real_xglResetCommandBuffer, hooked_xglResetCommandBuffer);
+        hookSuccess &= Mhook_SetHook((PVOID*)&real_xglCmdBindPipeline, hooked_xglCmdBindPipeline);
+        hookSuccess &= Mhook_SetHook((PVOID*)&real_xglCmdBindPipelineDelta, hooked_xglCmdBindPipelineDelta);
+        hookSuccess &= Mhook_SetHook((PVOID*)&real_xglCmdBindDynamicStateObject, hooked_xglCmdBindDynamicStateObject);
+        hookSuccess &= Mhook_SetHook((PVOID*)&real_xglCmdBindDescriptorSet, hooked_xglCmdBindDescriptorSet);
+        hookSuccess &= Mhook_SetHook((PVOID*)&real_xglCmdBindVertexBuffer, hooked_xglCmdBindVertexBuffer);
+        hookSuccess &= Mhook_SetHook((PVOID*)&real_xglCmdBindIndexBuffer, hooked_xglCmdBindIndexBuffer);
+        hookSuccess &= Mhook_SetHook((PVOID*)&real_xglCmdDraw, hooked_xglCmdDraw);
+        hookSuccess &= Mhook_SetHook((PVOID*)&real_xglCmdDrawIndexed, hooked_xglCmdDrawIndexed);
+        hookSuccess &= Mhook_SetHook((PVOID*)&real_xglCmdDrawIndirect, hooked_xglCmdDrawIndirect);
+        hookSuccess &= Mhook_SetHook((PVOID*)&real_xglCmdDrawIndexedIndirect, hooked_xglCmdDrawIndexedIndirect);
+        hookSuccess &= Mhook_SetHook((PVOID*)&real_xglCmdDispatch, hooked_xglCmdDispatch);
+        hookSuccess &= Mhook_SetHook((PVOID*)&real_xglCmdDispatchIndirect, hooked_xglCmdDispatchIndirect);
+        hookSuccess &= Mhook_SetHook((PVOID*)&real_xglCmdCopyBuffer, hooked_xglCmdCopyBuffer);
+        hookSuccess &= Mhook_SetHook((PVOID*)&real_xglCmdCopyImage, hooked_xglCmdCopyImage);
+        hookSuccess &= Mhook_SetHook((PVOID*)&real_xglCmdCopyBufferToImage, hooked_xglCmdCopyBufferToImage);
+        hookSuccess &= Mhook_SetHook((PVOID*)&real_xglCmdCopyImageToBuffer, hooked_xglCmdCopyImageToBuffer);
+        hookSuccess &= Mhook_SetHook((PVOID*)&real_xglCmdCloneImageData, hooked_xglCmdCloneImageData);
+        hookSuccess &= Mhook_SetHook((PVOID*)&real_xglCmdUpdateBuffer, hooked_xglCmdUpdateBuffer);
+        hookSuccess &= Mhook_SetHook((PVOID*)&real_xglCmdFillBuffer, hooked_xglCmdFillBuffer);
+        hookSuccess &= Mhook_SetHook((PVOID*)&real_xglCmdClearColorImage, hooked_xglCmdClearColorImage);
+        hookSuccess &= Mhook_SetHook((PVOID*)&real_xglCmdClearColorImageRaw, hooked_xglCmdClearColorImageRaw);
+        hookSuccess &= Mhook_SetHook((PVOID*)&real_xglCmdClearDepthStencil, hooked_xglCmdClearDepthStencil);
+        hookSuccess &= Mhook_SetHook((PVOID*)&real_xglCmdResolveImage, hooked_xglCmdResolveImage);
+        hookSuccess &= Mhook_SetHook((PVOID*)&real_xglCmdSetEvent, hooked_xglCmdSetEvent);
+        hookSuccess &= Mhook_SetHook((PVOID*)&real_xglCmdResetEvent, hooked_xglCmdResetEvent);
+        hookSuccess &= Mhook_SetHook((PVOID*)&real_xglCmdWaitEvents, hooked_xglCmdWaitEvents);
+        hookSuccess &= Mhook_SetHook((PVOID*)&real_xglCmdPipelineBarrier, hooked_xglCmdPipelineBarrier);
+        hookSuccess &= Mhook_SetHook((PVOID*)&real_xglCmdBeginQuery, hooked_xglCmdBeginQuery);
+        hookSuccess &= Mhook_SetHook((PVOID*)&real_xglCmdEndQuery, hooked_xglCmdEndQuery);
+        hookSuccess &= Mhook_SetHook((PVOID*)&real_xglCmdResetQueryPool, hooked_xglCmdResetQueryPool);
+        hookSuccess &= Mhook_SetHook((PVOID*)&real_xglCmdWriteTimestamp, hooked_xglCmdWriteTimestamp);
+        hookSuccess &= Mhook_SetHook((PVOID*)&real_xglCmdInitAtomicCounters, hooked_xglCmdInitAtomicCounters);
+        hookSuccess &= Mhook_SetHook((PVOID*)&real_xglCmdLoadAtomicCounters, hooked_xglCmdLoadAtomicCounters);
+        hookSuccess &= Mhook_SetHook((PVOID*)&real_xglCmdSaveAtomicCounters, hooked_xglCmdSaveAtomicCounters);
+        hookSuccess &= Mhook_SetHook((PVOID*)&real_xglCreateFramebuffer, hooked_xglCreateFramebuffer);
+        hookSuccess &= Mhook_SetHook((PVOID*)&real_xglCreateRenderPass, hooked_xglCreateRenderPass);
+        hookSuccess &= Mhook_SetHook((PVOID*)&real_xglCmdBeginRenderPass, hooked_xglCmdBeginRenderPass);
+        hookSuccess &= Mhook_SetHook((PVOID*)&real_xglCmdEndRenderPass, hooked_xglCmdEndRenderPass);
+    }
+
+    if (!hookSuccess)
+    {
+        glv_LogError("Failed to hook XGL.");
+    }
+
+    Mhook_EndMultiOperation();
+
+#elif defined(__linux__)
+    if (real_xglCreateInstance == xglCreateInstance)
+        hookSuccess = glv_platform_get_next_lib_sym((PVOID*)&real_xglCreateInstance,"xglCreateInstance");
+    isHooked = TRUE;
+    hookSuccess &= glv_platform_get_next_lib_sym((PVOID*)&real_xglDestroyInstance, "xglDestroyInstance");
+    hookSuccess &= glv_platform_get_next_lib_sym((PVOID*)&real_xglEnumerateGpus, "xglEnumerateGpus");
+    hookSuccess &= glv_platform_get_next_lib_sym((PVOID*)&real_xglGetGpuInfo, "xglGetGpuInfo");
+    hookSuccess &= glv_platform_get_next_lib_sym((PVOID*)&real_xglGetProcAddr, "xglGetProcAddr");
+    hookSuccess &= glv_platform_get_next_lib_sym((PVOID*)&real_xglCreateDevice, "xglCreateDevice");
+    hookSuccess &= glv_platform_get_next_lib_sym((PVOID*)&real_xglDestroyDevice, "xglDestroyDevice");
+    hookSuccess &= glv_platform_get_next_lib_sym((PVOID*)&real_xglGetExtensionSupport, "xglGetExtensionSupport");
+    hookSuccess &= glv_platform_get_next_lib_sym((PVOID*)&real_xglEnumerateLayers, "xglEnumerateLayers");
+    hookSuccess &= glv_platform_get_next_lib_sym((PVOID*)&real_xglGetDeviceQueue, "xglGetDeviceQueue");
+    hookSuccess &= glv_platform_get_next_lib_sym((PVOID*)&real_xglQueueSubmit, "xglQueueSubmit");
+    hookSuccess &= glv_platform_get_next_lib_sym((PVOID*)&real_xglQueueSetGlobalMemReferences, "xglQueueSetGlobalMemReferences");
+    hookSuccess &= glv_platform_get_next_lib_sym((PVOID*)&real_xglQueueWaitIdle, "xglQueueWaitIdle");
+    hookSuccess &= glv_platform_get_next_lib_sym((PVOID*)&real_xglDeviceWaitIdle, "xglDeviceWaitIdle");
+    hookSuccess &= glv_platform_get_next_lib_sym((PVOID*)&real_xglAllocMemory, "xglAllocMemory");
+    hookSuccess &= glv_platform_get_next_lib_sym((PVOID*)&real_xglFreeMemory, "xglFreeMemory");
+    hookSuccess &= glv_platform_get_next_lib_sym((PVOID*)&real_xglSetMemoryPriority, "xglSetMemoryPriority");
+    hookSuccess &= glv_platform_get_next_lib_sym((PVOID*)&real_xglMapMemory, "xglMapMemory");
+    hookSuccess &= glv_platform_get_next_lib_sym((PVOID*)&real_xglUnmapMemory, "xglUnmapMemory");
+    hookSuccess &= glv_platform_get_next_lib_sym((PVOID*)&real_xglPinSystemMemory, "xglPinSystemMemory");
+    hookSuccess &= glv_platform_get_next_lib_sym((PVOID*)&real_xglGetMultiGpuCompatibility, "xglGetMultiGpuCompatibility");
+    hookSuccess &= glv_platform_get_next_lib_sym((PVOID*)&real_xglOpenSharedMemory, "xglOpenSharedMemory");
+    hookSuccess &= glv_platform_get_next_lib_sym((PVOID*)&real_xglOpenSharedQueueSemaphore, "xglOpenSharedQueueSemaphore");
+    hookSuccess &= glv_platform_get_next_lib_sym((PVOID*)&real_xglOpenPeerMemory, "xglOpenPeerMemory");
+    hookSuccess &= glv_platform_get_next_lib_sym((PVOID*)&real_xglOpenPeerImage, "xglOpenPeerImage");
+    hookSuccess &= glv_platform_get_next_lib_sym((PVOID*)&real_xglDestroyObject, "xglDestroyObject");
+    hookSuccess &= glv_platform_get_next_lib_sym((PVOID*)&real_xglGetObjectInfo, "xglGetObjectInfo");
+    hookSuccess &= glv_platform_get_next_lib_sym((PVOID*)&real_xglBindObjectMemory, "xglBindObjectMemory");
+    hookSuccess &= glv_platform_get_next_lib_sym((PVOID*)&real_xglBindObjectMemoryRange, "xglBindObjectMemoryRange");
+    hookSuccess &= glv_platform_get_next_lib_sym((PVOID*)&real_xglBindImageMemoryRange, "xglBindImageMemoryRange");
+    hookSuccess &= glv_platform_get_next_lib_sym((PVOID*)&real_xglCreateFence, "xglCreateFence");
+    hookSuccess &= glv_platform_get_next_lib_sym((PVOID*)&real_xglGetFenceStatus, "xglGetFenceStatus");
+    hookSuccess &= glv_platform_get_next_lib_sym((PVOID*)&real_xglWaitForFences, "xglWaitForFences");
+    hookSuccess &= glv_platform_get_next_lib_sym((PVOID*)&real_xglCreateQueueSemaphore, "xglCreateQueueSemaphore");
+    hookSuccess &= glv_platform_get_next_lib_sym((PVOID*)&real_xglSignalQueueSemaphore, "xglSignalQueueSemaphore");
+    hookSuccess &= glv_platform_get_next_lib_sym((PVOID*)&real_xglWaitQueueSemaphore, "xglWaitQueueSemaphore");
+    hookSuccess &= glv_platform_get_next_lib_sym((PVOID*)&real_xglCreateEvent, "xglCreateEvent");
+    hookSuccess &= glv_platform_get_next_lib_sym((PVOID*)&real_xglGetEventStatus, "xglGetEventStatus");
+    hookSuccess &= glv_platform_get_next_lib_sym((PVOID*)&real_xglSetEvent, "xglSetEvent");
+    hookSuccess &= glv_platform_get_next_lib_sym((PVOID*)&real_xglResetEvent, "xglResetEvent");
+    hookSuccess &= glv_platform_get_next_lib_sym((PVOID*)&real_xglCreateQueryPool, "xglCreateQueryPool");
+    hookSuccess &= glv_platform_get_next_lib_sym((PVOID*)&real_xglGetQueryPoolResults, "xglGetQueryPoolResults");
+    hookSuccess &= glv_platform_get_next_lib_sym((PVOID*)&real_xglGetFormatInfo, "xglGetFormatInfo");
+    hookSuccess &= glv_platform_get_next_lib_sym((PVOID*)&real_xglCreateBuffer, "xglCreateBuffer");
+    hookSuccess &= glv_platform_get_next_lib_sym((PVOID*)&real_xglCreateBufferView, "xglCreateBufferView");
+    hookSuccess &= glv_platform_get_next_lib_sym((PVOID*)&real_xglCreateImage, "xglCreateImage");
+    hookSuccess &= glv_platform_get_next_lib_sym((PVOID*)&real_xglSetFastClearColor, "xglSetFastClearColor");
+    hookSuccess &= glv_platform_get_next_lib_sym((PVOID*)&real_xglSetFastClearDepth, "xglSetFastClearDepth");
+    hookSuccess &= glv_platform_get_next_lib_sym((PVOID*)&real_xglGetImageSubresourceInfo, "xglGetImageSubresourceInfo");
+    hookSuccess &= glv_platform_get_next_lib_sym((PVOID*)&real_xglCreateImageView, "xglCreateImageView");
+    hookSuccess &= glv_platform_get_next_lib_sym((PVOID*)&real_xglCreateColorAttachmentView, "xglCreateColorAttachmentView");
+    hookSuccess &= glv_platform_get_next_lib_sym((PVOID*)&real_xglCreateDepthStencilView, "xglCreateDepthStencilView");
+    hookSuccess &= glv_platform_get_next_lib_sym((PVOID*)&real_xglCreateShader, "xglCreateShader");
+    hookSuccess &= glv_platform_get_next_lib_sym((PVOID*)&real_xglCreateGraphicsPipeline, "xglCreateGraphicsPipeline");
+    hookSuccess &= glv_platform_get_next_lib_sym((PVOID*)&real_xglCreateComputePipeline, "xglCreateComputePipeline");
+    hookSuccess &= glv_platform_get_next_lib_sym((PVOID*)&real_xglStorePipeline, "xglStorePipeline");
+    hookSuccess &= glv_platform_get_next_lib_sym((PVOID*)&real_xglLoadPipeline, "xglLoadPipeline");
+    hookSuccess &= glv_platform_get_next_lib_sym((PVOID*)&real_xglCreatePipelineDelta, "xglCreatePipelineDelta");
+    hookSuccess &= glv_platform_get_next_lib_sym((PVOID*)&real_xglCreateSampler, "xglCreateSampler");
+    hookSuccess &= glv_platform_get_next_lib_sym((PVOID*)&real_xglCreateDescriptorSetLayout, "xglCreateDescriptorSetLayout");
+    hookSuccess &= glv_platform_get_next_lib_sym((PVOID*)&real_xglBeginDescriptorRegionUpdate, "xglBeginDescriptorRegionUpdate");
+    hookSuccess &= glv_platform_get_next_lib_sym((PVOID*)&real_xglEndDescriptorRegionUpdate, "xglEndDescriptorRegionUpdate");
+    hookSuccess &= glv_platform_get_next_lib_sym((PVOID*)&real_xglCreateDescriptorRegion, "xglCreateDescriptorRegion");
+    hookSuccess &= glv_platform_get_next_lib_sym((PVOID*)&real_xglClearDescriptorRegion, "xglClearDescriptorRegion");
+    hookSuccess &= glv_platform_get_next_lib_sym((PVOID*)&real_xglAllocDescriptorSets, "xglAllocDescriptorSets");
+    hookSuccess &= glv_platform_get_next_lib_sym((PVOID*)&real_xglClearDescriptorSets, "xglClearDescriptorSets");
+    hookSuccess &= glv_platform_get_next_lib_sym((PVOID*)&real_xglUpdateDescriptors, "xglUpdateDescriptors");
+    hookSuccess &= glv_platform_get_next_lib_sym((PVOID*)&real_xglCreateDynamicViewportState, "xglCreateDynamicViewportState");
+    hookSuccess &= glv_platform_get_next_lib_sym((PVOID*)&real_xglCreateDynamicRasterState, "xglCreateDynamicRasterState");
+    hookSuccess &= glv_platform_get_next_lib_sym((PVOID*)&real_xglCreateDynamicColorBlendState, "xglCreateDynamicColorBlendState");
+    hookSuccess &= glv_platform_get_next_lib_sym((PVOID*)&real_xglCreateDynamicDepthStencilState, "xglCreateDynamicDepthStencilState");
+    hookSuccess &= glv_platform_get_next_lib_sym((PVOID*)&real_xglCreateCommandBuffer, "xglCreateCommandBuffer");
+    hookSuccess &= glv_platform_get_next_lib_sym((PVOID*)&real_xglBeginCommandBuffer, "xglBeginCommandBuffer");
+    hookSuccess &= glv_platform_get_next_lib_sym((PVOID*)&real_xglEndCommandBuffer, "xglEndCommandBuffer");
+    hookSuccess &= glv_platform_get_next_lib_sym((PVOID*)&real_xglResetCommandBuffer, "xglResetCommandBuffer");
+    hookSuccess &= glv_platform_get_next_lib_sym((PVOID*)&real_xglCmdBindPipeline, "xglCmdBindPipeline");
+    hookSuccess &= glv_platform_get_next_lib_sym((PVOID*)&real_xglCmdBindPipelineDelta, "xglCmdBindPipelineDelta");
+    hookSuccess &= glv_platform_get_next_lib_sym((PVOID*)&real_xglCmdBindDynamicStateObject, "xglCmdBindDynamicStateObject");
+    hookSuccess &= glv_platform_get_next_lib_sym((PVOID*)&real_xglCmdBindDescriptorSet, "xglCmdBindDescriptorSet");
+    hookSuccess &= glv_platform_get_next_lib_sym((PVOID*)&real_xglCmdBindVertexBuffer, "xglCmdBindVertexBuffer");
+    hookSuccess &= glv_platform_get_next_lib_sym((PVOID*)&real_xglCmdBindIndexBuffer, "xglCmdBindIndexBuffer");
+    hookSuccess &= glv_platform_get_next_lib_sym((PVOID*)&real_xglCmdDraw, "xglCmdDraw");
+    hookSuccess &= glv_platform_get_next_lib_sym((PVOID*)&real_xglCmdDrawIndexed, "xglCmdDrawIndexed");
+    hookSuccess &= glv_platform_get_next_lib_sym((PVOID*)&real_xglCmdDrawIndirect, "xglCmdDrawIndirect");
+    hookSuccess &= glv_platform_get_next_lib_sym((PVOID*)&real_xglCmdDrawIndexedIndirect, "xglCmdDrawIndexedIndirect");
+    hookSuccess &= glv_platform_get_next_lib_sym((PVOID*)&real_xglCmdDispatch, "xglCmdDispatch");
+    hookSuccess &= glv_platform_get_next_lib_sym((PVOID*)&real_xglCmdDispatchIndirect, "xglCmdDispatchIndirect");
+    hookSuccess &= glv_platform_get_next_lib_sym((PVOID*)&real_xglCmdCopyBuffer, "xglCmdCopyBuffer");
+    hookSuccess &= glv_platform_get_next_lib_sym((PVOID*)&real_xglCmdCopyImage, "xglCmdCopyImage");
+    hookSuccess &= glv_platform_get_next_lib_sym((PVOID*)&real_xglCmdCopyBufferToImage, "xglCmdCopyBufferToImage");
+    hookSuccess &= glv_platform_get_next_lib_sym((PVOID*)&real_xglCmdCopyImageToBuffer, "xglCmdCopyImageToBuffer");
+    hookSuccess &= glv_platform_get_next_lib_sym((PVOID*)&real_xglCmdCloneImageData, "xglCmdCloneImageData");
+    hookSuccess &= glv_platform_get_next_lib_sym((PVOID*)&real_xglCmdUpdateBuffer, "xglCmdUpdateBuffer");
+    hookSuccess &= glv_platform_get_next_lib_sym((PVOID*)&real_xglCmdFillBuffer, "xglCmdFillBuffer");
+    hookSuccess &= glv_platform_get_next_lib_sym((PVOID*)&real_xglCmdClearColorImage, "xglCmdClearColorImage");
+    hookSuccess &= glv_platform_get_next_lib_sym((PVOID*)&real_xglCmdClearColorImageRaw, "xglCmdClearColorImageRaw");
+    hookSuccess &= glv_platform_get_next_lib_sym((PVOID*)&real_xglCmdClearDepthStencil, "xglCmdClearDepthStencil");
+    hookSuccess &= glv_platform_get_next_lib_sym((PVOID*)&real_xglCmdResolveImage, "xglCmdResolveImage");
+    hookSuccess &= glv_platform_get_next_lib_sym((PVOID*)&real_xglCmdSetEvent, "xglCmdSetEvent");
+    hookSuccess &= glv_platform_get_next_lib_sym((PVOID*)&real_xglCmdResetEvent, "xglCmdResetEvent");
+    hookSuccess &= glv_platform_get_next_lib_sym((PVOID*)&real_xglCmdWaitEvents, "xglCmdWaitEvents");
+    hookSuccess &= glv_platform_get_next_lib_sym((PVOID*)&real_xglCmdPipelineBarrier, "xglCmdPipelineBarrier");
+    hookSuccess &= glv_platform_get_next_lib_sym((PVOID*)&real_xglCmdBeginQuery, "xglCmdBeginQuery");
+    hookSuccess &= glv_platform_get_next_lib_sym((PVOID*)&real_xglCmdEndQuery, "xglCmdEndQuery");
+    hookSuccess &= glv_platform_get_next_lib_sym((PVOID*)&real_xglCmdResetQueryPool, "xglCmdResetQueryPool");
+    hookSuccess &= glv_platform_get_next_lib_sym((PVOID*)&real_xglCmdWriteTimestamp, "xglCmdWriteTimestamp");
+    hookSuccess &= glv_platform_get_next_lib_sym((PVOID*)&real_xglCmdInitAtomicCounters, "xglCmdInitAtomicCounters");
+    hookSuccess &= glv_platform_get_next_lib_sym((PVOID*)&real_xglCmdLoadAtomicCounters, "xglCmdLoadAtomicCounters");
+    hookSuccess &= glv_platform_get_next_lib_sym((PVOID*)&real_xglCmdSaveAtomicCounters, "xglCmdSaveAtomicCounters");
+    hookSuccess &= glv_platform_get_next_lib_sym((PVOID*)&real_xglCreateFramebuffer, "xglCreateFramebuffer");
+    hookSuccess &= glv_platform_get_next_lib_sym((PVOID*)&real_xglCreateRenderPass, "xglCreateRenderPass");
+    hookSuccess &= glv_platform_get_next_lib_sym((PVOID*)&real_xglCmdBeginRenderPass, "xglCmdBeginRenderPass");
+    hookSuccess &= glv_platform_get_next_lib_sym((PVOID*)&real_xglCmdEndRenderPass, "xglCmdEndRenderPass");
+    if (!hookSuccess)
+    {
+        glv_LogError("Failed to hook XGL.");
+    }
+
+#endif
+}
+
+void DetachHooks()
+{
+#ifdef __linux__
+    return;
+#elif defined(WIN32)
+    BOOL unhookSuccess = TRUE;
+    if (real_xglGetGpuInfo != NULL)
+    {
+        unhookSuccess = Mhook_Unhook((PVOID*)&real_xglCreateInstance);
+        unhookSuccess &= Mhook_Unhook((PVOID*)&real_xglDestroyInstance);
+        unhookSuccess &= Mhook_Unhook((PVOID*)&real_xglEnumerateGpus);
+        unhookSuccess &= Mhook_Unhook((PVOID*)&real_xglGetGpuInfo);
+        unhookSuccess &= Mhook_Unhook((PVOID*)&real_xglGetProcAddr);
+        unhookSuccess &= Mhook_Unhook((PVOID*)&real_xglCreateDevice);
+        unhookSuccess &= Mhook_Unhook((PVOID*)&real_xglDestroyDevice);
+        unhookSuccess &= Mhook_Unhook((PVOID*)&real_xglGetExtensionSupport);
+        unhookSuccess &= Mhook_Unhook((PVOID*)&real_xglEnumerateLayers);
+        unhookSuccess &= Mhook_Unhook((PVOID*)&real_xglGetDeviceQueue);
+        unhookSuccess &= Mhook_Unhook((PVOID*)&real_xglQueueSubmit);
+        unhookSuccess &= Mhook_Unhook((PVOID*)&real_xglQueueSetGlobalMemReferences);
+        unhookSuccess &= Mhook_Unhook((PVOID*)&real_xglQueueWaitIdle);
+        unhookSuccess &= Mhook_Unhook((PVOID*)&real_xglDeviceWaitIdle);
+        unhookSuccess &= Mhook_Unhook((PVOID*)&real_xglAllocMemory);
+        unhookSuccess &= Mhook_Unhook((PVOID*)&real_xglFreeMemory);
+        unhookSuccess &= Mhook_Unhook((PVOID*)&real_xglSetMemoryPriority);
+        unhookSuccess &= Mhook_Unhook((PVOID*)&real_xglMapMemory);
+        unhookSuccess &= Mhook_Unhook((PVOID*)&real_xglUnmapMemory);
+        unhookSuccess &= Mhook_Unhook((PVOID*)&real_xglPinSystemMemory);
+        unhookSuccess &= Mhook_Unhook((PVOID*)&real_xglGetMultiGpuCompatibility);
+        unhookSuccess &= Mhook_Unhook((PVOID*)&real_xglOpenSharedMemory);
+        unhookSuccess &= Mhook_Unhook((PVOID*)&real_xglOpenSharedQueueSemaphore);
+        unhookSuccess &= Mhook_Unhook((PVOID*)&real_xglOpenPeerMemory);
+        unhookSuccess &= Mhook_Unhook((PVOID*)&real_xglOpenPeerImage);
+        unhookSuccess &= Mhook_Unhook((PVOID*)&real_xglDestroyObject);
+        unhookSuccess &= Mhook_Unhook((PVOID*)&real_xglGetObjectInfo);
+        unhookSuccess &= Mhook_Unhook((PVOID*)&real_xglBindObjectMemory);
+        unhookSuccess &= Mhook_Unhook((PVOID*)&real_xglBindObjectMemoryRange);
+        unhookSuccess &= Mhook_Unhook((PVOID*)&real_xglBindImageMemoryRange);
+        unhookSuccess &= Mhook_Unhook((PVOID*)&real_xglCreateFence);
+        unhookSuccess &= Mhook_Unhook((PVOID*)&real_xglGetFenceStatus);
+        unhookSuccess &= Mhook_Unhook((PVOID*)&real_xglWaitForFences);
+        unhookSuccess &= Mhook_Unhook((PVOID*)&real_xglCreateQueueSemaphore);
+        unhookSuccess &= Mhook_Unhook((PVOID*)&real_xglSignalQueueSemaphore);
+        unhookSuccess &= Mhook_Unhook((PVOID*)&real_xglWaitQueueSemaphore);
+        unhookSuccess &= Mhook_Unhook((PVOID*)&real_xglCreateEvent);
+        unhookSuccess &= Mhook_Unhook((PVOID*)&real_xglGetEventStatus);
+        unhookSuccess &= Mhook_Unhook((PVOID*)&real_xglSetEvent);
+        unhookSuccess &= Mhook_Unhook((PVOID*)&real_xglResetEvent);
+        unhookSuccess &= Mhook_Unhook((PVOID*)&real_xglCreateQueryPool);
+        unhookSuccess &= Mhook_Unhook((PVOID*)&real_xglGetQueryPoolResults);
+        unhookSuccess &= Mhook_Unhook((PVOID*)&real_xglGetFormatInfo);
+        unhookSuccess &= Mhook_Unhook((PVOID*)&real_xglCreateBuffer);
+        unhookSuccess &= Mhook_Unhook((PVOID*)&real_xglCreateBufferView);
+        unhookSuccess &= Mhook_Unhook((PVOID*)&real_xglCreateImage);
+        unhookSuccess &= Mhook_Unhook((PVOID*)&real_xglSetFastClearColor);
+        unhookSuccess &= Mhook_Unhook((PVOID*)&real_xglSetFastClearDepth);
+        unhookSuccess &= Mhook_Unhook((PVOID*)&real_xglGetImageSubresourceInfo);
+        unhookSuccess &= Mhook_Unhook((PVOID*)&real_xglCreateImageView);
+        unhookSuccess &= Mhook_Unhook((PVOID*)&real_xglCreateColorAttachmentView);
+        unhookSuccess &= Mhook_Unhook((PVOID*)&real_xglCreateDepthStencilView);
+        unhookSuccess &= Mhook_Unhook((PVOID*)&real_xglCreateShader);
+        unhookSuccess &= Mhook_Unhook((PVOID*)&real_xglCreateGraphicsPipeline);
+        unhookSuccess &= Mhook_Unhook((PVOID*)&real_xglCreateComputePipeline);
+        unhookSuccess &= Mhook_Unhook((PVOID*)&real_xglStorePipeline);
+        unhookSuccess &= Mhook_Unhook((PVOID*)&real_xglLoadPipeline);
+        unhookSuccess &= Mhook_Unhook((PVOID*)&real_xglCreatePipelineDelta);
+        unhookSuccess &= Mhook_Unhook((PVOID*)&real_xglCreateSampler);
+        unhookSuccess &= Mhook_Unhook((PVOID*)&real_xglCreateDescriptorSetLayout);
+        unhookSuccess &= Mhook_Unhook((PVOID*)&real_xglBeginDescriptorRegionUpdate);
+        unhookSuccess &= Mhook_Unhook((PVOID*)&real_xglEndDescriptorRegionUpdate);
+        unhookSuccess &= Mhook_Unhook((PVOID*)&real_xglCreateDescriptorRegion);
+        unhookSuccess &= Mhook_Unhook((PVOID*)&real_xglClearDescriptorRegion);
+        unhookSuccess &= Mhook_Unhook((PVOID*)&real_xglAllocDescriptorSets);
+        unhookSuccess &= Mhook_Unhook((PVOID*)&real_xglClearDescriptorSets);
+        unhookSuccess &= Mhook_Unhook((PVOID*)&real_xglUpdateDescriptors);
+        unhookSuccess &= Mhook_Unhook((PVOID*)&real_xglCreateDynamicViewportState);
+        unhookSuccess &= Mhook_Unhook((PVOID*)&real_xglCreateDynamicRasterState);
+        unhookSuccess &= Mhook_Unhook((PVOID*)&real_xglCreateDynamicColorBlendState);
+        unhookSuccess &= Mhook_Unhook((PVOID*)&real_xglCreateDynamicDepthStencilState);
+        unhookSuccess &= Mhook_Unhook((PVOID*)&real_xglCreateCommandBuffer);
+        unhookSuccess &= Mhook_Unhook((PVOID*)&real_xglBeginCommandBuffer);
+        unhookSuccess &= Mhook_Unhook((PVOID*)&real_xglEndCommandBuffer);
+        unhookSuccess &= Mhook_Unhook((PVOID*)&real_xglResetCommandBuffer);
+        unhookSuccess &= Mhook_Unhook((PVOID*)&real_xglCmdBindPipeline);
+        unhookSuccess &= Mhook_Unhook((PVOID*)&real_xglCmdBindPipelineDelta);
+        unhookSuccess &= Mhook_Unhook((PVOID*)&real_xglCmdBindDynamicStateObject);
+        unhookSuccess &= Mhook_Unhook((PVOID*)&real_xglCmdBindDescriptorSet);
+        unhookSuccess &= Mhook_Unhook((PVOID*)&real_xglCmdBindVertexBuffer);
+        unhookSuccess &= Mhook_Unhook((PVOID*)&real_xglCmdBindIndexBuffer);
+        unhookSuccess &= Mhook_Unhook((PVOID*)&real_xglCmdDraw);
+        unhookSuccess &= Mhook_Unhook((PVOID*)&real_xglCmdDrawIndexed);
+        unhookSuccess &= Mhook_Unhook((PVOID*)&real_xglCmdDrawIndirect);
+        unhookSuccess &= Mhook_Unhook((PVOID*)&real_xglCmdDrawIndexedIndirect);
+        unhookSuccess &= Mhook_Unhook((PVOID*)&real_xglCmdDispatch);
+        unhookSuccess &= Mhook_Unhook((PVOID*)&real_xglCmdDispatchIndirect);
+        unhookSuccess &= Mhook_Unhook((PVOID*)&real_xglCmdCopyBuffer);
+        unhookSuccess &= Mhook_Unhook((PVOID*)&real_xglCmdCopyImage);
+        unhookSuccess &= Mhook_Unhook((PVOID*)&real_xglCmdCopyBufferToImage);
+        unhookSuccess &= Mhook_Unhook((PVOID*)&real_xglCmdCopyImageToBuffer);
+        unhookSuccess &= Mhook_Unhook((PVOID*)&real_xglCmdCloneImageData);
+        unhookSuccess &= Mhook_Unhook((PVOID*)&real_xglCmdUpdateBuffer);
+        unhookSuccess &= Mhook_Unhook((PVOID*)&real_xglCmdFillBuffer);
+        unhookSuccess &= Mhook_Unhook((PVOID*)&real_xglCmdClearColorImage);
+        unhookSuccess &= Mhook_Unhook((PVOID*)&real_xglCmdClearColorImageRaw);
+        unhookSuccess &= Mhook_Unhook((PVOID*)&real_xglCmdClearDepthStencil);
+        unhookSuccess &= Mhook_Unhook((PVOID*)&real_xglCmdResolveImage);
+        unhookSuccess &= Mhook_Unhook((PVOID*)&real_xglCmdSetEvent);
+        unhookSuccess &= Mhook_Unhook((PVOID*)&real_xglCmdResetEvent);
+        unhookSuccess &= Mhook_Unhook((PVOID*)&real_xglCmdWaitEvents);
+        unhookSuccess &= Mhook_Unhook((PVOID*)&real_xglCmdPipelineBarrier);
+        unhookSuccess &= Mhook_Unhook((PVOID*)&real_xglCmdBeginQuery);
+        unhookSuccess &= Mhook_Unhook((PVOID*)&real_xglCmdEndQuery);
+        unhookSuccess &= Mhook_Unhook((PVOID*)&real_xglCmdResetQueryPool);
+        unhookSuccess &= Mhook_Unhook((PVOID*)&real_xglCmdWriteTimestamp);
+        unhookSuccess &= Mhook_Unhook((PVOID*)&real_xglCmdInitAtomicCounters);
+        unhookSuccess &= Mhook_Unhook((PVOID*)&real_xglCmdLoadAtomicCounters);
+        unhookSuccess &= Mhook_Unhook((PVOID*)&real_xglCmdSaveAtomicCounters);
+        unhookSuccess &= Mhook_Unhook((PVOID*)&real_xglCreateFramebuffer);
+        unhookSuccess &= Mhook_Unhook((PVOID*)&real_xglCreateRenderPass);
+        unhookSuccess &= Mhook_Unhook((PVOID*)&real_xglCmdBeginRenderPass);
+        unhookSuccess &= Mhook_Unhook((PVOID*)&real_xglCmdEndRenderPass);
+    }
+    isHooked = FALSE;
+    if (!unhookSuccess)
+    {
+        glv_LogError("Failed to unhook XGL.");
+    }
+#endif
+}
+#ifdef WIN32
+INIT_ONCE gInitOnce = INIT_ONCE_STATIC_INIT;
+#elif defined(PLATFORM_LINUX)
+pthread_once_t gInitOnce = PTHREAD_ONCE_INIT;
+#endif
+
+void send_xgl_api_version_packet()
+{
+    struct_xglApiVersion* pPacket;
+    glv_trace_packet_header* pHeader;
+    pHeader = glv_create_trace_packet(GLV_TID_XGL, GLV_TPI_XGL_xglApiVersion, sizeof(struct_xglApiVersion), 0);
+    pPacket = interpret_body_as_xglApiVersion(pHeader, FALSE);
+    pPacket->version = XGL_API_VERSION;
+    FINISH_TRACE_PACKET();
+}
+
+static GLV_CRITICAL_SECTION g_memInfoLock;
+void InitTracer(void)
+{
+    char *ipAddr = glv_get_global_var("GLVLIB_TRACE_IPADDR");
+    if (ipAddr == NULL)
+        ipAddr = "127.0.0.1";
+    gMessageStream = glv_MessageStream_create(FALSE, ipAddr, GLV_BASE_PORT + GLV_TID_XGL);
+    glv_trace_set_trace_file(glv_FileLike_create_msg(gMessageStream));
+//    glv_tracelog_set_log_file(glv_FileLike_create_file(fopen("glv_log_traceside.txt","w")));
+    glv_tracelog_set_tracer_id(GLV_TID_XGL);
+    glv_create_critical_section(&g_memInfoLock);
+    send_xgl_api_version_packet();
+}
+
+// Support for shadowing CPU mapped memory
+typedef struct _XGLAllocInfo {
+    XGL_GPU_SIZE   size;
+    XGL_GPU_MEMORY handle;
+    void           *pData;
+    BOOL           valid;
+} XGLAllocInfo;
+typedef struct _XGLMemInfo {
+    unsigned int numEntrys;
+    XGLAllocInfo *pEntrys;
+    XGLAllocInfo *pLastMapped;
+    unsigned int capacity;
+} XGLMemInfo;
+
+static XGLMemInfo g_memInfo = {0, NULL, NULL, 0};
+
+static void init_mem_info_entrys(XGLAllocInfo *ptr, const unsigned int num)
+{
+    unsigned int i;
+    for (i = 0; i < num; i++)
+    {
+        XGLAllocInfo *entry = ptr + i;
+        entry->pData = NULL;
+        entry->size  = 0;
+        entry->handle = NULL;
+        entry->valid = FALSE;
+    }
+}
+
+// caller must hold the g_memInfoLock
+static void init_mem_info()
+{
+    g_memInfo.numEntrys = 0;
+    g_memInfo.capacity = 4096;
+    g_memInfo.pLastMapped = NULL;
+
+    g_memInfo.pEntrys = GLV_NEW_ARRAY(XGLAllocInfo, g_memInfo.capacity);
+
+    if (g_memInfo.pEntrys == NULL)
+        glv_LogError("init_mem_info()  malloc failed\n");
+    else
+        init_mem_info_entrys(g_memInfo.pEntrys, g_memInfo.capacity);
+}
+
+// caller must hold the g_memInfoLock
+static void delete_mem_info()
+{
+    GLV_DELETE(g_memInfo.pEntrys);
+    g_memInfo.pEntrys = NULL;
+    g_memInfo.numEntrys = 0;
+    g_memInfo.capacity = 0;
+    g_memInfo.pLastMapped = NULL;
+}
+
+// caller must hold the g_memInfoLock
+static XGLAllocInfo * get_mem_info_entry()
+{
+    unsigned int i;
+    XGLAllocInfo *entry;
+    if (g_memInfo.numEntrys > g_memInfo.capacity)
+    {
+        glv_LogError("get_mem_info_entry() bad internal state numEntrys %u\n", g_memInfo.numEntrys);
+        return NULL;
+    }
+
+    entry = g_memInfo.pEntrys;
+    for (i = 0; i < g_memInfo.numEntrys; i++)
+    {
+        if ((entry + i)->valid == FALSE)
+            return entry + i;
+    }
+    if (g_memInfo.numEntrys == g_memInfo.capacity)
+    {  // grow the array 2x
+        g_memInfo.capacity *= 2;
+        g_memInfo.pEntrys = (XGLAllocInfo *) GLV_REALLOC(g_memInfo.pEntrys, g_memInfo.capacity * sizeof(XGLAllocInfo));
+        if (g_memInfo.pEntrys == NULL)
+            glv_LogError("get_mem_info_entry() realloc failed\n");
+        //glv_LogInfo("realloc memInfo from %u to %u\n", g_memInfo.capacity /2, g_memInfo.capacity);
+        //init the newly added entrys
+        init_mem_info_entrys(g_memInfo.pEntrys + g_memInfo.capacity / 2, g_memInfo.capacity / 2);
+    }
+
+    assert(g_memInfo.numEntrys < g_memInfo.capacity);
+    entry = g_memInfo.pEntrys + g_memInfo.numEntrys;
+    g_memInfo.numEntrys++;
+    assert(entry->valid == FALSE);
+    return entry;
+}
+
+// caller must hold the g_memInfoLock
+static XGLAllocInfo * find_mem_info_entry(const XGL_GPU_MEMORY handle)
+{
+    XGLAllocInfo *entry;
+    unsigned int i;
+    entry = g_memInfo.pEntrys;
+    if (g_memInfo.pLastMapped && g_memInfo.pLastMapped->handle == handle && g_memInfo.pLastMapped->valid)
+    {
+        return g_memInfo.pLastMapped;
+    }
+    for (i = 0; i < g_memInfo.numEntrys; i++)
+    {
+        if ((entry + i)->valid && (handle == (entry + i)->handle))
+        {
+            return entry + i;
+        }
+    }
+
+    return NULL;
+}
+
+static XGLAllocInfo * find_mem_info_entry_lock(const XGL_GPU_MEMORY handle)
+{
+    XGLAllocInfo *res;
+    glv_enter_critical_section(&g_memInfoLock);
+    res = find_mem_info_entry(handle);
+    glv_leave_critical_section(&g_memInfoLock);
+    return res;
+}
+
+static void add_new_handle_to_mem_info(const XGL_GPU_MEMORY handle, XGL_GPU_SIZE size, void *pData)
+{
+    XGLAllocInfo *entry;
+
+    glv_enter_critical_section(&g_memInfoLock);
+    if (g_memInfo.capacity == 0)
+        init_mem_info();
+
+    entry = get_mem_info_entry();
+    if (entry)
+    {
+        entry->valid = TRUE;
+        entry->handle = handle;
+        entry->size = size;
+        entry->pData = pData;   // NOTE: xglFreeMemory will free this mem, so no malloc()
+    }
+    glv_leave_critical_section(&g_memInfoLock);
+}
+
+static void add_data_to_mem_info(const XGL_GPU_MEMORY handle, void *pData)
+{
+    XGLAllocInfo *entry;
+
+    glv_enter_critical_section(&g_memInfoLock);
+    entry = find_mem_info_entry(handle);
+    if (entry)
+    {
+        entry->pData = pData;
+    }
+    g_memInfo.pLastMapped = entry;
+    glv_leave_critical_section(&g_memInfoLock);
+}
+
+static void rm_handle_from_mem_info(const XGL_GPU_MEMORY handle)
+{
+    XGLAllocInfo *entry;
+
+    glv_enter_critical_section(&g_memInfoLock);
+    entry = find_mem_info_entry(handle);
+    if (entry)
+    {
+        entry->valid = FALSE;
+        entry->pData = NULL;
+        entry->size = 0;
+        entry->handle = NULL;
+
+        if (entry == g_memInfo.pLastMapped)
+            g_memInfo.pLastMapped = NULL;
+        // adjust numEntrys to be last valid entry in list
+        do {
+            entry =  g_memInfo.pEntrys + g_memInfo.numEntrys - 1;
+            if (entry->valid == FALSE)
+                g_memInfo.numEntrys--;
+        } while ((entry->valid == FALSE) && (g_memInfo.numEntrys > 0));
+        if (g_memInfo.numEntrys == 0)
+            delete_mem_info();
+    }
+    glv_leave_critical_section(&g_memInfoLock);
+}
+
+static void add_begin_cmdbuf_to_trace_packet(glv_trace_packet_header* pHeader, void** ppOut, const void* pIn)
+{
+    const XGL_CMD_BUFFER_BEGIN_INFO* pInNow = pIn;
+    XGL_CMD_BUFFER_BEGIN_INFO** ppOutNext = (XGL_CMD_BUFFER_BEGIN_INFO**)ppOut;
+    while (pInNow != NULL)
+    {
+        XGL_CMD_BUFFER_BEGIN_INFO** ppOutNow = ppOutNext;
+        ppOutNext = NULL;
+
+        switch (pInNow->sType)
+        {
+            case XGL_STRUCTURE_TYPE_CMD_BUFFER_GRAPHICS_BEGIN_INFO:
+            {
+                glv_add_buffer_to_trace_packet(pHeader, (void**)(ppOutNow), sizeof(XGL_CMD_BUFFER_GRAPHICS_BEGIN_INFO), pInNow);
+                ppOutNext = (XGL_CMD_BUFFER_BEGIN_INFO**)&(*ppOutNow)->pNext;
+                glv_finalize_buffer_address(pHeader, (void**)(ppOutNow));
+                break;
+            }
+            default:
+                assert(!"Encountered an unexpected type in cmdbuffer_begin_info list");
+        }
+        pInNow = (XGL_CMD_BUFFER_BEGIN_INFO*)pInNow->pNext;
+    }
+    return;
+}
+
+static void add_alloc_memory_to_trace_packet(glv_trace_packet_header* pHeader, void** ppOut, const void* pIn)
+{
+    const XGL_MEMORY_ALLOC_INFO* pInNow = pIn;
+    XGL_MEMORY_ALLOC_INFO** ppOutNext = (XGL_MEMORY_ALLOC_INFO**)ppOut;
+    while (pInNow != NULL)
+    {
+        XGL_MEMORY_ALLOC_INFO** ppOutNow = ppOutNext;
+        ppOutNext = NULL;
+
+        switch (pInNow->sType)
+        {
+        case XGL_STRUCTURE_TYPE_MEMORY_ALLOC_BUFFER_INFO:
+        {
+            glv_add_buffer_to_trace_packet(pHeader, (void**)(ppOutNow), sizeof(XGL_MEMORY_ALLOC_BUFFER_INFO), pInNow);
+            ppOutNext = (XGL_MEMORY_ALLOC_INFO**)&(*ppOutNow)->pNext;
+            glv_finalize_buffer_address(pHeader, (void**)(ppOutNow));
+            break;
+        }
+        case XGL_STRUCTURE_TYPE_MEMORY_ALLOC_IMAGE_INFO:
+        {
+            glv_add_buffer_to_trace_packet(pHeader, (void**)(ppOutNow), sizeof(XGL_MEMORY_ALLOC_IMAGE_INFO), pInNow);
+            ppOutNext = (XGL_MEMORY_ALLOC_INFO**)&(*ppOutNow)->pNext;
+            glv_finalize_buffer_address(pHeader, (void**)(ppOutNow));
+            break;
+        }
+        default:
+            assert(!"Encountered an unexpected type in memory_alloc_info list");
+        }
+        pInNow = (XGL_MEMORY_ALLOC_INFO*)pInNow->pNext;
+    }
+    return;
+}
+
+static size_t calculate_memory_barrier_size(uint32_t mbCount, const void** ppMemBarriers)
+{
+    uint32_t i, siz=0;
+    for (i = 0; i < mbCount; i++) {
+        XGL_MEMORY_BARRIER *pNext = (XGL_MEMORY_BARRIER *) ppMemBarriers[i];
+        switch (pNext->sType) {
+            case XGL_STRUCTURE_TYPE_MEMORY_BARRIER:
+                siz += sizeof(XGL_MEMORY_BARRIER);
+                break;
+            case XGL_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER:
+                siz += sizeof(XGL_BUFFER_MEMORY_BARRIER);
+                break;
+            case XGL_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER:
+                siz += sizeof(XGL_IMAGE_MEMORY_BARRIER);
+                break;
+            default:
+                assert(0);
+                break;
+        }
+    }
+    return siz;
+}
+
+static void add_pipeline_shader_to_trace_packet(glv_trace_packet_header* pHeader, XGL_PIPELINE_SHADER* packetShader, const XGL_PIPELINE_SHADER* paramShader)
+{
+    uint32_t i;
+    // constant buffers
+    if (paramShader->linkConstBufferCount > 0 && paramShader->pLinkConstBufferInfo != NULL)
+    {
+        glv_add_buffer_to_trace_packet(pHeader, (void**)&(packetShader->pLinkConstBufferInfo), sizeof(XGL_LINK_CONST_BUFFER) * paramShader->linkConstBufferCount, paramShader->pLinkConstBufferInfo);
+        for (i = 0; i < paramShader->linkConstBufferCount; i++)
+        {
+            glv_add_buffer_to_trace_packet(pHeader, (void**)&(packetShader->pLinkConstBufferInfo[i].pBufferData), packetShader->pLinkConstBufferInfo[i].bufferSize, paramShader->pLinkConstBufferInfo[i].pBufferData);
+        }
+    }
+}
+
+static void finalize_pipeline_shader_address(glv_trace_packet_header* pHeader, const XGL_PIPELINE_SHADER* packetShader)
+{
+    uint32_t i;
+    // constant buffers
+    if (packetShader->linkConstBufferCount > 0 && packetShader->pLinkConstBufferInfo != NULL)
+    {
+        for (i = 0; i < packetShader->linkConstBufferCount; i++)
+        {
+            glv_finalize_buffer_address(pHeader, (void**)&(packetShader->pLinkConstBufferInfo[i].pBufferData));
+        }
+        glv_finalize_buffer_address(pHeader, (void**)&(packetShader->pLinkConstBufferInfo));
+    }
+}
+
+static void add_create_ds_layout_to_trace_packet(glv_trace_packet_header* pHeader, void** ppOut, const void* pIn)
+{
+    const XGL_DESCRIPTOR_SET_LAYOUT_CREATE_INFO* pInNow = pIn;
+    XGL_DESCRIPTOR_SET_LAYOUT_CREATE_INFO** ppOutNext = (XGL_DESCRIPTOR_SET_LAYOUT_CREATE_INFO**)ppOut;
+    while (pInNow != NULL)
+    {
+        XGL_DESCRIPTOR_SET_LAYOUT_CREATE_INFO** ppOutNow = ppOutNext;
+        ppOutNext = NULL;
+        glv_add_buffer_to_trace_packet(pHeader, (void**)(ppOutNow), sizeof(XGL_DESCRIPTOR_SET_LAYOUT_CREATE_INFO), pInNow);
+        ppOutNext = (XGL_DESCRIPTOR_SET_LAYOUT_CREATE_INFO**)&(*ppOutNow)->pNext;
+        glv_finalize_buffer_address(pHeader, (void**)(ppOutNow));
+        pInNow = (XGL_DESCRIPTOR_SET_LAYOUT_CREATE_INFO*)pInNow->pNext;
+    }
+    return;
+}
+
+static void add_update_descriptors_to_trace_packet(glv_trace_packet_header* pHeader, void** ppOut, const void* pIn)
+{
+    const XGL_UPDATE_SAMPLERS* pInNow = pIn;
+    XGL_UPDATE_SAMPLERS** ppOutNext = (XGL_UPDATE_SAMPLERS**)ppOut;
+    while (pInNow != NULL)
+    {
+        XGL_UPDATE_SAMPLERS** ppOutNow = ppOutNext;
+        ppOutNext = NULL;
+        switch (pInNow->sType)
+        {
+        case XGL_STRUCTURE_TYPE_UPDATE_SAMPLERS:
+        {
+            glv_add_buffer_to_trace_packet(pHeader, (void**)(ppOutNow), sizeof(XGL_UPDATE_SAMPLERS), pInNow);
+            XGL_UPDATE_SAMPLERS* pPacket = (XGL_UPDATE_SAMPLERS*)*ppOutNow;
+            glv_add_buffer_to_trace_packet(pHeader, (void **) &pPacket->pSamplers, ((XGL_UPDATE_SAMPLERS*)pInNow)->count * sizeof(XGL_SAMPLER), ((XGL_UPDATE_SAMPLERS*)pInNow)->pSamplers);
+            glv_finalize_buffer_address(pHeader, (void**)&(pPacket->pSamplers));
+            ppOutNext = (XGL_UPDATE_SAMPLERS**)&(*ppOutNow)->pNext;
+            glv_finalize_buffer_address(pHeader, (void**)(ppOutNow));
+            break;
+        }
+        case XGL_STRUCTURE_TYPE_UPDATE_SAMPLER_TEXTURES:
+        {
+            glv_add_buffer_to_trace_packet(pHeader, (void**)(ppOutNow), sizeof(XGL_UPDATE_SAMPLER_TEXTURES), pInNow);
+            XGL_UPDATE_SAMPLER_TEXTURES* pPacket = (XGL_UPDATE_SAMPLER_TEXTURES*)*ppOutNow;
+            glv_add_buffer_to_trace_packet(pHeader, (void **) &pPacket->pSamplerImageViews, ((XGL_UPDATE_SAMPLER_TEXTURES*)pInNow)->count * sizeof(XGL_SAMPLER_IMAGE_VIEW_INFO), ((XGL_UPDATE_SAMPLER_TEXTURES*)pInNow)->pSamplerImageViews);
+            uint32_t i;
+            for (i = 0; i < ((XGL_UPDATE_SAMPLER_TEXTURES*)pInNow)->count; i++) {
+                glv_add_buffer_to_trace_packet(pHeader, (void **) &pPacket->pSamplerImageViews[i].pImageView, sizeof(XGL_IMAGE_VIEW_ATTACH_INFO), ((XGL_UPDATE_SAMPLER_TEXTURES*)pInNow)->pSamplerImageViews[i].pImageView);
+                glv_finalize_buffer_address(pHeader, (void**)&(pPacket->pSamplerImageViews[i].pImageView));
+            }
+            glv_finalize_buffer_address(pHeader, (void**)&(pPacket->pSamplerImageViews));
+            ppOutNext = (XGL_UPDATE_SAMPLERS**)&(*ppOutNow)->pNext;
+            glv_finalize_buffer_address(pHeader, (void**)(ppOutNow));
+            break;
+        }
+        case XGL_STRUCTURE_TYPE_UPDATE_IMAGES:
+        {
+            glv_add_buffer_to_trace_packet(pHeader, (void**)(ppOutNow), sizeof(XGL_UPDATE_IMAGES), pInNow);
+            XGL_UPDATE_IMAGES* pPacket = (XGL_UPDATE_IMAGES*)*ppOutNow;
+            uint32_t i;
+            glv_add_buffer_to_trace_packet(pHeader, (void **) &pPacket->pImageViews, ((XGL_UPDATE_IMAGES*)pInNow)->count * sizeof(XGL_IMAGE_VIEW_ATTACH_INFO *), ((XGL_UPDATE_IMAGES*)pInNow)->pImageViews);
+            for (i = 0; i < ((XGL_UPDATE_IMAGES*)pInNow)->count; i++) {
+                glv_add_buffer_to_trace_packet(pHeader, (void **) &pPacket->pImageViews[i], sizeof(XGL_IMAGE_VIEW_ATTACH_INFO), ((XGL_UPDATE_IMAGES*)pInNow)->pImageViews[i]);
+                glv_finalize_buffer_address(pHeader, (void**)&(pPacket->pImageViews[i]));
+            }
+            glv_finalize_buffer_address(pHeader, (void**)&(pPacket->pImageViews));
+            ppOutNext = (XGL_UPDATE_SAMPLERS**)&(*ppOutNow)->pNext;
+            glv_finalize_buffer_address(pHeader, (void**)(ppOutNow));
+            break;
+        }
+        case XGL_STRUCTURE_TYPE_UPDATE_BUFFERS:
+        {
+            glv_add_buffer_to_trace_packet(pHeader, (void**)(ppOutNow), sizeof(XGL_UPDATE_BUFFERS), pInNow);
+            XGL_UPDATE_BUFFERS* pPacket = (XGL_UPDATE_BUFFERS*)*ppOutNow;
+            glv_add_buffer_to_trace_packet(pHeader, (void **) &pPacket->pBufferViews, ((XGL_UPDATE_BUFFERS*)pInNow)->count * sizeof(XGL_BUFFER_VIEW_ATTACH_INFO *), ((XGL_UPDATE_BUFFERS*)pInNow)->pBufferViews);
+            uint32_t i;
+            for (i = 0; i < ((XGL_UPDATE_BUFFERS*)pInNow)->count; i++) {
+                glv_add_buffer_to_trace_packet(pHeader, (void **) &pPacket->pBufferViews[i], sizeof(XGL_BUFFER_VIEW_ATTACH_INFO), ((XGL_UPDATE_BUFFERS*)pInNow)->pBufferViews[i]);
+                glv_finalize_buffer_address(pHeader, (void**)&(pPacket->pBufferViews[i]));
+            }
+            glv_finalize_buffer_address(pHeader, (void**)&(pPacket->pBufferViews));
+            ppOutNext = (XGL_UPDATE_SAMPLERS**)&(*ppOutNow)->pNext;
+            glv_finalize_buffer_address(pHeader, (void**)(ppOutNow));
+            break;
+        }
+        case XGL_STRUCTURE_TYPE_UPDATE_AS_COPY:
+        {
+            glv_add_buffer_to_trace_packet(pHeader, (void**)(ppOutNow), sizeof(XGL_UPDATE_AS_COPY), pInNow);
+            ppOutNext = (XGL_UPDATE_SAMPLERS**)&(*ppOutNow)->pNext;
+            glv_finalize_buffer_address(pHeader, (void**)(ppOutNow));
+            break;
+        }
+            default:
+                assert(0);
+        }
+        pInNow = (XGL_UPDATE_SAMPLERS*)pInNow->pNext;
+    }
+    return;
+}
+
+static void add_pipeline_state_to_trace_packet(glv_trace_packet_header* pHeader, void** ppOut, const void* pIn)
+{
+    const XGL_GRAPHICS_PIPELINE_CREATE_INFO* pInNow = pIn;
+    XGL_GRAPHICS_PIPELINE_CREATE_INFO** ppOutNext = (XGL_GRAPHICS_PIPELINE_CREATE_INFO**)ppOut;
+    while (pInNow != NULL)
+    {
+        XGL_GRAPHICS_PIPELINE_CREATE_INFO** ppOutNow = ppOutNext;
+        ppOutNext = NULL;
+
+        switch (pInNow->sType)
+        {
+            case XGL_STRUCTURE_TYPE_PIPELINE_IA_STATE_CREATE_INFO:
+            {
+                glv_add_buffer_to_trace_packet(pHeader, (void**)(ppOutNow), sizeof(XGL_PIPELINE_IA_STATE_CREATE_INFO), pInNow);
+                ppOutNext = (XGL_GRAPHICS_PIPELINE_CREATE_INFO**)&(*ppOutNow)->pNext;
+                glv_finalize_buffer_address(pHeader, (void**)(ppOutNow));
+                break;
+            }
+            case XGL_STRUCTURE_TYPE_PIPELINE_TESS_STATE_CREATE_INFO:
+            {
+                glv_add_buffer_to_trace_packet(pHeader, (void**)(ppOutNow), sizeof(XGL_PIPELINE_TESS_STATE_CREATE_INFO), pInNow);
+                ppOutNext = (XGL_GRAPHICS_PIPELINE_CREATE_INFO**)&(*ppOutNow)->pNext;
+                glv_finalize_buffer_address(pHeader, (void**)(ppOutNow));
+                break;
+            }
+            case XGL_STRUCTURE_TYPE_PIPELINE_RS_STATE_CREATE_INFO:
+            {
+                glv_add_buffer_to_trace_packet(pHeader, (void**)(ppOutNow), sizeof(XGL_PIPELINE_RS_STATE_CREATE_INFO), pInNow);
+                ppOutNext = (XGL_GRAPHICS_PIPELINE_CREATE_INFO**)&(*ppOutNow)->pNext;
+                glv_finalize_buffer_address(pHeader, (void**)(ppOutNow));
+                break;
+            }
+            case XGL_STRUCTURE_TYPE_PIPELINE_DS_STATE_CREATE_INFO:
+            {
+                glv_add_buffer_to_trace_packet(pHeader, (void**)(ppOutNow), sizeof(XGL_PIPELINE_DS_STATE_CREATE_INFO), pInNow);
+                ppOutNext = (XGL_GRAPHICS_PIPELINE_CREATE_INFO**)&(*ppOutNow)->pNext;
+                glv_finalize_buffer_address(pHeader, (void**)(ppOutNow));
+                break;
+            }
+            case XGL_STRUCTURE_TYPE_PIPELINE_VP_STATE_CREATE_INFO:
+            {
+                glv_add_buffer_to_trace_packet(pHeader, (void**)(ppOutNow), sizeof(XGL_PIPELINE_VP_STATE_CREATE_INFO), pInNow);
+                ppOutNext = (XGL_GRAPHICS_PIPELINE_CREATE_INFO**)&(*ppOutNow)->pNext;
+                glv_finalize_buffer_address(pHeader, (void**)(ppOutNow));
+                break;
+            }
+            case XGL_STRUCTURE_TYPE_PIPELINE_MS_STATE_CREATE_INFO:
+            {
+                glv_add_buffer_to_trace_packet(pHeader, (void**)(ppOutNow), sizeof(XGL_PIPELINE_MS_STATE_CREATE_INFO), pInNow);
+                ppOutNext = (XGL_GRAPHICS_PIPELINE_CREATE_INFO**)&(*ppOutNow)->pNext;
+                glv_finalize_buffer_address(pHeader, (void**)(ppOutNow));
+                break;
+            }
+            case XGL_STRUCTURE_TYPE_PIPELINE_CB_STATE_CREATE_INFO:
+            {
+                XGL_PIPELINE_CB_STATE_CREATE_INFO *pPacket = NULL;
+                XGL_PIPELINE_CB_STATE_CREATE_INFO *pIn = NULL;
+                glv_add_buffer_to_trace_packet(pHeader, (void**)(ppOutNow), sizeof(XGL_PIPELINE_CB_STATE_CREATE_INFO), pInNow);
+                pPacket = (XGL_PIPELINE_CB_STATE_CREATE_INFO*) *ppOutNow;
+                pIn = (XGL_PIPELINE_CB_STATE_CREATE_INFO*) pInNow;
+                glv_add_buffer_to_trace_packet(pHeader, (void **) &pPacket->pAttachments, pIn->attachmentCount * sizeof(XGL_PIPELINE_CB_ATTACHMENT_STATE), pIn->pAttachments);
+                glv_finalize_buffer_address(pHeader, (void**)&(pPacket->pAttachments));
+                ppOutNext = (XGL_GRAPHICS_PIPELINE_CREATE_INFO**)&(*ppOutNow)->pNext;
+                glv_finalize_buffer_address(pHeader, (void**)(ppOutNow));
+                break;
+            }
+            case XGL_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO:
+            {
+                XGL_PIPELINE_SHADER_STAGE_CREATE_INFO* pPacket = NULL;
+                XGL_PIPELINE_SHADER_STAGE_CREATE_INFO* pInPacket = NULL;
+                glv_add_buffer_to_trace_packet(pHeader, (void**)(ppOutNow), sizeof(XGL_PIPELINE_SHADER_STAGE_CREATE_INFO), pInNow);
+                pPacket = (XGL_PIPELINE_SHADER_STAGE_CREATE_INFO*) *ppOutNow;
+                pInPacket = (XGL_PIPELINE_SHADER_STAGE_CREATE_INFO*) pInNow;
+                add_pipeline_shader_to_trace_packet(pHeader, &pPacket->shader, &pInPacket->shader);
+                finalize_pipeline_shader_address(pHeader, &pPacket->shader);
+                ppOutNext = (XGL_GRAPHICS_PIPELINE_CREATE_INFO**)&(*ppOutNow)->pNext;
+                glv_finalize_buffer_address(pHeader, (void**)(ppOutNow));
+                break;
+            }
+            case XGL_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_CREATE_INFO:
+            {
+                XGL_PIPELINE_VERTEX_INPUT_CREATE_INFO *pPacket = NULL;
+                XGL_PIPELINE_VERTEX_INPUT_CREATE_INFO *pIn = NULL;
+                glv_add_buffer_to_trace_packet(pHeader, (void**)(ppOutNow), sizeof(XGL_PIPELINE_VERTEX_INPUT_CREATE_INFO), pInNow);
+                pPacket = (XGL_PIPELINE_VERTEX_INPUT_CREATE_INFO*) *ppOutNow;
+                pIn = (XGL_PIPELINE_VERTEX_INPUT_CREATE_INFO*) pInNow;
+                glv_add_buffer_to_trace_packet(pHeader, (void **) &pPacket->pVertexBindingDescriptions, pIn->bindingCount * sizeof(XGL_VERTEX_INPUT_BINDING_DESCRIPTION), pIn->pVertexBindingDescriptions);
+                glv_finalize_buffer_address(pHeader, (void**)&(pPacket->pVertexBindingDescriptions));
+                glv_add_buffer_to_trace_packet(pHeader, (void **) &pPacket->pVertexAttributeDescriptions, pIn->attributeCount * sizeof(XGL_VERTEX_INPUT_ATTRIBUTE_DESCRIPTION), pIn->pVertexAttributeDescriptions);
+                glv_finalize_buffer_address(pHeader, (void**)&(pPacket->pVertexAttributeDescriptions));
+                ppOutNext = (XGL_GRAPHICS_PIPELINE_CREATE_INFO**)&(*ppOutNow)->pNext;
+                glv_finalize_buffer_address(pHeader, (void**)(ppOutNow));
+                break;
+            }
+            default:
+                assert(!"Encountered an unexpected type in pipeline state list");
+        }
+        pInNow = (XGL_GRAPHICS_PIPELINE_CREATE_INFO*)pInNow->pNext;
+    }
+    return;
+}
+GLVTRACER_EXPORT XGL_RESULT XGLAPI __HOOKED_xglCreateInstance(
+    const XGL_APPLICATION_INFO* pAppInfo,
+    const XGL_ALLOC_CALLBACKS* pAllocCb,
+    XGL_INSTANCE* pInstance)
+{
+    glv_trace_packet_header* pHeader;
+    XGL_RESULT result;
+    struct_xglCreateInstance* pPacket = NULL;
+    uint64_t startTime;
+    glv_platform_thread_once(&gInitOnce, InitTracer);
+    SEND_ENTRYPOINT_ID(xglCreateInstance);
+    if (real_xglCreateInstance == xglCreateInstance)
+    {
+        glv_platform_get_next_lib_sym((void **) &real_xglCreateInstance,"xglCreateInstance");
+    }
+    startTime = glv_get_time();
+    result = real_xglCreateInstance(pAppInfo, pAllocCb, pInstance);
+    CREATE_TRACE_PACKET(xglCreateInstance, sizeof(XGL_INSTANCE) + get_struct_chain_size((void*)pAppInfo) + ((pAllocCb == NULL) ? 0 :sizeof(XGL_ALLOC_CALLBACKS)));
+    pHeader->entrypoint_begin_time = startTime;
+    if (isHooked == FALSE) {
+        AttachHooks();
+        AttachHooks_xgldbg();
+        AttachHooks_xglwsix11ext();
+    }
+    pPacket = interpret_body_as_xglCreateInstance(pHeader);
+
+    add_XGL_APPLICATION_INFO_to_packet(pHeader, (XGL_APPLICATION_INFO**)&(pPacket->pAppInfo), pAppInfo);
+    glv_add_buffer_to_trace_packet(pHeader, (void**)&(pPacket->pAllocCb), sizeof(XGL_ALLOC_CALLBACKS), pAllocCb);
+    glv_add_buffer_to_trace_packet(pHeader, (void**)&(pPacket->pInstance), sizeof(XGL_INSTANCE), pInstance);
+    pPacket->result = result;
+    glv_finalize_buffer_address(pHeader, (void**)&(pPacket->pAllocCb));
+    glv_finalize_buffer_address(pHeader, (void**)&(pPacket->pInstance));
+    FINISH_TRACE_PACKET();
+    return result;
+}
+
+GLVTRACER_EXPORT XGL_RESULT XGLAPI __HOOKED_xglDestroyInstance(
+    XGL_INSTANCE instance)
+{
+    glv_trace_packet_header* pHeader;
+    XGL_RESULT result;
+    struct_xglDestroyInstance* pPacket = NULL;
+    CREATE_TRACE_PACKET(xglDestroyInstance, 0);
+    result = real_xglDestroyInstance(instance);
+    pPacket = interpret_body_as_xglDestroyInstance(pHeader);
+    pPacket->instance = instance;
+    pPacket->result = result;
+    FINISH_TRACE_PACKET();
+    return result;
+}
+
+GLVTRACER_EXPORT XGL_RESULT XGLAPI __HOOKED_xglEnumerateGpus(
+    XGL_INSTANCE instance,
+    uint32_t maxGpus,
+    uint32_t* pGpuCount,
+    XGL_PHYSICAL_GPU* pGpus)
+{
+    glv_trace_packet_header* pHeader;
+    XGL_RESULT result;
+    struct_xglEnumerateGpus* pPacket = NULL;
+    uint64_t startTime;
+    SEND_ENTRYPOINT_ID(xglEnumerateGpus);
+    startTime = glv_get_time();
+    result = real_xglEnumerateGpus(instance, maxGpus, pGpuCount, pGpus);
+    CREATE_TRACE_PACKET(xglEnumerateGpus, sizeof(uint32_t) + ((pGpus && pGpuCount) ? *pGpuCount * sizeof(XGL_PHYSICAL_GPU) : 0));
+    pHeader->entrypoint_begin_time = startTime;
+    pPacket = interpret_body_as_xglEnumerateGpus(pHeader);
+    pPacket->instance = instance;
+    pPacket->maxGpus = maxGpus;
+    glv_add_buffer_to_trace_packet(pHeader, (void**)&(pPacket->pGpuCount), sizeof(uint32_t), pGpuCount);
+    glv_add_buffer_to_trace_packet(pHeader, (void**)&(pPacket->pGpus), *pGpuCount*sizeof(XGL_PHYSICAL_GPU), pGpus);
+    pPacket->result = result;
+    glv_finalize_buffer_address(pHeader, (void**)&(pPacket->pGpuCount));
+    glv_finalize_buffer_address(pHeader, (void**)&(pPacket->pGpus));
+    FINISH_TRACE_PACKET();
+    return result;
+}
+
+GLVTRACER_EXPORT XGL_RESULT XGLAPI __HOOKED_xglGetGpuInfo(
+    XGL_PHYSICAL_GPU gpu,
+    XGL_PHYSICAL_GPU_INFO_TYPE infoType,
+    size_t* pDataSize,
+    void* pData)
+{
+    glv_trace_packet_header* pHeader;
+    XGL_RESULT result;
+    size_t _dataSize;
+    struct_xglGetGpuInfo* pPacket = NULL;
+    CREATE_TRACE_PACKET(xglGetGpuInfo, ((pDataSize != NULL) ? sizeof(size_t) : 0) + ((pDataSize != NULL && pData != NULL) ? *pDataSize : 0));
+    result = real_xglGetGpuInfo(gpu, infoType, pDataSize, pData);
+    _dataSize = (pDataSize == NULL || pData == NULL) ? 0 : *pDataSize;
+    pPacket = interpret_body_as_xglGetGpuInfo(pHeader);
+    pPacket->gpu = gpu;
+    pPacket->infoType = infoType;
+    glv_add_buffer_to_trace_packet(pHeader, (void**)&(pPacket->pDataSize), sizeof(size_t), &_dataSize);
+    glv_add_buffer_to_trace_packet(pHeader, (void**)&(pPacket->pData), _dataSize, pData);
+    pPacket->result = result;
+    glv_finalize_buffer_address(pHeader, (void**)&(pPacket->pDataSize));
+    glv_finalize_buffer_address(pHeader, (void**)&(pPacket->pData));
+    FINISH_TRACE_PACKET();
+    return result;
+}
+
+GLVTRACER_EXPORT void* XGLAPI __HOOKED_xglGetProcAddr(
+    XGL_PHYSICAL_GPU gpu,
+    const char* pName)
+{
+    glv_trace_packet_header* pHeader;
+    void* result;
+    struct_xglGetProcAddr* pPacket = NULL;
+    CREATE_TRACE_PACKET(xglGetProcAddr, ((pName != NULL) ? strlen(pName) + 1 : 0));
+    result = real_xglGetProcAddr(gpu, pName);
+    pPacket = interpret_body_as_xglGetProcAddr(pHeader);
+    pPacket->gpu = gpu;
+    glv_add_buffer_to_trace_packet(pHeader, (void**)&(pPacket->pName), ((pName != NULL) ? strlen(pName) + 1 : 0), pName);
+    pPacket->result = result;
+    glv_finalize_buffer_address(pHeader, (void**)&(pPacket->pName));
+    FINISH_TRACE_PACKET();
+    return result;
+}
+
+GLVTRACER_EXPORT XGL_RESULT XGLAPI __HOOKED_xglCreateDevice(
+    XGL_PHYSICAL_GPU gpu,
+    const XGL_DEVICE_CREATE_INFO* pCreateInfo,
+    XGL_DEVICE* pDevice)
+{
+    glv_trace_packet_header* pHeader;
+    XGL_RESULT result;
+    struct_xglCreateDevice* pPacket = NULL;
+    CREATE_TRACE_PACKET(xglCreateDevice, get_struct_chain_size((void*)pCreateInfo) + sizeof(XGL_DEVICE));
+    result = real_xglCreateDevice(gpu, pCreateInfo, pDevice);
+    pPacket = interpret_body_as_xglCreateDevice(pHeader);
+    pPacket->gpu = gpu;
+    add_XGL_DEVICE_CREATE_INFO_to_packet(pHeader, (XGL_DEVICE_CREATE_INFO**) &(pPacket->pCreateInfo), pCreateInfo);
+    glv_add_buffer_to_trace_packet(pHeader, (void**)&(pPacket->pDevice), sizeof(XGL_DEVICE), pDevice);
+    pPacket->result = result;
+    glv_finalize_buffer_address(pHeader, (void**)&(pPacket->pDevice));
+    FINISH_TRACE_PACKET();
+    return result;
+}
+
+GLVTRACER_EXPORT XGL_RESULT XGLAPI __HOOKED_xglDestroyDevice(
+    XGL_DEVICE device)
+{
+    glv_trace_packet_header* pHeader;
+    XGL_RESULT result;
+    struct_xglDestroyDevice* pPacket = NULL;
+    CREATE_TRACE_PACKET(xglDestroyDevice, 0);
+    result = real_xglDestroyDevice(device);
+    pPacket = interpret_body_as_xglDestroyDevice(pHeader);
+    pPacket->device = device;
+    pPacket->result = result;
+    FINISH_TRACE_PACKET();
+    return result;
+}
+
+GLVTRACER_EXPORT XGL_RESULT XGLAPI __HOOKED_xglGetExtensionSupport(
+    XGL_PHYSICAL_GPU gpu,
+    const char* pExtName)
+{
+    glv_trace_packet_header* pHeader;
+    XGL_RESULT result;
+    struct_xglGetExtensionSupport* pPacket = NULL;
+    CREATE_TRACE_PACKET(xglGetExtensionSupport, ((pExtName != NULL) ? strlen(pExtName) + 1 : 0));
+    result = real_xglGetExtensionSupport(gpu, pExtName);
+    pPacket = interpret_body_as_xglGetExtensionSupport(pHeader);
+    pPacket->gpu = gpu;
+    glv_add_buffer_to_trace_packet(pHeader, (void**)&(pPacket->pExtName), ((pExtName != NULL) ? strlen(pExtName) + 1 : 0), pExtName);
+    pPacket->result = result;
+    glv_finalize_buffer_address(pHeader, (void**)&(pPacket->pExtName));
+    FINISH_TRACE_PACKET();
+    return result;
+}
+
+GLVTRACER_EXPORT XGL_RESULT XGLAPI __HOOKED_xglEnumerateLayers(
+    XGL_PHYSICAL_GPU gpu,
+    size_t maxLayerCount,
+    size_t maxStringSize,
+    size_t* pOutLayerCount,
+    char* const* pOutLayers,
+    void* pReserved)
+{
+    glv_trace_packet_header* pHeader;
+    XGL_RESULT result;
+    struct_xglEnumerateLayers* pPacket = NULL;
+    uint64_t startTime;
+    SEND_ENTRYPOINT_ID(xglEnumerateLayers);
+    startTime = glv_get_time();
+    result = real_xglEnumerateLayers(gpu, maxLayerCount, maxStringSize, pOutLayerCount, pOutLayers, pReserved);
+    size_t totStringSize = 0;
+    uint32_t i = 0;
+    for (i = 0; i < *pOutLayerCount; i++)
+        totStringSize += (pOutLayers[i] != NULL) ? strlen(pOutLayers[i]) + 1: 0;
+    CREATE_TRACE_PACKET(xglEnumerateLayers, totStringSize + sizeof(size_t));
+    pHeader->entrypoint_begin_time = startTime;
+    pPacket = interpret_body_as_xglEnumerateLayers(pHeader);
+    pPacket->gpu = gpu;
+    pPacket->maxLayerCount = maxLayerCount;
+    pPacket->maxStringSize = maxStringSize;
+    pPacket->pReserved = pReserved;
+    pPacket->gpu = gpu;
+    pPacket->maxLayerCount = maxLayerCount;
+    pPacket->maxStringSize = maxStringSize;
+    glv_add_buffer_to_trace_packet(pHeader, (void**)&(pPacket->pOutLayerCount), sizeof(size_t), pOutLayerCount);
+    glv_finalize_buffer_address(pHeader, (void**)&(pPacket->pOutLayerCount));
+    for (i = 0; i < *pOutLayerCount; i++) {
+        glv_add_buffer_to_trace_packet(pHeader, (void**)&(pPacket->pOutLayers[i]), ((pOutLayers[i] != NULL) ? strlen(pOutLayers[i]) + 1 : 0), pOutLayers[i]);
+        glv_finalize_buffer_address(pHeader, (void**)&(pPacket->pOutLayers[i]));
+    }
+    pPacket->pReserved = pReserved;
+    pPacket->result = result;
+    FINISH_TRACE_PACKET();
+    return result;
+}
+
+GLVTRACER_EXPORT XGL_RESULT XGLAPI __HOOKED_xglGetDeviceQueue(
+    XGL_DEVICE device,
+    XGL_QUEUE_TYPE queueType,
+    uint32_t queueIndex,
+    XGL_QUEUE* pQueue)
+{
+    glv_trace_packet_header* pHeader;
+    XGL_RESULT result;
+    struct_xglGetDeviceQueue* pPacket = NULL;
+    CREATE_TRACE_PACKET(xglGetDeviceQueue, sizeof(XGL_QUEUE));
+    result = real_xglGetDeviceQueue(device, queueType, queueIndex, pQueue);
+    pPacket = interpret_body_as_xglGetDeviceQueue(pHeader);
+    pPacket->device = device;
+    pPacket->queueType = queueType;
+    pPacket->queueIndex = queueIndex;
+    glv_add_buffer_to_trace_packet(pHeader, (void**)&(pPacket->pQueue), sizeof(XGL_QUEUE), pQueue);
+    pPacket->result = result;
+    glv_finalize_buffer_address(pHeader, (void**)&(pPacket->pQueue));
+    FINISH_TRACE_PACKET();
+    return result;
+}
+
+GLVTRACER_EXPORT XGL_RESULT XGLAPI __HOOKED_xglQueueSubmit(
+    XGL_QUEUE queue,
+    uint32_t cmdBufferCount,
+    const XGL_CMD_BUFFER* pCmdBuffers,
+    uint32_t memRefCount,
+    const XGL_MEMORY_REF* pMemRefs,
+    XGL_FENCE fence)
+{
+    glv_trace_packet_header* pHeader;
+    XGL_RESULT result;
+    struct_xglQueueSubmit* pPacket = NULL;
+    CREATE_TRACE_PACKET(xglQueueSubmit, cmdBufferCount*sizeof(XGL_CMD_BUFFER) + memRefCount*sizeof(XGL_MEMORY_REF));
+    result = real_xglQueueSubmit(queue, cmdBufferCount, pCmdBuffers, memRefCount, pMemRefs, fence);
+    pPacket = interpret_body_as_xglQueueSubmit(pHeader);
+    pPacket->queue = queue;
+    pPacket->cmdBufferCount = cmdBufferCount;
+    pPacket->memRefCount = memRefCount;
+    pPacket->fence = fence;
+    glv_add_buffer_to_trace_packet(pHeader, (void**)&(pPacket->pCmdBuffers), cmdBufferCount*sizeof(XGL_CMD_BUFFER), pCmdBuffers);
+    glv_add_buffer_to_trace_packet(pHeader, (void**)&(pPacket->pMemRefs), memRefCount*sizeof(XGL_MEMORY_REF), pMemRefs);
+    pPacket->result = result;
+    glv_finalize_buffer_address(pHeader, (void**)&(pPacket->pCmdBuffers));
+    glv_finalize_buffer_address(pHeader, (void**)&(pPacket->pMemRefs));
+    FINISH_TRACE_PACKET();
+    return result;
+}
+
+GLVTRACER_EXPORT XGL_RESULT XGLAPI __HOOKED_xglQueueSetGlobalMemReferences(
+    XGL_QUEUE queue,
+    uint32_t memRefCount,
+    const XGL_MEMORY_REF* pMemRefs)
+{
+    glv_trace_packet_header* pHeader;
+    XGL_RESULT result;
+    struct_xglQueueSetGlobalMemReferences* pPacket = NULL;
+    CREATE_TRACE_PACKET(xglQueueSetGlobalMemReferences, memRefCount*sizeof(XGL_MEMORY_REF));
+    result = real_xglQueueSetGlobalMemReferences(queue, memRefCount, pMemRefs);
+    pPacket = interpret_body_as_xglQueueSetGlobalMemReferences(pHeader);
+    pPacket->queue = queue;
+    pPacket->memRefCount = memRefCount;
+    glv_add_buffer_to_trace_packet(pHeader, (void**)&(pPacket->pMemRefs), memRefCount*sizeof(XGL_MEMORY_REF), pMemRefs);
+    pPacket->result = result;
+    glv_finalize_buffer_address(pHeader, (void**)&(pPacket->pMemRefs));
+    FINISH_TRACE_PACKET();
+    return result;
+}
+
+GLVTRACER_EXPORT XGL_RESULT XGLAPI __HOOKED_xglQueueWaitIdle(
+    XGL_QUEUE queue)
+{
+    glv_trace_packet_header* pHeader;
+    XGL_RESULT result;
+    struct_xglQueueWaitIdle* pPacket = NULL;
+    CREATE_TRACE_PACKET(xglQueueWaitIdle, 0);
+    result = real_xglQueueWaitIdle(queue);
+    pPacket = interpret_body_as_xglQueueWaitIdle(pHeader);
+    pPacket->queue = queue;
+    pPacket->result = result;
+    FINISH_TRACE_PACKET();
+    return result;
+}
+
+GLVTRACER_EXPORT XGL_RESULT XGLAPI __HOOKED_xglDeviceWaitIdle(
+    XGL_DEVICE device)
+{
+    glv_trace_packet_header* pHeader;
+    XGL_RESULT result;
+    struct_xglDeviceWaitIdle* pPacket = NULL;
+    CREATE_TRACE_PACKET(xglDeviceWaitIdle, 0);
+    result = real_xglDeviceWaitIdle(device);
+    pPacket = interpret_body_as_xglDeviceWaitIdle(pHeader);
+    pPacket->device = device;
+    pPacket->result = result;
+    FINISH_TRACE_PACKET();
+    return result;
+}
+
+GLVTRACER_EXPORT XGL_RESULT XGLAPI __HOOKED_xglAllocMemory(
+    XGL_DEVICE device,
+    const XGL_MEMORY_ALLOC_INFO* pAllocInfo,
+    XGL_GPU_MEMORY* pMem)
+{
+    glv_trace_packet_header* pHeader;
+    XGL_RESULT result;
+    struct_xglAllocMemory* pPacket = NULL;
+    CREATE_TRACE_PACKET(xglAllocMemory, get_struct_chain_size((void*)pAllocInfo) + sizeof(XGL_GPU_MEMORY));
+    result = real_xglAllocMemory(device, pAllocInfo, pMem);
+    pPacket = interpret_body_as_xglAllocMemory(pHeader);
+    pPacket->device = device;
+    glv_add_buffer_to_trace_packet(pHeader, (void**)&(pPacket->pAllocInfo), sizeof(XGL_MEMORY_ALLOC_INFO), pAllocInfo);
+    add_alloc_memory_to_trace_packet(pHeader, (void**)&(pPacket->pAllocInfo->pNext), pAllocInfo->pNext);
+    glv_add_buffer_to_trace_packet(pHeader, (void**)&(pPacket->pMem), sizeof(XGL_GPU_MEMORY), pMem);
+    pPacket->result = result;
+    glv_finalize_buffer_address(pHeader, (void**)&(pPacket->pAllocInfo));
+    glv_finalize_buffer_address(pHeader, (void**)&(pPacket->pMem));
+    FINISH_TRACE_PACKET();
+    add_new_handle_to_mem_info(*pMem, pAllocInfo->allocationSize, NULL);
+    return result;
+}
+
+GLVTRACER_EXPORT XGL_RESULT XGLAPI __HOOKED_xglFreeMemory(
+    XGL_GPU_MEMORY mem)
+{
+    glv_trace_packet_header* pHeader;
+    XGL_RESULT result;
+    struct_xglFreeMemory* pPacket = NULL;
+    CREATE_TRACE_PACKET(xglFreeMemory, 0);
+    result = real_xglFreeMemory(mem);
+    pPacket = interpret_body_as_xglFreeMemory(pHeader);
+    pPacket->mem = mem;
+    pPacket->result = result;
+    FINISH_TRACE_PACKET();
+    rm_handle_from_mem_info(mem);
+    return result;
+}
+
+GLVTRACER_EXPORT XGL_RESULT XGLAPI __HOOKED_xglSetMemoryPriority(
+    XGL_GPU_MEMORY mem,
+    XGL_MEMORY_PRIORITY priority)
+{
+    glv_trace_packet_header* pHeader;
+    XGL_RESULT result;
+    struct_xglSetMemoryPriority* pPacket = NULL;
+    CREATE_TRACE_PACKET(xglSetMemoryPriority, 0);
+    result = real_xglSetMemoryPriority(mem, priority);
+    pPacket = interpret_body_as_xglSetMemoryPriority(pHeader);
+    pPacket->mem = mem;
+    pPacket->priority = priority;
+    pPacket->result = result;
+    FINISH_TRACE_PACKET();
+    return result;
+}
+
+GLVTRACER_EXPORT XGL_RESULT XGLAPI __HOOKED_xglMapMemory(
+    XGL_GPU_MEMORY mem,
+    XGL_FLAGS flags,
+    void** ppData)
+{
+    glv_trace_packet_header* pHeader;
+    XGL_RESULT result;
+    struct_xglMapMemory* pPacket = NULL;
+    CREATE_TRACE_PACKET(xglMapMemory, sizeof(void*));
+    result = real_xglMapMemory(mem, flags, ppData);
+    pPacket = interpret_body_as_xglMapMemory(pHeader);
+    pPacket->mem = mem;
+    pPacket->flags = flags;
+    if (ppData != NULL)
+    {
+        glv_add_buffer_to_trace_packet(pHeader, (void**)&(pPacket->ppData), sizeof(void*), *ppData);
+        glv_finalize_buffer_address(pHeader, (void**)&(pPacket->ppData));
+        add_data_to_mem_info(mem, *ppData);
+    }
+    pPacket->result = result;
+    FINISH_TRACE_PACKET();
+    return result;
+}
+
+GLVTRACER_EXPORT XGL_RESULT XGLAPI __HOOKED_xglUnmapMemory(
+    XGL_GPU_MEMORY mem)
+{
+    glv_trace_packet_header* pHeader;
+    XGL_RESULT result;
+    struct_xglUnmapMemory* pPacket;
+    XGLAllocInfo *entry;
+    SEND_ENTRYPOINT_PARAMS("xglUnmapMemory(mem %p)\n", mem);
+    // insert into packet the data that was written by CPU between the xglMapMemory call and here
+    // Note must do this prior to the real xglUnMap() or else may get a FAULT
+    glv_enter_critical_section(&g_memInfoLock);
+    entry = find_mem_info_entry(mem);
+    CREATE_TRACE_PACKET(xglUnmapMemory, (entry) ? entry->size : 0);
+    pPacket = interpret_body_as_xglUnmapMemory(pHeader);
+    if (entry)
+    {
+        assert(entry->handle == mem);
+        glv_add_buffer_to_trace_packet(pHeader, (void**) &(pPacket->pData), entry->size, entry->pData);
+        glv_finalize_buffer_address(pHeader, (void**)&(pPacket->pData));
+        entry->pData = NULL;
+    } else
+    {
+         glv_LogError("Failed to copy app memory into trace packet (idx = %u) on xglUnmapMemory\n", pHeader->global_packet_index);
+    }
+    glv_leave_critical_section(&g_memInfoLock);
+    result = real_xglUnmapMemory(mem);
+    pPacket->mem = mem;
+    pPacket->result = result;
+    FINISH_TRACE_PACKET();
+    return result;
+}
+
+GLVTRACER_EXPORT XGL_RESULT XGLAPI __HOOKED_xglPinSystemMemory(
+    XGL_DEVICE device,
+    const void* pSysMem,
+    size_t memSize,
+    XGL_GPU_MEMORY* pMem)
+{
+    glv_trace_packet_header* pHeader;
+    XGL_RESULT result;
+    struct_xglPinSystemMemory* pPacket = NULL;
+    CREATE_TRACE_PACKET(xglPinSystemMemory, sizeof(XGL_GPU_MEMORY));
+    result = real_xglPinSystemMemory(device, pSysMem, memSize, pMem);
+    pPacket = interpret_body_as_xglPinSystemMemory(pHeader);
+    pPacket->device = device;
+    pPacket->pSysMem = pSysMem;
+    pPacket->memSize = memSize;
+    glv_add_buffer_to_trace_packet(pHeader, (void**)&(pPacket->pMem), sizeof(XGL_GPU_MEMORY), pMem);
+    pPacket->result = result;
+    glv_finalize_buffer_address(pHeader, (void**)&(pPacket->pMem));
+    FINISH_TRACE_PACKET();
+    return result;
+}
+
+GLVTRACER_EXPORT XGL_RESULT XGLAPI __HOOKED_xglGetMultiGpuCompatibility(
+    XGL_PHYSICAL_GPU gpu0,
+    XGL_PHYSICAL_GPU gpu1,
+    XGL_GPU_COMPATIBILITY_INFO* pInfo)
+{
+    glv_trace_packet_header* pHeader;
+    XGL_RESULT result;
+    struct_xglGetMultiGpuCompatibility* pPacket = NULL;
+    CREATE_TRACE_PACKET(xglGetMultiGpuCompatibility, sizeof(XGL_GPU_COMPATIBILITY_INFO));
+    result = real_xglGetMultiGpuCompatibility(gpu0, gpu1, pInfo);
+    pPacket = interpret_body_as_xglGetMultiGpuCompatibility(pHeader);
+    pPacket->gpu0 = gpu0;
+    pPacket->gpu1 = gpu1;
+    glv_add_buffer_to_trace_packet(pHeader, (void**)&(pPacket->pInfo), sizeof(XGL_GPU_COMPATIBILITY_INFO), pInfo);
+    pPacket->result = result;
+    glv_finalize_buffer_address(pHeader, (void**)&(pPacket->pInfo));
+    FINISH_TRACE_PACKET();
+    return result;
+}
+
+GLVTRACER_EXPORT XGL_RESULT XGLAPI __HOOKED_xglOpenSharedMemory(
+    XGL_DEVICE device,
+    const XGL_MEMORY_OPEN_INFO* pOpenInfo,
+    XGL_GPU_MEMORY* pMem)
+{
+    glv_trace_packet_header* pHeader;
+    XGL_RESULT result;
+    struct_xglOpenSharedMemory* pPacket = NULL;
+    CREATE_TRACE_PACKET(xglOpenSharedMemory, sizeof(XGL_MEMORY_OPEN_INFO) + sizeof(XGL_GPU_MEMORY));
+    result = real_xglOpenSharedMemory(device, pOpenInfo, pMem);
+    pPacket = interpret_body_as_xglOpenSharedMemory(pHeader);
+    pPacket->device = device;
+    glv_add_buffer_to_trace_packet(pHeader, (void**)&(pPacket->pOpenInfo), sizeof(XGL_MEMORY_OPEN_INFO), pOpenInfo);
+    glv_add_buffer_to_trace_packet(pHeader, (void**)&(pPacket->pMem), sizeof(XGL_GPU_MEMORY), pMem);
+    pPacket->result = result;
+    glv_finalize_buffer_address(pHeader, (void**)&(pPacket->pOpenInfo));
+    glv_finalize_buffer_address(pHeader, (void**)&(pPacket->pMem));
+    FINISH_TRACE_PACKET();
+    return result;
+}
+
+GLVTRACER_EXPORT XGL_RESULT XGLAPI __HOOKED_xglOpenSharedQueueSemaphore(
+    XGL_DEVICE device,
+    const XGL_QUEUE_SEMAPHORE_OPEN_INFO* pOpenInfo,
+    XGL_QUEUE_SEMAPHORE* pSemaphore)
+{
+    glv_trace_packet_header* pHeader;
+    XGL_RESULT result;
+    struct_xglOpenSharedQueueSemaphore* pPacket = NULL;
+    CREATE_TRACE_PACKET(xglOpenSharedQueueSemaphore, sizeof(XGL_QUEUE_SEMAPHORE_OPEN_INFO) + sizeof(XGL_QUEUE_SEMAPHORE));
+    result = real_xglOpenSharedQueueSemaphore(device, pOpenInfo, pSemaphore);
+    pPacket = interpret_body_as_xglOpenSharedQueueSemaphore(pHeader);
+    pPacket->device = device;
+    glv_add_buffer_to_trace_packet(pHeader, (void**)&(pPacket->pOpenInfo), sizeof(XGL_QUEUE_SEMAPHORE_OPEN_INFO), pOpenInfo);
+    glv_add_buffer_to_trace_packet(pHeader, (void**)&(pPacket->pSemaphore), sizeof(XGL_QUEUE_SEMAPHORE), pSemaphore);
+    pPacket->result = result;
+    glv_finalize_buffer_address(pHeader, (void**)&(pPacket->pOpenInfo));
+    glv_finalize_buffer_address(pHeader, (void**)&(pPacket->pSemaphore));
+    FINISH_TRACE_PACKET();
+    return result;
+}
+
+GLVTRACER_EXPORT XGL_RESULT XGLAPI __HOOKED_xglOpenPeerMemory(
+    XGL_DEVICE device,
+    const XGL_PEER_MEMORY_OPEN_INFO* pOpenInfo,
+    XGL_GPU_MEMORY* pMem)
+{
+    glv_trace_packet_header* pHeader;
+    XGL_RESULT result;
+    struct_xglOpenPeerMemory* pPacket = NULL;
+    CREATE_TRACE_PACKET(xglOpenPeerMemory, sizeof(XGL_PEER_MEMORY_OPEN_INFO) + sizeof(XGL_GPU_MEMORY));
+    result = real_xglOpenPeerMemory(device, pOpenInfo, pMem);
+    pPacket = interpret_body_as_xglOpenPeerMemory(pHeader);
+    pPacket->device = device;
+    glv_add_buffer_to_trace_packet(pHeader, (void**)&(pPacket->pOpenInfo), sizeof(XGL_PEER_MEMORY_OPEN_INFO), pOpenInfo);
+    glv_add_buffer_to_trace_packet(pHeader, (void**)&(pPacket->pMem), sizeof(XGL_GPU_MEMORY), pMem);
+    pPacket->result = result;
+    glv_finalize_buffer_address(pHeader, (void**)&(pPacket->pOpenInfo));
+    glv_finalize_buffer_address(pHeader, (void**)&(pPacket->pMem));
+    FINISH_TRACE_PACKET();
+    return result;
+}
+
+GLVTRACER_EXPORT XGL_RESULT XGLAPI __HOOKED_xglOpenPeerImage(
+    XGL_DEVICE device,
+    const XGL_PEER_IMAGE_OPEN_INFO* pOpenInfo,
+    XGL_IMAGE* pImage,
+    XGL_GPU_MEMORY* pMem)
+{
+    glv_trace_packet_header* pHeader;
+    XGL_RESULT result;
+    struct_xglOpenPeerImage* pPacket = NULL;
+    CREATE_TRACE_PACKET(xglOpenPeerImage, sizeof(XGL_PEER_IMAGE_OPEN_INFO) + sizeof(XGL_IMAGE) + sizeof(XGL_GPU_MEMORY));
+    result = real_xglOpenPeerImage(device, pOpenInfo, pImage, pMem);
+    pPacket = interpret_body_as_xglOpenPeerImage(pHeader);
+    pPacket->device = device;
+    glv_add_buffer_to_trace_packet(pHeader, (void**)&(pPacket->pOpenInfo), sizeof(XGL_PEER_IMAGE_OPEN_INFO), pOpenInfo);
+    glv_add_buffer_to_trace_packet(pHeader, (void**)&(pPacket->pImage), sizeof(XGL_IMAGE), pImage);
+    glv_add_buffer_to_trace_packet(pHeader, (void**)&(pPacket->pMem), sizeof(XGL_GPU_MEMORY), pMem);
+    pPacket->result = result;
+    glv_finalize_buffer_address(pHeader, (void**)&(pPacket->pOpenInfo));
+    glv_finalize_buffer_address(pHeader, (void**)&(pPacket->pImage));
+    glv_finalize_buffer_address(pHeader, (void**)&(pPacket->pMem));
+    FINISH_TRACE_PACKET();
+    return result;
+}
+
+GLVTRACER_EXPORT XGL_RESULT XGLAPI __HOOKED_xglDestroyObject(
+    XGL_OBJECT object)
+{
+    glv_trace_packet_header* pHeader;
+    XGL_RESULT result;
+    struct_xglDestroyObject* pPacket = NULL;
+    CREATE_TRACE_PACKET(xglDestroyObject, 0);
+    result = real_xglDestroyObject(object);
+    pPacket = interpret_body_as_xglDestroyObject(pHeader);
+    pPacket->object = object;
+    pPacket->result = result;
+    FINISH_TRACE_PACKET();
+    return result;
+}
+
+GLVTRACER_EXPORT XGL_RESULT XGLAPI __HOOKED_xglGetObjectInfo(
+    XGL_BASE_OBJECT object,
+    XGL_OBJECT_INFO_TYPE infoType,
+    size_t* pDataSize,
+    void* pData)
+{
+    glv_trace_packet_header* pHeader;
+    XGL_RESULT result;
+    size_t _dataSize;
+    struct_xglGetObjectInfo* pPacket = NULL;
+    CREATE_TRACE_PACKET(xglGetObjectInfo, ((pDataSize != NULL) ? sizeof(size_t) : 0) + ((pDataSize != NULL && pData != NULL) ? *pDataSize : 0));
+    result = real_xglGetObjectInfo(object, infoType, pDataSize, pData);
+    _dataSize = (pDataSize == NULL || pData == NULL) ? 0 : *pDataSize;
+    pPacket = interpret_body_as_xglGetObjectInfo(pHeader);
+    pPacket->object = object;
+    pPacket->infoType = infoType;
+    glv_add_buffer_to_trace_packet(pHeader, (void**)&(pPacket->pDataSize), sizeof(size_t), &_dataSize);
+    glv_add_buffer_to_trace_packet(pHeader, (void**)&(pPacket->pData), _dataSize, pData);
+    pPacket->result = result;
+    glv_finalize_buffer_address(pHeader, (void**)&(pPacket->pDataSize));
+    glv_finalize_buffer_address(pHeader, (void**)&(pPacket->pData));
+    FINISH_TRACE_PACKET();
+    return result;
+}
+
+GLVTRACER_EXPORT XGL_RESULT XGLAPI __HOOKED_xglBindObjectMemory(
+    XGL_OBJECT object,
+    uint32_t allocationIdx,
+    XGL_GPU_MEMORY mem,
+    XGL_GPU_SIZE offset)
+{
+    glv_trace_packet_header* pHeader;
+    XGL_RESULT result;
+    struct_xglBindObjectMemory* pPacket = NULL;
+    CREATE_TRACE_PACKET(xglBindObjectMemory, 0);
+    result = real_xglBindObjectMemory(object, allocationIdx, mem, offset);
+    pPacket = interpret_body_as_xglBindObjectMemory(pHeader);
+    pPacket->object = object;
+    pPacket->allocationIdx = allocationIdx;
+    pPacket->mem = mem;
+    pPacket->offset = offset;
+    pPacket->result = result;
+    FINISH_TRACE_PACKET();
+    return result;
+}
+
+GLVTRACER_EXPORT XGL_RESULT XGLAPI __HOOKED_xglBindObjectMemoryRange(
+    XGL_OBJECT object,
+    uint32_t allocationIdx,
+    XGL_GPU_SIZE rangeOffset,
+    XGL_GPU_SIZE rangeSize,
+    XGL_GPU_MEMORY mem,
+    XGL_GPU_SIZE memOffset)
+{
+    glv_trace_packet_header* pHeader;
+    XGL_RESULT result;
+    struct_xglBindObjectMemoryRange* pPacket = NULL;
+    CREATE_TRACE_PACKET(xglBindObjectMemoryRange, 0);
+    result = real_xglBindObjectMemoryRange(object, allocationIdx, rangeOffset, rangeSize, mem, memOffset);
+    pPacket = interpret_body_as_xglBindObjectMemoryRange(pHeader);
+    pPacket->object = object;
+    pPacket->allocationIdx = allocationIdx;
+    pPacket->rangeOffset = rangeOffset;
+    pPacket->rangeSize = rangeSize;
+    pPacket->mem = mem;
+    pPacket->memOffset = memOffset;
+    pPacket->result = result;
+    FINISH_TRACE_PACKET();
+    return result;
+}
+
+GLVTRACER_EXPORT XGL_RESULT XGLAPI __HOOKED_xglBindImageMemoryRange(
+    XGL_IMAGE image,
+    uint32_t allocationIdx,
+    const XGL_IMAGE_MEMORY_BIND_INFO* bindInfo,
+    XGL_GPU_MEMORY mem,
+    XGL_GPU_SIZE memOffset)
+{
+    glv_trace_packet_header* pHeader;
+    XGL_RESULT result;
+    struct_xglBindImageMemoryRange* pPacket = NULL;
+    CREATE_TRACE_PACKET(xglBindImageMemoryRange, sizeof(XGL_IMAGE_MEMORY_BIND_INFO));
+    result = real_xglBindImageMemoryRange(image, allocationIdx, bindInfo, mem, memOffset);
+    pPacket = interpret_body_as_xglBindImageMemoryRange(pHeader);
+    pPacket->image = image;
+    pPacket->allocationIdx = allocationIdx;
+    pPacket->mem = mem;
+    pPacket->memOffset = memOffset;
+    glv_add_buffer_to_trace_packet(pHeader, (void**)&(pPacket->bindInfo), sizeof(XGL_IMAGE_MEMORY_BIND_INFO), bindInfo);
+    pPacket->result = result;
+    glv_finalize_buffer_address(pHeader, (void**)&(pPacket->bindInfo));
+    FINISH_TRACE_PACKET();
+    return result;
+}
+
+GLVTRACER_EXPORT XGL_RESULT XGLAPI __HOOKED_xglCreateFence(
+    XGL_DEVICE device,
+    const XGL_FENCE_CREATE_INFO* pCreateInfo,
+    XGL_FENCE* pFence)
+{
+    glv_trace_packet_header* pHeader;
+    XGL_RESULT result;
+    struct_xglCreateFence* pPacket = NULL;
+    CREATE_TRACE_PACKET(xglCreateFence, get_struct_chain_size((void*)pCreateInfo) + sizeof(XGL_FENCE));
+    result = real_xglCreateFence(device, pCreateInfo, pFence);
+    pPacket = interpret_body_as_xglCreateFence(pHeader);
+    pPacket->device = device;
+    glv_add_buffer_to_trace_packet(pHeader, (void**)&(pPacket->pCreateInfo), sizeof(XGL_FENCE_CREATE_INFO), pCreateInfo);
+    glv_add_buffer_to_trace_packet(pHeader, (void**)&(pPacket->pFence), sizeof(XGL_FENCE), pFence);
+    pPacket->result = result;
+    glv_finalize_buffer_address(pHeader, (void**)&(pPacket->pCreateInfo));
+    glv_finalize_buffer_address(pHeader, (void**)&(pPacket->pFence));
+    FINISH_TRACE_PACKET();
+    return result;
+}
+
+GLVTRACER_EXPORT XGL_RESULT XGLAPI __HOOKED_xglGetFenceStatus(
+    XGL_FENCE fence)
+{
+    glv_trace_packet_header* pHeader;
+    XGL_RESULT result;
+    struct_xglGetFenceStatus* pPacket = NULL;
+    CREATE_TRACE_PACKET(xglGetFenceStatus, 0);
+    result = real_xglGetFenceStatus(fence);
+    pPacket = interpret_body_as_xglGetFenceStatus(pHeader);
+    pPacket->fence = fence;
+    pPacket->result = result;
+    FINISH_TRACE_PACKET();
+    return result;
+}
+
+GLVTRACER_EXPORT XGL_RESULT XGLAPI __HOOKED_xglWaitForFences(
+    XGL_DEVICE device,
+    uint32_t fenceCount,
+    const XGL_FENCE* pFences,
+    bool32_t waitAll,
+    uint64_t timeout)
+{
+    glv_trace_packet_header* pHeader;
+    XGL_RESULT result;
+    struct_xglWaitForFences* pPacket = NULL;
+    CREATE_TRACE_PACKET(xglWaitForFences, fenceCount*sizeof(XGL_FENCE));
+    result = real_xglWaitForFences(device, fenceCount, pFences, waitAll, timeout);
+    pPacket = interpret_body_as_xglWaitForFences(pHeader);
+    pPacket->device = device;
+    pPacket->fenceCount = fenceCount;
+    pPacket->waitAll = waitAll;
+    pPacket->timeout = timeout;
+    glv_add_buffer_to_trace_packet(pHeader, (void**)&(pPacket->pFences), fenceCount*sizeof(XGL_FENCE), pFences);
+    pPacket->result = result;
+    glv_finalize_buffer_address(pHeader, (void**)&(pPacket->pFences));
+    FINISH_TRACE_PACKET();
+    return result;
+}
+
+GLVTRACER_EXPORT XGL_RESULT XGLAPI __HOOKED_xglCreateQueueSemaphore(
+    XGL_DEVICE device,
+    const XGL_QUEUE_SEMAPHORE_CREATE_INFO* pCreateInfo,
+    XGL_QUEUE_SEMAPHORE* pSemaphore)
+{
+    glv_trace_packet_header* pHeader;
+    XGL_RESULT result;
+    struct_xglCreateQueueSemaphore* pPacket = NULL;
+    CREATE_TRACE_PACKET(xglCreateQueueSemaphore, get_struct_chain_size((void*)pCreateInfo) + sizeof(XGL_QUEUE_SEMAPHORE));
+    result = real_xglCreateQueueSemaphore(device, pCreateInfo, pSemaphore);
+    pPacket = interpret_body_as_xglCreateQueueSemaphore(pHeader);
+    pPacket->device = device;
+    glv_add_buffer_to_trace_packet(pHeader, (void**)&(pPacket->pCreateInfo), sizeof(XGL_QUEUE_SEMAPHORE_CREATE_INFO), pCreateInfo);
+    glv_add_buffer_to_trace_packet(pHeader, (void**)&(pPacket->pSemaphore), sizeof(XGL_QUEUE_SEMAPHORE), pSemaphore);
+    pPacket->result = result;
+    glv_finalize_buffer_address(pHeader, (void**)&(pPacket->pCreateInfo));
+    glv_finalize_buffer_address(pHeader, (void**)&(pPacket->pSemaphore));
+    FINISH_TRACE_PACKET();
+    return result;
+}
+
+GLVTRACER_EXPORT XGL_RESULT XGLAPI __HOOKED_xglSignalQueueSemaphore(
+    XGL_QUEUE queue,
+    XGL_QUEUE_SEMAPHORE semaphore)
+{
+    glv_trace_packet_header* pHeader;
+    XGL_RESULT result;
+    struct_xglSignalQueueSemaphore* pPacket = NULL;
+    CREATE_TRACE_PACKET(xglSignalQueueSemaphore, 0);
+    result = real_xglSignalQueueSemaphore(queue, semaphore);
+    pPacket = interpret_body_as_xglSignalQueueSemaphore(pHeader);
+    pPacket->queue = queue;
+    pPacket->semaphore = semaphore;
+    pPacket->result = result;
+    FINISH_TRACE_PACKET();
+    return result;
+}
+
+GLVTRACER_EXPORT XGL_RESULT XGLAPI __HOOKED_xglWaitQueueSemaphore(
+    XGL_QUEUE queue,
+    XGL_QUEUE_SEMAPHORE semaphore)
+{
+    glv_trace_packet_header* pHeader;
+    XGL_RESULT result;
+    struct_xglWaitQueueSemaphore* pPacket = NULL;
+    CREATE_TRACE_PACKET(xglWaitQueueSemaphore, 0);
+    result = real_xglWaitQueueSemaphore(queue, semaphore);
+    pPacket = interpret_body_as_xglWaitQueueSemaphore(pHeader);
+    pPacket->queue = queue;
+    pPacket->semaphore = semaphore;
+    pPacket->result = result;
+    FINISH_TRACE_PACKET();
+    return result;
+}
+
+GLVTRACER_EXPORT XGL_RESULT XGLAPI __HOOKED_xglCreateEvent(
+    XGL_DEVICE device,
+    const XGL_EVENT_CREATE_INFO* pCreateInfo,
+    XGL_EVENT* pEvent)
+{
+    glv_trace_packet_header* pHeader;
+    XGL_RESULT result;
+    struct_xglCreateEvent* pPacket = NULL;
+    CREATE_TRACE_PACKET(xglCreateEvent, get_struct_chain_size((void*)pCreateInfo) + sizeof(XGL_EVENT));
+    result = real_xglCreateEvent(device, pCreateInfo, pEvent);
+    pPacket = interpret_body_as_xglCreateEvent(pHeader);
+    pPacket->device = device;
+    glv_add_buffer_to_trace_packet(pHeader, (void**)&(pPacket->pCreateInfo), sizeof(XGL_EVENT_CREATE_INFO), pCreateInfo);
+    glv_add_buffer_to_trace_packet(pHeader, (void**)&(pPacket->pEvent), sizeof(XGL_EVENT), pEvent);
+    pPacket->result = result;
+    glv_finalize_buffer_address(pHeader, (void**)&(pPacket->pCreateInfo));
+    glv_finalize_buffer_address(pHeader, (void**)&(pPacket->pEvent));
+    FINISH_TRACE_PACKET();
+    return result;
+}
+
+GLVTRACER_EXPORT XGL_RESULT XGLAPI __HOOKED_xglGetEventStatus(
+    XGL_EVENT event)
+{
+    glv_trace_packet_header* pHeader;
+    XGL_RESULT result;
+    struct_xglGetEventStatus* pPacket = NULL;
+    CREATE_TRACE_PACKET(xglGetEventStatus, 0);
+    result = real_xglGetEventStatus(event);
+    pPacket = interpret_body_as_xglGetEventStatus(pHeader);
+    pPacket->event = event;
+    pPacket->result = result;
+    FINISH_TRACE_PACKET();
+    return result;
+}
+
+GLVTRACER_EXPORT XGL_RESULT XGLAPI __HOOKED_xglSetEvent(
+    XGL_EVENT event)
+{
+    glv_trace_packet_header* pHeader;
+    XGL_RESULT result;
+    struct_xglSetEvent* pPacket = NULL;
+    CREATE_TRACE_PACKET(xglSetEvent, 0);
+    result = real_xglSetEvent(event);
+    pPacket = interpret_body_as_xglSetEvent(pHeader);
+    pPacket->event = event;
+    pPacket->result = result;
+    FINISH_TRACE_PACKET();
+    return result;
+}
+
+GLVTRACER_EXPORT XGL_RESULT XGLAPI __HOOKED_xglResetEvent(
+    XGL_EVENT event)
+{
+    glv_trace_packet_header* pHeader;
+    XGL_RESULT result;
+    struct_xglResetEvent* pPacket = NULL;
+    CREATE_TRACE_PACKET(xglResetEvent, 0);
+    result = real_xglResetEvent(event);
+    pPacket = interpret_body_as_xglResetEvent(pHeader);
+    pPacket->event = event;
+    pPacket->result = result;
+    FINISH_TRACE_PACKET();
+    return result;
+}
+
+GLVTRACER_EXPORT XGL_RESULT XGLAPI __HOOKED_xglCreateQueryPool(
+    XGL_DEVICE device,
+    const XGL_QUERY_POOL_CREATE_INFO* pCreateInfo,
+    XGL_QUERY_POOL* pQueryPool)
+{
+    glv_trace_packet_header* pHeader;
+    XGL_RESULT result;
+    struct_xglCreateQueryPool* pPacket = NULL;
+    CREATE_TRACE_PACKET(xglCreateQueryPool, get_struct_chain_size((void*)pCreateInfo) + sizeof(XGL_QUERY_POOL));
+    result = real_xglCreateQueryPool(device, pCreateInfo, pQueryPool);
+    pPacket = interpret_body_as_xglCreateQueryPool(pHeader);
+    pPacket->device = device;
+    glv_add_buffer_to_trace_packet(pHeader, (void**)&(pPacket->pCreateInfo), sizeof(XGL_QUERY_POOL_CREATE_INFO), pCreateInfo);
+    glv_add_buffer_to_trace_packet(pHeader, (void**)&(pPacket->pQueryPool), sizeof(XGL_QUERY_POOL), pQueryPool);
+    pPacket->result = result;
+    glv_finalize_buffer_address(pHeader, (void**)&(pPacket->pCreateInfo));
+    glv_finalize_buffer_address(pHeader, (void**)&(pPacket->pQueryPool));
+    FINISH_TRACE_PACKET();
+    return result;
+}
+
+GLVTRACER_EXPORT XGL_RESULT XGLAPI __HOOKED_xglGetQueryPoolResults(
+    XGL_QUERY_POOL queryPool,
+    uint32_t startQuery,
+    uint32_t queryCount,
+    size_t* pDataSize,
+    void* pData)
+{
+    glv_trace_packet_header* pHeader;
+    XGL_RESULT result;
+    size_t _dataSize;
+    struct_xglGetQueryPoolResults* pPacket = NULL;
+    CREATE_TRACE_PACKET(xglGetQueryPoolResults, ((pDataSize != NULL) ? sizeof(size_t) : 0) + ((pDataSize != NULL && pData != NULL) ? *pDataSize : 0));
+    result = real_xglGetQueryPoolResults(queryPool, startQuery, queryCount, pDataSize, pData);
+    _dataSize = (pDataSize == NULL || pData == NULL) ? 0 : *pDataSize;
+    pPacket = interpret_body_as_xglGetQueryPoolResults(pHeader);
+    pPacket->queryPool = queryPool;
+    pPacket->startQuery = startQuery;
+    pPacket->queryCount = queryCount;
+    glv_add_buffer_to_trace_packet(pHeader, (void**)&(pPacket->pDataSize), sizeof(size_t), &_dataSize);
+    glv_add_buffer_to_trace_packet(pHeader, (void**)&(pPacket->pData), _dataSize, pData);
+    pPacket->result = result;
+    glv_finalize_buffer_address(pHeader, (void**)&(pPacket->pDataSize));
+    glv_finalize_buffer_address(pHeader, (void**)&(pPacket->pData));
+    FINISH_TRACE_PACKET();
+    return result;
+}
+
+GLVTRACER_EXPORT XGL_RESULT XGLAPI __HOOKED_xglGetFormatInfo(
+    XGL_DEVICE device,
+    XGL_FORMAT format,
+    XGL_FORMAT_INFO_TYPE infoType,
+    size_t* pDataSize,
+    void* pData)
+{
+    glv_trace_packet_header* pHeader;
+    XGL_RESULT result;
+    size_t _dataSize;
+    struct_xglGetFormatInfo* pPacket = NULL;
+    CREATE_TRACE_PACKET(xglGetFormatInfo, ((pDataSize != NULL) ? sizeof(size_t) : 0) + ((pDataSize != NULL && pData != NULL) ? *pDataSize : 0));
+    result = real_xglGetFormatInfo(device, format, infoType, pDataSize, pData);
+    _dataSize = (pDataSize == NULL || pData == NULL) ? 0 : *pDataSize;
+    pPacket = interpret_body_as_xglGetFormatInfo(pHeader);
+    pPacket->device = device;
+    pPacket->format = format;
+    pPacket->infoType = infoType;
+    glv_add_buffer_to_trace_packet(pHeader, (void**)&(pPacket->pDataSize), sizeof(size_t), &_dataSize);
+    glv_add_buffer_to_trace_packet(pHeader, (void**)&(pPacket->pData), _dataSize, pData);
+    pPacket->result = result;
+    glv_finalize_buffer_address(pHeader, (void**)&(pPacket->pDataSize));
+    glv_finalize_buffer_address(pHeader, (void**)&(pPacket->pData));
+    FINISH_TRACE_PACKET();
+    return result;
+}
+
+GLVTRACER_EXPORT XGL_RESULT XGLAPI __HOOKED_xglCreateBuffer(
+    XGL_DEVICE device,
+    const XGL_BUFFER_CREATE_INFO* pCreateInfo,
+    XGL_BUFFER* pBuffer)
+{
+    glv_trace_packet_header* pHeader;
+    XGL_RESULT result;
+    struct_xglCreateBuffer* pPacket = NULL;
+    CREATE_TRACE_PACKET(xglCreateBuffer, get_struct_chain_size((void*)pCreateInfo) + sizeof(XGL_BUFFER));
+    result = real_xglCreateBuffer(device, pCreateInfo, pBuffer);
+    pPacket = interpret_body_as_xglCreateBuffer(pHeader);
+    pPacket->device = device;
+    glv_add_buffer_to_trace_packet(pHeader, (void**)&(pPacket->pCreateInfo), sizeof(XGL_BUFFER_CREATE_INFO), pCreateInfo);
+    glv_add_buffer_to_trace_packet(pHeader, (void**)&(pPacket->pBuffer), sizeof(XGL_BUFFER), pBuffer);
+    pPacket->result = result;
+    glv_finalize_buffer_address(pHeader, (void**)&(pPacket->pCreateInfo));
+    glv_finalize_buffer_address(pHeader, (void**)&(pPacket->pBuffer));
+    FINISH_TRACE_PACKET();
+    return result;
+}
+
+GLVTRACER_EXPORT XGL_RESULT XGLAPI __HOOKED_xglCreateBufferView(
+    XGL_DEVICE device,
+    const XGL_BUFFER_VIEW_CREATE_INFO* pCreateInfo,
+    XGL_BUFFER_VIEW* pView)
+{
+    glv_trace_packet_header* pHeader;
+    XGL_RESULT result;
+    struct_xglCreateBufferView* pPacket = NULL;
+    CREATE_TRACE_PACKET(xglCreateBufferView, get_struct_chain_size((void*)pCreateInfo) + sizeof(XGL_BUFFER_VIEW));
+    result = real_xglCreateBufferView(device, pCreateInfo, pView);
+    pPacket = interpret_body_as_xglCreateBufferView(pHeader);
+    pPacket->device = device;
+    glv_add_buffer_to_trace_packet(pHeader, (void**)&(pPacket->pCreateInfo), sizeof(XGL_BUFFER_VIEW_CREATE_INFO), pCreateInfo);
+    glv_add_buffer_to_trace_packet(pHeader, (void**)&(pPacket->pView), sizeof(XGL_BUFFER_VIEW), pView);
+    pPacket->result = result;
+    glv_finalize_buffer_address(pHeader, (void**)&(pPacket->pCreateInfo));
+    glv_finalize_buffer_address(pHeader, (void**)&(pPacket->pView));
+    FINISH_TRACE_PACKET();
+    return result;
+}
+
+GLVTRACER_EXPORT XGL_RESULT XGLAPI __HOOKED_xglCreateImage(
+    XGL_DEVICE device,
+    const XGL_IMAGE_CREATE_INFO* pCreateInfo,
+    XGL_IMAGE* pImage)
+{
+    glv_trace_packet_header* pHeader;
+    XGL_RESULT result;
+    struct_xglCreateImage* pPacket = NULL;
+    CREATE_TRACE_PACKET(xglCreateImage, get_struct_chain_size((void*)pCreateInfo) + sizeof(XGL_IMAGE));
+    result = real_xglCreateImage(device, pCreateInfo, pImage);
+    pPacket = interpret_body_as_xglCreateImage(pHeader);
+    pPacket->device = device;
+    glv_add_buffer_to_trace_packet(pHeader, (void**)&(pPacket->pCreateInfo), sizeof(XGL_IMAGE_CREATE_INFO), pCreateInfo);
+    glv_add_buffer_to_trace_packet(pHeader, (void**)&(pPacket->pImage), sizeof(XGL_IMAGE), pImage);
+    pPacket->result = result;
+    glv_finalize_buffer_address(pHeader, (void**)&(pPacket->pCreateInfo));
+    glv_finalize_buffer_address(pHeader, (void**)&(pPacket->pImage));
+    FINISH_TRACE_PACKET();
+    return result;
+}
+
+GLVTRACER_EXPORT XGL_RESULT XGLAPI __HOOKED_xglSetFastClearColor(
+    XGL_IMAGE image,
+    const float color[4])
+{
+    glv_trace_packet_header* pHeader;
+    XGL_RESULT result;
+    struct_xglSetFastClearColor* pPacket = NULL;
+    CREATE_TRACE_PACKET(xglSetFastClearColor, 0);
+    result = real_xglSetFastClearColor(image, color);
+    pPacket = interpret_body_as_xglSetFastClearColor(pHeader);
+    pPacket->image = image;
+    memcpy((void*)pPacket->color, color, 4 * sizeof(float));
+    pPacket->result = result;
+    FINISH_TRACE_PACKET();
+    return result;
+}
+
+GLVTRACER_EXPORT XGL_RESULT XGLAPI __HOOKED_xglSetFastClearDepth(
+    XGL_IMAGE image,
+    float depth)
+{
+    glv_trace_packet_header* pHeader;
+    XGL_RESULT result;
+    struct_xglSetFastClearDepth* pPacket = NULL;
+    CREATE_TRACE_PACKET(xglSetFastClearDepth, 0);
+    result = real_xglSetFastClearDepth(image, depth);
+    pPacket = interpret_body_as_xglSetFastClearDepth(pHeader);
+    pPacket->image = image;
+    pPacket->depth = depth;
+    pPacket->result = result;
+    FINISH_TRACE_PACKET();
+    return result;
+}
+
+GLVTRACER_EXPORT XGL_RESULT XGLAPI __HOOKED_xglGetImageSubresourceInfo(
+    XGL_IMAGE image,
+    const XGL_IMAGE_SUBRESOURCE* pSubresource,
+    XGL_SUBRESOURCE_INFO_TYPE infoType,
+    size_t* pDataSize,
+    void* pData)
+{
+    glv_trace_packet_header* pHeader;
+    XGL_RESULT result;
+    size_t _dataSize;
+    struct_xglGetImageSubresourceInfo* pPacket = NULL;
+    CREATE_TRACE_PACKET(xglGetImageSubresourceInfo, ((pSubresource != NULL) ? sizeof(XGL_IMAGE_SUBRESOURCE) : 0) + ((pDataSize != NULL) ? sizeof(size_t) : 0) + ((pDataSize != NULL && pData != NULL) ? *pDataSize : 0));
+    result = real_xglGetImageSubresourceInfo(image, pSubresource, infoType, pDataSize, pData);
+    _dataSize = (pDataSize == NULL || pData == NULL) ? 0 : *pDataSize;
+    pPacket = interpret_body_as_xglGetImageSubresourceInfo(pHeader);
+    pPacket->image = image;
+    pPacket->infoType = infoType;
+    glv_add_buffer_to_trace_packet(pHeader, (void**)&(pPacket->pSubresource), sizeof(XGL_IMAGE_SUBRESOURCE), pSubresource);
+    glv_add_buffer_to_trace_packet(pHeader, (void**)&(pPacket->pDataSize), sizeof(size_t), &_dataSize);
+    glv_add_buffer_to_trace_packet(pHeader, (void**)&(pPacket->pData), _dataSize, pData);
+    pPacket->result = result;
+    glv_finalize_buffer_address(pHeader, (void**)&(pPacket->pSubresource));
+    glv_finalize_buffer_address(pHeader, (void**)&(pPacket->pDataSize));
+    glv_finalize_buffer_address(pHeader, (void**)&(pPacket->pData));
+    FINISH_TRACE_PACKET();
+    return result;
+}
+
+GLVTRACER_EXPORT XGL_RESULT XGLAPI __HOOKED_xglCreateImageView(
+    XGL_DEVICE device,
+    const XGL_IMAGE_VIEW_CREATE_INFO* pCreateInfo,
+    XGL_IMAGE_VIEW* pView)
+{
+    glv_trace_packet_header* pHeader;
+    XGL_RESULT result;
+    struct_xglCreateImageView* pPacket = NULL;
+    CREATE_TRACE_PACKET(xglCreateImageView, get_struct_chain_size((void*)pCreateInfo) + sizeof(XGL_IMAGE_VIEW));
+    result = real_xglCreateImageView(device, pCreateInfo, pView);
+    pPacket = interpret_body_as_xglCreateImageView(pHeader);
+    pPacket->device = device;
+    glv_add_buffer_to_trace_packet(pHeader, (void**)&(pPacket->pCreateInfo), sizeof(XGL_IMAGE_VIEW_CREATE_INFO), pCreateInfo);
+    glv_add_buffer_to_trace_packet(pHeader, (void**)&(pPacket->pView), sizeof(XGL_IMAGE_VIEW), pView);
+    pPacket->result = result;
+    glv_finalize_buffer_address(pHeader, (void**)&(pPacket->pCreateInfo));
+    glv_finalize_buffer_address(pHeader, (void**)&(pPacket->pView));
+    FINISH_TRACE_PACKET();
+    return result;
+}
+
+GLVTRACER_EXPORT XGL_RESULT XGLAPI __HOOKED_xglCreateColorAttachmentView(
+    XGL_DEVICE device,
+    const XGL_COLOR_ATTACHMENT_VIEW_CREATE_INFO* pCreateInfo,
+    XGL_COLOR_ATTACHMENT_VIEW* pView)
+{
+    glv_trace_packet_header* pHeader;
+    XGL_RESULT result;
+    struct_xglCreateColorAttachmentView* pPacket = NULL;
+    CREATE_TRACE_PACKET(xglCreateColorAttachmentView, get_struct_chain_size((void*)pCreateInfo) + sizeof(XGL_COLOR_ATTACHMENT_VIEW));
+    result = real_xglCreateColorAttachmentView(device, pCreateInfo, pView);
+    pPacket = interpret_body_as_xglCreateColorAttachmentView(pHeader);
+    pPacket->device = device;
+    glv_add_buffer_to_trace_packet(pHeader, (void**)&(pPacket->pCreateInfo), sizeof(XGL_COLOR_ATTACHMENT_VIEW_CREATE_INFO), pCreateInfo);
+    glv_add_buffer_to_trace_packet(pHeader, (void**)&(pPacket->pView), sizeof(XGL_COLOR_ATTACHMENT_VIEW), pView);
+    pPacket->result = result;
+    glv_finalize_buffer_address(pHeader, (void**)&(pPacket->pCreateInfo));
+    glv_finalize_buffer_address(pHeader, (void**)&(pPacket->pView));
+    FINISH_TRACE_PACKET();
+    return result;
+}
+
+GLVTRACER_EXPORT XGL_RESULT XGLAPI __HOOKED_xglCreateDepthStencilView(
+    XGL_DEVICE device,
+    const XGL_DEPTH_STENCIL_VIEW_CREATE_INFO* pCreateInfo,
+    XGL_DEPTH_STENCIL_VIEW* pView)
+{
+    glv_trace_packet_header* pHeader;
+    XGL_RESULT result;
+    struct_xglCreateDepthStencilView* pPacket = NULL;
+    CREATE_TRACE_PACKET(xglCreateDepthStencilView, get_struct_chain_size((void*)pCreateInfo) + sizeof(XGL_DEPTH_STENCIL_VIEW));
+    result = real_xglCreateDepthStencilView(device, pCreateInfo, pView);
+    pPacket = interpret_body_as_xglCreateDepthStencilView(pHeader);
+    pPacket->device = device;
+    glv_add_buffer_to_trace_packet(pHeader, (void**)&(pPacket->pCreateInfo), sizeof(XGL_DEPTH_STENCIL_VIEW_CREATE_INFO), pCreateInfo);
+    glv_add_buffer_to_trace_packet(pHeader, (void**)&(pPacket->pView), sizeof(XGL_DEPTH_STENCIL_VIEW), pView);
+    pPacket->result = result;
+    glv_finalize_buffer_address(pHeader, (void**)&(pPacket->pCreateInfo));
+    glv_finalize_buffer_address(pHeader, (void**)&(pPacket->pView));
+    FINISH_TRACE_PACKET();
+    return result;
+}
+
+GLVTRACER_EXPORT XGL_RESULT XGLAPI __HOOKED_xglCreateShader(
+    XGL_DEVICE device,
+    const XGL_SHADER_CREATE_INFO* pCreateInfo,
+    XGL_SHADER* pShader)
+{
+    glv_trace_packet_header* pHeader;
+    XGL_RESULT result;
+    struct_xglCreateShader* pPacket = NULL;
+    CREATE_TRACE_PACKET(xglCreateShader, get_struct_chain_size((void*)pCreateInfo) + sizeof(XGL_SHADER));
+    result = real_xglCreateShader(device, pCreateInfo, pShader);
+    pPacket = interpret_body_as_xglCreateShader(pHeader);
+    pPacket->device = device;
+    glv_add_buffer_to_trace_packet(pHeader, (void**)&(pPacket->pCreateInfo), sizeof(XGL_SHADER_CREATE_INFO), pCreateInfo);
+    glv_add_buffer_to_trace_packet(pHeader, (void**)&(pPacket->pCreateInfo->pCode), ((pCreateInfo != NULL) ? pCreateInfo->codeSize : 0), pCreateInfo->pCode);
+    glv_add_buffer_to_trace_packet(pHeader, (void**)&(pPacket->pShader), sizeof(XGL_SHADER), pShader);
+    pPacket->result = result;
+    glv_finalize_buffer_address(pHeader, (void**)&(pPacket->pCreateInfo->pCode));
+    glv_finalize_buffer_address(pHeader, (void**)&(pPacket->pCreateInfo));
+    glv_finalize_buffer_address(pHeader, (void**)&(pPacket->pShader));
+    FINISH_TRACE_PACKET();
+    return result;
+}
+
+GLVTRACER_EXPORT XGL_RESULT XGLAPI __HOOKED_xglCreateGraphicsPipeline(
+    XGL_DEVICE device,
+    const XGL_GRAPHICS_PIPELINE_CREATE_INFO* pCreateInfo,
+    XGL_PIPELINE* pPipeline)
+{
+    glv_trace_packet_header* pHeader;
+    XGL_RESULT result;
+    struct_xglCreateGraphicsPipeline* pPacket = NULL;
+    CREATE_TRACE_PACKET(xglCreateGraphicsPipeline, get_struct_chain_size((void*)pCreateInfo) + sizeof(XGL_PIPELINE));
+    result = real_xglCreateGraphicsPipeline(device, pCreateInfo, pPipeline);
+    pPacket = interpret_body_as_xglCreateGraphicsPipeline(pHeader);
+    pPacket->device = device;
+    glv_add_buffer_to_trace_packet(pHeader, (void**)&(pPacket->pCreateInfo), sizeof(XGL_GRAPHICS_PIPELINE_CREATE_INFO), pCreateInfo);
+    add_pipeline_state_to_trace_packet(pHeader, (void**)&(pPacket->pCreateInfo->pNext), pCreateInfo->pNext);
+    glv_add_buffer_to_trace_packet(pHeader, (void**)&(pPacket->pPipeline), sizeof(XGL_PIPELINE), pPipeline);
+    pPacket->result = result;
+    glv_finalize_buffer_address(pHeader, (void**)&(pPacket->pCreateInfo));
+    glv_finalize_buffer_address(pHeader, (void**)&(pPacket->pPipeline));
+    FINISH_TRACE_PACKET();
+    return result;
+}
+
+GLVTRACER_EXPORT XGL_RESULT XGLAPI __HOOKED_xglCreateComputePipeline(
+    XGL_DEVICE device,
+    const XGL_COMPUTE_PIPELINE_CREATE_INFO* pCreateInfo,
+    XGL_PIPELINE* pPipeline)
+{
+    glv_trace_packet_header* pHeader;
+    XGL_RESULT result;
+    struct_xglCreateComputePipeline* pPacket = NULL;
+    CREATE_TRACE_PACKET(xglCreateComputePipeline, get_struct_chain_size((void*)pCreateInfo) + sizeof(XGL_PIPELINE));
+    result = real_xglCreateComputePipeline(device, pCreateInfo, pPipeline);
+    pPacket = interpret_body_as_xglCreateComputePipeline(pHeader);
+    pPacket->device = device;
+    glv_add_buffer_to_trace_packet(pHeader, (void**)&(pPacket->pCreateInfo), sizeof(XGL_COMPUTE_PIPELINE_CREATE_INFO), pCreateInfo);
+    add_pipeline_state_to_trace_packet(pHeader, (void**)&(pPacket->pCreateInfo->pNext), pCreateInfo->pNext);
+    add_pipeline_shader_to_trace_packet(pHeader, (XGL_PIPELINE_SHADER*)&pPacket->pCreateInfo->cs, &pCreateInfo->cs);
+    glv_add_buffer_to_trace_packet(pHeader, (void**)&(pPacket->pPipeline), sizeof(XGL_PIPELINE), pPipeline);
+    pPacket->result = result;
+    finalize_pipeline_shader_address(pHeader, &pPacket->pCreateInfo->cs);
+    glv_finalize_buffer_address(pHeader, (void**)&(pPacket->pCreateInfo));
+    glv_finalize_buffer_address(pHeader, (void**)&(pPacket->pPipeline));
+    FINISH_TRACE_PACKET();
+    return result;
+}
+
+GLVTRACER_EXPORT XGL_RESULT XGLAPI __HOOKED_xglStorePipeline(
+    XGL_PIPELINE pipeline,
+    size_t* pDataSize,
+    void* pData)
+{
+    glv_trace_packet_header* pHeader;
+    XGL_RESULT result;
+    size_t _dataSize;
+    struct_xglStorePipeline* pPacket = NULL;
+    CREATE_TRACE_PACKET(xglStorePipeline, ((pDataSize != NULL) ? sizeof(size_t) : 0) + ((pDataSize != NULL && pData != NULL) ? *pDataSize : 0));
+    result = real_xglStorePipeline(pipeline, pDataSize, pData);
+    _dataSize = (pDataSize == NULL || pData == NULL) ? 0 : *pDataSize;
+    pPacket = interpret_body_as_xglStorePipeline(pHeader);
+    pPacket->pipeline = pipeline;
+    glv_add_buffer_to_trace_packet(pHeader, (void**)&(pPacket->pDataSize), sizeof(size_t), &_dataSize);
+    glv_add_buffer_to_trace_packet(pHeader, (void**)&(pPacket->pData), _dataSize, pData);
+    pPacket->result = result;
+    glv_finalize_buffer_address(pHeader, (void**)&(pPacket->pDataSize));
+    glv_finalize_buffer_address(pHeader, (void**)&(pPacket->pData));
+    FINISH_TRACE_PACKET();
+    return result;
+}
+
+GLVTRACER_EXPORT XGL_RESULT XGLAPI __HOOKED_xglLoadPipeline(
+    XGL_DEVICE device,
+    size_t dataSize,
+    const void* pData,
+    XGL_PIPELINE* pPipeline)
+{
+    glv_trace_packet_header* pHeader;
+    XGL_RESULT result;
+    struct_xglLoadPipeline* pPacket = NULL;
+    CREATE_TRACE_PACKET(xglLoadPipeline, dataSize + sizeof(XGL_PIPELINE));
+    result = real_xglLoadPipeline(device, dataSize, pData, pPipeline);
+    pPacket = interpret_body_as_xglLoadPipeline(pHeader);
+    pPacket->device = device;
+    pPacket->dataSize = dataSize;
+    glv_add_buffer_to_trace_packet(pHeader, (void**)&(pPacket->pData), dataSize, pData);
+    glv_add_buffer_to_trace_packet(pHeader, (void**)&(pPacket->pPipeline), sizeof(XGL_PIPELINE), pPipeline);
+    pPacket->result = result;
+    glv_finalize_buffer_address(pHeader, (void**)&(pPacket->pData));
+    glv_finalize_buffer_address(pHeader, (void**)&(pPacket->pPipeline));
+    FINISH_TRACE_PACKET();
+    return result;
+}
+
+GLVTRACER_EXPORT XGL_RESULT XGLAPI __HOOKED_xglCreatePipelineDelta(
+    XGL_DEVICE device,
+    XGL_PIPELINE p1,
+    XGL_PIPELINE p2,
+    XGL_PIPELINE_DELTA* delta)
+{
+    glv_trace_packet_header* pHeader;
+    XGL_RESULT result;
+    struct_xglCreatePipelineDelta* pPacket = NULL;
+    CREATE_TRACE_PACKET(xglCreatePipelineDelta, sizeof(XGL_PIPELINE_DELTA));
+    result = real_xglCreatePipelineDelta(device, p1, p2, delta);
+    pPacket = interpret_body_as_xglCreatePipelineDelta(pHeader);
+    pPacket->device = device;
+    pPacket->p1 = p1;
+    pPacket->p2 = p2;
+    glv_add_buffer_to_trace_packet(pHeader, (void**)&(pPacket->delta), sizeof(XGL_PIPELINE_DELTA), delta);
+    pPacket->result = result;
+    glv_finalize_buffer_address(pHeader, (void**)&(pPacket->delta));
+    FINISH_TRACE_PACKET();
+    return result;
+}
+
+GLVTRACER_EXPORT XGL_RESULT XGLAPI __HOOKED_xglCreateSampler(
+    XGL_DEVICE device,
+    const XGL_SAMPLER_CREATE_INFO* pCreateInfo,
+    XGL_SAMPLER* pSampler)
+{
+    glv_trace_packet_header* pHeader;
+    XGL_RESULT result;
+    struct_xglCreateSampler* pPacket = NULL;
+    CREATE_TRACE_PACKET(xglCreateSampler, get_struct_chain_size((void*)pCreateInfo) + sizeof(XGL_SAMPLER));
+    result = real_xglCreateSampler(device, pCreateInfo, pSampler);
+    pPacket = interpret_body_as_xglCreateSampler(pHeader);
+    pPacket->device = device;
+    glv_add_buffer_to_trace_packet(pHeader, (void**)&(pPacket->pCreateInfo), sizeof(XGL_SAMPLER_CREATE_INFO), pCreateInfo);
+    glv_add_buffer_to_trace_packet(pHeader, (void**)&(pPacket->pSampler), sizeof(XGL_SAMPLER), pSampler);
+    pPacket->result = result;
+    glv_finalize_buffer_address(pHeader, (void**)&(pPacket->pCreateInfo));
+    glv_finalize_buffer_address(pHeader, (void**)&(pPacket->pSampler));
+    FINISH_TRACE_PACKET();
+    return result;
+}
+
+GLVTRACER_EXPORT XGL_RESULT XGLAPI __HOOKED_xglCreateDescriptorSetLayout(
+    XGL_DEVICE device,
+    XGL_FLAGS stageFlags,
+    const uint32_t* pSetBindPoints,
+    XGL_DESCRIPTOR_SET_LAYOUT priorSetLayout,
+    const XGL_DESCRIPTOR_SET_LAYOUT_CREATE_INFO* pSetLayoutInfoList,
+    XGL_DESCRIPTOR_SET_LAYOUT* pSetLayout)
+{
+    glv_trace_packet_header* pHeader;
+    XGL_RESULT result;
+    struct_xglCreateDescriptorSetLayout* pPacket = NULL;
+    CREATE_TRACE_PACKET(xglCreateDescriptorSetLayout, (XGL_SHADER_STAGE_COMPUTE * sizeof(uint32_t)) + get_struct_chain_size((void*)pSetLayoutInfoList) + sizeof(XGL_DESCRIPTOR_SET_LAYOUT));
+    result = real_xglCreateDescriptorSetLayout(device, stageFlags, pSetBindPoints, priorSetLayout, pSetLayoutInfoList, pSetLayout);
+    pPacket = interpret_body_as_xglCreateDescriptorSetLayout(pHeader);
+    pPacket->device = device;
+    pPacket->stageFlags = stageFlags;
+    pPacket->priorSetLayout = priorSetLayout;
+    glv_add_buffer_to_trace_packet(pHeader, (void**)&(pPacket->pSetBindPoints), sizeof(uint32_t), pSetBindPoints);
+    glv_add_buffer_to_trace_packet(pHeader, (void**)&(pPacket->pSetLayoutInfoList), sizeof(XGL_DESCRIPTOR_SET_LAYOUT_CREATE_INFO), pSetLayoutInfoList);
+    if (pSetLayoutInfoList)
+        add_create_ds_layout_to_trace_packet(pHeader, (void**)&(pPacket->pSetLayoutInfoList->pNext), pSetLayoutInfoList->pNext);
+    glv_add_buffer_to_trace_packet(pHeader, (void**)&(pPacket->pSetLayout), sizeof(XGL_DESCRIPTOR_SET_LAYOUT), pSetLayout);
+    pPacket->result = result;
+    glv_finalize_buffer_address(pHeader, (void**)&(pPacket->pSetBindPoints));
+    glv_finalize_buffer_address(pHeader, (void**)&(pPacket->pSetLayoutInfoList));
+    glv_finalize_buffer_address(pHeader, (void**)&(pPacket->pSetLayout));
+    FINISH_TRACE_PACKET();
+    return result;
+}
+
+GLVTRACER_EXPORT XGL_RESULT XGLAPI __HOOKED_xglBeginDescriptorRegionUpdate(
+    XGL_DEVICE device,
+    XGL_DESCRIPTOR_UPDATE_MODE updateMode)
+{
+    glv_trace_packet_header* pHeader;
+    XGL_RESULT result;
+    struct_xglBeginDescriptorRegionUpdate* pPacket = NULL;
+    CREATE_TRACE_PACKET(xglBeginDescriptorRegionUpdate, 0);
+    result = real_xglBeginDescriptorRegionUpdate(device, updateMode);
+    pPacket = interpret_body_as_xglBeginDescriptorRegionUpdate(pHeader);
+    pPacket->device = device;
+    pPacket->updateMode = updateMode;
+    pPacket->result = result;
+    FINISH_TRACE_PACKET();
+    return result;
+}
+
+GLVTRACER_EXPORT XGL_RESULT XGLAPI __HOOKED_xglEndDescriptorRegionUpdate(
+    XGL_DEVICE device,
+    XGL_CMD_BUFFER cmd)
+{
+    glv_trace_packet_header* pHeader;
+    XGL_RESULT result;
+    struct_xglEndDescriptorRegionUpdate* pPacket = NULL;
+    CREATE_TRACE_PACKET(xglEndDescriptorRegionUpdate, 0);
+    result = real_xglEndDescriptorRegionUpdate(device, cmd);
+    pPacket = interpret_body_as_xglEndDescriptorRegionUpdate(pHeader);
+    pPacket->device = device;
+    pPacket->cmd = cmd;
+    pPacket->result = result;
+    FINISH_TRACE_PACKET();
+    return result;
+}
+
+GLVTRACER_EXPORT XGL_RESULT XGLAPI __HOOKED_xglCreateDescriptorRegion(
+    XGL_DEVICE device,
+    XGL_DESCRIPTOR_REGION_USAGE regionUsage,
+    uint32_t maxSets,
+    const XGL_DESCRIPTOR_REGION_CREATE_INFO* pCreateInfo,
+    XGL_DESCRIPTOR_REGION* pDescriptorRegion)
+{
+    glv_trace_packet_header* pHeader;
+    XGL_RESULT result;
+    struct_xglCreateDescriptorRegion* pPacket = NULL;
+    uint32_t rgCount = (pCreateInfo != NULL && pCreateInfo->pTypeCount != NULL) ? pCreateInfo->count : 0;
+    CREATE_TRACE_PACKET(xglCreateDescriptorRegion,  get_struct_chain_size((void*)pCreateInfo) + sizeof(XGL_DESCRIPTOR_REGION));
+    result = real_xglCreateDescriptorRegion(device, regionUsage, maxSets, pCreateInfo, pDescriptorRegion);
+    pPacket = interpret_body_as_xglCreateDescriptorRegion(pHeader);
+    pPacket->device = device;
+    pPacket->regionUsage = regionUsage;
+    pPacket->maxSets = maxSets;
+    glv_add_buffer_to_trace_packet(pHeader, (void**)&(pPacket->pCreateInfo), sizeof(XGL_DESCRIPTOR_REGION_CREATE_INFO), pCreateInfo);
+    glv_add_buffer_to_trace_packet(pHeader, (void**)&(pPacket->pCreateInfo->pTypeCount), rgCount * sizeof(XGL_DESCRIPTOR_TYPE_COUNT), pCreateInfo->pTypeCount);
+    glv_add_buffer_to_trace_packet(pHeader, (void**)&(pPacket->pDescriptorRegion), sizeof(XGL_DESCRIPTOR_REGION), pDescriptorRegion);
+    pPacket->result = result;
+    glv_finalize_buffer_address(pHeader, (void**)&(pPacket->pCreateInfo->pTypeCount));
+    glv_finalize_buffer_address(pHeader, (void**)&(pPacket->pCreateInfo));
+    glv_finalize_buffer_address(pHeader, (void**)&(pPacket->pDescriptorRegion));
+    FINISH_TRACE_PACKET();
+    return result;
+}
+
+GLVTRACER_EXPORT XGL_RESULT XGLAPI __HOOKED_xglClearDescriptorRegion(
+    XGL_DESCRIPTOR_REGION descriptorRegion)
+{
+    glv_trace_packet_header* pHeader;
+    XGL_RESULT result;
+    struct_xglClearDescriptorRegion* pPacket = NULL;
+    CREATE_TRACE_PACKET(xglClearDescriptorRegion, 0);
+    result = real_xglClearDescriptorRegion(descriptorRegion);
+    pPacket = interpret_body_as_xglClearDescriptorRegion(pHeader);
+    pPacket->descriptorRegion = descriptorRegion;
+    pPacket->result = result;
+    FINISH_TRACE_PACKET();
+    return result;
+}
+
+GLVTRACER_EXPORT XGL_RESULT XGLAPI __HOOKED_xglAllocDescriptorSets(
+    XGL_DESCRIPTOR_REGION descriptorRegion,
+    XGL_DESCRIPTOR_SET_USAGE setUsage,
+    uint32_t count,
+    const XGL_DESCRIPTOR_SET_LAYOUT* pSetLayouts,
+    XGL_DESCRIPTOR_SET* pDescriptorSets,
+    uint32_t* pCount)
+{
+    glv_trace_packet_header* pHeader;
+    XGL_RESULT result;
+    struct_xglAllocDescriptorSets* pPacket = NULL;
+    uint64_t startTime;
+    SEND_ENTRYPOINT_ID(xglAllocDescriptorSets);
+    startTime = glv_get_time();
+    result = real_xglAllocDescriptorSets(descriptorRegion, setUsage, count, pSetLayouts, pDescriptorSets, pCount);
+    size_t customSize = (*pCount <= 0) ? (sizeof(XGL_DESCRIPTOR_SET)) : (*pCount * sizeof(XGL_DESCRIPTOR_SET));
+    CREATE_TRACE_PACKET(xglAllocDescriptorSets, sizeof(XGL_DESCRIPTOR_SET_LAYOUT) + customSize + sizeof(uint32_t));
+    pHeader->entrypoint_begin_time = startTime;
+    pPacket = interpret_body_as_xglAllocDescriptorSets(pHeader);
+    pPacket->descriptorRegion = descriptorRegion;
+    pPacket->setUsage = setUsage;
+    pPacket->count = count;
+    glv_add_buffer_to_trace_packet(pHeader, (void**)&(pPacket->pSetLayouts), count*sizeof(XGL_DESCRIPTOR_SET_LAYOUT), pSetLayouts);
+    glv_add_buffer_to_trace_packet(pHeader, (void**)&(pPacket->pDescriptorSets), customSize, pDescriptorSets);
+    glv_add_buffer_to_trace_packet(pHeader, (void**)&(pPacket->pCount), sizeof(uint32_t), pCount);
+    pPacket->result = result;
+    glv_finalize_buffer_address(pHeader, (void**)&(pPacket->pSetLayouts));
+    glv_finalize_buffer_address(pHeader, (void**)&(pPacket->pDescriptorSets));
+    glv_finalize_buffer_address(pHeader, (void**)&(pPacket->pCount));
+    FINISH_TRACE_PACKET();
+    return result;
+}
+
+GLVTRACER_EXPORT void XGLAPI __HOOKED_xglClearDescriptorSets(
+    XGL_DESCRIPTOR_REGION descriptorRegion,
+    uint32_t count,
+    const XGL_DESCRIPTOR_SET* pDescriptorSets)
+{
+    glv_trace_packet_header* pHeader;
+    struct_xglClearDescriptorSets* pPacket = NULL;
+    CREATE_TRACE_PACKET(xglClearDescriptorSets, count*sizeof(XGL_DESCRIPTOR_SET));
+    real_xglClearDescriptorSets(descriptorRegion, count, pDescriptorSets);
+    pPacket = interpret_body_as_xglClearDescriptorSets(pHeader);
+    pPacket->descriptorRegion = descriptorRegion;
+    pPacket->count = count;
+    glv_add_buffer_to_trace_packet(pHeader, (void**)&(pPacket->pDescriptorSets), count*sizeof(XGL_DESCRIPTOR_SET), pDescriptorSets);
+    glv_finalize_buffer_address(pHeader, (void**)&(pPacket->pDescriptorSets));
+    FINISH_TRACE_PACKET();
+}
+
+GLVTRACER_EXPORT void XGLAPI __HOOKED_xglUpdateDescriptors(
+    XGL_DESCRIPTOR_SET descriptorSet,
+    const void* pUpdateChain)
+{
+    glv_trace_packet_header* pHeader;
+    struct_xglUpdateDescriptors* pPacket = NULL;
+    CREATE_TRACE_PACKET(xglUpdateDescriptors, get_struct_chain_size((void*)pUpdateChain));
+    real_xglUpdateDescriptors(descriptorSet, pUpdateChain);
+    pPacket = interpret_body_as_xglUpdateDescriptors(pHeader);
+    pPacket->descriptorSet = descriptorSet;
+    add_update_descriptors_to_trace_packet(pHeader, (void**)&(pPacket->pUpdateChain), pUpdateChain);
+    FINISH_TRACE_PACKET();
+}
+
+GLVTRACER_EXPORT XGL_RESULT XGLAPI __HOOKED_xglCreateDynamicViewportState(
+    XGL_DEVICE device,
+    const XGL_DYNAMIC_VP_STATE_CREATE_INFO* pCreateInfo,
+    XGL_DYNAMIC_VP_STATE_OBJECT* pState)
+{
+    glv_trace_packet_header* pHeader;
+    XGL_RESULT result;
+    struct_xglCreateDynamicViewportState* pPacket = NULL;
+    uint32_t vpsCount = (pCreateInfo != NULL && pCreateInfo->pViewports != NULL) ? pCreateInfo->viewportAndScissorCount : 0;
+    CREATE_TRACE_PACKET(xglCreateDynamicViewportState,  get_struct_chain_size((void*)pCreateInfo) + sizeof(XGL_DYNAMIC_VP_STATE_OBJECT));
+    result = real_xglCreateDynamicViewportState(device, pCreateInfo, pState);
+    pPacket = interpret_body_as_xglCreateDynamicViewportState(pHeader);
+    pPacket->device = device;
+    glv_add_buffer_to_trace_packet(pHeader, (void**)&(pPacket->pCreateInfo), sizeof(XGL_DYNAMIC_VP_STATE_CREATE_INFO), pCreateInfo);
+    glv_add_buffer_to_trace_packet(pHeader, (void**)&(pPacket->pCreateInfo->pViewports), vpsCount * sizeof(XGL_VIEWPORT), pCreateInfo->pViewports);
+    glv_add_buffer_to_trace_packet(pHeader, (void**)&(pPacket->pCreateInfo->pScissors), vpsCount * sizeof(XGL_RECT), pCreateInfo->pScissors);
+    glv_add_buffer_to_trace_packet(pHeader, (void**)&(pPacket->pState), sizeof(XGL_DYNAMIC_VP_STATE_OBJECT), pState);
+    pPacket->result = result;
+    glv_finalize_buffer_address(pHeader, (void**)&(pPacket->pCreateInfo->pViewports));
+    glv_finalize_buffer_address(pHeader, (void**)&(pPacket->pCreateInfo->pScissors));
+    glv_finalize_buffer_address(pHeader, (void**)&(pPacket->pCreateInfo));
+    glv_finalize_buffer_address(pHeader, (void**)&(pPacket->pState));
+    FINISH_TRACE_PACKET();
+    return result;
+}
+
+GLVTRACER_EXPORT XGL_RESULT XGLAPI __HOOKED_xglCreateDynamicRasterState(
+    XGL_DEVICE device,
+    const XGL_DYNAMIC_RS_STATE_CREATE_INFO* pCreateInfo,
+    XGL_DYNAMIC_RS_STATE_OBJECT* pState)
+{
+    glv_trace_packet_header* pHeader;
+    XGL_RESULT result;
+    struct_xglCreateDynamicRasterState* pPacket = NULL;
+    CREATE_TRACE_PACKET(xglCreateDynamicRasterState, get_struct_chain_size((void*)pCreateInfo) + sizeof(XGL_DYNAMIC_RS_STATE_OBJECT));
+    result = real_xglCreateDynamicRasterState(device, pCreateInfo, pState);
+    pPacket = interpret_body_as_xglCreateDynamicRasterState(pHeader);
+    pPacket->device = device;
+    glv_add_buffer_to_trace_packet(pHeader, (void**)&(pPacket->pCreateInfo), sizeof(XGL_DYNAMIC_RS_STATE_CREATE_INFO), pCreateInfo);
+    glv_add_buffer_to_trace_packet(pHeader, (void**)&(pPacket->pState), sizeof(XGL_DYNAMIC_RS_STATE_OBJECT), pState);
+    pPacket->result = result;
+    glv_finalize_buffer_address(pHeader, (void**)&(pPacket->pCreateInfo));
+    glv_finalize_buffer_address(pHeader, (void**)&(pPacket->pState));
+    FINISH_TRACE_PACKET();
+    return result;
+}
+
+GLVTRACER_EXPORT XGL_RESULT XGLAPI __HOOKED_xglCreateDynamicColorBlendState(
+    XGL_DEVICE device,
+    const XGL_DYNAMIC_CB_STATE_CREATE_INFO* pCreateInfo,
+    XGL_DYNAMIC_CB_STATE_OBJECT* pState)
+{
+    glv_trace_packet_header* pHeader;
+    XGL_RESULT result;
+    struct_xglCreateDynamicColorBlendState* pPacket = NULL;
+    CREATE_TRACE_PACKET(xglCreateDynamicColorBlendState, get_struct_chain_size((void*)pCreateInfo) + sizeof(XGL_DYNAMIC_CB_STATE_OBJECT));
+    result = real_xglCreateDynamicColorBlendState(device, pCreateInfo, pState);
+    pPacket = interpret_body_as_xglCreateDynamicColorBlendState(pHeader);
+    pPacket->device = device;
+    glv_add_buffer_to_trace_packet(pHeader, (void**)&(pPacket->pCreateInfo), sizeof(XGL_DYNAMIC_CB_STATE_CREATE_INFO), pCreateInfo);
+    glv_add_buffer_to_trace_packet(pHeader, (void**)&(pPacket->pState), sizeof(XGL_DYNAMIC_CB_STATE_OBJECT), pState);
+    pPacket->result = result;
+    glv_finalize_buffer_address(pHeader, (void**)&(pPacket->pCreateInfo));
+    glv_finalize_buffer_address(pHeader, (void**)&(pPacket->pState));
+    FINISH_TRACE_PACKET();
+    return result;
+}
+
+GLVTRACER_EXPORT XGL_RESULT XGLAPI __HOOKED_xglCreateDynamicDepthStencilState(
+    XGL_DEVICE device,
+    const XGL_DYNAMIC_DS_STATE_CREATE_INFO* pCreateInfo,
+    XGL_DYNAMIC_DS_STATE_OBJECT* pState)
+{
+    glv_trace_packet_header* pHeader;
+    XGL_RESULT result;
+    struct_xglCreateDynamicDepthStencilState* pPacket = NULL;
+    CREATE_TRACE_PACKET(xglCreateDynamicDepthStencilState, get_struct_chain_size((void*)pCreateInfo) + sizeof(XGL_DYNAMIC_DS_STATE_OBJECT));
+    result = real_xglCreateDynamicDepthStencilState(device, pCreateInfo, pState);
+    pPacket = interpret_body_as_xglCreateDynamicDepthStencilState(pHeader);
+    pPacket->device = device;
+    glv_add_buffer_to_trace_packet(pHeader, (void**)&(pPacket->pCreateInfo), sizeof(XGL_DYNAMIC_DS_STATE_CREATE_INFO), pCreateInfo);
+    glv_add_buffer_to_trace_packet(pHeader, (void**)&(pPacket->pState), sizeof(XGL_DYNAMIC_DS_STATE_OBJECT), pState);
+    pPacket->result = result;
+    glv_finalize_buffer_address(pHeader, (void**)&(pPacket->pCreateInfo));
+    glv_finalize_buffer_address(pHeader, (void**)&(pPacket->pState));
+    FINISH_TRACE_PACKET();
+    return result;
+}
+
+GLVTRACER_EXPORT XGL_RESULT XGLAPI __HOOKED_xglCreateCommandBuffer(
+    XGL_DEVICE device,
+    const XGL_CMD_BUFFER_CREATE_INFO* pCreateInfo,
+    XGL_CMD_BUFFER* pCmdBuffer)
+{
+    glv_trace_packet_header* pHeader;
+    XGL_RESULT result;
+    struct_xglCreateCommandBuffer* pPacket = NULL;
+    CREATE_TRACE_PACKET(xglCreateCommandBuffer, get_struct_chain_size((void*)pCreateInfo) + sizeof(XGL_CMD_BUFFER));
+    result = real_xglCreateCommandBuffer(device, pCreateInfo, pCmdBuffer);
+    pPacket = interpret_body_as_xglCreateCommandBuffer(pHeader);
+    pPacket->device = device;
+    glv_add_buffer_to_trace_packet(pHeader, (void**)&(pPacket->pCreateInfo), sizeof(XGL_CMD_BUFFER_CREATE_INFO), pCreateInfo);
+    glv_add_buffer_to_trace_packet(pHeader, (void**)&(pPacket->pCmdBuffer), sizeof(XGL_CMD_BUFFER), pCmdBuffer);
+    pPacket->result = result;
+    glv_finalize_buffer_address(pHeader, (void**)&(pPacket->pCreateInfo));
+    glv_finalize_buffer_address(pHeader, (void**)&(pPacket->pCmdBuffer));
+    FINISH_TRACE_PACKET();
+    return result;
+}
+
+GLVTRACER_EXPORT XGL_RESULT XGLAPI __HOOKED_xglBeginCommandBuffer(
+    XGL_CMD_BUFFER cmdBuffer,
+    const XGL_CMD_BUFFER_BEGIN_INFO* pBeginInfo)
+{
+    glv_trace_packet_header* pHeader;
+    XGL_RESULT result;
+    struct_xglBeginCommandBuffer* pPacket = NULL;
+    CREATE_TRACE_PACKET(xglBeginCommandBuffer, get_struct_chain_size((void*)pBeginInfo));
+    result = real_xglBeginCommandBuffer(cmdBuffer, pBeginInfo);
+    pPacket = interpret_body_as_xglBeginCommandBuffer(pHeader);
+    pPacket->cmdBuffer = cmdBuffer;
+    glv_add_buffer_to_trace_packet(pHeader, (void**)&(pPacket->pBeginInfo), sizeof(XGL_CMD_BUFFER_BEGIN_INFO), pBeginInfo);
+    add_begin_cmdbuf_to_trace_packet(pHeader, (void**)&(pPacket->pBeginInfo->pNext), pBeginInfo->pNext);
+    pPacket->result = result;
+    glv_finalize_buffer_address(pHeader, (void**)&(pPacket->pBeginInfo));
+    FINISH_TRACE_PACKET();
+    return result;
+}
+
+GLVTRACER_EXPORT XGL_RESULT XGLAPI __HOOKED_xglEndCommandBuffer(
+    XGL_CMD_BUFFER cmdBuffer)
+{
+    glv_trace_packet_header* pHeader;
+    XGL_RESULT result;
+    struct_xglEndCommandBuffer* pPacket = NULL;
+    CREATE_TRACE_PACKET(xglEndCommandBuffer, 0);
+    result = real_xglEndCommandBuffer(cmdBuffer);
+    pPacket = interpret_body_as_xglEndCommandBuffer(pHeader);
+    pPacket->cmdBuffer = cmdBuffer;
+    pPacket->result = result;
+    FINISH_TRACE_PACKET();
+    return result;
+}
+
+GLVTRACER_EXPORT XGL_RESULT XGLAPI __HOOKED_xglResetCommandBuffer(
+    XGL_CMD_BUFFER cmdBuffer)
+{
+    glv_trace_packet_header* pHeader;
+    XGL_RESULT result;
+    struct_xglResetCommandBuffer* pPacket = NULL;
+    CREATE_TRACE_PACKET(xglResetCommandBuffer, 0);
+    result = real_xglResetCommandBuffer(cmdBuffer);
+    pPacket = interpret_body_as_xglResetCommandBuffer(pHeader);
+    pPacket->cmdBuffer = cmdBuffer;
+    pPacket->result = result;
+    FINISH_TRACE_PACKET();
+    return result;
+}
+
+GLVTRACER_EXPORT void XGLAPI __HOOKED_xglCmdBindPipeline(
+    XGL_CMD_BUFFER cmdBuffer,
+    XGL_PIPELINE_BIND_POINT pipelineBindPoint,
+    XGL_PIPELINE pipeline)
+{
+    glv_trace_packet_header* pHeader;
+    struct_xglCmdBindPipeline* pPacket = NULL;
+    CREATE_TRACE_PACKET(xglCmdBindPipeline, 0);
+    real_xglCmdBindPipeline(cmdBuffer, pipelineBindPoint, pipeline);
+    pPacket = interpret_body_as_xglCmdBindPipeline(pHeader);
+    pPacket->cmdBuffer = cmdBuffer;
+    pPacket->pipelineBindPoint = pipelineBindPoint;
+    pPacket->pipeline = pipeline;
+    FINISH_TRACE_PACKET();
+}
+
+GLVTRACER_EXPORT void XGLAPI __HOOKED_xglCmdBindPipelineDelta(
+    XGL_CMD_BUFFER cmdBuffer,
+    XGL_PIPELINE_BIND_POINT pipelineBindPoint,
+    XGL_PIPELINE_DELTA delta)
+{
+    glv_trace_packet_header* pHeader;
+    struct_xglCmdBindPipelineDelta* pPacket = NULL;
+    CREATE_TRACE_PACKET(xglCmdBindPipelineDelta, 0);
+    real_xglCmdBindPipelineDelta(cmdBuffer, pipelineBindPoint, delta);
+    pPacket = interpret_body_as_xglCmdBindPipelineDelta(pHeader);
+    pPacket->cmdBuffer = cmdBuffer;
+    pPacket->pipelineBindPoint = pipelineBindPoint;
+    pPacket->delta = delta;
+    FINISH_TRACE_PACKET();
+}
+
+GLVTRACER_EXPORT void XGLAPI __HOOKED_xglCmdBindDynamicStateObject(
+    XGL_CMD_BUFFER cmdBuffer,
+    XGL_STATE_BIND_POINT stateBindPoint,
+    XGL_DYNAMIC_STATE_OBJECT state)
+{
+    glv_trace_packet_header* pHeader;
+    struct_xglCmdBindDynamicStateObject* pPacket = NULL;
+    CREATE_TRACE_PACKET(xglCmdBindDynamicStateObject, 0);
+    real_xglCmdBindDynamicStateObject(cmdBuffer, stateBindPoint, state);
+    pPacket = interpret_body_as_xglCmdBindDynamicStateObject(pHeader);
+    pPacket->cmdBuffer = cmdBuffer;
+    pPacket->stateBindPoint = stateBindPoint;
+    pPacket->state = state;
+    FINISH_TRACE_PACKET();
+}
+
+GLVTRACER_EXPORT void XGLAPI __HOOKED_xglCmdBindDescriptorSet(
+    XGL_CMD_BUFFER cmdBuffer,
+    XGL_PIPELINE_BIND_POINT pipelineBindPoint,
+    XGL_DESCRIPTOR_SET descriptorSet,
+    const uint32_t* pUserData)
+{
+    glv_trace_packet_header* pHeader;
+    struct_xglCmdBindDescriptorSet* pPacket = NULL;
+    CREATE_TRACE_PACKET(xglCmdBindDescriptorSet, sizeof(uint32_t));
+    real_xglCmdBindDescriptorSet(cmdBuffer, pipelineBindPoint, descriptorSet, pUserData);
+    pPacket = interpret_body_as_xglCmdBindDescriptorSet(pHeader);
+    pPacket->cmdBuffer = cmdBuffer;
+    pPacket->pipelineBindPoint = pipelineBindPoint;
+    pPacket->descriptorSet = descriptorSet;
+    glv_add_buffer_to_trace_packet(pHeader, (void**)&(pPacket->pUserData), sizeof(uint32_t), pUserData);
+    glv_finalize_buffer_address(pHeader, (void**)&(pPacket->pUserData));
+    FINISH_TRACE_PACKET();
+}
+
+GLVTRACER_EXPORT void XGLAPI __HOOKED_xglCmdBindVertexBuffer(
+    XGL_CMD_BUFFER cmdBuffer,
+    XGL_BUFFER buffer,
+    XGL_GPU_SIZE offset,
+    uint32_t binding)
+{
+    glv_trace_packet_header* pHeader;
+    struct_xglCmdBindVertexBuffer* pPacket = NULL;
+    CREATE_TRACE_PACKET(xglCmdBindVertexBuffer, 0);
+    real_xglCmdBindVertexBuffer(cmdBuffer, buffer, offset, binding);
+    pPacket = interpret_body_as_xglCmdBindVertexBuffer(pHeader);
+    pPacket->cmdBuffer = cmdBuffer;
+    pPacket->buffer = buffer;
+    pPacket->offset = offset;
+    pPacket->binding = binding;
+    FINISH_TRACE_PACKET();
+}
+
+GLVTRACER_EXPORT void XGLAPI __HOOKED_xglCmdBindIndexBuffer(
+    XGL_CMD_BUFFER cmdBuffer,
+    XGL_BUFFER buffer,
+    XGL_GPU_SIZE offset,
+    XGL_INDEX_TYPE indexType)
+{
+    glv_trace_packet_header* pHeader;
+    struct_xglCmdBindIndexBuffer* pPacket = NULL;
+    CREATE_TRACE_PACKET(xglCmdBindIndexBuffer, 0);
+    real_xglCmdBindIndexBuffer(cmdBuffer, buffer, offset, indexType);
+    pPacket = interpret_body_as_xglCmdBindIndexBuffer(pHeader);
+    pPacket->cmdBuffer = cmdBuffer;
+    pPacket->buffer = buffer;
+    pPacket->offset = offset;
+    pPacket->indexType = indexType;
+    FINISH_TRACE_PACKET();
+}
+
+GLVTRACER_EXPORT void XGLAPI __HOOKED_xglCmdDraw(
+    XGL_CMD_BUFFER cmdBuffer,
+    uint32_t firstVertex,
+    uint32_t vertexCount,
+    uint32_t firstInstance,
+    uint32_t instanceCount)
+{
+    glv_trace_packet_header* pHeader;
+    struct_xglCmdDraw* pPacket = NULL;
+    CREATE_TRACE_PACKET(xglCmdDraw, 0);
+    real_xglCmdDraw(cmdBuffer, firstVertex, vertexCount, firstInstance, instanceCount);
+    pPacket = interpret_body_as_xglCmdDraw(pHeader);
+    pPacket->cmdBuffer = cmdBuffer;
+    pPacket->firstVertex = firstVertex;
+    pPacket->vertexCount = vertexCount;
+    pPacket->firstInstance = firstInstance;
+    pPacket->instanceCount = instanceCount;
+    FINISH_TRACE_PACKET();
+}
+
+GLVTRACER_EXPORT void XGLAPI __HOOKED_xglCmdDrawIndexed(
+    XGL_CMD_BUFFER cmdBuffer,
+    uint32_t firstIndex,
+    uint32_t indexCount,
+    int32_t vertexOffset,
+    uint32_t firstInstance,
+    uint32_t instanceCount)
+{
+    glv_trace_packet_header* pHeader;
+    struct_xglCmdDrawIndexed* pPacket = NULL;
+    CREATE_TRACE_PACKET(xglCmdDrawIndexed, 0);
+    real_xglCmdDrawIndexed(cmdBuffer, firstIndex, indexCount, vertexOffset, firstInstance, instanceCount);
+    pPacket = interpret_body_as_xglCmdDrawIndexed(pHeader);
+    pPacket->cmdBuffer = cmdBuffer;
+    pPacket->firstIndex = firstIndex;
+    pPacket->indexCount = indexCount;
+    pPacket->vertexOffset = vertexOffset;
+    pPacket->firstInstance = firstInstance;
+    pPacket->instanceCount = instanceCount;
+    FINISH_TRACE_PACKET();
+}
+
+GLVTRACER_EXPORT void XGLAPI __HOOKED_xglCmdDrawIndirect(
+    XGL_CMD_BUFFER cmdBuffer,
+    XGL_BUFFER buffer,
+    XGL_GPU_SIZE offset,
+    uint32_t count,
+    uint32_t stride)
+{
+    glv_trace_packet_header* pHeader;
+    struct_xglCmdDrawIndirect* pPacket = NULL;
+    CREATE_TRACE_PACKET(xglCmdDrawIndirect, 0);
+    real_xglCmdDrawIndirect(cmdBuffer, buffer, offset, count, stride);
+    pPacket = interpret_body_as_xglCmdDrawIndirect(pHeader);
+    pPacket->cmdBuffer = cmdBuffer;
+    pPacket->buffer = buffer;
+    pPacket->offset = offset;
+    pPacket->count = count;
+    pPacket->stride = stride;
+    FINISH_TRACE_PACKET();
+}
+
+GLVTRACER_EXPORT void XGLAPI __HOOKED_xglCmdDrawIndexedIndirect(
+    XGL_CMD_BUFFER cmdBuffer,
+    XGL_BUFFER buffer,
+    XGL_GPU_SIZE offset,
+    uint32_t count,
+    uint32_t stride)
+{
+    glv_trace_packet_header* pHeader;
+    struct_xglCmdDrawIndexedIndirect* pPacket = NULL;
+    CREATE_TRACE_PACKET(xglCmdDrawIndexedIndirect, 0);
+    real_xglCmdDrawIndexedIndirect(cmdBuffer, buffer, offset, count, stride);
+    pPacket = interpret_body_as_xglCmdDrawIndexedIndirect(pHeader);
+    pPacket->cmdBuffer = cmdBuffer;
+    pPacket->buffer = buffer;
+    pPacket->offset = offset;
+    pPacket->count = count;
+    pPacket->stride = stride;
+    FINISH_TRACE_PACKET();
+}
+
+GLVTRACER_EXPORT void XGLAPI __HOOKED_xglCmdDispatch(
+    XGL_CMD_BUFFER cmdBuffer,
+    uint32_t x,
+    uint32_t y,
+    uint32_t z)
+{
+    glv_trace_packet_header* pHeader;
+    struct_xglCmdDispatch* pPacket = NULL;
+    CREATE_TRACE_PACKET(xglCmdDispatch, 0);
+    real_xglCmdDispatch(cmdBuffer, x, y, z);
+    pPacket = interpret_body_as_xglCmdDispatch(pHeader);
+    pPacket->cmdBuffer = cmdBuffer;
+    pPacket->x = x;
+    pPacket->y = y;
+    pPacket->z = z;
+    FINISH_TRACE_PACKET();
+}
+
+GLVTRACER_EXPORT void XGLAPI __HOOKED_xglCmdDispatchIndirect(
+    XGL_CMD_BUFFER cmdBuffer,
+    XGL_BUFFER buffer,
+    XGL_GPU_SIZE offset)
+{
+    glv_trace_packet_header* pHeader;
+    struct_xglCmdDispatchIndirect* pPacket = NULL;
+    CREATE_TRACE_PACKET(xglCmdDispatchIndirect, 0);
+    real_xglCmdDispatchIndirect(cmdBuffer, buffer, offset);
+    pPacket = interpret_body_as_xglCmdDispatchIndirect(pHeader);
+    pPacket->cmdBuffer = cmdBuffer;
+    pPacket->buffer = buffer;
+    pPacket->offset = offset;
+    FINISH_TRACE_PACKET();
+}
+
+GLVTRACER_EXPORT void XGLAPI __HOOKED_xglCmdCopyBuffer(
+    XGL_CMD_BUFFER cmdBuffer,
+    XGL_BUFFER srcBuffer,
+    XGL_BUFFER destBuffer,
+    uint32_t regionCount,
+    const XGL_BUFFER_COPY* pRegions)
+{
+    glv_trace_packet_header* pHeader;
+    struct_xglCmdCopyBuffer* pPacket = NULL;
+    CREATE_TRACE_PACKET(xglCmdCopyBuffer, regionCount*sizeof(XGL_BUFFER_COPY));
+    real_xglCmdCopyBuffer(cmdBuffer, srcBuffer, destBuffer, regionCount, pRegions);
+    pPacket = interpret_body_as_xglCmdCopyBuffer(pHeader);
+    pPacket->cmdBuffer = cmdBuffer;
+    pPacket->srcBuffer = srcBuffer;
+    pPacket->destBuffer = destBuffer;
+    pPacket->regionCount = regionCount;
+    glv_add_buffer_to_trace_packet(pHeader, (void**)&(pPacket->pRegions), regionCount*sizeof(XGL_BUFFER_COPY), pRegions);
+    glv_finalize_buffer_address(pHeader, (void**)&(pPacket->pRegions));
+    FINISH_TRACE_PACKET();
+}
+
+GLVTRACER_EXPORT void XGLAPI __HOOKED_xglCmdCopyImage(
+    XGL_CMD_BUFFER cmdBuffer,
+    XGL_IMAGE srcImage,
+    XGL_IMAGE destImage,
+    uint32_t regionCount,
+    const XGL_IMAGE_COPY* pRegions)
+{
+    glv_trace_packet_header* pHeader;
+    struct_xglCmdCopyImage* pPacket = NULL;
+    CREATE_TRACE_PACKET(xglCmdCopyImage, regionCount*sizeof(XGL_IMAGE_COPY));
+    real_xglCmdCopyImage(cmdBuffer, srcImage, destImage, regionCount, pRegions);
+    pPacket = interpret_body_as_xglCmdCopyImage(pHeader);
+    pPacket->cmdBuffer = cmdBuffer;
+    pPacket->srcImage = srcImage;
+    pPacket->destImage = destImage;
+    pPacket->regionCount = regionCount;
+    glv_add_buffer_to_trace_packet(pHeader, (void**)&(pPacket->pRegions), regionCount*sizeof(XGL_IMAGE_COPY), pRegions);
+    glv_finalize_buffer_address(pHeader, (void**)&(pPacket->pRegions));
+    FINISH_TRACE_PACKET();
+}
+
+GLVTRACER_EXPORT void XGLAPI __HOOKED_xglCmdCopyBufferToImage(
+    XGL_CMD_BUFFER cmdBuffer,
+    XGL_BUFFER srcBuffer,
+    XGL_IMAGE destImage,
+    uint32_t regionCount,
+    const XGL_BUFFER_IMAGE_COPY* pRegions)
+{
+    glv_trace_packet_header* pHeader;
+    struct_xglCmdCopyBufferToImage* pPacket = NULL;
+    CREATE_TRACE_PACKET(xglCmdCopyBufferToImage, regionCount*sizeof(XGL_BUFFER_IMAGE_COPY));
+    real_xglCmdCopyBufferToImage(cmdBuffer, srcBuffer, destImage, regionCount, pRegions);
+    pPacket = interpret_body_as_xglCmdCopyBufferToImage(pHeader);
+    pPacket->cmdBuffer = cmdBuffer;
+    pPacket->srcBuffer = srcBuffer;
+    pPacket->destImage = destImage;
+    pPacket->regionCount = regionCount;
+    glv_add_buffer_to_trace_packet(pHeader, (void**)&(pPacket->pRegions), regionCount*sizeof(XGL_BUFFER_IMAGE_COPY), pRegions);
+    glv_finalize_buffer_address(pHeader, (void**)&(pPacket->pRegions));
+    FINISH_TRACE_PACKET();
+}
+
+GLVTRACER_EXPORT void XGLAPI __HOOKED_xglCmdCopyImageToBuffer(
+    XGL_CMD_BUFFER cmdBuffer,
+    XGL_IMAGE srcImage,
+    XGL_BUFFER destBuffer,
+    uint32_t regionCount,
+    const XGL_BUFFER_IMAGE_COPY* pRegions)
+{
+    glv_trace_packet_header* pHeader;
+    struct_xglCmdCopyImageToBuffer* pPacket = NULL;
+    CREATE_TRACE_PACKET(xglCmdCopyImageToBuffer, regionCount*sizeof(XGL_BUFFER_IMAGE_COPY));
+    real_xglCmdCopyImageToBuffer(cmdBuffer, srcImage, destBuffer, regionCount, pRegions);
+    pPacket = interpret_body_as_xglCmdCopyImageToBuffer(pHeader);
+    pPacket->cmdBuffer = cmdBuffer;
+    pPacket->srcImage = srcImage;
+    pPacket->destBuffer = destBuffer;
+    pPacket->regionCount = regionCount;
+    glv_add_buffer_to_trace_packet(pHeader, (void**)&(pPacket->pRegions), regionCount*sizeof(XGL_BUFFER_IMAGE_COPY), pRegions);
+    glv_finalize_buffer_address(pHeader, (void**)&(pPacket->pRegions));
+    FINISH_TRACE_PACKET();
+}
+
+GLVTRACER_EXPORT void XGLAPI __HOOKED_xglCmdCloneImageData(
+    XGL_CMD_BUFFER cmdBuffer,
+    XGL_IMAGE srcImage,
+    XGL_IMAGE_LAYOUT srcImageLayout,
+    XGL_IMAGE destImage,
+    XGL_IMAGE_LAYOUT destImageLayout)
+{
+    glv_trace_packet_header* pHeader;
+    struct_xglCmdCloneImageData* pPacket = NULL;
+    CREATE_TRACE_PACKET(xglCmdCloneImageData, 0);
+    real_xglCmdCloneImageData(cmdBuffer, srcImage, srcImageLayout, destImage, destImageLayout);
+    pPacket = interpret_body_as_xglCmdCloneImageData(pHeader);
+    pPacket->cmdBuffer = cmdBuffer;
+    pPacket->srcImage = srcImage;
+    pPacket->srcImageLayout = srcImageLayout;
+    pPacket->destImage = destImage;
+    pPacket->destImageLayout = destImageLayout;
+    FINISH_TRACE_PACKET();
+}
+
+GLVTRACER_EXPORT void XGLAPI __HOOKED_xglCmdUpdateBuffer(
+    XGL_CMD_BUFFER cmdBuffer,
+    XGL_BUFFER destBuffer,
+    XGL_GPU_SIZE destOffset,
+    XGL_GPU_SIZE dataSize,
+    const uint32_t* pData)
+{
+    glv_trace_packet_header* pHeader;
+    struct_xglCmdUpdateBuffer* pPacket = NULL;
+    CREATE_TRACE_PACKET(xglCmdUpdateBuffer, dataSize);
+    real_xglCmdUpdateBuffer(cmdBuffer, destBuffer, destOffset, dataSize, pData);
+    pPacket = interpret_body_as_xglCmdUpdateBuffer(pHeader);
+    pPacket->cmdBuffer = cmdBuffer;
+    pPacket->destBuffer = destBuffer;
+    pPacket->destOffset = destOffset;
+    pPacket->dataSize = dataSize;
+    glv_add_buffer_to_trace_packet(pHeader, (void**)&(pPacket->pData), dataSize, pData);
+    glv_finalize_buffer_address(pHeader, (void**)&(pPacket->pData));
+    FINISH_TRACE_PACKET();
+}
+
+GLVTRACER_EXPORT void XGLAPI __HOOKED_xglCmdFillBuffer(
+    XGL_CMD_BUFFER cmdBuffer,
+    XGL_BUFFER destBuffer,
+    XGL_GPU_SIZE destOffset,
+    XGL_GPU_SIZE fillSize,
+    uint32_t data)
+{
+    glv_trace_packet_header* pHeader;
+    struct_xglCmdFillBuffer* pPacket = NULL;
+    CREATE_TRACE_PACKET(xglCmdFillBuffer, 0);
+    real_xglCmdFillBuffer(cmdBuffer, destBuffer, destOffset, fillSize, data);
+    pPacket = interpret_body_as_xglCmdFillBuffer(pHeader);
+    pPacket->cmdBuffer = cmdBuffer;
+    pPacket->destBuffer = destBuffer;
+    pPacket->destOffset = destOffset;
+    pPacket->fillSize = fillSize;
+    pPacket->data = data;
+    FINISH_TRACE_PACKET();
+}
+
+GLVTRACER_EXPORT void XGLAPI __HOOKED_xglCmdClearColorImage(
+    XGL_CMD_BUFFER cmdBuffer,
+    XGL_IMAGE image,
+    const float color[4],
+    uint32_t rangeCount,
+    const XGL_IMAGE_SUBRESOURCE_RANGE* pRanges)
+{
+    glv_trace_packet_header* pHeader;
+    struct_xglCmdClearColorImage* pPacket = NULL;
+    CREATE_TRACE_PACKET(xglCmdClearColorImage, rangeCount*sizeof(XGL_IMAGE_SUBRESOURCE_RANGE));
+    real_xglCmdClearColorImage(cmdBuffer, image, color, rangeCount, pRanges);
+    pPacket = interpret_body_as_xglCmdClearColorImage(pHeader);
+    pPacket->cmdBuffer = cmdBuffer;
+    pPacket->image = image;
+    memcpy((void*)pPacket->color, color, 4 * sizeof(float));
+    pPacket->rangeCount = rangeCount;
+    glv_add_buffer_to_trace_packet(pHeader, (void**)&(pPacket->pRanges), rangeCount*sizeof(XGL_IMAGE_SUBRESOURCE_RANGE), pRanges);
+    glv_finalize_buffer_address(pHeader, (void**)&(pPacket->pRanges));
+    FINISH_TRACE_PACKET();
+}
+
+GLVTRACER_EXPORT void XGLAPI __HOOKED_xglCmdClearColorImageRaw(
+    XGL_CMD_BUFFER cmdBuffer,
+    XGL_IMAGE image,
+    const uint32_t color[4],
+    uint32_t rangeCount,
+    const XGL_IMAGE_SUBRESOURCE_RANGE* pRanges)
+{
+    glv_trace_packet_header* pHeader;
+    struct_xglCmdClearColorImageRaw* pPacket = NULL;
+    CREATE_TRACE_PACKET(xglCmdClearColorImageRaw, rangeCount*sizeof(XGL_IMAGE_SUBRESOURCE_RANGE));
+    real_xglCmdClearColorImageRaw(cmdBuffer, image, color, rangeCount, pRanges);
+    pPacket = interpret_body_as_xglCmdClearColorImageRaw(pHeader);
+    pPacket->cmdBuffer = cmdBuffer;
+    pPacket->image = image;
+    memcpy((void*)pPacket->color, color, 4 * sizeof(uint32_t));
+    pPacket->rangeCount = rangeCount;
+    glv_add_buffer_to_trace_packet(pHeader, (void**)&(pPacket->pRanges), rangeCount*sizeof(XGL_IMAGE_SUBRESOURCE_RANGE), pRanges);
+    glv_finalize_buffer_address(pHeader, (void**)&(pPacket->pRanges));
+    FINISH_TRACE_PACKET();
+}
+
+GLVTRACER_EXPORT void XGLAPI __HOOKED_xglCmdClearDepthStencil(
+    XGL_CMD_BUFFER cmdBuffer,
+    XGL_IMAGE image,
+    float depth,
+    uint32_t stencil,
+    uint32_t rangeCount,
+    const XGL_IMAGE_SUBRESOURCE_RANGE* pRanges)
+{
+    glv_trace_packet_header* pHeader;
+    struct_xglCmdClearDepthStencil* pPacket = NULL;
+    CREATE_TRACE_PACKET(xglCmdClearDepthStencil, rangeCount*sizeof(XGL_IMAGE_SUBRESOURCE_RANGE));
+    real_xglCmdClearDepthStencil(cmdBuffer, image, depth, stencil, rangeCount, pRanges);
+    pPacket = interpret_body_as_xglCmdClearDepthStencil(pHeader);
+    pPacket->cmdBuffer = cmdBuffer;
+    pPacket->image = image;
+    pPacket->depth = depth;
+    pPacket->stencil = stencil;
+    pPacket->rangeCount = rangeCount;
+    glv_add_buffer_to_trace_packet(pHeader, (void**)&(pPacket->pRanges), rangeCount*sizeof(XGL_IMAGE_SUBRESOURCE_RANGE), pRanges);
+    glv_finalize_buffer_address(pHeader, (void**)&(pPacket->pRanges));
+    FINISH_TRACE_PACKET();
+}
+
+GLVTRACER_EXPORT void XGLAPI __HOOKED_xglCmdResolveImage(
+    XGL_CMD_BUFFER cmdBuffer,
+    XGL_IMAGE srcImage,
+    XGL_IMAGE destImage,
+    uint32_t rectCount,
+    const XGL_IMAGE_RESOLVE* pRects)
+{
+    glv_trace_packet_header* pHeader;
+    struct_xglCmdResolveImage* pPacket = NULL;
+    CREATE_TRACE_PACKET(xglCmdResolveImage, rectCount*sizeof(XGL_IMAGE_RESOLVE));
+    real_xglCmdResolveImage(cmdBuffer, srcImage, destImage, rectCount, pRects);
+    pPacket = interpret_body_as_xglCmdResolveImage(pHeader);
+    pPacket->cmdBuffer = cmdBuffer;
+    pPacket->srcImage = srcImage;
+    pPacket->destImage = destImage;
+    pPacket->rectCount = rectCount;
+    glv_add_buffer_to_trace_packet(pHeader, (void**)&(pPacket->pRects), rectCount*sizeof(XGL_IMAGE_RESOLVE), pRects);
+    glv_finalize_buffer_address(pHeader, (void**)&(pPacket->pRects));
+    FINISH_TRACE_PACKET();
+}
+
+GLVTRACER_EXPORT void XGLAPI __HOOKED_xglCmdSetEvent(
+    XGL_CMD_BUFFER cmdBuffer,
+    XGL_EVENT event,
+    XGL_SET_EVENT pipeEvent)
+{
+    glv_trace_packet_header* pHeader;
+    struct_xglCmdSetEvent* pPacket = NULL;
+    CREATE_TRACE_PACKET(xglCmdSetEvent, 0);
+    real_xglCmdSetEvent(cmdBuffer, event, pipeEvent);
+    pPacket = interpret_body_as_xglCmdSetEvent(pHeader);
+    pPacket->cmdBuffer = cmdBuffer;
+    pPacket->event = event;
+    pPacket->pipeEvent = pipeEvent;
+    FINISH_TRACE_PACKET();
+}
+
+GLVTRACER_EXPORT void XGLAPI __HOOKED_xglCmdResetEvent(
+    XGL_CMD_BUFFER cmdBuffer,
+    XGL_EVENT event)
+{
+    glv_trace_packet_header* pHeader;
+    struct_xglCmdResetEvent* pPacket = NULL;
+    CREATE_TRACE_PACKET(xglCmdResetEvent, 0);
+    real_xglCmdResetEvent(cmdBuffer, event);
+    pPacket = interpret_body_as_xglCmdResetEvent(pHeader);
+    pPacket->cmdBuffer = cmdBuffer;
+    pPacket->event = event;
+    FINISH_TRACE_PACKET();
+}
+
+GLVTRACER_EXPORT void XGLAPI __HOOKED_xglCmdWaitEvents(
+    XGL_CMD_BUFFER cmdBuffer,
+    const XGL_EVENT_WAIT_INFO* pWaitInfo)
+{
+    glv_trace_packet_header* pHeader;
+    struct_xglCmdWaitEvents* pPacket = NULL;
+    size_t customSize;
+    uint32_t eventCount = (pWaitInfo != NULL && pWaitInfo->pEvents != NULL) ? pWaitInfo->eventCount : 0;
+    uint32_t mbCount = (pWaitInfo != NULL && pWaitInfo->ppMemBarriers != NULL) ? pWaitInfo->memBarrierCount : 0;
+    customSize = (eventCount * sizeof(XGL_EVENT)) + mbCount * sizeof(void*) + calculate_memory_barrier_size(mbCount, pWaitInfo->ppMemBarriers);
+    CREATE_TRACE_PACKET(xglCmdWaitEvents, sizeof(XGL_EVENT_WAIT_INFO) + customSize);
+    real_xglCmdWaitEvents(cmdBuffer, pWaitInfo);
+    pPacket = interpret_body_as_xglCmdWaitEvents(pHeader);
+    pPacket->cmdBuffer = cmdBuffer;
+    glv_add_buffer_to_trace_packet(pHeader, (void**)&(pPacket->pWaitInfo), sizeof(XGL_EVENT_WAIT_INFO), pWaitInfo);
+    glv_add_buffer_to_trace_packet(pHeader, (void**)&(pPacket->pWaitInfo->pEvents), eventCount * sizeof(XGL_EVENT), pWaitInfo->pEvents);
+    glv_finalize_buffer_address(pHeader, (void**)&(pPacket->pWaitInfo->pEvents));
+    glv_add_buffer_to_trace_packet(pHeader, (void**)&(pPacket->pWaitInfo->ppMemBarriers), mbCount * sizeof(void*), pWaitInfo->ppMemBarriers);
+    uint32_t i, siz;
+    for (i = 0; i < mbCount; i++) {
+        XGL_MEMORY_BARRIER *pNext = (XGL_MEMORY_BARRIER *) pWaitInfo->ppMemBarriers[i];
+        switch (pNext->sType) {
+            case XGL_STRUCTURE_TYPE_MEMORY_BARRIER:
+                siz = sizeof(XGL_MEMORY_BARRIER);
+                break;
+            case XGL_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER:
+                siz = sizeof(XGL_BUFFER_MEMORY_BARRIER);
+                break;
+            case XGL_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER:
+                siz = sizeof(XGL_IMAGE_MEMORY_BARRIER);
+                break;
+            default:
+                assert(0);
+                siz = 0;
+                break;
+        }
+        glv_add_buffer_to_trace_packet(pHeader, (void**)&(pPacket->pWaitInfo->ppMemBarriers[i]), siz, pWaitInfo->ppMemBarriers[i]);
+        glv_finalize_buffer_address(pHeader, (void**)&(pPacket->pWaitInfo->ppMemBarriers[i]));
+    }
+    glv_finalize_buffer_address(pHeader, (void**)&(pPacket->pWaitInfo->ppMemBarriers));
+    glv_finalize_buffer_address(pHeader, (void**)&(pPacket->pWaitInfo));
+    FINISH_TRACE_PACKET();
+}
+
+GLVTRACER_EXPORT void XGLAPI __HOOKED_xglCmdPipelineBarrier(
+    XGL_CMD_BUFFER cmdBuffer,
+    const XGL_PIPELINE_BARRIER* pBarrier)
+{
+    glv_trace_packet_header* pHeader;
+    struct_xglCmdPipelineBarrier* pPacket = NULL;
+    size_t customSize;
+    uint32_t eventCount = (pBarrier != NULL && pBarrier->pEvents != NULL) ? pBarrier->eventCount : 0;
+    uint32_t mbCount = (pBarrier != NULL && pBarrier->ppMemBarriers != NULL) ? pBarrier->memBarrierCount : 0;
+    customSize = (eventCount * sizeof(XGL_SET_EVENT)) + mbCount * sizeof(void*) + calculate_memory_barrier_size(mbCount, pBarrier->ppMemBarriers);
+    CREATE_TRACE_PACKET(xglCmdPipelineBarrier, sizeof(XGL_PIPELINE_BARRIER) + customSize);
+    real_xglCmdPipelineBarrier(cmdBuffer, pBarrier);
+    pPacket = interpret_body_as_xglCmdPipelineBarrier(pHeader);
+    pPacket->cmdBuffer = cmdBuffer;
+    glv_add_buffer_to_trace_packet(pHeader, (void**)&(pPacket->pBarrier), sizeof(XGL_PIPELINE_BARRIER), pBarrier);
+    glv_add_buffer_to_trace_packet(pHeader, (void**)&(pPacket->pBarrier->pEvents), eventCount * sizeof(XGL_SET_EVENT), pBarrier->pEvents);
+    glv_finalize_buffer_address(pHeader, (void**)&(pPacket->pBarrier->pEvents));
+    glv_add_buffer_to_trace_packet(pHeader, (void**)&(pPacket->pBarrier->ppMemBarriers), mbCount * sizeof(void*), pBarrier->ppMemBarriers);
+    uint32_t i, siz;
+    for (i = 0; i < mbCount; i++) {
+        XGL_MEMORY_BARRIER *pNext = (XGL_MEMORY_BARRIER *) pBarrier->ppMemBarriers[i];
+        switch (pNext->sType) {
+            case XGL_STRUCTURE_TYPE_MEMORY_BARRIER:
+                siz = sizeof(XGL_MEMORY_BARRIER);
+                break;
+            case XGL_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER:
+                siz = sizeof(XGL_BUFFER_MEMORY_BARRIER);
+                break;
+            case XGL_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER:
+                siz = sizeof(XGL_IMAGE_MEMORY_BARRIER);
+                break;
+            default:
+                assert(0);
+                siz = 0;
+                break;
+        }
+        glv_add_buffer_to_trace_packet(pHeader, (void**)&(pPacket->pBarrier->ppMemBarriers[i]), siz, pBarrier->ppMemBarriers[i]);
+        glv_finalize_buffer_address(pHeader, (void**)&(pPacket->pBarrier->ppMemBarriers[i]));
+    }
+    glv_finalize_buffer_address(pHeader, (void**)&(pPacket->pBarrier->ppMemBarriers));
+    glv_finalize_buffer_address(pHeader, (void**)&(pPacket->pBarrier));
+    FINISH_TRACE_PACKET();
+}
+
+GLVTRACER_EXPORT void XGLAPI __HOOKED_xglCmdBeginQuery(
+    XGL_CMD_BUFFER cmdBuffer,
+    XGL_QUERY_POOL queryPool,
+    uint32_t slot,
+    XGL_FLAGS flags)
+{
+    glv_trace_packet_header* pHeader;
+    struct_xglCmdBeginQuery* pPacket = NULL;
+    CREATE_TRACE_PACKET(xglCmdBeginQuery, 0);
+    real_xglCmdBeginQuery(cmdBuffer, queryPool, slot, flags);
+    pPacket = interpret_body_as_xglCmdBeginQuery(pHeader);
+    pPacket->cmdBuffer = cmdBuffer;
+    pPacket->queryPool = queryPool;
+    pPacket->slot = slot;
+    pPacket->flags = flags;
+    FINISH_TRACE_PACKET();
+}
+
+GLVTRACER_EXPORT void XGLAPI __HOOKED_xglCmdEndQuery(
+    XGL_CMD_BUFFER cmdBuffer,
+    XGL_QUERY_POOL queryPool,
+    uint32_t slot)
+{
+    glv_trace_packet_header* pHeader;
+    struct_xglCmdEndQuery* pPacket = NULL;
+    CREATE_TRACE_PACKET(xglCmdEndQuery, 0);
+    real_xglCmdEndQuery(cmdBuffer, queryPool, slot);
+    pPacket = interpret_body_as_xglCmdEndQuery(pHeader);
+    pPacket->cmdBuffer = cmdBuffer;
+    pPacket->queryPool = queryPool;
+    pPacket->slot = slot;
+    FINISH_TRACE_PACKET();
+}
+
+GLVTRACER_EXPORT void XGLAPI __HOOKED_xglCmdResetQueryPool(
+    XGL_CMD_BUFFER cmdBuffer,
+    XGL_QUERY_POOL queryPool,
+    uint32_t startQuery,
+    uint32_t queryCount)
+{
+    glv_trace_packet_header* pHeader;
+    struct_xglCmdResetQueryPool* pPacket = NULL;
+    CREATE_TRACE_PACKET(xglCmdResetQueryPool, 0);
+    real_xglCmdResetQueryPool(cmdBuffer, queryPool, startQuery, queryCount);
+    pPacket = interpret_body_as_xglCmdResetQueryPool(pHeader);
+    pPacket->cmdBuffer = cmdBuffer;
+    pPacket->queryPool = queryPool;
+    pPacket->startQuery = startQuery;
+    pPacket->queryCount = queryCount;
+    FINISH_TRACE_PACKET();
+}
+
+GLVTRACER_EXPORT void XGLAPI __HOOKED_xglCmdWriteTimestamp(
+    XGL_CMD_BUFFER cmdBuffer,
+    XGL_TIMESTAMP_TYPE timestampType,
+    XGL_BUFFER destBuffer,
+    XGL_GPU_SIZE destOffset)
+{
+    glv_trace_packet_header* pHeader;
+    struct_xglCmdWriteTimestamp* pPacket = NULL;
+    CREATE_TRACE_PACKET(xglCmdWriteTimestamp, 0);
+    real_xglCmdWriteTimestamp(cmdBuffer, timestampType, destBuffer, destOffset);
+    pPacket = interpret_body_as_xglCmdWriteTimestamp(pHeader);
+    pPacket->cmdBuffer = cmdBuffer;
+    pPacket->timestampType = timestampType;
+    pPacket->destBuffer = destBuffer;
+    pPacket->destOffset = destOffset;
+    FINISH_TRACE_PACKET();
+}
+
+GLVTRACER_EXPORT void XGLAPI __HOOKED_xglCmdInitAtomicCounters(
+    XGL_CMD_BUFFER cmdBuffer,
+    XGL_PIPELINE_BIND_POINT pipelineBindPoint,
+    uint32_t startCounter,
+    uint32_t counterCount,
+    const uint32_t* pData)
+{
+    glv_trace_packet_header* pHeader;
+    struct_xglCmdInitAtomicCounters* pPacket = NULL;
+    CREATE_TRACE_PACKET(xglCmdInitAtomicCounters, counterCount*sizeof(uint32_t));
+    real_xglCmdInitAtomicCounters(cmdBuffer, pipelineBindPoint, startCounter, counterCount, pData);
+    pPacket = interpret_body_as_xglCmdInitAtomicCounters(pHeader);
+    pPacket->cmdBuffer = cmdBuffer;
+    pPacket->pipelineBindPoint = pipelineBindPoint;
+    pPacket->startCounter = startCounter;
+    pPacket->counterCount = counterCount;
+    glv_add_buffer_to_trace_packet(pHeader, (void**)&(pPacket->pData), counterCount*sizeof(uint32_t), pData);
+    glv_finalize_buffer_address(pHeader, (void**)&(pPacket->pData));
+    FINISH_TRACE_PACKET();
+}
+
+GLVTRACER_EXPORT void XGLAPI __HOOKED_xglCmdLoadAtomicCounters(
+    XGL_CMD_BUFFER cmdBuffer,
+    XGL_PIPELINE_BIND_POINT pipelineBindPoint,
+    uint32_t startCounter,
+    uint32_t counterCount,
+    XGL_BUFFER srcBuffer,
+    XGL_GPU_SIZE srcOffset)
+{
+    glv_trace_packet_header* pHeader;
+    struct_xglCmdLoadAtomicCounters* pPacket = NULL;
+    CREATE_TRACE_PACKET(xglCmdLoadAtomicCounters, 0);
+    real_xglCmdLoadAtomicCounters(cmdBuffer, pipelineBindPoint, startCounter, counterCount, srcBuffer, srcOffset);
+    pPacket = interpret_body_as_xglCmdLoadAtomicCounters(pHeader);
+    pPacket->cmdBuffer = cmdBuffer;
+    pPacket->pipelineBindPoint = pipelineBindPoint;
+    pPacket->startCounter = startCounter;
+    pPacket->counterCount = counterCount;
+    pPacket->srcBuffer = srcBuffer;
+    pPacket->srcOffset = srcOffset;
+    FINISH_TRACE_PACKET();
+}
+
+GLVTRACER_EXPORT void XGLAPI __HOOKED_xglCmdSaveAtomicCounters(
+    XGL_CMD_BUFFER cmdBuffer,
+    XGL_PIPELINE_BIND_POINT pipelineBindPoint,
+    uint32_t startCounter,
+    uint32_t counterCount,
+    XGL_BUFFER destBuffer,
+    XGL_GPU_SIZE destOffset)
+{
+    glv_trace_packet_header* pHeader;
+    struct_xglCmdSaveAtomicCounters* pPacket = NULL;
+    CREATE_TRACE_PACKET(xglCmdSaveAtomicCounters, 0);
+    real_xglCmdSaveAtomicCounters(cmdBuffer, pipelineBindPoint, startCounter, counterCount, destBuffer, destOffset);
+    pPacket = interpret_body_as_xglCmdSaveAtomicCounters(pHeader);
+    pPacket->cmdBuffer = cmdBuffer;
+    pPacket->pipelineBindPoint = pipelineBindPoint;
+    pPacket->startCounter = startCounter;
+    pPacket->counterCount = counterCount;
+    pPacket->destBuffer = destBuffer;
+    pPacket->destOffset = destOffset;
+    FINISH_TRACE_PACKET();
+}
+
+GLVTRACER_EXPORT XGL_RESULT XGLAPI __HOOKED_xglCreateFramebuffer(
+    XGL_DEVICE device,
+    const XGL_FRAMEBUFFER_CREATE_INFO* pCreateInfo,
+    XGL_FRAMEBUFFER* pFramebuffer)
+{
+    glv_trace_packet_header* pHeader;
+    XGL_RESULT result;
+    struct_xglCreateFramebuffer* pPacket = NULL;
+    int dsSize = (pCreateInfo != NULL && pCreateInfo->pDepthStencilAttachment != NULL) ? sizeof(XGL_DEPTH_STENCIL_BIND_INFO) : 0;
+    uint32_t colorCount = (pCreateInfo != NULL && pCreateInfo->pColorAttachments != NULL) ? pCreateInfo->colorAttachmentCount : 0;
+    CREATE_TRACE_PACKET(xglCreateFramebuffer, get_struct_chain_size((void*)pCreateInfo) + sizeof(XGL_FRAMEBUFFER));
+    result = real_xglCreateFramebuffer(device, pCreateInfo, pFramebuffer);
+    pPacket = interpret_body_as_xglCreateFramebuffer(pHeader);
+    pPacket->device = device;
+    glv_add_buffer_to_trace_packet(pHeader, (void**)&(pPacket->pCreateInfo), sizeof(XGL_FRAMEBUFFER_CREATE_INFO), pCreateInfo);
+    glv_add_buffer_to_trace_packet(pHeader, (void**)&(pPacket->pCreateInfo->pColorAttachments), colorCount * sizeof(XGL_COLOR_ATTACHMENT_BIND_INFO), pCreateInfo->pColorAttachments);
+    glv_add_buffer_to_trace_packet(pHeader, (void**)&(pPacket->pCreateInfo->pDepthStencilAttachment), dsSize, pCreateInfo->pDepthStencilAttachment);
+    glv_add_buffer_to_trace_packet(pHeader, (void**)&(pPacket->pFramebuffer), sizeof(XGL_FRAMEBUFFER), pFramebuffer);
+    pPacket->result = result;
+    glv_finalize_buffer_address(pHeader, (void**)&(pPacket->pCreateInfo->pColorAttachments));
+    glv_finalize_buffer_address(pHeader, (void**)&(pPacket->pCreateInfo->pDepthStencilAttachment));
+    glv_finalize_buffer_address(pHeader, (void**)&(pPacket->pCreateInfo));
+    glv_finalize_buffer_address(pHeader, (void**)&(pPacket->pFramebuffer));
+    FINISH_TRACE_PACKET();
+    return result;
+}
+
+GLVTRACER_EXPORT XGL_RESULT XGLAPI __HOOKED_xglCreateRenderPass(
+    XGL_DEVICE device,
+    const XGL_RENDER_PASS_CREATE_INFO* pCreateInfo,
+    XGL_RENDER_PASS* pRenderPass)
+{
+    glv_trace_packet_header* pHeader;
+    XGL_RESULT result;
+    struct_xglCreateRenderPass* pPacket = NULL;
+    uint32_t colorCount = (pCreateInfo != NULL && (pCreateInfo->pColorLoadOps != NULL || pCreateInfo->pColorStoreOps != NULL || pCreateInfo->pColorLoadClearValues != NULL)) ? pCreateInfo->colorAttachmentCount : 0;
+    CREATE_TRACE_PACKET(xglCreateRenderPass, get_struct_chain_size((void*)pCreateInfo) + sizeof(XGL_RENDER_PASS));
+    result = real_xglCreateRenderPass(device, pCreateInfo, pRenderPass);
+    pPacket = interpret_body_as_xglCreateRenderPass(pHeader);
+    pPacket->device = device;
+    glv_add_buffer_to_trace_packet(pHeader, (void**)&(pPacket->pCreateInfo), sizeof(XGL_RENDER_PASS_CREATE_INFO), pCreateInfo);
+    glv_add_buffer_to_trace_packet(pHeader, (void**)&(pPacket->pCreateInfo->pColorLoadOps), colorCount * sizeof(XGL_ATTACHMENT_LOAD_OP), pCreateInfo->pColorLoadOps);
+    glv_add_buffer_to_trace_packet(pHeader, (void**)&(pPacket->pCreateInfo->pColorStoreOps), colorCount * sizeof(XGL_ATTACHMENT_STORE_OP), pCreateInfo->pColorStoreOps);
+    glv_add_buffer_to_trace_packet(pHeader, (void**)&(pPacket->pCreateInfo->pColorLoadClearValues), colorCount * sizeof(XGL_CLEAR_COLOR), pCreateInfo->pColorLoadClearValues);
+    glv_add_buffer_to_trace_packet(pHeader, (void**)&(pPacket->pRenderPass), sizeof(XGL_RENDER_PASS), pRenderPass);
+    pPacket->result = result;
+    glv_finalize_buffer_address(pHeader, (void**)&(pPacket->pCreateInfo->pColorLoadOps));
+    glv_finalize_buffer_address(pHeader, (void**)&(pPacket->pCreateInfo->pColorStoreOps));
+    glv_finalize_buffer_address(pHeader, (void**)&(pPacket->pCreateInfo->pColorLoadClearValues));
+    glv_finalize_buffer_address(pHeader, (void**)&(pPacket->pCreateInfo));
+    glv_finalize_buffer_address(pHeader, (void**)&(pPacket->pRenderPass));
+    FINISH_TRACE_PACKET();
+    return result;
+}
+
+GLVTRACER_EXPORT void XGLAPI __HOOKED_xglCmdBeginRenderPass(
+    XGL_CMD_BUFFER cmdBuffer,
+    XGL_RENDER_PASS renderPass)
+{
+    glv_trace_packet_header* pHeader;
+    struct_xglCmdBeginRenderPass* pPacket = NULL;
+    CREATE_TRACE_PACKET(xglCmdBeginRenderPass, 0);
+    real_xglCmdBeginRenderPass(cmdBuffer, renderPass);
+    pPacket = interpret_body_as_xglCmdBeginRenderPass(pHeader);
+    pPacket->cmdBuffer = cmdBuffer;
+    pPacket->renderPass = renderPass;
+    FINISH_TRACE_PACKET();
+}
+
+GLVTRACER_EXPORT void XGLAPI __HOOKED_xglCmdEndRenderPass(
+    XGL_CMD_BUFFER cmdBuffer,
+    XGL_RENDER_PASS renderPass)
+{
+    glv_trace_packet_header* pHeader;
+    struct_xglCmdEndRenderPass* pPacket = NULL;
+    CREATE_TRACE_PACKET(xglCmdEndRenderPass, 0);
+    real_xglCmdEndRenderPass(cmdBuffer, renderPass);
+    pPacket = interpret_body_as_xglCmdEndRenderPass(pHeader);
+    pPacket->cmdBuffer = cmdBuffer;
+    pPacket->renderPass = renderPass;
+    FINISH_TRACE_PACKET();
+}
+
diff --git a/tools/glave/src/glv_extensions/glvtrace_xgl/codegen/glvtrace_xgl_xgl.h b/tools/glave/src/glv_extensions/glvtrace_xgl/codegen/glvtrace_xgl_xgl.h
new file mode 100644
index 0000000..6284559
--- /dev/null
+++ b/tools/glave/src/glv_extensions/glvtrace_xgl/codegen/glvtrace_xgl_xgl.h
@@ -0,0 +1,383 @@
+/* THIS FILE IS GENERATED.  DO NOT EDIT. */
+
+/*
+ * XGL
+ *
+ * Copyright (C) 2014 LunarG, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+#include "glvtrace_xgl_xgl_structs.h"
+#include "glvtrace_xgl_packet_id.h"
+
+void AttachHooks();
+void DetachHooks();
+void InitTracer(void);
+
+
+// Pointers to real functions and declarations of hooked functions
+#ifdef WIN32
+extern INIT_ONCE gInitOnce;
+#define __HOOKED_xglCreateInstance hooked_xglCreateInstance
+#define __HOOKED_xglDestroyInstance hooked_xglDestroyInstance
+#define __HOOKED_xglEnumerateGpus hooked_xglEnumerateGpus
+#define __HOOKED_xglGetGpuInfo hooked_xglGetGpuInfo
+#define __HOOKED_xglGetProcAddr hooked_xglGetProcAddr
+#define __HOOKED_xglCreateDevice hooked_xglCreateDevice
+#define __HOOKED_xglDestroyDevice hooked_xglDestroyDevice
+#define __HOOKED_xglGetExtensionSupport hooked_xglGetExtensionSupport
+#define __HOOKED_xglEnumerateLayers hooked_xglEnumerateLayers
+#define __HOOKED_xglGetDeviceQueue hooked_xglGetDeviceQueue
+#define __HOOKED_xglQueueSubmit hooked_xglQueueSubmit
+#define __HOOKED_xglQueueSetGlobalMemReferences hooked_xglQueueSetGlobalMemReferences
+#define __HOOKED_xglQueueWaitIdle hooked_xglQueueWaitIdle
+#define __HOOKED_xglDeviceWaitIdle hooked_xglDeviceWaitIdle
+#define __HOOKED_xglAllocMemory hooked_xglAllocMemory
+#define __HOOKED_xglFreeMemory hooked_xglFreeMemory
+#define __HOOKED_xglSetMemoryPriority hooked_xglSetMemoryPriority
+#define __HOOKED_xglMapMemory hooked_xglMapMemory
+#define __HOOKED_xglUnmapMemory hooked_xglUnmapMemory
+#define __HOOKED_xglPinSystemMemory hooked_xglPinSystemMemory
+#define __HOOKED_xglGetMultiGpuCompatibility hooked_xglGetMultiGpuCompatibility
+#define __HOOKED_xglOpenSharedMemory hooked_xglOpenSharedMemory
+#define __HOOKED_xglOpenSharedQueueSemaphore hooked_xglOpenSharedQueueSemaphore
+#define __HOOKED_xglOpenPeerMemory hooked_xglOpenPeerMemory
+#define __HOOKED_xglOpenPeerImage hooked_xglOpenPeerImage
+#define __HOOKED_xglDestroyObject hooked_xglDestroyObject
+#define __HOOKED_xglGetObjectInfo hooked_xglGetObjectInfo
+#define __HOOKED_xglBindObjectMemory hooked_xglBindObjectMemory
+#define __HOOKED_xglBindObjectMemoryRange hooked_xglBindObjectMemoryRange
+#define __HOOKED_xglBindImageMemoryRange hooked_xglBindImageMemoryRange
+#define __HOOKED_xglCreateFence hooked_xglCreateFence
+#define __HOOKED_xglGetFenceStatus hooked_xglGetFenceStatus
+#define __HOOKED_xglWaitForFences hooked_xglWaitForFences
+#define __HOOKED_xglCreateQueueSemaphore hooked_xglCreateQueueSemaphore
+#define __HOOKED_xglSignalQueueSemaphore hooked_xglSignalQueueSemaphore
+#define __HOOKED_xglWaitQueueSemaphore hooked_xglWaitQueueSemaphore
+#define __HOOKED_xglCreateEvent hooked_xglCreateEvent
+#define __HOOKED_xglGetEventStatus hooked_xglGetEventStatus
+#define __HOOKED_xglSetEvent hooked_xglSetEvent
+#define __HOOKED_xglResetEvent hooked_xglResetEvent
+#define __HOOKED_xglCreateQueryPool hooked_xglCreateQueryPool
+#define __HOOKED_xglGetQueryPoolResults hooked_xglGetQueryPoolResults
+#define __HOOKED_xglGetFormatInfo hooked_xglGetFormatInfo
+#define __HOOKED_xglCreateBuffer hooked_xglCreateBuffer
+#define __HOOKED_xglCreateBufferView hooked_xglCreateBufferView
+#define __HOOKED_xglCreateImage hooked_xglCreateImage
+#define __HOOKED_xglSetFastClearColor hooked_xglSetFastClearColor
+#define __HOOKED_xglSetFastClearDepth hooked_xglSetFastClearDepth
+#define __HOOKED_xglGetImageSubresourceInfo hooked_xglGetImageSubresourceInfo
+#define __HOOKED_xglCreateImageView hooked_xglCreateImageView
+#define __HOOKED_xglCreateColorAttachmentView hooked_xglCreateColorAttachmentView
+#define __HOOKED_xglCreateDepthStencilView hooked_xglCreateDepthStencilView
+#define __HOOKED_xglCreateShader hooked_xglCreateShader
+#define __HOOKED_xglCreateGraphicsPipeline hooked_xglCreateGraphicsPipeline
+#define __HOOKED_xglCreateComputePipeline hooked_xglCreateComputePipeline
+#define __HOOKED_xglStorePipeline hooked_xglStorePipeline
+#define __HOOKED_xglLoadPipeline hooked_xglLoadPipeline
+#define __HOOKED_xglCreatePipelineDelta hooked_xglCreatePipelineDelta
+#define __HOOKED_xglCreateSampler hooked_xglCreateSampler
+#define __HOOKED_xglCreateDescriptorSetLayout hooked_xglCreateDescriptorSetLayout
+#define __HOOKED_xglBeginDescriptorRegionUpdate hooked_xglBeginDescriptorRegionUpdate
+#define __HOOKED_xglEndDescriptorRegionUpdate hooked_xglEndDescriptorRegionUpdate
+#define __HOOKED_xglCreateDescriptorRegion hooked_xglCreateDescriptorRegion
+#define __HOOKED_xglClearDescriptorRegion hooked_xglClearDescriptorRegion
+#define __HOOKED_xglAllocDescriptorSets hooked_xglAllocDescriptorSets
+#define __HOOKED_xglClearDescriptorSets hooked_xglClearDescriptorSets
+#define __HOOKED_xglUpdateDescriptors hooked_xglUpdateDescriptors
+#define __HOOKED_xglCreateDynamicViewportState hooked_xglCreateDynamicViewportState
+#define __HOOKED_xglCreateDynamicRasterState hooked_xglCreateDynamicRasterState
+#define __HOOKED_xglCreateDynamicColorBlendState hooked_xglCreateDynamicColorBlendState
+#define __HOOKED_xglCreateDynamicDepthStencilState hooked_xglCreateDynamicDepthStencilState
+#define __HOOKED_xglCreateCommandBuffer hooked_xglCreateCommandBuffer
+#define __HOOKED_xglBeginCommandBuffer hooked_xglBeginCommandBuffer
+#define __HOOKED_xglEndCommandBuffer hooked_xglEndCommandBuffer
+#define __HOOKED_xglResetCommandBuffer hooked_xglResetCommandBuffer
+#define __HOOKED_xglCmdBindPipeline hooked_xglCmdBindPipeline
+#define __HOOKED_xglCmdBindPipelineDelta hooked_xglCmdBindPipelineDelta
+#define __HOOKED_xglCmdBindDynamicStateObject hooked_xglCmdBindDynamicStateObject
+#define __HOOKED_xglCmdBindDescriptorSet hooked_xglCmdBindDescriptorSet
+#define __HOOKED_xglCmdBindVertexBuffer hooked_xglCmdBindVertexBuffer
+#define __HOOKED_xglCmdBindIndexBuffer hooked_xglCmdBindIndexBuffer
+#define __HOOKED_xglCmdDraw hooked_xglCmdDraw
+#define __HOOKED_xglCmdDrawIndexed hooked_xglCmdDrawIndexed
+#define __HOOKED_xglCmdDrawIndirect hooked_xglCmdDrawIndirect
+#define __HOOKED_xglCmdDrawIndexedIndirect hooked_xglCmdDrawIndexedIndirect
+#define __HOOKED_xglCmdDispatch hooked_xglCmdDispatch
+#define __HOOKED_xglCmdDispatchIndirect hooked_xglCmdDispatchIndirect
+#define __HOOKED_xglCmdCopyBuffer hooked_xglCmdCopyBuffer
+#define __HOOKED_xglCmdCopyImage hooked_xglCmdCopyImage
+#define __HOOKED_xglCmdCopyBufferToImage hooked_xglCmdCopyBufferToImage
+#define __HOOKED_xglCmdCopyImageToBuffer hooked_xglCmdCopyImageToBuffer
+#define __HOOKED_xglCmdCloneImageData hooked_xglCmdCloneImageData
+#define __HOOKED_xglCmdUpdateBuffer hooked_xglCmdUpdateBuffer
+#define __HOOKED_xglCmdFillBuffer hooked_xglCmdFillBuffer
+#define __HOOKED_xglCmdClearColorImage hooked_xglCmdClearColorImage
+#define __HOOKED_xglCmdClearColorImageRaw hooked_xglCmdClearColorImageRaw
+#define __HOOKED_xglCmdClearDepthStencil hooked_xglCmdClearDepthStencil
+#define __HOOKED_xglCmdResolveImage hooked_xglCmdResolveImage
+#define __HOOKED_xglCmdSetEvent hooked_xglCmdSetEvent
+#define __HOOKED_xglCmdResetEvent hooked_xglCmdResetEvent
+#define __HOOKED_xglCmdWaitEvents hooked_xglCmdWaitEvents
+#define __HOOKED_xglCmdPipelineBarrier hooked_xglCmdPipelineBarrier
+#define __HOOKED_xglCmdBeginQuery hooked_xglCmdBeginQuery
+#define __HOOKED_xglCmdEndQuery hooked_xglCmdEndQuery
+#define __HOOKED_xglCmdResetQueryPool hooked_xglCmdResetQueryPool
+#define __HOOKED_xglCmdWriteTimestamp hooked_xglCmdWriteTimestamp
+#define __HOOKED_xglCmdInitAtomicCounters hooked_xglCmdInitAtomicCounters
+#define __HOOKED_xglCmdLoadAtomicCounters hooked_xglCmdLoadAtomicCounters
+#define __HOOKED_xglCmdSaveAtomicCounters hooked_xglCmdSaveAtomicCounters
+#define __HOOKED_xglCreateFramebuffer hooked_xglCreateFramebuffer
+#define __HOOKED_xglCreateRenderPass hooked_xglCreateRenderPass
+#define __HOOKED_xglCmdBeginRenderPass hooked_xglCmdBeginRenderPass
+#define __HOOKED_xglCmdEndRenderPass hooked_xglCmdEndRenderPass
+
+#elif defined(PLATFORM_LINUX)
+extern pthread_once_t gInitOnce;
+#define __HOOKED_xglCreateInstance xglCreateInstance
+#define __HOOKED_xglDestroyInstance xglDestroyInstance
+#define __HOOKED_xglEnumerateGpus xglEnumerateGpus
+#define __HOOKED_xglGetGpuInfo xglGetGpuInfo
+#define __HOOKED_xglGetProcAddr xglGetProcAddr
+#define __HOOKED_xglCreateDevice xglCreateDevice
+#define __HOOKED_xglDestroyDevice xglDestroyDevice
+#define __HOOKED_xglGetExtensionSupport xglGetExtensionSupport
+#define __HOOKED_xglEnumerateLayers xglEnumerateLayers
+#define __HOOKED_xglGetDeviceQueue xglGetDeviceQueue
+#define __HOOKED_xglQueueSubmit xglQueueSubmit
+#define __HOOKED_xglQueueSetGlobalMemReferences xglQueueSetGlobalMemReferences
+#define __HOOKED_xglQueueWaitIdle xglQueueWaitIdle
+#define __HOOKED_xglDeviceWaitIdle xglDeviceWaitIdle
+#define __HOOKED_xglAllocMemory xglAllocMemory
+#define __HOOKED_xglFreeMemory xglFreeMemory
+#define __HOOKED_xglSetMemoryPriority xglSetMemoryPriority
+#define __HOOKED_xglMapMemory xglMapMemory
+#define __HOOKED_xglUnmapMemory xglUnmapMemory
+#define __HOOKED_xglPinSystemMemory xglPinSystemMemory
+#define __HOOKED_xglGetMultiGpuCompatibility xglGetMultiGpuCompatibility
+#define __HOOKED_xglOpenSharedMemory xglOpenSharedMemory
+#define __HOOKED_xglOpenSharedQueueSemaphore xglOpenSharedQueueSemaphore
+#define __HOOKED_xglOpenPeerMemory xglOpenPeerMemory
+#define __HOOKED_xglOpenPeerImage xglOpenPeerImage
+#define __HOOKED_xglDestroyObject xglDestroyObject
+#define __HOOKED_xglGetObjectInfo xglGetObjectInfo
+#define __HOOKED_xglBindObjectMemory xglBindObjectMemory
+#define __HOOKED_xglBindObjectMemoryRange xglBindObjectMemoryRange
+#define __HOOKED_xglBindImageMemoryRange xglBindImageMemoryRange
+#define __HOOKED_xglCreateFence xglCreateFence
+#define __HOOKED_xglGetFenceStatus xglGetFenceStatus
+#define __HOOKED_xglWaitForFences xglWaitForFences
+#define __HOOKED_xglCreateQueueSemaphore xglCreateQueueSemaphore
+#define __HOOKED_xglSignalQueueSemaphore xglSignalQueueSemaphore
+#define __HOOKED_xglWaitQueueSemaphore xglWaitQueueSemaphore
+#define __HOOKED_xglCreateEvent xglCreateEvent
+#define __HOOKED_xglGetEventStatus xglGetEventStatus
+#define __HOOKED_xglSetEvent xglSetEvent
+#define __HOOKED_xglResetEvent xglResetEvent
+#define __HOOKED_xglCreateQueryPool xglCreateQueryPool
+#define __HOOKED_xglGetQueryPoolResults xglGetQueryPoolResults
+#define __HOOKED_xglGetFormatInfo xglGetFormatInfo
+#define __HOOKED_xglCreateBuffer xglCreateBuffer
+#define __HOOKED_xglCreateBufferView xglCreateBufferView
+#define __HOOKED_xglCreateImage xglCreateImage
+#define __HOOKED_xglSetFastClearColor xglSetFastClearColor
+#define __HOOKED_xglSetFastClearDepth xglSetFastClearDepth
+#define __HOOKED_xglGetImageSubresourceInfo xglGetImageSubresourceInfo
+#define __HOOKED_xglCreateImageView xglCreateImageView
+#define __HOOKED_xglCreateColorAttachmentView xglCreateColorAttachmentView
+#define __HOOKED_xglCreateDepthStencilView xglCreateDepthStencilView
+#define __HOOKED_xglCreateShader xglCreateShader
+#define __HOOKED_xglCreateGraphicsPipeline xglCreateGraphicsPipeline
+#define __HOOKED_xglCreateComputePipeline xglCreateComputePipeline
+#define __HOOKED_xglStorePipeline xglStorePipeline
+#define __HOOKED_xglLoadPipeline xglLoadPipeline
+#define __HOOKED_xglCreatePipelineDelta xglCreatePipelineDelta
+#define __HOOKED_xglCreateSampler xglCreateSampler
+#define __HOOKED_xglCreateDescriptorSetLayout xglCreateDescriptorSetLayout
+#define __HOOKED_xglBeginDescriptorRegionUpdate xglBeginDescriptorRegionUpdate
+#define __HOOKED_xglEndDescriptorRegionUpdate xglEndDescriptorRegionUpdate
+#define __HOOKED_xglCreateDescriptorRegion xglCreateDescriptorRegion
+#define __HOOKED_xglClearDescriptorRegion xglClearDescriptorRegion
+#define __HOOKED_xglAllocDescriptorSets xglAllocDescriptorSets
+#define __HOOKED_xglClearDescriptorSets xglClearDescriptorSets
+#define __HOOKED_xglUpdateDescriptors xglUpdateDescriptors
+#define __HOOKED_xglCreateDynamicViewportState xglCreateDynamicViewportState
+#define __HOOKED_xglCreateDynamicRasterState xglCreateDynamicRasterState
+#define __HOOKED_xglCreateDynamicColorBlendState xglCreateDynamicColorBlendState
+#define __HOOKED_xglCreateDynamicDepthStencilState xglCreateDynamicDepthStencilState
+#define __HOOKED_xglCreateCommandBuffer xglCreateCommandBuffer
+#define __HOOKED_xglBeginCommandBuffer xglBeginCommandBuffer
+#define __HOOKED_xglEndCommandBuffer xglEndCommandBuffer
+#define __HOOKED_xglResetCommandBuffer xglResetCommandBuffer
+#define __HOOKED_xglCmdBindPipeline xglCmdBindPipeline
+#define __HOOKED_xglCmdBindPipelineDelta xglCmdBindPipelineDelta
+#define __HOOKED_xglCmdBindDynamicStateObject xglCmdBindDynamicStateObject
+#define __HOOKED_xglCmdBindDescriptorSet xglCmdBindDescriptorSet
+#define __HOOKED_xglCmdBindVertexBuffer xglCmdBindVertexBuffer
+#define __HOOKED_xglCmdBindIndexBuffer xglCmdBindIndexBuffer
+#define __HOOKED_xglCmdDraw xglCmdDraw
+#define __HOOKED_xglCmdDrawIndexed xglCmdDrawIndexed
+#define __HOOKED_xglCmdDrawIndirect xglCmdDrawIndirect
+#define __HOOKED_xglCmdDrawIndexedIndirect xglCmdDrawIndexedIndirect
+#define __HOOKED_xglCmdDispatch xglCmdDispatch
+#define __HOOKED_xglCmdDispatchIndirect xglCmdDispatchIndirect
+#define __HOOKED_xglCmdCopyBuffer xglCmdCopyBuffer
+#define __HOOKED_xglCmdCopyImage xglCmdCopyImage
+#define __HOOKED_xglCmdCopyBufferToImage xglCmdCopyBufferToImage
+#define __HOOKED_xglCmdCopyImageToBuffer xglCmdCopyImageToBuffer
+#define __HOOKED_xglCmdCloneImageData xglCmdCloneImageData
+#define __HOOKED_xglCmdUpdateBuffer xglCmdUpdateBuffer
+#define __HOOKED_xglCmdFillBuffer xglCmdFillBuffer
+#define __HOOKED_xglCmdClearColorImage xglCmdClearColorImage
+#define __HOOKED_xglCmdClearColorImageRaw xglCmdClearColorImageRaw
+#define __HOOKED_xglCmdClearDepthStencil xglCmdClearDepthStencil
+#define __HOOKED_xglCmdResolveImage xglCmdResolveImage
+#define __HOOKED_xglCmdSetEvent xglCmdSetEvent
+#define __HOOKED_xglCmdResetEvent xglCmdResetEvent
+#define __HOOKED_xglCmdWaitEvents xglCmdWaitEvents
+#define __HOOKED_xglCmdPipelineBarrier xglCmdPipelineBarrier
+#define __HOOKED_xglCmdBeginQuery xglCmdBeginQuery
+#define __HOOKED_xglCmdEndQuery xglCmdEndQuery
+#define __HOOKED_xglCmdResetQueryPool xglCmdResetQueryPool
+#define __HOOKED_xglCmdWriteTimestamp xglCmdWriteTimestamp
+#define __HOOKED_xglCmdInitAtomicCounters xglCmdInitAtomicCounters
+#define __HOOKED_xglCmdLoadAtomicCounters xglCmdLoadAtomicCounters
+#define __HOOKED_xglCmdSaveAtomicCounters xglCmdSaveAtomicCounters
+#define __HOOKED_xglCreateFramebuffer xglCreateFramebuffer
+#define __HOOKED_xglCreateRenderPass xglCreateRenderPass
+#define __HOOKED_xglCmdBeginRenderPass xglCmdBeginRenderPass
+#define __HOOKED_xglCmdEndRenderPass xglCmdEndRenderPass
+#endif
+
+// Hooked function prototypes
+
+GLVTRACER_EXPORT XGL_RESULT XGLAPI __HOOKED_xglCreateInstance(const XGL_APPLICATION_INFO* pAppInfo, const XGL_ALLOC_CALLBACKS* pAllocCb, XGL_INSTANCE* pInstance);
+GLVTRACER_EXPORT XGL_RESULT XGLAPI __HOOKED_xglDestroyInstance(XGL_INSTANCE instance);
+GLVTRACER_EXPORT XGL_RESULT XGLAPI __HOOKED_xglEnumerateGpus(XGL_INSTANCE instance, uint32_t maxGpus, uint32_t* pGpuCount, XGL_PHYSICAL_GPU* pGpus);
+GLVTRACER_EXPORT XGL_RESULT XGLAPI __HOOKED_xglGetGpuInfo(XGL_PHYSICAL_GPU gpu, XGL_PHYSICAL_GPU_INFO_TYPE infoType, size_t* pDataSize, void* pData);
+GLVTRACER_EXPORT void* XGLAPI __HOOKED_xglGetProcAddr(XGL_PHYSICAL_GPU gpu, const char* pName);
+GLVTRACER_EXPORT XGL_RESULT XGLAPI __HOOKED_xglCreateDevice(XGL_PHYSICAL_GPU gpu, const XGL_DEVICE_CREATE_INFO* pCreateInfo, XGL_DEVICE* pDevice);
+GLVTRACER_EXPORT XGL_RESULT XGLAPI __HOOKED_xglDestroyDevice(XGL_DEVICE device);
+GLVTRACER_EXPORT XGL_RESULT XGLAPI __HOOKED_xglGetExtensionSupport(XGL_PHYSICAL_GPU gpu, const char* pExtName);
+GLVTRACER_EXPORT XGL_RESULT XGLAPI __HOOKED_xglEnumerateLayers(XGL_PHYSICAL_GPU gpu, size_t maxLayerCount, size_t maxStringSize, size_t* pOutLayerCount, char* const* pOutLayers, void* pReserved);
+GLVTRACER_EXPORT XGL_RESULT XGLAPI __HOOKED_xglGetDeviceQueue(XGL_DEVICE device, XGL_QUEUE_TYPE queueType, uint32_t queueIndex, XGL_QUEUE* pQueue);
+GLVTRACER_EXPORT XGL_RESULT XGLAPI __HOOKED_xglQueueSubmit(XGL_QUEUE queue, uint32_t cmdBufferCount, const XGL_CMD_BUFFER* pCmdBuffers, uint32_t memRefCount, const XGL_MEMORY_REF* pMemRefs, XGL_FENCE fence);
+GLVTRACER_EXPORT XGL_RESULT XGLAPI __HOOKED_xglQueueSetGlobalMemReferences(XGL_QUEUE queue, uint32_t memRefCount, const XGL_MEMORY_REF* pMemRefs);
+GLVTRACER_EXPORT XGL_RESULT XGLAPI __HOOKED_xglQueueWaitIdle(XGL_QUEUE queue);
+GLVTRACER_EXPORT XGL_RESULT XGLAPI __HOOKED_xglDeviceWaitIdle(XGL_DEVICE device);
+GLVTRACER_EXPORT XGL_RESULT XGLAPI __HOOKED_xglAllocMemory(XGL_DEVICE device, const XGL_MEMORY_ALLOC_INFO* pAllocInfo, XGL_GPU_MEMORY* pMem);
+GLVTRACER_EXPORT XGL_RESULT XGLAPI __HOOKED_xglFreeMemory(XGL_GPU_MEMORY mem);
+GLVTRACER_EXPORT XGL_RESULT XGLAPI __HOOKED_xglSetMemoryPriority(XGL_GPU_MEMORY mem, XGL_MEMORY_PRIORITY priority);
+GLVTRACER_EXPORT XGL_RESULT XGLAPI __HOOKED_xglMapMemory(XGL_GPU_MEMORY mem, XGL_FLAGS flags, void** ppData);
+GLVTRACER_EXPORT XGL_RESULT XGLAPI __HOOKED_xglUnmapMemory(XGL_GPU_MEMORY mem);
+GLVTRACER_EXPORT XGL_RESULT XGLAPI __HOOKED_xglPinSystemMemory(XGL_DEVICE device, const void* pSysMem, size_t memSize, XGL_GPU_MEMORY* pMem);
+GLVTRACER_EXPORT XGL_RESULT XGLAPI __HOOKED_xglGetMultiGpuCompatibility(XGL_PHYSICAL_GPU gpu0, XGL_PHYSICAL_GPU gpu1, XGL_GPU_COMPATIBILITY_INFO* pInfo);
+GLVTRACER_EXPORT XGL_RESULT XGLAPI __HOOKED_xglOpenSharedMemory(XGL_DEVICE device, const XGL_MEMORY_OPEN_INFO* pOpenInfo, XGL_GPU_MEMORY* pMem);
+GLVTRACER_EXPORT XGL_RESULT XGLAPI __HOOKED_xglOpenSharedQueueSemaphore(XGL_DEVICE device, const XGL_QUEUE_SEMAPHORE_OPEN_INFO* pOpenInfo, XGL_QUEUE_SEMAPHORE* pSemaphore);
+GLVTRACER_EXPORT XGL_RESULT XGLAPI __HOOKED_xglOpenPeerMemory(XGL_DEVICE device, const XGL_PEER_MEMORY_OPEN_INFO* pOpenInfo, XGL_GPU_MEMORY* pMem);
+GLVTRACER_EXPORT XGL_RESULT XGLAPI __HOOKED_xglOpenPeerImage(XGL_DEVICE device, const XGL_PEER_IMAGE_OPEN_INFO* pOpenInfo, XGL_IMAGE* pImage, XGL_GPU_MEMORY* pMem);
+GLVTRACER_EXPORT XGL_RESULT XGLAPI __HOOKED_xglDestroyObject(XGL_OBJECT object);
+GLVTRACER_EXPORT XGL_RESULT XGLAPI __HOOKED_xglGetObjectInfo(XGL_BASE_OBJECT object, XGL_OBJECT_INFO_TYPE infoType, size_t* pDataSize, void* pData);
+GLVTRACER_EXPORT XGL_RESULT XGLAPI __HOOKED_xglBindObjectMemory(XGL_OBJECT object, uint32_t allocationIdx, XGL_GPU_MEMORY mem, XGL_GPU_SIZE offset);
+GLVTRACER_EXPORT XGL_RESULT XGLAPI __HOOKED_xglBindObjectMemoryRange(XGL_OBJECT object, uint32_t allocationIdx, XGL_GPU_SIZE rangeOffset, XGL_GPU_SIZE rangeSize, XGL_GPU_MEMORY mem, XGL_GPU_SIZE memOffset);
+GLVTRACER_EXPORT XGL_RESULT XGLAPI __HOOKED_xglBindImageMemoryRange(XGL_IMAGE image, uint32_t allocationIdx, const XGL_IMAGE_MEMORY_BIND_INFO* bindInfo, XGL_GPU_MEMORY mem, XGL_GPU_SIZE memOffset);
+GLVTRACER_EXPORT XGL_RESULT XGLAPI __HOOKED_xglCreateFence(XGL_DEVICE device, const XGL_FENCE_CREATE_INFO* pCreateInfo, XGL_FENCE* pFence);
+GLVTRACER_EXPORT XGL_RESULT XGLAPI __HOOKED_xglGetFenceStatus(XGL_FENCE fence);
+GLVTRACER_EXPORT XGL_RESULT XGLAPI __HOOKED_xglWaitForFences(XGL_DEVICE device, uint32_t fenceCount, const XGL_FENCE* pFences, bool32_t waitAll, uint64_t timeout);
+GLVTRACER_EXPORT XGL_RESULT XGLAPI __HOOKED_xglCreateQueueSemaphore(XGL_DEVICE device, const XGL_QUEUE_SEMAPHORE_CREATE_INFO* pCreateInfo, XGL_QUEUE_SEMAPHORE* pSemaphore);
+GLVTRACER_EXPORT XGL_RESULT XGLAPI __HOOKED_xglSignalQueueSemaphore(XGL_QUEUE queue, XGL_QUEUE_SEMAPHORE semaphore);
+GLVTRACER_EXPORT XGL_RESULT XGLAPI __HOOKED_xglWaitQueueSemaphore(XGL_QUEUE queue, XGL_QUEUE_SEMAPHORE semaphore);
+GLVTRACER_EXPORT XGL_RESULT XGLAPI __HOOKED_xglCreateEvent(XGL_DEVICE device, const XGL_EVENT_CREATE_INFO* pCreateInfo, XGL_EVENT* pEvent);
+GLVTRACER_EXPORT XGL_RESULT XGLAPI __HOOKED_xglGetEventStatus(XGL_EVENT event);
+GLVTRACER_EXPORT XGL_RESULT XGLAPI __HOOKED_xglSetEvent(XGL_EVENT event);
+GLVTRACER_EXPORT XGL_RESULT XGLAPI __HOOKED_xglResetEvent(XGL_EVENT event);
+GLVTRACER_EXPORT XGL_RESULT XGLAPI __HOOKED_xglCreateQueryPool(XGL_DEVICE device, const XGL_QUERY_POOL_CREATE_INFO* pCreateInfo, XGL_QUERY_POOL* pQueryPool);
+GLVTRACER_EXPORT XGL_RESULT XGLAPI __HOOKED_xglGetQueryPoolResults(XGL_QUERY_POOL queryPool, uint32_t startQuery, uint32_t queryCount, size_t* pDataSize, void* pData);
+GLVTRACER_EXPORT XGL_RESULT XGLAPI __HOOKED_xglGetFormatInfo(XGL_DEVICE device, XGL_FORMAT format, XGL_FORMAT_INFO_TYPE infoType, size_t* pDataSize, void* pData);
+GLVTRACER_EXPORT XGL_RESULT XGLAPI __HOOKED_xglCreateBuffer(XGL_DEVICE device, const XGL_BUFFER_CREATE_INFO* pCreateInfo, XGL_BUFFER* pBuffer);
+GLVTRACER_EXPORT XGL_RESULT XGLAPI __HOOKED_xglCreateBufferView(XGL_DEVICE device, const XGL_BUFFER_VIEW_CREATE_INFO* pCreateInfo, XGL_BUFFER_VIEW* pView);
+GLVTRACER_EXPORT XGL_RESULT XGLAPI __HOOKED_xglCreateImage(XGL_DEVICE device, const XGL_IMAGE_CREATE_INFO* pCreateInfo, XGL_IMAGE* pImage);
+GLVTRACER_EXPORT XGL_RESULT XGLAPI __HOOKED_xglSetFastClearColor(XGL_IMAGE image, const float color[4]);
+GLVTRACER_EXPORT XGL_RESULT XGLAPI __HOOKED_xglSetFastClearDepth(XGL_IMAGE image, float depth);
+GLVTRACER_EXPORT XGL_RESULT XGLAPI __HOOKED_xglGetImageSubresourceInfo(XGL_IMAGE image, const XGL_IMAGE_SUBRESOURCE* pSubresource, XGL_SUBRESOURCE_INFO_TYPE infoType, size_t* pDataSize, void* pData);
+GLVTRACER_EXPORT XGL_RESULT XGLAPI __HOOKED_xglCreateImageView(XGL_DEVICE device, const XGL_IMAGE_VIEW_CREATE_INFO* pCreateInfo, XGL_IMAGE_VIEW* pView);
+GLVTRACER_EXPORT XGL_RESULT XGLAPI __HOOKED_xglCreateColorAttachmentView(XGL_DEVICE device, const XGL_COLOR_ATTACHMENT_VIEW_CREATE_INFO* pCreateInfo, XGL_COLOR_ATTACHMENT_VIEW* pView);
+GLVTRACER_EXPORT XGL_RESULT XGLAPI __HOOKED_xglCreateDepthStencilView(XGL_DEVICE device, const XGL_DEPTH_STENCIL_VIEW_CREATE_INFO* pCreateInfo, XGL_DEPTH_STENCIL_VIEW* pView);
+GLVTRACER_EXPORT XGL_RESULT XGLAPI __HOOKED_xglCreateShader(XGL_DEVICE device, const XGL_SHADER_CREATE_INFO* pCreateInfo, XGL_SHADER* pShader);
+GLVTRACER_EXPORT XGL_RESULT XGLAPI __HOOKED_xglCreateGraphicsPipeline(XGL_DEVICE device, const XGL_GRAPHICS_PIPELINE_CREATE_INFO* pCreateInfo, XGL_PIPELINE* pPipeline);
+GLVTRACER_EXPORT XGL_RESULT XGLAPI __HOOKED_xglCreateComputePipeline(XGL_DEVICE device, const XGL_COMPUTE_PIPELINE_CREATE_INFO* pCreateInfo, XGL_PIPELINE* pPipeline);
+GLVTRACER_EXPORT XGL_RESULT XGLAPI __HOOKED_xglStorePipeline(XGL_PIPELINE pipeline, size_t* pDataSize, void* pData);
+GLVTRACER_EXPORT XGL_RESULT XGLAPI __HOOKED_xglLoadPipeline(XGL_DEVICE device, size_t dataSize, const void* pData, XGL_PIPELINE* pPipeline);
+GLVTRACER_EXPORT XGL_RESULT XGLAPI __HOOKED_xglCreatePipelineDelta(XGL_DEVICE device, XGL_PIPELINE p1, XGL_PIPELINE p2, XGL_PIPELINE_DELTA* delta);
+GLVTRACER_EXPORT XGL_RESULT XGLAPI __HOOKED_xglCreateSampler(XGL_DEVICE device, const XGL_SAMPLER_CREATE_INFO* pCreateInfo, XGL_SAMPLER* pSampler);
+GLVTRACER_EXPORT XGL_RESULT XGLAPI __HOOKED_xglCreateDescriptorSetLayout(XGL_DEVICE device, XGL_FLAGS stageFlags, const uint32_t* pSetBindPoints, XGL_DESCRIPTOR_SET_LAYOUT priorSetLayout, const XGL_DESCRIPTOR_SET_LAYOUT_CREATE_INFO* pSetLayoutInfoList, XGL_DESCRIPTOR_SET_LAYOUT* pSetLayout);
+GLVTRACER_EXPORT XGL_RESULT XGLAPI __HOOKED_xglBeginDescriptorRegionUpdate(XGL_DEVICE device, XGL_DESCRIPTOR_UPDATE_MODE updateMode);
+GLVTRACER_EXPORT XGL_RESULT XGLAPI __HOOKED_xglEndDescriptorRegionUpdate(XGL_DEVICE device, XGL_CMD_BUFFER cmd);
+GLVTRACER_EXPORT XGL_RESULT XGLAPI __HOOKED_xglCreateDescriptorRegion(XGL_DEVICE device, XGL_DESCRIPTOR_REGION_USAGE regionUsage, uint32_t maxSets, const XGL_DESCRIPTOR_REGION_CREATE_INFO* pCreateInfo, XGL_DESCRIPTOR_REGION* pDescriptorRegion);
+GLVTRACER_EXPORT XGL_RESULT XGLAPI __HOOKED_xglClearDescriptorRegion(XGL_DESCRIPTOR_REGION descriptorRegion);
+GLVTRACER_EXPORT XGL_RESULT XGLAPI __HOOKED_xglAllocDescriptorSets(XGL_DESCRIPTOR_REGION descriptorRegion, XGL_DESCRIPTOR_SET_USAGE setUsage, uint32_t count, const XGL_DESCRIPTOR_SET_LAYOUT* pSetLayouts, XGL_DESCRIPTOR_SET* pDescriptorSets, uint32_t* pCount);
+GLVTRACER_EXPORT void XGLAPI __HOOKED_xglClearDescriptorSets(XGL_DESCRIPTOR_REGION descriptorRegion, uint32_t count, const XGL_DESCRIPTOR_SET* pDescriptorSets);
+GLVTRACER_EXPORT void XGLAPI __HOOKED_xglUpdateDescriptors(XGL_DESCRIPTOR_SET descriptorSet, const void* pUpdateChain);
+GLVTRACER_EXPORT XGL_RESULT XGLAPI __HOOKED_xglCreateDynamicViewportState(XGL_DEVICE device, const XGL_DYNAMIC_VP_STATE_CREATE_INFO* pCreateInfo, XGL_DYNAMIC_VP_STATE_OBJECT* pState);
+GLVTRACER_EXPORT XGL_RESULT XGLAPI __HOOKED_xglCreateDynamicRasterState(XGL_DEVICE device, const XGL_DYNAMIC_RS_STATE_CREATE_INFO* pCreateInfo, XGL_DYNAMIC_RS_STATE_OBJECT* pState);
+GLVTRACER_EXPORT XGL_RESULT XGLAPI __HOOKED_xglCreateDynamicColorBlendState(XGL_DEVICE device, const XGL_DYNAMIC_CB_STATE_CREATE_INFO* pCreateInfo, XGL_DYNAMIC_CB_STATE_OBJECT* pState);
+GLVTRACER_EXPORT XGL_RESULT XGLAPI __HOOKED_xglCreateDynamicDepthStencilState(XGL_DEVICE device, const XGL_DYNAMIC_DS_STATE_CREATE_INFO* pCreateInfo, XGL_DYNAMIC_DS_STATE_OBJECT* pState);
+GLVTRACER_EXPORT XGL_RESULT XGLAPI __HOOKED_xglCreateCommandBuffer(XGL_DEVICE device, const XGL_CMD_BUFFER_CREATE_INFO* pCreateInfo, XGL_CMD_BUFFER* pCmdBuffer);
+GLVTRACER_EXPORT XGL_RESULT XGLAPI __HOOKED_xglBeginCommandBuffer(XGL_CMD_BUFFER cmdBuffer, const XGL_CMD_BUFFER_BEGIN_INFO* pBeginInfo);
+GLVTRACER_EXPORT XGL_RESULT XGLAPI __HOOKED_xglEndCommandBuffer(XGL_CMD_BUFFER cmdBuffer);
+GLVTRACER_EXPORT XGL_RESULT XGLAPI __HOOKED_xglResetCommandBuffer(XGL_CMD_BUFFER cmdBuffer);
+GLVTRACER_EXPORT void XGLAPI __HOOKED_xglCmdBindPipeline(XGL_CMD_BUFFER cmdBuffer, XGL_PIPELINE_BIND_POINT pipelineBindPoint, XGL_PIPELINE pipeline);
+GLVTRACER_EXPORT void XGLAPI __HOOKED_xglCmdBindPipelineDelta(XGL_CMD_BUFFER cmdBuffer, XGL_PIPELINE_BIND_POINT pipelineBindPoint, XGL_PIPELINE_DELTA delta);
+GLVTRACER_EXPORT void XGLAPI __HOOKED_xglCmdBindDynamicStateObject(XGL_CMD_BUFFER cmdBuffer, XGL_STATE_BIND_POINT stateBindPoint, XGL_DYNAMIC_STATE_OBJECT state);
+GLVTRACER_EXPORT void XGLAPI __HOOKED_xglCmdBindDescriptorSet(XGL_CMD_BUFFER cmdBuffer, XGL_PIPELINE_BIND_POINT pipelineBindPoint, XGL_DESCRIPTOR_SET descriptorSet, const uint32_t* pUserData);
+GLVTRACER_EXPORT void XGLAPI __HOOKED_xglCmdBindVertexBuffer(XGL_CMD_BUFFER cmdBuffer, XGL_BUFFER buffer, XGL_GPU_SIZE offset, uint32_t binding);
+GLVTRACER_EXPORT void XGLAPI __HOOKED_xglCmdBindIndexBuffer(XGL_CMD_BUFFER cmdBuffer, XGL_BUFFER buffer, XGL_GPU_SIZE offset, XGL_INDEX_TYPE indexType);
+GLVTRACER_EXPORT void XGLAPI __HOOKED_xglCmdDraw(XGL_CMD_BUFFER cmdBuffer, uint32_t firstVertex, uint32_t vertexCount, uint32_t firstInstance, uint32_t instanceCount);
+GLVTRACER_EXPORT void XGLAPI __HOOKED_xglCmdDrawIndexed(XGL_CMD_BUFFER cmdBuffer, uint32_t firstIndex, uint32_t indexCount, int32_t vertexOffset, uint32_t firstInstance, uint32_t instanceCount);
+GLVTRACER_EXPORT void XGLAPI __HOOKED_xglCmdDrawIndirect(XGL_CMD_BUFFER cmdBuffer, XGL_BUFFER buffer, XGL_GPU_SIZE offset, uint32_t count, uint32_t stride);
+GLVTRACER_EXPORT void XGLAPI __HOOKED_xglCmdDrawIndexedIndirect(XGL_CMD_BUFFER cmdBuffer, XGL_BUFFER buffer, XGL_GPU_SIZE offset, uint32_t count, uint32_t stride);
+GLVTRACER_EXPORT void XGLAPI __HOOKED_xglCmdDispatch(XGL_CMD_BUFFER cmdBuffer, uint32_t x, uint32_t y, uint32_t z);
+GLVTRACER_EXPORT void XGLAPI __HOOKED_xglCmdDispatchIndirect(XGL_CMD_BUFFER cmdBuffer, XGL_BUFFER buffer, XGL_GPU_SIZE offset);
+GLVTRACER_EXPORT void XGLAPI __HOOKED_xglCmdCopyBuffer(XGL_CMD_BUFFER cmdBuffer, XGL_BUFFER srcBuffer, XGL_BUFFER destBuffer, uint32_t regionCount, const XGL_BUFFER_COPY* pRegions);
+GLVTRACER_EXPORT void XGLAPI __HOOKED_xglCmdCopyImage(XGL_CMD_BUFFER cmdBuffer, XGL_IMAGE srcImage, XGL_IMAGE destImage, uint32_t regionCount, const XGL_IMAGE_COPY* pRegions);
+GLVTRACER_EXPORT void XGLAPI __HOOKED_xglCmdCopyBufferToImage(XGL_CMD_BUFFER cmdBuffer, XGL_BUFFER srcBuffer, XGL_IMAGE destImage, uint32_t regionCount, const XGL_BUFFER_IMAGE_COPY* pRegions);
+GLVTRACER_EXPORT void XGLAPI __HOOKED_xglCmdCopyImageToBuffer(XGL_CMD_BUFFER cmdBuffer, XGL_IMAGE srcImage, XGL_BUFFER destBuffer, uint32_t regionCount, const XGL_BUFFER_IMAGE_COPY* pRegions);
+GLVTRACER_EXPORT void XGLAPI __HOOKED_xglCmdCloneImageData(XGL_CMD_BUFFER cmdBuffer, XGL_IMAGE srcImage, XGL_IMAGE_LAYOUT srcImageLayout, XGL_IMAGE destImage, XGL_IMAGE_LAYOUT destImageLayout);
+GLVTRACER_EXPORT void XGLAPI __HOOKED_xglCmdUpdateBuffer(XGL_CMD_BUFFER cmdBuffer, XGL_BUFFER destBuffer, XGL_GPU_SIZE destOffset, XGL_GPU_SIZE dataSize, const uint32_t* pData);
+GLVTRACER_EXPORT void XGLAPI __HOOKED_xglCmdFillBuffer(XGL_CMD_BUFFER cmdBuffer, XGL_BUFFER destBuffer, XGL_GPU_SIZE destOffset, XGL_GPU_SIZE fillSize, uint32_t data);
+GLVTRACER_EXPORT void XGLAPI __HOOKED_xglCmdClearColorImage(XGL_CMD_BUFFER cmdBuffer, XGL_IMAGE image, const float color[4], uint32_t rangeCount, const XGL_IMAGE_SUBRESOURCE_RANGE* pRanges);
+GLVTRACER_EXPORT void XGLAPI __HOOKED_xglCmdClearColorImageRaw(XGL_CMD_BUFFER cmdBuffer, XGL_IMAGE image, const uint32_t color[4], uint32_t rangeCount, const XGL_IMAGE_SUBRESOURCE_RANGE* pRanges);
+GLVTRACER_EXPORT void XGLAPI __HOOKED_xglCmdClearDepthStencil(XGL_CMD_BUFFER cmdBuffer, XGL_IMAGE image, float depth, uint32_t stencil, uint32_t rangeCount, const XGL_IMAGE_SUBRESOURCE_RANGE* pRanges);
+GLVTRACER_EXPORT void XGLAPI __HOOKED_xglCmdResolveImage(XGL_CMD_BUFFER cmdBuffer, XGL_IMAGE srcImage, XGL_IMAGE destImage, uint32_t rectCount, const XGL_IMAGE_RESOLVE* pRects);
+GLVTRACER_EXPORT void XGLAPI __HOOKED_xglCmdSetEvent(XGL_CMD_BUFFER cmdBuffer, XGL_EVENT event, XGL_SET_EVENT pipeEvent);
+GLVTRACER_EXPORT void XGLAPI __HOOKED_xglCmdResetEvent(XGL_CMD_BUFFER cmdBuffer, XGL_EVENT event);
+GLVTRACER_EXPORT void XGLAPI __HOOKED_xglCmdWaitEvents(XGL_CMD_BUFFER cmdBuffer, const XGL_EVENT_WAIT_INFO* pWaitInfo);
+GLVTRACER_EXPORT void XGLAPI __HOOKED_xglCmdPipelineBarrier(XGL_CMD_BUFFER cmdBuffer, const XGL_PIPELINE_BARRIER* pBarrier);
+GLVTRACER_EXPORT void XGLAPI __HOOKED_xglCmdBeginQuery(XGL_CMD_BUFFER cmdBuffer, XGL_QUERY_POOL queryPool, uint32_t slot, XGL_FLAGS flags);
+GLVTRACER_EXPORT void XGLAPI __HOOKED_xglCmdEndQuery(XGL_CMD_BUFFER cmdBuffer, XGL_QUERY_POOL queryPool, uint32_t slot);
+GLVTRACER_EXPORT void XGLAPI __HOOKED_xglCmdResetQueryPool(XGL_CMD_BUFFER cmdBuffer, XGL_QUERY_POOL queryPool, uint32_t startQuery, uint32_t queryCount);
+GLVTRACER_EXPORT void XGLAPI __HOOKED_xglCmdWriteTimestamp(XGL_CMD_BUFFER cmdBuffer, XGL_TIMESTAMP_TYPE timestampType, XGL_BUFFER destBuffer, XGL_GPU_SIZE destOffset);
+GLVTRACER_EXPORT void XGLAPI __HOOKED_xglCmdInitAtomicCounters(XGL_CMD_BUFFER cmdBuffer, XGL_PIPELINE_BIND_POINT pipelineBindPoint, uint32_t startCounter, uint32_t counterCount, const uint32_t* pData);
+GLVTRACER_EXPORT void XGLAPI __HOOKED_xglCmdLoadAtomicCounters(XGL_CMD_BUFFER cmdBuffer, XGL_PIPELINE_BIND_POINT pipelineBindPoint, uint32_t startCounter, uint32_t counterCount, XGL_BUFFER srcBuffer, XGL_GPU_SIZE srcOffset);
+GLVTRACER_EXPORT void XGLAPI __HOOKED_xglCmdSaveAtomicCounters(XGL_CMD_BUFFER cmdBuffer, XGL_PIPELINE_BIND_POINT pipelineBindPoint, uint32_t startCounter, uint32_t counterCount, XGL_BUFFER destBuffer, XGL_GPU_SIZE destOffset);
+GLVTRACER_EXPORT XGL_RESULT XGLAPI __HOOKED_xglCreateFramebuffer(XGL_DEVICE device, const XGL_FRAMEBUFFER_CREATE_INFO* pCreateInfo, XGL_FRAMEBUFFER* pFramebuffer);
+GLVTRACER_EXPORT XGL_RESULT XGLAPI __HOOKED_xglCreateRenderPass(XGL_DEVICE device, const XGL_RENDER_PASS_CREATE_INFO* pCreateInfo, XGL_RENDER_PASS* pRenderPass);
+GLVTRACER_EXPORT void XGLAPI __HOOKED_xglCmdBeginRenderPass(XGL_CMD_BUFFER cmdBuffer, XGL_RENDER_PASS renderPass);
+GLVTRACER_EXPORT void XGLAPI __HOOKED_xglCmdEndRenderPass(XGL_CMD_BUFFER cmdBuffer, XGL_RENDER_PASS renderPass);
diff --git a/tools/glave/src/glv_extensions/glvtrace_xgl/codegen/glvtrace_xgl_xgl_structs.h b/tools/glave/src/glv_extensions/glvtrace_xgl/codegen/glvtrace_xgl_xgl_structs.h
new file mode 100644
index 0000000..c61f718
--- /dev/null
+++ b/tools/glave/src/glv_extensions/glvtrace_xgl/codegen/glvtrace_xgl_xgl_structs.h
@@ -0,0 +1,2259 @@
+/* THIS FILE IS GENERATED.  DO NOT EDIT. */
+
+/*
+ * XGL
+ *
+ * Copyright (C) 2014 LunarG, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+#pragma once
+
+#include "xgl.h"
+#include "glv_trace_packet_utils.h"
+
+
+//=============================================================================
+static void add_XGL_APPLICATION_INFO_to_packet(glv_trace_packet_header*  pHeader, XGL_APPLICATION_INFO** ppStruct, const XGL_APPLICATION_INFO *pInStruct)
+{
+    glv_add_buffer_to_trace_packet(pHeader, (void**)ppStruct, sizeof(XGL_APPLICATION_INFO), pInStruct);
+    glv_add_buffer_to_trace_packet(pHeader, (void**)&((*ppStruct)->pAppName), strlen(pInStruct->pAppName) + 1, pInStruct->pAppName);
+    glv_add_buffer_to_trace_packet(pHeader, (void**)&((*ppStruct)->pEngineName), strlen(pInStruct->pEngineName) + 1, pInStruct->pEngineName);
+    glv_finalize_buffer_address(pHeader, (void**)&((*ppStruct)->pAppName));
+    glv_finalize_buffer_address(pHeader, (void**)&((*ppStruct)->pEngineName));
+    glv_finalize_buffer_address(pHeader, (void**)&*ppStruct);
+};
+
+//=============================================================================
+
+static void add_XGL_DEVICE_CREATE_INFO_to_packet(glv_trace_packet_header*  pHeader, XGL_DEVICE_CREATE_INFO** ppStruct, const XGL_DEVICE_CREATE_INFO *pInStruct)
+{
+    uint32_t i;
+    glv_add_buffer_to_trace_packet(pHeader, (void**)ppStruct, sizeof(XGL_DEVICE_CREATE_INFO), pInStruct);
+    glv_add_buffer_to_trace_packet(pHeader, (void**)&(*ppStruct)->pRequestedQueues, pInStruct->queueRecordCount*sizeof(XGL_DEVICE_QUEUE_CREATE_INFO), pInStruct->pRequestedQueues);
+    glv_finalize_buffer_address(pHeader, (void**)&(*ppStruct)->pRequestedQueues);
+    if (pInStruct->extensionCount > 0) 
+    {
+        glv_add_buffer_to_trace_packet(pHeader, (void**)(&(*ppStruct)->ppEnabledExtensionNames), pInStruct->extensionCount * sizeof(char *), pInStruct->ppEnabledExtensionNames);
+        for (i = 0; i < pInStruct->extensionCount; i++)
+        {
+            glv_add_buffer_to_trace_packet(pHeader, (void**)(&((*ppStruct)->ppEnabledExtensionNames[i])), strlen(pInStruct->ppEnabledExtensionNames[i]) + 1, pInStruct->ppEnabledExtensionNames[i]);
+            glv_finalize_buffer_address(pHeader, (void**)(&((*ppStruct)->ppEnabledExtensionNames[i])));
+        }
+        glv_finalize_buffer_address(pHeader, (void **)&(*ppStruct)->ppEnabledExtensionNames);
+    }
+    XGL_LAYER_CREATE_INFO *pNext = ( XGL_LAYER_CREATE_INFO *) pInStruct->pNext;
+    while (pNext != NULL)
+    {
+        if ((pNext->sType == XGL_STRUCTURE_TYPE_LAYER_CREATE_INFO) && pNext->layerCount > 0)
+        {
+            glv_add_buffer_to_trace_packet(pHeader, (void**)(&((*ppStruct)->pNext)), sizeof(XGL_LAYER_CREATE_INFO), pNext);
+            glv_finalize_buffer_address(pHeader, (void**)(&((*ppStruct)->pNext)));
+            XGL_LAYER_CREATE_INFO **ppOutStruct = (XGL_LAYER_CREATE_INFO **) &((*ppStruct)->pNext);
+            glv_add_buffer_to_trace_packet(pHeader, (void**)(&(*ppOutStruct)->ppActiveLayerNames), pNext->layerCount * sizeof(char *), pNext->ppActiveLayerNames);
+            for (i = 0; i < pNext->layerCount; i++)
+            {
+                glv_add_buffer_to_trace_packet(pHeader, (void**)(&((*ppOutStruct)->ppActiveLayerNames[i])), strlen(pNext->ppActiveLayerNames[i]) + 1, pNext->ppActiveLayerNames[i]);
+                glv_finalize_buffer_address(pHeader, (void**)(&((*ppOutStruct)->ppActiveLayerNames[i])));
+            }
+            glv_finalize_buffer_address(pHeader, (void **)&(*ppOutStruct)->ppActiveLayerNames);
+        }
+        pNext = ( XGL_LAYER_CREATE_INFO *) pNext->pNext;
+    }
+    glv_finalize_buffer_address(pHeader, (void**)ppStruct);
+}
+
+static XGL_DEVICE_CREATE_INFO* interpret_XGL_DEVICE_CREATE_INFO(glv_trace_packet_header*  pHeader, intptr_t ptr_variable)
+{
+    XGL_DEVICE_CREATE_INFO* pXGL_DEVICE_CREATE_INFO = (XGL_DEVICE_CREATE_INFO*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)ptr_variable);
+
+    if (pXGL_DEVICE_CREATE_INFO != NULL)
+    {
+            uint32_t i;
+            const char** pNames;
+        pXGL_DEVICE_CREATE_INFO->pRequestedQueues = (const XGL_DEVICE_QUEUE_CREATE_INFO*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pXGL_DEVICE_CREATE_INFO->pRequestedQueues);
+
+        if (pXGL_DEVICE_CREATE_INFO->extensionCount > 0)
+        {
+            pXGL_DEVICE_CREATE_INFO->ppEnabledExtensionNames = (const char *const*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pXGL_DEVICE_CREATE_INFO->ppEnabledExtensionNames);
+            pNames = (const char**)pXGL_DEVICE_CREATE_INFO->ppEnabledExtensionNames;
+            for (i = 0; i < pXGL_DEVICE_CREATE_INFO->extensionCount; i++)
+            {
+                pNames[i] = (const char*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)(pXGL_DEVICE_CREATE_INFO->ppEnabledExtensionNames[i]));
+            }
+        }
+        XGL_LAYER_CREATE_INFO *pNext = ( XGL_LAYER_CREATE_INFO *) glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pXGL_DEVICE_CREATE_INFO->pNext);
+        while (pNext != NULL)
+        {
+            if ((pNext->sType == XGL_STRUCTURE_TYPE_LAYER_CREATE_INFO) && pNext->layerCount > 0)
+            {
+                pNext->ppActiveLayerNames = (const char**) glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)(pNext->ppActiveLayerNames));
+                pNames = (const char**)pNext->ppActiveLayerNames;
+                for (i = 0; i < pNext->layerCount; i++)
+                {
+                    pNames[i] = (const char*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)(pNext->ppActiveLayerNames[i]));
+                }
+            }
+            pNext = ( XGL_LAYER_CREATE_INFO *) glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pNext->pNext);
+        }
+    }
+
+    return pXGL_DEVICE_CREATE_INFO;
+}
+
+static void interpret_pipeline_shader(glv_trace_packet_header*  pHeader, XGL_PIPELINE_SHADER* pShader)
+{
+    if (pShader != NULL)
+    {
+        // constant buffers
+        if (pShader->linkConstBufferCount > 0)
+        {
+            uint32_t i;
+            pShader->pLinkConstBufferInfo = (const XGL_LINK_CONST_BUFFER*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pShader->pLinkConstBufferInfo);
+            for (i = 0; i < pShader->linkConstBufferCount; i++)
+            {
+                XGL_LINK_CONST_BUFFER* pBuffer = (XGL_LINK_CONST_BUFFER*)pShader->pLinkConstBufferInfo;
+                pBuffer[i].pBufferData = (const void*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pShader->pLinkConstBufferInfo[i].pBufferData);
+            }
+        }
+    }
+}
+
+//=============================================================================
+typedef struct struct_xglApiVersion {
+    glv_trace_packet_header* header;
+    uint32_t version;
+} struct_xglApiVersion;
+
+static struct_xglApiVersion* interpret_body_as_xglApiVersion(glv_trace_packet_header* pHeader, BOOL check_version)
+{
+    struct_xglApiVersion* pPacket = (struct_xglApiVersion*)pHeader->pBody;
+    pPacket->header = pHeader;
+    if (check_version && pPacket->version != XGL_API_VERSION)
+        glv_LogError("Trace file from older XGL version 0x%x, xgl replayer built from version 0x%x, replayer may fail\n", pPacket->version, XGL_API_VERSION);
+    return pPacket;
+}
+
+typedef struct struct_xglCreateInstance {
+    glv_trace_packet_header* header;
+    const XGL_APPLICATION_INFO* pAppInfo;
+    const XGL_ALLOC_CALLBACKS* pAllocCb;
+    XGL_INSTANCE* pInstance;
+    XGL_RESULT result;
+} struct_xglCreateInstance;
+
+static struct_xglCreateInstance* interpret_body_as_xglCreateInstance(glv_trace_packet_header* pHeader)
+{
+    struct_xglCreateInstance* pPacket = (struct_xglCreateInstance*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->pAppInfo = (const XGL_APPLICATION_INFO*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pAppInfo);
+    if (pPacket->pAppInfo != NULL)
+    {
+        XGL_APPLICATION_INFO* pInfo = (XGL_APPLICATION_INFO*)pPacket->pAppInfo;
+        pInfo->pAppName = (const char*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pAppInfo->pAppName);
+        pInfo->pEngineName = (const char*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pAppInfo->pEngineName);
+    }
+    pPacket->pAllocCb = (const XGL_ALLOC_CALLBACKS*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pAllocCb);
+    pPacket->pInstance = (XGL_INSTANCE*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pInstance);
+    return pPacket;
+}
+
+typedef struct struct_xglDestroyInstance {
+    glv_trace_packet_header* header;
+    XGL_INSTANCE instance;
+    XGL_RESULT result;
+} struct_xglDestroyInstance;
+
+static struct_xglDestroyInstance* interpret_body_as_xglDestroyInstance(glv_trace_packet_header* pHeader)
+{
+    struct_xglDestroyInstance* pPacket = (struct_xglDestroyInstance*)pHeader->pBody;
+    pPacket->header = pHeader;
+    return pPacket;
+}
+
+typedef struct struct_xglEnumerateGpus {
+    glv_trace_packet_header* header;
+    XGL_INSTANCE instance;
+    uint32_t maxGpus;
+    uint32_t* pGpuCount;
+    XGL_PHYSICAL_GPU* pGpus;
+    XGL_RESULT result;
+} struct_xglEnumerateGpus;
+
+static struct_xglEnumerateGpus* interpret_body_as_xglEnumerateGpus(glv_trace_packet_header* pHeader)
+{
+    struct_xglEnumerateGpus* pPacket = (struct_xglEnumerateGpus*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->pGpuCount = (uint32_t*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pGpuCount);
+    pPacket->pGpus = (XGL_PHYSICAL_GPU*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pGpus);
+    return pPacket;
+}
+
+typedef struct struct_xglGetGpuInfo {
+    glv_trace_packet_header* header;
+    XGL_PHYSICAL_GPU gpu;
+    XGL_PHYSICAL_GPU_INFO_TYPE infoType;
+    size_t* pDataSize;
+    void* pData;
+    XGL_RESULT result;
+} struct_xglGetGpuInfo;
+
+static struct_xglGetGpuInfo* interpret_body_as_xglGetGpuInfo(glv_trace_packet_header* pHeader)
+{
+    struct_xglGetGpuInfo* pPacket = (struct_xglGetGpuInfo*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->pDataSize = (size_t*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pDataSize);
+    pPacket->pData = (void*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pData);
+    return pPacket;
+}
+
+typedef struct struct_xglGetProcAddr {
+    glv_trace_packet_header* header;
+    XGL_PHYSICAL_GPU gpu;
+    const char* pName;
+    void* result;
+} struct_xglGetProcAddr;
+
+static struct_xglGetProcAddr* interpret_body_as_xglGetProcAddr(glv_trace_packet_header* pHeader)
+{
+    struct_xglGetProcAddr* pPacket = (struct_xglGetProcAddr*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->pName = (const char*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pName);
+    return pPacket;
+}
+
+typedef struct struct_xglCreateDevice {
+    glv_trace_packet_header* header;
+    XGL_PHYSICAL_GPU gpu;
+    const XGL_DEVICE_CREATE_INFO* pCreateInfo;
+    XGL_DEVICE* pDevice;
+    XGL_RESULT result;
+} struct_xglCreateDevice;
+
+static struct_xglCreateDevice* interpret_body_as_xglCreateDevice(glv_trace_packet_header* pHeader)
+{
+    struct_xglCreateDevice* pPacket = (struct_xglCreateDevice*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->pCreateInfo = interpret_XGL_DEVICE_CREATE_INFO(pHeader, (intptr_t)pPacket->pCreateInfo);
+    pPacket->pDevice = (XGL_DEVICE*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pDevice);
+    return pPacket;
+}
+
+typedef struct struct_xglDestroyDevice {
+    glv_trace_packet_header* header;
+    XGL_DEVICE device;
+    XGL_RESULT result;
+} struct_xglDestroyDevice;
+
+static struct_xglDestroyDevice* interpret_body_as_xglDestroyDevice(glv_trace_packet_header* pHeader)
+{
+    struct_xglDestroyDevice* pPacket = (struct_xglDestroyDevice*)pHeader->pBody;
+    pPacket->header = pHeader;
+    return pPacket;
+}
+
+typedef struct struct_xglGetExtensionSupport {
+    glv_trace_packet_header* header;
+    XGL_PHYSICAL_GPU gpu;
+    const char* pExtName;
+    XGL_RESULT result;
+} struct_xglGetExtensionSupport;
+
+static struct_xglGetExtensionSupport* interpret_body_as_xglGetExtensionSupport(glv_trace_packet_header* pHeader)
+{
+    struct_xglGetExtensionSupport* pPacket = (struct_xglGetExtensionSupport*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->pExtName = (const char*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pExtName);
+    return pPacket;
+}
+
+typedef struct struct_xglEnumerateLayers {
+    glv_trace_packet_header* header;
+    XGL_PHYSICAL_GPU gpu;
+    size_t maxLayerCount;
+    size_t maxStringSize;
+    size_t* pOutLayerCount;
+    char* const* pOutLayers;
+    void* pReserved;
+    XGL_RESULT result;
+} struct_xglEnumerateLayers;
+
+static struct_xglEnumerateLayers* interpret_body_as_xglEnumerateLayers(glv_trace_packet_header* pHeader)
+{
+    struct_xglEnumerateLayers* pPacket = (struct_xglEnumerateLayers*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->pOutLayerCount = (size_t*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pOutLayerCount);
+    pPacket->pOutLayers = (char* const*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pOutLayers);
+    pPacket->pReserved = (void*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pReserved);
+    return pPacket;
+}
+
+typedef struct struct_xglGetDeviceQueue {
+    glv_trace_packet_header* header;
+    XGL_DEVICE device;
+    XGL_QUEUE_TYPE queueType;
+    uint32_t queueIndex;
+    XGL_QUEUE* pQueue;
+    XGL_RESULT result;
+} struct_xglGetDeviceQueue;
+
+static struct_xglGetDeviceQueue* interpret_body_as_xglGetDeviceQueue(glv_trace_packet_header* pHeader)
+{
+    struct_xglGetDeviceQueue* pPacket = (struct_xglGetDeviceQueue*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->pQueue = (XGL_QUEUE*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pQueue);
+    return pPacket;
+}
+
+typedef struct struct_xglQueueSubmit {
+    glv_trace_packet_header* header;
+    XGL_QUEUE queue;
+    uint32_t cmdBufferCount;
+    const XGL_CMD_BUFFER* pCmdBuffers;
+    uint32_t memRefCount;
+    const XGL_MEMORY_REF* pMemRefs;
+    XGL_FENCE fence;
+    XGL_RESULT result;
+} struct_xglQueueSubmit;
+
+static struct_xglQueueSubmit* interpret_body_as_xglQueueSubmit(glv_trace_packet_header* pHeader)
+{
+    struct_xglQueueSubmit* pPacket = (struct_xglQueueSubmit*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->pCmdBuffers = (const XGL_CMD_BUFFER*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pCmdBuffers);
+    pPacket->pMemRefs = (const XGL_MEMORY_REF*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pMemRefs);
+    return pPacket;
+}
+
+typedef struct struct_xglQueueSetGlobalMemReferences {
+    glv_trace_packet_header* header;
+    XGL_QUEUE queue;
+    uint32_t memRefCount;
+    const XGL_MEMORY_REF* pMemRefs;
+    XGL_RESULT result;
+} struct_xglQueueSetGlobalMemReferences;
+
+static struct_xglQueueSetGlobalMemReferences* interpret_body_as_xglQueueSetGlobalMemReferences(glv_trace_packet_header* pHeader)
+{
+    struct_xglQueueSetGlobalMemReferences* pPacket = (struct_xglQueueSetGlobalMemReferences*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->pMemRefs = (const XGL_MEMORY_REF*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pMemRefs);
+    return pPacket;
+}
+
+typedef struct struct_xglQueueWaitIdle {
+    glv_trace_packet_header* header;
+    XGL_QUEUE queue;
+    XGL_RESULT result;
+} struct_xglQueueWaitIdle;
+
+static struct_xglQueueWaitIdle* interpret_body_as_xglQueueWaitIdle(glv_trace_packet_header* pHeader)
+{
+    struct_xglQueueWaitIdle* pPacket = (struct_xglQueueWaitIdle*)pHeader->pBody;
+    pPacket->header = pHeader;
+    return pPacket;
+}
+
+typedef struct struct_xglDeviceWaitIdle {
+    glv_trace_packet_header* header;
+    XGL_DEVICE device;
+    XGL_RESULT result;
+} struct_xglDeviceWaitIdle;
+
+static struct_xglDeviceWaitIdle* interpret_body_as_xglDeviceWaitIdle(glv_trace_packet_header* pHeader)
+{
+    struct_xglDeviceWaitIdle* pPacket = (struct_xglDeviceWaitIdle*)pHeader->pBody;
+    pPacket->header = pHeader;
+    return pPacket;
+}
+
+typedef struct struct_xglAllocMemory {
+    glv_trace_packet_header* header;
+    XGL_DEVICE device;
+    const XGL_MEMORY_ALLOC_INFO* pAllocInfo;
+    XGL_GPU_MEMORY* pMem;
+    XGL_RESULT result;
+} struct_xglAllocMemory;
+
+static struct_xglAllocMemory* interpret_body_as_xglAllocMemory(glv_trace_packet_header* pHeader)
+{
+    struct_xglAllocMemory* pPacket = (struct_xglAllocMemory*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->pAllocInfo = (const XGL_MEMORY_ALLOC_INFO*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pAllocInfo);
+    if (pPacket->pAllocInfo != NULL)
+    {
+        if (pPacket->pAllocInfo->sType == XGL_STRUCTURE_TYPE_MEMORY_ALLOC_INFO) {
+            XGL_MEMORY_ALLOC_INFO** ppNext = (XGL_MEMORY_ALLOC_INFO**) &(pPacket->pAllocInfo->pNext);
+            *ppNext = (XGL_MEMORY_ALLOC_INFO*) glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pAllocInfo->pNext);
+            XGL_MEMORY_ALLOC_INFO* pNext = (XGL_MEMORY_ALLOC_INFO*) *ppNext;
+            while (NULL != pNext)
+            {
+                switch(pNext->sType)
+                {
+                    case XGL_STRUCTURE_TYPE_MEMORY_ALLOC_BUFFER_INFO:
+                    case XGL_STRUCTURE_TYPE_MEMORY_ALLOC_IMAGE_INFO:
+                    {
+                        ppNext = (XGL_MEMORY_ALLOC_INFO **) &(pNext->pNext);
+                        *ppNext = (XGL_MEMORY_ALLOC_INFO*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pNext->pNext);
+                        break;
+                    }
+                    default:
+                    {
+                       glv_LogError("Encountered an unexpected type alloc memory list.\n");
+                       pPacket->header = NULL;
+                       pNext->pNext = NULL;
+                    }
+                }
+                pNext = (XGL_MEMORY_ALLOC_INFO*)pNext->pNext;
+            }
+        } else {
+            // This is unexpected.
+            glv_LogError("AllocMemory must have AllocInfo stype of XGL_STRUCTURE_TYPE_MEMORY_ALLOC_INFO.\n");
+            pPacket->header = NULL;
+        }
+    }
+    pPacket->pMem = (XGL_GPU_MEMORY*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pMem);
+    return pPacket;
+}
+
+typedef struct struct_xglFreeMemory {
+    glv_trace_packet_header* header;
+    XGL_GPU_MEMORY mem;
+    XGL_RESULT result;
+} struct_xglFreeMemory;
+
+static struct_xglFreeMemory* interpret_body_as_xglFreeMemory(glv_trace_packet_header* pHeader)
+{
+    struct_xglFreeMemory* pPacket = (struct_xglFreeMemory*)pHeader->pBody;
+    pPacket->header = pHeader;
+    return pPacket;
+}
+
+typedef struct struct_xglSetMemoryPriority {
+    glv_trace_packet_header* header;
+    XGL_GPU_MEMORY mem;
+    XGL_MEMORY_PRIORITY priority;
+    XGL_RESULT result;
+} struct_xglSetMemoryPriority;
+
+static struct_xglSetMemoryPriority* interpret_body_as_xglSetMemoryPriority(glv_trace_packet_header* pHeader)
+{
+    struct_xglSetMemoryPriority* pPacket = (struct_xglSetMemoryPriority*)pHeader->pBody;
+    pPacket->header = pHeader;
+    return pPacket;
+}
+
+typedef struct struct_xglMapMemory {
+    glv_trace_packet_header* header;
+    XGL_GPU_MEMORY mem;
+    XGL_FLAGS flags;
+    void** ppData;
+    XGL_RESULT result;
+} struct_xglMapMemory;
+
+static struct_xglMapMemory* interpret_body_as_xglMapMemory(glv_trace_packet_header* pHeader)
+{
+    struct_xglMapMemory* pPacket = (struct_xglMapMemory*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->ppData = (void**)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->ppData);
+    return pPacket;
+}
+
+typedef struct struct_xglUnmapMemory {
+    glv_trace_packet_header* header;
+    XGL_GPU_MEMORY mem;
+    void* pData;
+    XGL_RESULT result;
+} struct_xglUnmapMemory;
+
+static struct_xglUnmapMemory* interpret_body_as_xglUnmapMemory(glv_trace_packet_header* pHeader)
+{
+    struct_xglUnmapMemory* pPacket = (struct_xglUnmapMemory*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->pData = (void*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pData);
+    return pPacket;
+}
+
+typedef struct struct_xglPinSystemMemory {
+    glv_trace_packet_header* header;
+    XGL_DEVICE device;
+    const void* pSysMem;
+    size_t memSize;
+    XGL_GPU_MEMORY* pMem;
+    XGL_RESULT result;
+} struct_xglPinSystemMemory;
+
+static struct_xglPinSystemMemory* interpret_body_as_xglPinSystemMemory(glv_trace_packet_header* pHeader)
+{
+    struct_xglPinSystemMemory* pPacket = (struct_xglPinSystemMemory*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->pSysMem = (const void*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pSysMem);
+    pPacket->pMem = (XGL_GPU_MEMORY*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pMem);
+    return pPacket;
+}
+
+typedef struct struct_xglGetMultiGpuCompatibility {
+    glv_trace_packet_header* header;
+    XGL_PHYSICAL_GPU gpu0;
+    XGL_PHYSICAL_GPU gpu1;
+    XGL_GPU_COMPATIBILITY_INFO* pInfo;
+    XGL_RESULT result;
+} struct_xglGetMultiGpuCompatibility;
+
+static struct_xglGetMultiGpuCompatibility* interpret_body_as_xglGetMultiGpuCompatibility(glv_trace_packet_header* pHeader)
+{
+    struct_xglGetMultiGpuCompatibility* pPacket = (struct_xglGetMultiGpuCompatibility*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->pInfo = (XGL_GPU_COMPATIBILITY_INFO*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pInfo);
+    return pPacket;
+}
+
+typedef struct struct_xglOpenSharedMemory {
+    glv_trace_packet_header* header;
+    XGL_DEVICE device;
+    const XGL_MEMORY_OPEN_INFO* pOpenInfo;
+    XGL_GPU_MEMORY* pMem;
+    XGL_RESULT result;
+} struct_xglOpenSharedMemory;
+
+static struct_xglOpenSharedMemory* interpret_body_as_xglOpenSharedMemory(glv_trace_packet_header* pHeader)
+{
+    struct_xglOpenSharedMemory* pPacket = (struct_xglOpenSharedMemory*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->pOpenInfo = (const XGL_MEMORY_OPEN_INFO*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pOpenInfo);
+    pPacket->pMem = (XGL_GPU_MEMORY*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pMem);
+    return pPacket;
+}
+
+typedef struct struct_xglOpenSharedQueueSemaphore {
+    glv_trace_packet_header* header;
+    XGL_DEVICE device;
+    const XGL_QUEUE_SEMAPHORE_OPEN_INFO* pOpenInfo;
+    XGL_QUEUE_SEMAPHORE* pSemaphore;
+    XGL_RESULT result;
+} struct_xglOpenSharedQueueSemaphore;
+
+static struct_xglOpenSharedQueueSemaphore* interpret_body_as_xglOpenSharedQueueSemaphore(glv_trace_packet_header* pHeader)
+{
+    struct_xglOpenSharedQueueSemaphore* pPacket = (struct_xglOpenSharedQueueSemaphore*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->pOpenInfo = (const XGL_QUEUE_SEMAPHORE_OPEN_INFO*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pOpenInfo);
+    pPacket->pSemaphore = (XGL_QUEUE_SEMAPHORE*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pSemaphore);
+    return pPacket;
+}
+
+typedef struct struct_xglOpenPeerMemory {
+    glv_trace_packet_header* header;
+    XGL_DEVICE device;
+    const XGL_PEER_MEMORY_OPEN_INFO* pOpenInfo;
+    XGL_GPU_MEMORY* pMem;
+    XGL_RESULT result;
+} struct_xglOpenPeerMemory;
+
+static struct_xglOpenPeerMemory* interpret_body_as_xglOpenPeerMemory(glv_trace_packet_header* pHeader)
+{
+    struct_xglOpenPeerMemory* pPacket = (struct_xglOpenPeerMemory*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->pOpenInfo = (const XGL_PEER_MEMORY_OPEN_INFO*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pOpenInfo);
+    pPacket->pMem = (XGL_GPU_MEMORY*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pMem);
+    return pPacket;
+}
+
+typedef struct struct_xglOpenPeerImage {
+    glv_trace_packet_header* header;
+    XGL_DEVICE device;
+    const XGL_PEER_IMAGE_OPEN_INFO* pOpenInfo;
+    XGL_IMAGE* pImage;
+    XGL_GPU_MEMORY* pMem;
+    XGL_RESULT result;
+} struct_xglOpenPeerImage;
+
+static struct_xglOpenPeerImage* interpret_body_as_xglOpenPeerImage(glv_trace_packet_header* pHeader)
+{
+    struct_xglOpenPeerImage* pPacket = (struct_xglOpenPeerImage*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->pOpenInfo = (const XGL_PEER_IMAGE_OPEN_INFO*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pOpenInfo);
+    pPacket->pImage = (XGL_IMAGE*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pImage);
+    pPacket->pMem = (XGL_GPU_MEMORY*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pMem);
+    return pPacket;
+}
+
+typedef struct struct_xglDestroyObject {
+    glv_trace_packet_header* header;
+    XGL_OBJECT object;
+    XGL_RESULT result;
+} struct_xglDestroyObject;
+
+static struct_xglDestroyObject* interpret_body_as_xglDestroyObject(glv_trace_packet_header* pHeader)
+{
+    struct_xglDestroyObject* pPacket = (struct_xglDestroyObject*)pHeader->pBody;
+    pPacket->header = pHeader;
+    return pPacket;
+}
+
+typedef struct struct_xglGetObjectInfo {
+    glv_trace_packet_header* header;
+    XGL_BASE_OBJECT object;
+    XGL_OBJECT_INFO_TYPE infoType;
+    size_t* pDataSize;
+    void* pData;
+    XGL_RESULT result;
+} struct_xglGetObjectInfo;
+
+static struct_xglGetObjectInfo* interpret_body_as_xglGetObjectInfo(glv_trace_packet_header* pHeader)
+{
+    struct_xglGetObjectInfo* pPacket = (struct_xglGetObjectInfo*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->pDataSize = (size_t*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pDataSize);
+    pPacket->pData = (void*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pData);
+    return pPacket;
+}
+
+typedef struct struct_xglBindObjectMemory {
+    glv_trace_packet_header* header;
+    XGL_OBJECT object;
+    uint32_t allocationIdx;
+    XGL_GPU_MEMORY mem;
+    XGL_GPU_SIZE offset;
+    XGL_RESULT result;
+} struct_xglBindObjectMemory;
+
+static struct_xglBindObjectMemory* interpret_body_as_xglBindObjectMemory(glv_trace_packet_header* pHeader)
+{
+    struct_xglBindObjectMemory* pPacket = (struct_xglBindObjectMemory*)pHeader->pBody;
+    pPacket->header = pHeader;
+    return pPacket;
+}
+
+typedef struct struct_xglBindObjectMemoryRange {
+    glv_trace_packet_header* header;
+    XGL_OBJECT object;
+    uint32_t allocationIdx;
+    XGL_GPU_SIZE rangeOffset;
+    XGL_GPU_SIZE rangeSize;
+    XGL_GPU_MEMORY mem;
+    XGL_GPU_SIZE memOffset;
+    XGL_RESULT result;
+} struct_xglBindObjectMemoryRange;
+
+static struct_xglBindObjectMemoryRange* interpret_body_as_xglBindObjectMemoryRange(glv_trace_packet_header* pHeader)
+{
+    struct_xglBindObjectMemoryRange* pPacket = (struct_xglBindObjectMemoryRange*)pHeader->pBody;
+    pPacket->header = pHeader;
+    return pPacket;
+}
+
+typedef struct struct_xglBindImageMemoryRange {
+    glv_trace_packet_header* header;
+    XGL_IMAGE image;
+    uint32_t allocationIdx;
+    const XGL_IMAGE_MEMORY_BIND_INFO* bindInfo;
+    XGL_GPU_MEMORY mem;
+    XGL_GPU_SIZE memOffset;
+    XGL_RESULT result;
+} struct_xglBindImageMemoryRange;
+
+static struct_xglBindImageMemoryRange* interpret_body_as_xglBindImageMemoryRange(glv_trace_packet_header* pHeader)
+{
+    struct_xglBindImageMemoryRange* pPacket = (struct_xglBindImageMemoryRange*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->bindInfo = (const XGL_IMAGE_MEMORY_BIND_INFO*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->bindInfo);
+    return pPacket;
+}
+
+typedef struct struct_xglCreateFence {
+    glv_trace_packet_header* header;
+    XGL_DEVICE device;
+    const XGL_FENCE_CREATE_INFO* pCreateInfo;
+    XGL_FENCE* pFence;
+    XGL_RESULT result;
+} struct_xglCreateFence;
+
+static struct_xglCreateFence* interpret_body_as_xglCreateFence(glv_trace_packet_header* pHeader)
+{
+    struct_xglCreateFence* pPacket = (struct_xglCreateFence*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->pCreateInfo = (const XGL_FENCE_CREATE_INFO*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pCreateInfo);
+    pPacket->pFence = (XGL_FENCE*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pFence);
+    return pPacket;
+}
+
+typedef struct struct_xglGetFenceStatus {
+    glv_trace_packet_header* header;
+    XGL_FENCE fence;
+    XGL_RESULT result;
+} struct_xglGetFenceStatus;
+
+static struct_xglGetFenceStatus* interpret_body_as_xglGetFenceStatus(glv_trace_packet_header* pHeader)
+{
+    struct_xglGetFenceStatus* pPacket = (struct_xglGetFenceStatus*)pHeader->pBody;
+    pPacket->header = pHeader;
+    return pPacket;
+}
+
+typedef struct struct_xglWaitForFences {
+    glv_trace_packet_header* header;
+    XGL_DEVICE device;
+    uint32_t fenceCount;
+    const XGL_FENCE* pFences;
+    bool32_t waitAll;
+    uint64_t timeout;
+    XGL_RESULT result;
+} struct_xglWaitForFences;
+
+static struct_xglWaitForFences* interpret_body_as_xglWaitForFences(glv_trace_packet_header* pHeader)
+{
+    struct_xglWaitForFences* pPacket = (struct_xglWaitForFences*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->pFences = (const XGL_FENCE*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pFences);
+    return pPacket;
+}
+
+typedef struct struct_xglCreateQueueSemaphore {
+    glv_trace_packet_header* header;
+    XGL_DEVICE device;
+    const XGL_QUEUE_SEMAPHORE_CREATE_INFO* pCreateInfo;
+    XGL_QUEUE_SEMAPHORE* pSemaphore;
+    XGL_RESULT result;
+} struct_xglCreateQueueSemaphore;
+
+static struct_xglCreateQueueSemaphore* interpret_body_as_xglCreateQueueSemaphore(glv_trace_packet_header* pHeader)
+{
+    struct_xglCreateQueueSemaphore* pPacket = (struct_xglCreateQueueSemaphore*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->pCreateInfo = (const XGL_QUEUE_SEMAPHORE_CREATE_INFO*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pCreateInfo);
+    pPacket->pSemaphore = (XGL_QUEUE_SEMAPHORE*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pSemaphore);
+    return pPacket;
+}
+
+typedef struct struct_xglSignalQueueSemaphore {
+    glv_trace_packet_header* header;
+    XGL_QUEUE queue;
+    XGL_QUEUE_SEMAPHORE semaphore;
+    XGL_RESULT result;
+} struct_xglSignalQueueSemaphore;
+
+static struct_xglSignalQueueSemaphore* interpret_body_as_xglSignalQueueSemaphore(glv_trace_packet_header* pHeader)
+{
+    struct_xglSignalQueueSemaphore* pPacket = (struct_xglSignalQueueSemaphore*)pHeader->pBody;
+    pPacket->header = pHeader;
+    return pPacket;
+}
+
+typedef struct struct_xglWaitQueueSemaphore {
+    glv_trace_packet_header* header;
+    XGL_QUEUE queue;
+    XGL_QUEUE_SEMAPHORE semaphore;
+    XGL_RESULT result;
+} struct_xglWaitQueueSemaphore;
+
+static struct_xglWaitQueueSemaphore* interpret_body_as_xglWaitQueueSemaphore(glv_trace_packet_header* pHeader)
+{
+    struct_xglWaitQueueSemaphore* pPacket = (struct_xglWaitQueueSemaphore*)pHeader->pBody;
+    pPacket->header = pHeader;
+    return pPacket;
+}
+
+typedef struct struct_xglCreateEvent {
+    glv_trace_packet_header* header;
+    XGL_DEVICE device;
+    const XGL_EVENT_CREATE_INFO* pCreateInfo;
+    XGL_EVENT* pEvent;
+    XGL_RESULT result;
+} struct_xglCreateEvent;
+
+static struct_xglCreateEvent* interpret_body_as_xglCreateEvent(glv_trace_packet_header* pHeader)
+{
+    struct_xglCreateEvent* pPacket = (struct_xglCreateEvent*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->pCreateInfo = (const XGL_EVENT_CREATE_INFO*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pCreateInfo);
+    pPacket->pEvent = (XGL_EVENT*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pEvent);
+    return pPacket;
+}
+
+typedef struct struct_xglGetEventStatus {
+    glv_trace_packet_header* header;
+    XGL_EVENT event;
+    XGL_RESULT result;
+} struct_xglGetEventStatus;
+
+static struct_xglGetEventStatus* interpret_body_as_xglGetEventStatus(glv_trace_packet_header* pHeader)
+{
+    struct_xglGetEventStatus* pPacket = (struct_xglGetEventStatus*)pHeader->pBody;
+    pPacket->header = pHeader;
+    return pPacket;
+}
+
+typedef struct struct_xglSetEvent {
+    glv_trace_packet_header* header;
+    XGL_EVENT event;
+    XGL_RESULT result;
+} struct_xglSetEvent;
+
+static struct_xglSetEvent* interpret_body_as_xglSetEvent(glv_trace_packet_header* pHeader)
+{
+    struct_xglSetEvent* pPacket = (struct_xglSetEvent*)pHeader->pBody;
+    pPacket->header = pHeader;
+    return pPacket;
+}
+
+typedef struct struct_xglResetEvent {
+    glv_trace_packet_header* header;
+    XGL_EVENT event;
+    XGL_RESULT result;
+} struct_xglResetEvent;
+
+static struct_xglResetEvent* interpret_body_as_xglResetEvent(glv_trace_packet_header* pHeader)
+{
+    struct_xglResetEvent* pPacket = (struct_xglResetEvent*)pHeader->pBody;
+    pPacket->header = pHeader;
+    return pPacket;
+}
+
+typedef struct struct_xglCreateQueryPool {
+    glv_trace_packet_header* header;
+    XGL_DEVICE device;
+    const XGL_QUERY_POOL_CREATE_INFO* pCreateInfo;
+    XGL_QUERY_POOL* pQueryPool;
+    XGL_RESULT result;
+} struct_xglCreateQueryPool;
+
+static struct_xglCreateQueryPool* interpret_body_as_xglCreateQueryPool(glv_trace_packet_header* pHeader)
+{
+    struct_xglCreateQueryPool* pPacket = (struct_xglCreateQueryPool*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->pCreateInfo = (const XGL_QUERY_POOL_CREATE_INFO*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pCreateInfo);
+    pPacket->pQueryPool = (XGL_QUERY_POOL*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pQueryPool);
+    return pPacket;
+}
+
+typedef struct struct_xglGetQueryPoolResults {
+    glv_trace_packet_header* header;
+    XGL_QUERY_POOL queryPool;
+    uint32_t startQuery;
+    uint32_t queryCount;
+    size_t* pDataSize;
+    void* pData;
+    XGL_RESULT result;
+} struct_xglGetQueryPoolResults;
+
+static struct_xglGetQueryPoolResults* interpret_body_as_xglGetQueryPoolResults(glv_trace_packet_header* pHeader)
+{
+    struct_xglGetQueryPoolResults* pPacket = (struct_xglGetQueryPoolResults*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->pDataSize = (size_t*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pDataSize);
+    pPacket->pData = (void*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pData);
+    return pPacket;
+}
+
+typedef struct struct_xglGetFormatInfo {
+    glv_trace_packet_header* header;
+    XGL_DEVICE device;
+    XGL_FORMAT format;
+    XGL_FORMAT_INFO_TYPE infoType;
+    size_t* pDataSize;
+    void* pData;
+    XGL_RESULT result;
+} struct_xglGetFormatInfo;
+
+static struct_xglGetFormatInfo* interpret_body_as_xglGetFormatInfo(glv_trace_packet_header* pHeader)
+{
+    struct_xglGetFormatInfo* pPacket = (struct_xglGetFormatInfo*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->pDataSize = (size_t*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pDataSize);
+    pPacket->pData = (void*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pData);
+    return pPacket;
+}
+
+typedef struct struct_xglCreateBuffer {
+    glv_trace_packet_header* header;
+    XGL_DEVICE device;
+    const XGL_BUFFER_CREATE_INFO* pCreateInfo;
+    XGL_BUFFER* pBuffer;
+    XGL_RESULT result;
+} struct_xglCreateBuffer;
+
+static struct_xglCreateBuffer* interpret_body_as_xglCreateBuffer(glv_trace_packet_header* pHeader)
+{
+    struct_xglCreateBuffer* pPacket = (struct_xglCreateBuffer*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->pCreateInfo = (const XGL_BUFFER_CREATE_INFO*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pCreateInfo);
+    pPacket->pBuffer = (XGL_BUFFER*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pBuffer);
+    return pPacket;
+}
+
+typedef struct struct_xglCreateBufferView {
+    glv_trace_packet_header* header;
+    XGL_DEVICE device;
+    const XGL_BUFFER_VIEW_CREATE_INFO* pCreateInfo;
+    XGL_BUFFER_VIEW* pView;
+    XGL_RESULT result;
+} struct_xglCreateBufferView;
+
+static struct_xglCreateBufferView* interpret_body_as_xglCreateBufferView(glv_trace_packet_header* pHeader)
+{
+    struct_xglCreateBufferView* pPacket = (struct_xglCreateBufferView*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->pCreateInfo = (const XGL_BUFFER_VIEW_CREATE_INFO*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pCreateInfo);
+    pPacket->pView = (XGL_BUFFER_VIEW*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pView);
+    return pPacket;
+}
+
+typedef struct struct_xglCreateImage {
+    glv_trace_packet_header* header;
+    XGL_DEVICE device;
+    const XGL_IMAGE_CREATE_INFO* pCreateInfo;
+    XGL_IMAGE* pImage;
+    XGL_RESULT result;
+} struct_xglCreateImage;
+
+static struct_xglCreateImage* interpret_body_as_xglCreateImage(glv_trace_packet_header* pHeader)
+{
+    struct_xglCreateImage* pPacket = (struct_xglCreateImage*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->pCreateInfo = (const XGL_IMAGE_CREATE_INFO*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pCreateInfo);
+    pPacket->pImage = (XGL_IMAGE*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pImage);
+    return pPacket;
+}
+
+typedef struct struct_xglSetFastClearColor {
+    glv_trace_packet_header* header;
+    XGL_IMAGE image;
+    const float color[4];
+    XGL_RESULT result;
+} struct_xglSetFastClearColor;
+
+static struct_xglSetFastClearColor* interpret_body_as_xglSetFastClearColor(glv_trace_packet_header* pHeader)
+{
+    struct_xglSetFastClearColor* pPacket = (struct_xglSetFastClearColor*)pHeader->pBody;
+    pPacket->header = pHeader;
+    return pPacket;
+}
+
+typedef struct struct_xglSetFastClearDepth {
+    glv_trace_packet_header* header;
+    XGL_IMAGE image;
+    float depth;
+    XGL_RESULT result;
+} struct_xglSetFastClearDepth;
+
+static struct_xglSetFastClearDepth* interpret_body_as_xglSetFastClearDepth(glv_trace_packet_header* pHeader)
+{
+    struct_xglSetFastClearDepth* pPacket = (struct_xglSetFastClearDepth*)pHeader->pBody;
+    pPacket->header = pHeader;
+    return pPacket;
+}
+
+typedef struct struct_xglGetImageSubresourceInfo {
+    glv_trace_packet_header* header;
+    XGL_IMAGE image;
+    const XGL_IMAGE_SUBRESOURCE* pSubresource;
+    XGL_SUBRESOURCE_INFO_TYPE infoType;
+    size_t* pDataSize;
+    void* pData;
+    XGL_RESULT result;
+} struct_xglGetImageSubresourceInfo;
+
+static struct_xglGetImageSubresourceInfo* interpret_body_as_xglGetImageSubresourceInfo(glv_trace_packet_header* pHeader)
+{
+    struct_xglGetImageSubresourceInfo* pPacket = (struct_xglGetImageSubresourceInfo*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->pSubresource = (const XGL_IMAGE_SUBRESOURCE*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pSubresource);
+    pPacket->pDataSize = (size_t*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pDataSize);
+    pPacket->pData = (void*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pData);
+    return pPacket;
+}
+
+typedef struct struct_xglCreateImageView {
+    glv_trace_packet_header* header;
+    XGL_DEVICE device;
+    const XGL_IMAGE_VIEW_CREATE_INFO* pCreateInfo;
+    XGL_IMAGE_VIEW* pView;
+    XGL_RESULT result;
+} struct_xglCreateImageView;
+
+static struct_xglCreateImageView* interpret_body_as_xglCreateImageView(glv_trace_packet_header* pHeader)
+{
+    struct_xglCreateImageView* pPacket = (struct_xglCreateImageView*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->pCreateInfo = (const XGL_IMAGE_VIEW_CREATE_INFO*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pCreateInfo);
+    pPacket->pView = (XGL_IMAGE_VIEW*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pView);
+    return pPacket;
+}
+
+typedef struct struct_xglCreateColorAttachmentView {
+    glv_trace_packet_header* header;
+    XGL_DEVICE device;
+    const XGL_COLOR_ATTACHMENT_VIEW_CREATE_INFO* pCreateInfo;
+    XGL_COLOR_ATTACHMENT_VIEW* pView;
+    XGL_RESULT result;
+} struct_xglCreateColorAttachmentView;
+
+static struct_xglCreateColorAttachmentView* interpret_body_as_xglCreateColorAttachmentView(glv_trace_packet_header* pHeader)
+{
+    struct_xglCreateColorAttachmentView* pPacket = (struct_xglCreateColorAttachmentView*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->pCreateInfo = (const XGL_COLOR_ATTACHMENT_VIEW_CREATE_INFO*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pCreateInfo);
+    pPacket->pView = (XGL_COLOR_ATTACHMENT_VIEW*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pView);
+    return pPacket;
+}
+
+typedef struct struct_xglCreateDepthStencilView {
+    glv_trace_packet_header* header;
+    XGL_DEVICE device;
+    const XGL_DEPTH_STENCIL_VIEW_CREATE_INFO* pCreateInfo;
+    XGL_DEPTH_STENCIL_VIEW* pView;
+    XGL_RESULT result;
+} struct_xglCreateDepthStencilView;
+
+static struct_xglCreateDepthStencilView* interpret_body_as_xglCreateDepthStencilView(glv_trace_packet_header* pHeader)
+{
+    struct_xglCreateDepthStencilView* pPacket = (struct_xglCreateDepthStencilView*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->pCreateInfo = (const XGL_DEPTH_STENCIL_VIEW_CREATE_INFO*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pCreateInfo);
+    pPacket->pView = (XGL_DEPTH_STENCIL_VIEW*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pView);
+    return pPacket;
+}
+
+typedef struct struct_xglCreateShader {
+    glv_trace_packet_header* header;
+    XGL_DEVICE device;
+    const XGL_SHADER_CREATE_INFO* pCreateInfo;
+    XGL_SHADER* pShader;
+    XGL_RESULT result;
+} struct_xglCreateShader;
+
+static struct_xglCreateShader* interpret_body_as_xglCreateShader(glv_trace_packet_header* pHeader)
+{
+    struct_xglCreateShader* pPacket = (struct_xglCreateShader*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->pCreateInfo = (const XGL_SHADER_CREATE_INFO*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pCreateInfo);
+    if (pPacket->pCreateInfo != NULL)
+    {
+        XGL_SHADER_CREATE_INFO* pInfo = (XGL_SHADER_CREATE_INFO*)pPacket->pCreateInfo;
+        pInfo->pCode = glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pCreateInfo->pCode);
+    }
+    pPacket->pShader = (XGL_SHADER*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pShader);
+    return pPacket;
+}
+
+typedef struct struct_xglCreateGraphicsPipeline {
+    glv_trace_packet_header* header;
+    XGL_DEVICE device;
+    const XGL_GRAPHICS_PIPELINE_CREATE_INFO* pCreateInfo;
+    XGL_PIPELINE* pPipeline;
+    XGL_RESULT result;
+} struct_xglCreateGraphicsPipeline;
+
+static struct_xglCreateGraphicsPipeline* interpret_body_as_xglCreateGraphicsPipeline(glv_trace_packet_header* pHeader)
+{
+    struct_xglCreateGraphicsPipeline* pPacket = (struct_xglCreateGraphicsPipeline*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->pCreateInfo = (const XGL_GRAPHICS_PIPELINE_CREATE_INFO*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pCreateInfo);
+    if (pPacket->pCreateInfo != NULL)
+    {
+        if (pPacket->pCreateInfo->sType == XGL_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO) {
+            // need to make a non-const pointer to the pointer so that we can properly change the original pointer to the interpretted one
+            void** ppNextVoidPtr = (void**)&pPacket->pCreateInfo->pNext;
+            *ppNextVoidPtr = (void*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pCreateInfo->pNext);
+            XGL_PIPELINE_SHADER_STAGE_CREATE_INFO* pNext = (XGL_PIPELINE_SHADER_STAGE_CREATE_INFO*)pPacket->pCreateInfo->pNext;
+            while ((NULL != pNext) && (XGL_NULL_HANDLE != pNext))
+        {
+                switch(pNext->sType)
+            {
+                    case XGL_STRUCTURE_TYPE_PIPELINE_IA_STATE_CREATE_INFO:
+                    case XGL_STRUCTURE_TYPE_PIPELINE_TESS_STATE_CREATE_INFO:
+                    case XGL_STRUCTURE_TYPE_PIPELINE_RS_STATE_CREATE_INFO:
+                    case XGL_STRUCTURE_TYPE_PIPELINE_VP_STATE_CREATE_INFO:
+                    case XGL_STRUCTURE_TYPE_PIPELINE_MS_STATE_CREATE_INFO:
+                    case XGL_STRUCTURE_TYPE_PIPELINE_DS_STATE_CREATE_INFO:
+                    {
+                        void** ppNextVoidPtr = (void**)&pNext->pNext;
+                        *ppNextVoidPtr = (void*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pNext->pNext);
+                        break;
+                    }
+                    case XGL_STRUCTURE_TYPE_PIPELINE_CB_STATE_CREATE_INFO:
+                    {
+                        void** ppNextVoidPtr = (void**)&pNext->pNext;
+                        XGL_PIPELINE_CB_STATE_CREATE_INFO *pCb = (XGL_PIPELINE_CB_STATE_CREATE_INFO *) pNext;
+                        *ppNextVoidPtr = (void*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pNext->pNext);
+                        pCb->pAttachments = (XGL_PIPELINE_CB_ATTACHMENT_STATE*) glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pCb->pAttachments);
+                        break;
+                    }
+                    case XGL_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO:
+                    {
+                        void** ppNextVoidPtr = (void**)&pNext->pNext;
+                        *ppNextVoidPtr = (void*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pNext->pNext);
+                        interpret_pipeline_shader(pHeader, &pNext->shader);
+                        break;
+                    }
+                    case XGL_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_CREATE_INFO:
+                    {
+                        void** ppNextVoidPtr = (void**)&pNext->pNext;
+                        XGL_PIPELINE_VERTEX_INPUT_CREATE_INFO *pVi = (XGL_PIPELINE_VERTEX_INPUT_CREATE_INFO *) pNext;
+                        *ppNextVoidPtr = (void*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pNext->pNext);
+                        pVi->pVertexBindingDescriptions = (XGL_VERTEX_INPUT_BINDING_DESCRIPTION*) glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pVi->pVertexBindingDescriptions);
+                        pVi->pVertexAttributeDescriptions = (XGL_VERTEX_INPUT_ATTRIBUTE_DESCRIPTION*) glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pVi->pVertexAttributeDescriptions);
+                        break;
+                    }
+                    default:
+                    {
+                       glv_LogError("Encountered an unexpected type in pipeline state list.\n");
+                       pPacket->header = NULL;
+                       pNext->pNext = NULL;
+                    }
+                }
+                pNext = (XGL_PIPELINE_SHADER_STAGE_CREATE_INFO*)pNext->pNext;
+            }
+        } else {
+            // This is unexpected.
+            glv_LogError("CreateGraphicsPipeline must have CreateInfo stype of XGL_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO.\n");
+            pPacket->header = NULL;
+        }
+    }
+    pPacket->pPipeline = (XGL_PIPELINE*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pPipeline);
+    return pPacket;
+}
+
+typedef struct struct_xglCreateComputePipeline {
+    glv_trace_packet_header* header;
+    XGL_DEVICE device;
+    const XGL_COMPUTE_PIPELINE_CREATE_INFO* pCreateInfo;
+    XGL_PIPELINE* pPipeline;
+    XGL_RESULT result;
+} struct_xglCreateComputePipeline;
+
+static struct_xglCreateComputePipeline* interpret_body_as_xglCreateComputePipeline(glv_trace_packet_header* pHeader)
+{
+    struct_xglCreateComputePipeline* pPacket = (struct_xglCreateComputePipeline*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->pCreateInfo = (const XGL_COMPUTE_PIPELINE_CREATE_INFO*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pCreateInfo);
+    if (pPacket->pCreateInfo != NULL)
+    {
+        interpret_pipeline_shader(pHeader, (XGL_PIPELINE_SHADER*)(&pPacket->pCreateInfo->cs));
+    }
+    pPacket->pPipeline = (XGL_PIPELINE*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pPipeline);
+    return pPacket;
+}
+
+typedef struct struct_xglStorePipeline {
+    glv_trace_packet_header* header;
+    XGL_PIPELINE pipeline;
+    size_t* pDataSize;
+    void* pData;
+    XGL_RESULT result;
+} struct_xglStorePipeline;
+
+static struct_xglStorePipeline* interpret_body_as_xglStorePipeline(glv_trace_packet_header* pHeader)
+{
+    struct_xglStorePipeline* pPacket = (struct_xglStorePipeline*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->pDataSize = (size_t*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pDataSize);
+    pPacket->pData = (void*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pData);
+    return pPacket;
+}
+
+typedef struct struct_xglLoadPipeline {
+    glv_trace_packet_header* header;
+    XGL_DEVICE device;
+    size_t dataSize;
+    const void* pData;
+    XGL_PIPELINE* pPipeline;
+    XGL_RESULT result;
+} struct_xglLoadPipeline;
+
+static struct_xglLoadPipeline* interpret_body_as_xglLoadPipeline(glv_trace_packet_header* pHeader)
+{
+    struct_xglLoadPipeline* pPacket = (struct_xglLoadPipeline*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->pData = (const void*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pData);
+    pPacket->pPipeline = (XGL_PIPELINE*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pPipeline);
+    return pPacket;
+}
+
+typedef struct struct_xglCreatePipelineDelta {
+    glv_trace_packet_header* header;
+    XGL_DEVICE device;
+    XGL_PIPELINE p1;
+    XGL_PIPELINE p2;
+    XGL_PIPELINE_DELTA* delta;
+    XGL_RESULT result;
+} struct_xglCreatePipelineDelta;
+
+static struct_xglCreatePipelineDelta* interpret_body_as_xglCreatePipelineDelta(glv_trace_packet_header* pHeader)
+{
+    struct_xglCreatePipelineDelta* pPacket = (struct_xglCreatePipelineDelta*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->delta = (XGL_PIPELINE_DELTA*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->delta);
+    return pPacket;
+}
+
+typedef struct struct_xglCreateSampler {
+    glv_trace_packet_header* header;
+    XGL_DEVICE device;
+    const XGL_SAMPLER_CREATE_INFO* pCreateInfo;
+    XGL_SAMPLER* pSampler;
+    XGL_RESULT result;
+} struct_xglCreateSampler;
+
+static struct_xglCreateSampler* interpret_body_as_xglCreateSampler(glv_trace_packet_header* pHeader)
+{
+    struct_xglCreateSampler* pPacket = (struct_xglCreateSampler*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->pCreateInfo = (const XGL_SAMPLER_CREATE_INFO*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pCreateInfo);
+    pPacket->pSampler = (XGL_SAMPLER*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pSampler);
+    return pPacket;
+}
+
+typedef struct struct_xglCreateDescriptorSetLayout {
+    glv_trace_packet_header* header;
+    XGL_DEVICE device;
+    XGL_FLAGS stageFlags;
+    const uint32_t* pSetBindPoints;
+    XGL_DESCRIPTOR_SET_LAYOUT priorSetLayout;
+    const XGL_DESCRIPTOR_SET_LAYOUT_CREATE_INFO* pSetLayoutInfoList;
+    XGL_DESCRIPTOR_SET_LAYOUT* pSetLayout;
+    XGL_RESULT result;
+} struct_xglCreateDescriptorSetLayout;
+
+static struct_xglCreateDescriptorSetLayout* interpret_body_as_xglCreateDescriptorSetLayout(glv_trace_packet_header* pHeader)
+{
+    struct_xglCreateDescriptorSetLayout* pPacket = (struct_xglCreateDescriptorSetLayout*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->pSetBindPoints = (const uint32_t*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pSetBindPoints);
+    pPacket->pSetLayoutInfoList = (const XGL_DESCRIPTOR_SET_LAYOUT_CREATE_INFO*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pSetLayoutInfoList);
+    if (pPacket->pSetLayoutInfoList != NULL)
+    {
+        if (pPacket->pSetLayoutInfoList->sType == XGL_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO) {
+            // need to make a non-const pointer to the pointer so that we can properly change the original pointer to the interpretted one
+            void** ppNextVoidPtr = (void**)&(pPacket->pSetLayoutInfoList->pNext);
+            *ppNextVoidPtr = (void*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pSetLayoutInfoList->pNext);
+            XGL_DESCRIPTOR_SET_LAYOUT_CREATE_INFO* pNext = (XGL_DESCRIPTOR_SET_LAYOUT_CREATE_INFO*)pPacket->pSetLayoutInfoList->pNext;
+            while (NULL != pNext)
+            {
+                switch(pNext->sType)
+                {
+                    case XGL_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO:
+                    {
+                        void** ppNextVoidPtr = (void**)&pNext->pNext;
+                        *ppNextVoidPtr = (void*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pNext->pNext);
+                        break;
+                    }
+                    default:
+                    {
+                        glv_LogError("Encountered an unexpected type in descriptor set layout create list.\n");
+                        pPacket->header = NULL;
+                        pNext->pNext = NULL;
+                    }
+                }
+                pNext = (XGL_DESCRIPTOR_SET_LAYOUT_CREATE_INFO*)pNext->pNext;
+             }
+        } else {
+             // This is unexpected.
+             glv_LogError("CreateDescriptorSetLayout must have LayoutInfoList stype of XGL_STRCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO\n");
+             pPacket->header = NULL;
+        }
+    }
+    pPacket->pSetLayout = (XGL_DESCRIPTOR_SET_LAYOUT*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pSetLayout);
+    return pPacket;
+}
+
+typedef struct struct_xglBeginDescriptorRegionUpdate {
+    glv_trace_packet_header* header;
+    XGL_DEVICE device;
+    XGL_DESCRIPTOR_UPDATE_MODE updateMode;
+    XGL_RESULT result;
+} struct_xglBeginDescriptorRegionUpdate;
+
+static struct_xglBeginDescriptorRegionUpdate* interpret_body_as_xglBeginDescriptorRegionUpdate(glv_trace_packet_header* pHeader)
+{
+    struct_xglBeginDescriptorRegionUpdate* pPacket = (struct_xglBeginDescriptorRegionUpdate*)pHeader->pBody;
+    pPacket->header = pHeader;
+    return pPacket;
+}
+
+typedef struct struct_xglEndDescriptorRegionUpdate {
+    glv_trace_packet_header* header;
+    XGL_DEVICE device;
+    XGL_CMD_BUFFER cmd;
+    XGL_RESULT result;
+} struct_xglEndDescriptorRegionUpdate;
+
+static struct_xglEndDescriptorRegionUpdate* interpret_body_as_xglEndDescriptorRegionUpdate(glv_trace_packet_header* pHeader)
+{
+    struct_xglEndDescriptorRegionUpdate* pPacket = (struct_xglEndDescriptorRegionUpdate*)pHeader->pBody;
+    pPacket->header = pHeader;
+    return pPacket;
+}
+
+typedef struct struct_xglCreateDescriptorRegion {
+    glv_trace_packet_header* header;
+    XGL_DEVICE device;
+    XGL_DESCRIPTOR_REGION_USAGE regionUsage;
+    uint32_t maxSets;
+    const XGL_DESCRIPTOR_REGION_CREATE_INFO* pCreateInfo;
+    XGL_DESCRIPTOR_REGION* pDescriptorRegion;
+    XGL_RESULT result;
+} struct_xglCreateDescriptorRegion;
+
+static struct_xglCreateDescriptorRegion* interpret_body_as_xglCreateDescriptorRegion(glv_trace_packet_header* pHeader)
+{
+    struct_xglCreateDescriptorRegion* pPacket = (struct_xglCreateDescriptorRegion*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->pCreateInfo = (const XGL_DESCRIPTOR_REGION_CREATE_INFO*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pCreateInfo);
+    if (pPacket->pCreateInfo != NULL)
+    {
+        XGL_DESCRIPTOR_REGION_CREATE_INFO* pInfo = (XGL_DESCRIPTOR_REGION_CREATE_INFO*)pPacket->pCreateInfo;
+        pInfo->pTypeCount = (XGL_DESCRIPTOR_TYPE_COUNT*) glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pCreateInfo->pTypeCount);
+
+    }
+    pPacket->pDescriptorRegion = (XGL_DESCRIPTOR_REGION*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pDescriptorRegion);
+    return pPacket;
+}
+
+typedef struct struct_xglClearDescriptorRegion {
+    glv_trace_packet_header* header;
+    XGL_DESCRIPTOR_REGION descriptorRegion;
+    XGL_RESULT result;
+} struct_xglClearDescriptorRegion;
+
+static struct_xglClearDescriptorRegion* interpret_body_as_xglClearDescriptorRegion(glv_trace_packet_header* pHeader)
+{
+    struct_xglClearDescriptorRegion* pPacket = (struct_xglClearDescriptorRegion*)pHeader->pBody;
+    pPacket->header = pHeader;
+    return pPacket;
+}
+
+typedef struct struct_xglAllocDescriptorSets {
+    glv_trace_packet_header* header;
+    XGL_DESCRIPTOR_REGION descriptorRegion;
+    XGL_DESCRIPTOR_SET_USAGE setUsage;
+    uint32_t count;
+    const XGL_DESCRIPTOR_SET_LAYOUT* pSetLayouts;
+    XGL_DESCRIPTOR_SET* pDescriptorSets;
+    uint32_t* pCount;
+    XGL_RESULT result;
+} struct_xglAllocDescriptorSets;
+
+static struct_xglAllocDescriptorSets* interpret_body_as_xglAllocDescriptorSets(glv_trace_packet_header* pHeader)
+{
+    struct_xglAllocDescriptorSets* pPacket = (struct_xglAllocDescriptorSets*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->pSetLayouts = (const XGL_DESCRIPTOR_SET_LAYOUT*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pSetLayouts);
+    pPacket->pDescriptorSets = (XGL_DESCRIPTOR_SET*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pDescriptorSets);
+    pPacket->pCount = (uint32_t*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pCount);
+    return pPacket;
+}
+
+typedef struct struct_xglClearDescriptorSets {
+    glv_trace_packet_header* header;
+    XGL_DESCRIPTOR_REGION descriptorRegion;
+    uint32_t count;
+    const XGL_DESCRIPTOR_SET* pDescriptorSets;
+} struct_xglClearDescriptorSets;
+
+static struct_xglClearDescriptorSets* interpret_body_as_xglClearDescriptorSets(glv_trace_packet_header* pHeader)
+{
+    struct_xglClearDescriptorSets* pPacket = (struct_xglClearDescriptorSets*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->pDescriptorSets = (const XGL_DESCRIPTOR_SET*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pDescriptorSets);
+    return pPacket;
+}
+
+typedef struct struct_xglUpdateDescriptors {
+    glv_trace_packet_header* header;
+    XGL_DESCRIPTOR_SET descriptorSet;
+    const void* pUpdateChain;
+} struct_xglUpdateDescriptors;
+
+static struct_xglUpdateDescriptors* interpret_body_as_xglUpdateDescriptors(glv_trace_packet_header* pHeader)
+{
+    struct_xglUpdateDescriptors* pPacket = (struct_xglUpdateDescriptors*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->pUpdateChain = (const void*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pUpdateChain);
+    if (pPacket->pUpdateChain != NULL)
+    {
+        XGL_UPDATE_SAMPLERS* pNext = (XGL_UPDATE_SAMPLERS*)pPacket->pUpdateChain;
+        while ((NULL != pNext) && (XGL_NULL_HANDLE != pNext))
+        {
+            switch(pNext->sType)
+            {
+                case XGL_STRUCTURE_TYPE_UPDATE_AS_COPY:
+                {
+                    void** ppNextVoidPtr = (void**)&pNext->pNext;
+                    *ppNextVoidPtr = (void*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pNext->pNext);
+                    break;
+                }
+                case XGL_STRUCTURE_TYPE_UPDATE_SAMPLERS:
+                {
+                    void** ppNextVoidPtr = (void**)&pNext->pNext;
+                    XGL_UPDATE_SAMPLERS* pUS = (XGL_UPDATE_SAMPLERS*)pNext;
+                    *ppNextVoidPtr = (void*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pNext->pNext);
+                    pUS->pSamplers = (XGL_SAMPLER*) glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pUS->pSamplers);
+                    break;
+                }
+                case XGL_STRUCTURE_TYPE_UPDATE_SAMPLER_TEXTURES:
+                {
+                    void** ppNextVoidPtr = (void**)&pNext->pNext;
+                    XGL_UPDATE_SAMPLER_TEXTURES* pUST = (XGL_UPDATE_SAMPLER_TEXTURES*)pNext;
+                    *ppNextVoidPtr = (void*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pNext->pNext);
+                    pUST->pSamplerImageViews = (XGL_SAMPLER_IMAGE_VIEW_INFO*) glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pUST->pSamplerImageViews);
+                    uint32_t i;
+                    for (i = 0; i < pUST->count; i++) {
+                        XGL_IMAGE_VIEW_ATTACH_INFO** ppLocalImageView = (XGL_IMAGE_VIEW_ATTACH_INFO**)&pUST->pSamplerImageViews[i].pImageView;
+                        *ppLocalImageView = (XGL_IMAGE_VIEW_ATTACH_INFO*) glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pUST->pSamplerImageViews[i].pImageView);
+                    }
+                    break;
+                }
+                case XGL_STRUCTURE_TYPE_UPDATE_IMAGES:
+                {
+                    void** ppNextVoidPtr = (void**)&pNext->pNext;
+                    XGL_UPDATE_IMAGES* pUI = (XGL_UPDATE_IMAGES*)pNext;
+                    *ppNextVoidPtr = (void*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pNext->pNext);
+                    XGL_IMAGE_VIEW_ATTACH_INFO** ppLocalImageView = (XGL_IMAGE_VIEW_ATTACH_INFO**)&pUI->pImageViews;
+                    *ppLocalImageView = (XGL_IMAGE_VIEW_ATTACH_INFO*) glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pUI->pImageViews);
+                    uint32_t i;
+                    for (i = 0; i < pUI->count; i++) {
+                        XGL_IMAGE_VIEW_ATTACH_INFO** ppLocalImageViews = (XGL_IMAGE_VIEW_ATTACH_INFO**)&pUI->pImageViews[i];
+                        *ppLocalImageViews = (XGL_IMAGE_VIEW_ATTACH_INFO*) glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pUI->pImageViews[i]);
+                    }
+                    break;
+                }
+                case XGL_STRUCTURE_TYPE_UPDATE_BUFFERS:
+                {
+                    void** ppNextVoidPtr = (void**)&pNext->pNext;
+                    XGL_UPDATE_BUFFERS* pUB = (XGL_UPDATE_BUFFERS*)pNext;
+                    *ppNextVoidPtr = (void*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pNext->pNext);
+                    XGL_BUFFER_VIEW_ATTACH_INFO** ppLocalBufferView = (XGL_BUFFER_VIEW_ATTACH_INFO**)&pUB->pBufferViews;
+                    *ppLocalBufferView = (XGL_BUFFER_VIEW_ATTACH_INFO*) glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pUB->pBufferViews);
+                    uint32_t i;
+                    for (i = 0; i < pUB->count; i++) {
+                        XGL_BUFFER_VIEW_ATTACH_INFO** ppLocalBufferViews = (XGL_BUFFER_VIEW_ATTACH_INFO**)&pUB->pBufferViews[i];
+                        *ppLocalBufferViews = (XGL_BUFFER_VIEW_ATTACH_INFO*) glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pUB->pBufferViews[i]);
+                    }
+                    break;
+                }
+                default:
+                {
+                   glv_LogError("Encountered an unexpected type in update descriptors pUpdateChain.\n");
+                   pPacket->header = NULL;
+                   pNext->pNext = NULL;
+                }
+            }
+            pNext = (XGL_UPDATE_SAMPLERS*)pNext->pNext;
+        }
+    }
+    return pPacket;
+}
+
+typedef struct struct_xglCreateDynamicViewportState {
+    glv_trace_packet_header* header;
+    XGL_DEVICE device;
+    const XGL_DYNAMIC_VP_STATE_CREATE_INFO* pCreateInfo;
+    XGL_DYNAMIC_VP_STATE_OBJECT* pState;
+    XGL_RESULT result;
+} struct_xglCreateDynamicViewportState;
+
+static struct_xglCreateDynamicViewportState* interpret_body_as_xglCreateDynamicViewportState(glv_trace_packet_header* pHeader)
+{
+    struct_xglCreateDynamicViewportState* pPacket = (struct_xglCreateDynamicViewportState*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->pCreateInfo = (const XGL_DYNAMIC_VP_STATE_CREATE_INFO*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pCreateInfo);
+    if (pPacket->pCreateInfo != NULL)
+    {
+        XGL_DYNAMIC_VP_STATE_CREATE_INFO* pInfo = (XGL_DYNAMIC_VP_STATE_CREATE_INFO*)pPacket->pCreateInfo;
+        pInfo->pViewports = (XGL_VIEWPORT*) glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pCreateInfo->pViewports);
+        pInfo->pScissors = (XGL_RECT*) glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pCreateInfo->pScissors);
+    }
+    pPacket->pState = (XGL_DYNAMIC_VP_STATE_OBJECT*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pState);
+    return pPacket;
+}
+
+typedef struct struct_xglCreateDynamicRasterState {
+    glv_trace_packet_header* header;
+    XGL_DEVICE device;
+    const XGL_DYNAMIC_RS_STATE_CREATE_INFO* pCreateInfo;
+    XGL_DYNAMIC_RS_STATE_OBJECT* pState;
+    XGL_RESULT result;
+} struct_xglCreateDynamicRasterState;
+
+static struct_xglCreateDynamicRasterState* interpret_body_as_xglCreateDynamicRasterState(glv_trace_packet_header* pHeader)
+{
+    struct_xglCreateDynamicRasterState* pPacket = (struct_xglCreateDynamicRasterState*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->pCreateInfo = (const XGL_DYNAMIC_RS_STATE_CREATE_INFO*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pCreateInfo);
+    pPacket->pState = (XGL_DYNAMIC_RS_STATE_OBJECT*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pState);
+    return pPacket;
+}
+
+typedef struct struct_xglCreateDynamicColorBlendState {
+    glv_trace_packet_header* header;
+    XGL_DEVICE device;
+    const XGL_DYNAMIC_CB_STATE_CREATE_INFO* pCreateInfo;
+    XGL_DYNAMIC_CB_STATE_OBJECT* pState;
+    XGL_RESULT result;
+} struct_xglCreateDynamicColorBlendState;
+
+static struct_xglCreateDynamicColorBlendState* interpret_body_as_xglCreateDynamicColorBlendState(glv_trace_packet_header* pHeader)
+{
+    struct_xglCreateDynamicColorBlendState* pPacket = (struct_xglCreateDynamicColorBlendState*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->pCreateInfo = (const XGL_DYNAMIC_CB_STATE_CREATE_INFO*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pCreateInfo);
+    pPacket->pState = (XGL_DYNAMIC_CB_STATE_OBJECT*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pState);
+    return pPacket;
+}
+
+typedef struct struct_xglCreateDynamicDepthStencilState {
+    glv_trace_packet_header* header;
+    XGL_DEVICE device;
+    const XGL_DYNAMIC_DS_STATE_CREATE_INFO* pCreateInfo;
+    XGL_DYNAMIC_DS_STATE_OBJECT* pState;
+    XGL_RESULT result;
+} struct_xglCreateDynamicDepthStencilState;
+
+static struct_xglCreateDynamicDepthStencilState* interpret_body_as_xglCreateDynamicDepthStencilState(glv_trace_packet_header* pHeader)
+{
+    struct_xglCreateDynamicDepthStencilState* pPacket = (struct_xglCreateDynamicDepthStencilState*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->pCreateInfo = (const XGL_DYNAMIC_DS_STATE_CREATE_INFO*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pCreateInfo);
+    pPacket->pState = (XGL_DYNAMIC_DS_STATE_OBJECT*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pState);
+    return pPacket;
+}
+
+typedef struct struct_xglCreateCommandBuffer {
+    glv_trace_packet_header* header;
+    XGL_DEVICE device;
+    const XGL_CMD_BUFFER_CREATE_INFO* pCreateInfo;
+    XGL_CMD_BUFFER* pCmdBuffer;
+    XGL_RESULT result;
+} struct_xglCreateCommandBuffer;
+
+static struct_xglCreateCommandBuffer* interpret_body_as_xglCreateCommandBuffer(glv_trace_packet_header* pHeader)
+{
+    struct_xglCreateCommandBuffer* pPacket = (struct_xglCreateCommandBuffer*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->pCreateInfo = (const XGL_CMD_BUFFER_CREATE_INFO*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pCreateInfo);
+    pPacket->pCmdBuffer = (XGL_CMD_BUFFER*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pCmdBuffer);
+    return pPacket;
+}
+
+typedef struct struct_xglBeginCommandBuffer {
+    glv_trace_packet_header* header;
+    XGL_CMD_BUFFER cmdBuffer;
+    const XGL_CMD_BUFFER_BEGIN_INFO* pBeginInfo;
+    XGL_RESULT result;
+} struct_xglBeginCommandBuffer;
+
+static struct_xglBeginCommandBuffer* interpret_body_as_xglBeginCommandBuffer(glv_trace_packet_header* pHeader)
+{
+    struct_xglBeginCommandBuffer* pPacket = (struct_xglBeginCommandBuffer*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->pBeginInfo = (const XGL_CMD_BUFFER_BEGIN_INFO*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pBeginInfo);
+    if (pPacket->pBeginInfo != NULL)
+    {
+        if (pPacket->pBeginInfo->sType == XGL_STRUCTURE_TYPE_CMD_BUFFER_BEGIN_INFO) {
+            // need to make a non-const pointer to the pointer so that we can properly change the original pointer to the interpretted one
+            XGL_CMD_BUFFER_GRAPHICS_BEGIN_INFO** ppNext = (XGL_CMD_BUFFER_GRAPHICS_BEGIN_INFO**)&(pPacket->pBeginInfo->pNext);
+            *ppNext = (XGL_CMD_BUFFER_GRAPHICS_BEGIN_INFO*) glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pBeginInfo->pNext);
+            XGL_CMD_BUFFER_GRAPHICS_BEGIN_INFO* pNext = *ppNext;
+            while (NULL != pNext)
+            {
+                switch(pNext->sType)
+                {
+                    case XGL_STRUCTURE_TYPE_CMD_BUFFER_GRAPHICS_BEGIN_INFO:
+                    {
+                        ppNext = (XGL_CMD_BUFFER_GRAPHICS_BEGIN_INFO**) &pNext->pNext;
+                        *ppNext = (XGL_CMD_BUFFER_GRAPHICS_BEGIN_INFO*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pNext->pNext);
+                        break;
+                    }
+                    default:
+                    {
+                        glv_LogError("Encountered an unexpected type in begin command buffer list.\n");
+                        pPacket->header = NULL;
+                        pNext->pNext = NULL;
+                    }
+                }
+                pNext = (XGL_CMD_BUFFER_GRAPHICS_BEGIN_INFO*)pNext->pNext;
+            }
+        } else {
+            // This is unexpected.
+            glv_LogError("BeginCommandBuffer must have BeginInfo stype of XGL_STRUCTURE_TYPE_CMD_BUFFER_BEGIN_INFO.\n");
+            pPacket->header = NULL;
+        }
+    }
+    return pPacket;
+}
+
+typedef struct struct_xglEndCommandBuffer {
+    glv_trace_packet_header* header;
+    XGL_CMD_BUFFER cmdBuffer;
+    XGL_RESULT result;
+} struct_xglEndCommandBuffer;
+
+static struct_xglEndCommandBuffer* interpret_body_as_xglEndCommandBuffer(glv_trace_packet_header* pHeader)
+{
+    struct_xglEndCommandBuffer* pPacket = (struct_xglEndCommandBuffer*)pHeader->pBody;
+    pPacket->header = pHeader;
+    return pPacket;
+}
+
+typedef struct struct_xglResetCommandBuffer {
+    glv_trace_packet_header* header;
+    XGL_CMD_BUFFER cmdBuffer;
+    XGL_RESULT result;
+} struct_xglResetCommandBuffer;
+
+static struct_xglResetCommandBuffer* interpret_body_as_xglResetCommandBuffer(glv_trace_packet_header* pHeader)
+{
+    struct_xglResetCommandBuffer* pPacket = (struct_xglResetCommandBuffer*)pHeader->pBody;
+    pPacket->header = pHeader;
+    return pPacket;
+}
+
+typedef struct struct_xglCmdBindPipeline {
+    glv_trace_packet_header* header;
+    XGL_CMD_BUFFER cmdBuffer;
+    XGL_PIPELINE_BIND_POINT pipelineBindPoint;
+    XGL_PIPELINE pipeline;
+} struct_xglCmdBindPipeline;
+
+static struct_xglCmdBindPipeline* interpret_body_as_xglCmdBindPipeline(glv_trace_packet_header* pHeader)
+{
+    struct_xglCmdBindPipeline* pPacket = (struct_xglCmdBindPipeline*)pHeader->pBody;
+    pPacket->header = pHeader;
+    return pPacket;
+}
+
+typedef struct struct_xglCmdBindPipelineDelta {
+    glv_trace_packet_header* header;
+    XGL_CMD_BUFFER cmdBuffer;
+    XGL_PIPELINE_BIND_POINT pipelineBindPoint;
+    XGL_PIPELINE_DELTA delta;
+} struct_xglCmdBindPipelineDelta;
+
+static struct_xglCmdBindPipelineDelta* interpret_body_as_xglCmdBindPipelineDelta(glv_trace_packet_header* pHeader)
+{
+    struct_xglCmdBindPipelineDelta* pPacket = (struct_xglCmdBindPipelineDelta*)pHeader->pBody;
+    pPacket->header = pHeader;
+    return pPacket;
+}
+
+typedef struct struct_xglCmdBindDynamicStateObject {
+    glv_trace_packet_header* header;
+    XGL_CMD_BUFFER cmdBuffer;
+    XGL_STATE_BIND_POINT stateBindPoint;
+    XGL_DYNAMIC_STATE_OBJECT state;
+} struct_xglCmdBindDynamicStateObject;
+
+static struct_xglCmdBindDynamicStateObject* interpret_body_as_xglCmdBindDynamicStateObject(glv_trace_packet_header* pHeader)
+{
+    struct_xglCmdBindDynamicStateObject* pPacket = (struct_xglCmdBindDynamicStateObject*)pHeader->pBody;
+    pPacket->header = pHeader;
+    return pPacket;
+}
+
+typedef struct struct_xglCmdBindDescriptorSet {
+    glv_trace_packet_header* header;
+    XGL_CMD_BUFFER cmdBuffer;
+    XGL_PIPELINE_BIND_POINT pipelineBindPoint;
+    XGL_DESCRIPTOR_SET descriptorSet;
+    const uint32_t* pUserData;
+} struct_xglCmdBindDescriptorSet;
+
+static struct_xglCmdBindDescriptorSet* interpret_body_as_xglCmdBindDescriptorSet(glv_trace_packet_header* pHeader)
+{
+    struct_xglCmdBindDescriptorSet* pPacket = (struct_xglCmdBindDescriptorSet*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->pUserData = (const uint32_t*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pUserData);
+    return pPacket;
+}
+
+typedef struct struct_xglCmdBindVertexBuffer {
+    glv_trace_packet_header* header;
+    XGL_CMD_BUFFER cmdBuffer;
+    XGL_BUFFER buffer;
+    XGL_GPU_SIZE offset;
+    uint32_t binding;
+} struct_xglCmdBindVertexBuffer;
+
+static struct_xglCmdBindVertexBuffer* interpret_body_as_xglCmdBindVertexBuffer(glv_trace_packet_header* pHeader)
+{
+    struct_xglCmdBindVertexBuffer* pPacket = (struct_xglCmdBindVertexBuffer*)pHeader->pBody;
+    pPacket->header = pHeader;
+    return pPacket;
+}
+
+typedef struct struct_xglCmdBindIndexBuffer {
+    glv_trace_packet_header* header;
+    XGL_CMD_BUFFER cmdBuffer;
+    XGL_BUFFER buffer;
+    XGL_GPU_SIZE offset;
+    XGL_INDEX_TYPE indexType;
+} struct_xglCmdBindIndexBuffer;
+
+static struct_xglCmdBindIndexBuffer* interpret_body_as_xglCmdBindIndexBuffer(glv_trace_packet_header* pHeader)
+{
+    struct_xglCmdBindIndexBuffer* pPacket = (struct_xglCmdBindIndexBuffer*)pHeader->pBody;
+    pPacket->header = pHeader;
+    return pPacket;
+}
+
+typedef struct struct_xglCmdDraw {
+    glv_trace_packet_header* header;
+    XGL_CMD_BUFFER cmdBuffer;
+    uint32_t firstVertex;
+    uint32_t vertexCount;
+    uint32_t firstInstance;
+    uint32_t instanceCount;
+} struct_xglCmdDraw;
+
+static struct_xglCmdDraw* interpret_body_as_xglCmdDraw(glv_trace_packet_header* pHeader)
+{
+    struct_xglCmdDraw* pPacket = (struct_xglCmdDraw*)pHeader->pBody;
+    pPacket->header = pHeader;
+    return pPacket;
+}
+
+typedef struct struct_xglCmdDrawIndexed {
+    glv_trace_packet_header* header;
+    XGL_CMD_BUFFER cmdBuffer;
+    uint32_t firstIndex;
+    uint32_t indexCount;
+    int32_t vertexOffset;
+    uint32_t firstInstance;
+    uint32_t instanceCount;
+} struct_xglCmdDrawIndexed;
+
+static struct_xglCmdDrawIndexed* interpret_body_as_xglCmdDrawIndexed(glv_trace_packet_header* pHeader)
+{
+    struct_xglCmdDrawIndexed* pPacket = (struct_xglCmdDrawIndexed*)pHeader->pBody;
+    pPacket->header = pHeader;
+    return pPacket;
+}
+
+typedef struct struct_xglCmdDrawIndirect {
+    glv_trace_packet_header* header;
+    XGL_CMD_BUFFER cmdBuffer;
+    XGL_BUFFER buffer;
+    XGL_GPU_SIZE offset;
+    uint32_t count;
+    uint32_t stride;
+} struct_xglCmdDrawIndirect;
+
+static struct_xglCmdDrawIndirect* interpret_body_as_xglCmdDrawIndirect(glv_trace_packet_header* pHeader)
+{
+    struct_xglCmdDrawIndirect* pPacket = (struct_xglCmdDrawIndirect*)pHeader->pBody;
+    pPacket->header = pHeader;
+    return pPacket;
+}
+
+typedef struct struct_xglCmdDrawIndexedIndirect {
+    glv_trace_packet_header* header;
+    XGL_CMD_BUFFER cmdBuffer;
+    XGL_BUFFER buffer;
+    XGL_GPU_SIZE offset;
+    uint32_t count;
+    uint32_t stride;
+} struct_xglCmdDrawIndexedIndirect;
+
+static struct_xglCmdDrawIndexedIndirect* interpret_body_as_xglCmdDrawIndexedIndirect(glv_trace_packet_header* pHeader)
+{
+    struct_xglCmdDrawIndexedIndirect* pPacket = (struct_xglCmdDrawIndexedIndirect*)pHeader->pBody;
+    pPacket->header = pHeader;
+    return pPacket;
+}
+
+typedef struct struct_xglCmdDispatch {
+    glv_trace_packet_header* header;
+    XGL_CMD_BUFFER cmdBuffer;
+    uint32_t x;
+    uint32_t y;
+    uint32_t z;
+} struct_xglCmdDispatch;
+
+static struct_xglCmdDispatch* interpret_body_as_xglCmdDispatch(glv_trace_packet_header* pHeader)
+{
+    struct_xglCmdDispatch* pPacket = (struct_xglCmdDispatch*)pHeader->pBody;
+    pPacket->header = pHeader;
+    return pPacket;
+}
+
+typedef struct struct_xglCmdDispatchIndirect {
+    glv_trace_packet_header* header;
+    XGL_CMD_BUFFER cmdBuffer;
+    XGL_BUFFER buffer;
+    XGL_GPU_SIZE offset;
+} struct_xglCmdDispatchIndirect;
+
+static struct_xglCmdDispatchIndirect* interpret_body_as_xglCmdDispatchIndirect(glv_trace_packet_header* pHeader)
+{
+    struct_xglCmdDispatchIndirect* pPacket = (struct_xglCmdDispatchIndirect*)pHeader->pBody;
+    pPacket->header = pHeader;
+    return pPacket;
+}
+
+typedef struct struct_xglCmdCopyBuffer {
+    glv_trace_packet_header* header;
+    XGL_CMD_BUFFER cmdBuffer;
+    XGL_BUFFER srcBuffer;
+    XGL_BUFFER destBuffer;
+    uint32_t regionCount;
+    const XGL_BUFFER_COPY* pRegions;
+} struct_xglCmdCopyBuffer;
+
+static struct_xglCmdCopyBuffer* interpret_body_as_xglCmdCopyBuffer(glv_trace_packet_header* pHeader)
+{
+    struct_xglCmdCopyBuffer* pPacket = (struct_xglCmdCopyBuffer*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->pRegions = (const XGL_BUFFER_COPY*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pRegions);
+    return pPacket;
+}
+
+typedef struct struct_xglCmdCopyImage {
+    glv_trace_packet_header* header;
+    XGL_CMD_BUFFER cmdBuffer;
+    XGL_IMAGE srcImage;
+    XGL_IMAGE destImage;
+    uint32_t regionCount;
+    const XGL_IMAGE_COPY* pRegions;
+} struct_xglCmdCopyImage;
+
+static struct_xglCmdCopyImage* interpret_body_as_xglCmdCopyImage(glv_trace_packet_header* pHeader)
+{
+    struct_xglCmdCopyImage* pPacket = (struct_xglCmdCopyImage*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->pRegions = (const XGL_IMAGE_COPY*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pRegions);
+    return pPacket;
+}
+
+typedef struct struct_xglCmdCopyBufferToImage {
+    glv_trace_packet_header* header;
+    XGL_CMD_BUFFER cmdBuffer;
+    XGL_BUFFER srcBuffer;
+    XGL_IMAGE destImage;
+    uint32_t regionCount;
+    const XGL_BUFFER_IMAGE_COPY* pRegions;
+} struct_xglCmdCopyBufferToImage;
+
+static struct_xglCmdCopyBufferToImage* interpret_body_as_xglCmdCopyBufferToImage(glv_trace_packet_header* pHeader)
+{
+    struct_xglCmdCopyBufferToImage* pPacket = (struct_xglCmdCopyBufferToImage*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->pRegions = (const XGL_BUFFER_IMAGE_COPY*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pRegions);
+    return pPacket;
+}
+
+typedef struct struct_xglCmdCopyImageToBuffer {
+    glv_trace_packet_header* header;
+    XGL_CMD_BUFFER cmdBuffer;
+    XGL_IMAGE srcImage;
+    XGL_BUFFER destBuffer;
+    uint32_t regionCount;
+    const XGL_BUFFER_IMAGE_COPY* pRegions;
+} struct_xglCmdCopyImageToBuffer;
+
+static struct_xglCmdCopyImageToBuffer* interpret_body_as_xglCmdCopyImageToBuffer(glv_trace_packet_header* pHeader)
+{
+    struct_xglCmdCopyImageToBuffer* pPacket = (struct_xglCmdCopyImageToBuffer*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->pRegions = (const XGL_BUFFER_IMAGE_COPY*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pRegions);
+    return pPacket;
+}
+
+typedef struct struct_xglCmdCloneImageData {
+    glv_trace_packet_header* header;
+    XGL_CMD_BUFFER cmdBuffer;
+    XGL_IMAGE srcImage;
+    XGL_IMAGE_LAYOUT srcImageLayout;
+    XGL_IMAGE destImage;
+    XGL_IMAGE_LAYOUT destImageLayout;
+} struct_xglCmdCloneImageData;
+
+static struct_xglCmdCloneImageData* interpret_body_as_xglCmdCloneImageData(glv_trace_packet_header* pHeader)
+{
+    struct_xglCmdCloneImageData* pPacket = (struct_xglCmdCloneImageData*)pHeader->pBody;
+    pPacket->header = pHeader;
+    return pPacket;
+}
+
+typedef struct struct_xglCmdUpdateBuffer {
+    glv_trace_packet_header* header;
+    XGL_CMD_BUFFER cmdBuffer;
+    XGL_BUFFER destBuffer;
+    XGL_GPU_SIZE destOffset;
+    XGL_GPU_SIZE dataSize;
+    const uint32_t* pData;
+} struct_xglCmdUpdateBuffer;
+
+static struct_xglCmdUpdateBuffer* interpret_body_as_xglCmdUpdateBuffer(glv_trace_packet_header* pHeader)
+{
+    struct_xglCmdUpdateBuffer* pPacket = (struct_xglCmdUpdateBuffer*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->pData = (const uint32_t*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pData);
+    return pPacket;
+}
+
+typedef struct struct_xglCmdFillBuffer {
+    glv_trace_packet_header* header;
+    XGL_CMD_BUFFER cmdBuffer;
+    XGL_BUFFER destBuffer;
+    XGL_GPU_SIZE destOffset;
+    XGL_GPU_SIZE fillSize;
+    uint32_t data;
+} struct_xglCmdFillBuffer;
+
+static struct_xglCmdFillBuffer* interpret_body_as_xglCmdFillBuffer(glv_trace_packet_header* pHeader)
+{
+    struct_xglCmdFillBuffer* pPacket = (struct_xglCmdFillBuffer*)pHeader->pBody;
+    pPacket->header = pHeader;
+    return pPacket;
+}
+
+typedef struct struct_xglCmdClearColorImage {
+    glv_trace_packet_header* header;
+    XGL_CMD_BUFFER cmdBuffer;
+    XGL_IMAGE image;
+    const float color[4];
+    uint32_t rangeCount;
+    const XGL_IMAGE_SUBRESOURCE_RANGE* pRanges;
+} struct_xglCmdClearColorImage;
+
+static struct_xglCmdClearColorImage* interpret_body_as_xglCmdClearColorImage(glv_trace_packet_header* pHeader)
+{
+    struct_xglCmdClearColorImage* pPacket = (struct_xglCmdClearColorImage*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->pRanges = (const XGL_IMAGE_SUBRESOURCE_RANGE*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pRanges);
+    return pPacket;
+}
+
+typedef struct struct_xglCmdClearColorImageRaw {
+    glv_trace_packet_header* header;
+    XGL_CMD_BUFFER cmdBuffer;
+    XGL_IMAGE image;
+    const uint32_t color[4];
+    uint32_t rangeCount;
+    const XGL_IMAGE_SUBRESOURCE_RANGE* pRanges;
+} struct_xglCmdClearColorImageRaw;
+
+static struct_xglCmdClearColorImageRaw* interpret_body_as_xglCmdClearColorImageRaw(glv_trace_packet_header* pHeader)
+{
+    struct_xglCmdClearColorImageRaw* pPacket = (struct_xglCmdClearColorImageRaw*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->pRanges = (const XGL_IMAGE_SUBRESOURCE_RANGE*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pRanges);
+    return pPacket;
+}
+
+typedef struct struct_xglCmdClearDepthStencil {
+    glv_trace_packet_header* header;
+    XGL_CMD_BUFFER cmdBuffer;
+    XGL_IMAGE image;
+    float depth;
+    uint32_t stencil;
+    uint32_t rangeCount;
+    const XGL_IMAGE_SUBRESOURCE_RANGE* pRanges;
+} struct_xglCmdClearDepthStencil;
+
+static struct_xglCmdClearDepthStencil* interpret_body_as_xglCmdClearDepthStencil(glv_trace_packet_header* pHeader)
+{
+    struct_xglCmdClearDepthStencil* pPacket = (struct_xglCmdClearDepthStencil*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->pRanges = (const XGL_IMAGE_SUBRESOURCE_RANGE*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pRanges);
+    return pPacket;
+}
+
+typedef struct struct_xglCmdResolveImage {
+    glv_trace_packet_header* header;
+    XGL_CMD_BUFFER cmdBuffer;
+    XGL_IMAGE srcImage;
+    XGL_IMAGE destImage;
+    uint32_t rectCount;
+    const XGL_IMAGE_RESOLVE* pRects;
+} struct_xglCmdResolveImage;
+
+static struct_xglCmdResolveImage* interpret_body_as_xglCmdResolveImage(glv_trace_packet_header* pHeader)
+{
+    struct_xglCmdResolveImage* pPacket = (struct_xglCmdResolveImage*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->pRects = (const XGL_IMAGE_RESOLVE*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pRects);
+    return pPacket;
+}
+
+typedef struct struct_xglCmdSetEvent {
+    glv_trace_packet_header* header;
+    XGL_CMD_BUFFER cmdBuffer;
+    XGL_EVENT event;
+    XGL_SET_EVENT pipeEvent;
+} struct_xglCmdSetEvent;
+
+static struct_xglCmdSetEvent* interpret_body_as_xglCmdSetEvent(glv_trace_packet_header* pHeader)
+{
+    struct_xglCmdSetEvent* pPacket = (struct_xglCmdSetEvent*)pHeader->pBody;
+    pPacket->header = pHeader;
+    return pPacket;
+}
+
+typedef struct struct_xglCmdResetEvent {
+    glv_trace_packet_header* header;
+    XGL_CMD_BUFFER cmdBuffer;
+    XGL_EVENT event;
+} struct_xglCmdResetEvent;
+
+static struct_xglCmdResetEvent* interpret_body_as_xglCmdResetEvent(glv_trace_packet_header* pHeader)
+{
+    struct_xglCmdResetEvent* pPacket = (struct_xglCmdResetEvent*)pHeader->pBody;
+    pPacket->header = pHeader;
+    return pPacket;
+}
+
+typedef struct struct_xglCmdWaitEvents {
+    glv_trace_packet_header* header;
+    XGL_CMD_BUFFER cmdBuffer;
+    const XGL_EVENT_WAIT_INFO* pWaitInfo;
+} struct_xglCmdWaitEvents;
+
+static struct_xglCmdWaitEvents* interpret_body_as_xglCmdWaitEvents(glv_trace_packet_header* pHeader)
+{
+    struct_xglCmdWaitEvents* pPacket = (struct_xglCmdWaitEvents*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->pWaitInfo = (const XGL_EVENT_WAIT_INFO*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pWaitInfo);
+    if (pPacket->pWaitInfo != NULL)
+    {
+        XGL_EVENT_WAIT_INFO* pInfo = (XGL_EVENT_WAIT_INFO*)pPacket->pWaitInfo;
+        pInfo->pEvents = (XGL_EVENT*) glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pWaitInfo->pEvents);
+        pInfo->ppMemBarriers = (const void**) glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pWaitInfo->ppMemBarriers);
+        uint32_t i;
+        for (i = 0; i < pInfo->memBarrierCount; i++) {
+            void** ppLocalMemBarriers = (void**)&pInfo->ppMemBarriers[i];
+            *ppLocalMemBarriers = (void*) glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pInfo->ppMemBarriers[i]);
+        }
+    }
+    return pPacket;
+}
+
+typedef struct struct_xglCmdPipelineBarrier {
+    glv_trace_packet_header* header;
+    XGL_CMD_BUFFER cmdBuffer;
+    const XGL_PIPELINE_BARRIER* pBarrier;
+} struct_xglCmdPipelineBarrier;
+
+static struct_xglCmdPipelineBarrier* interpret_body_as_xglCmdPipelineBarrier(glv_trace_packet_header* pHeader)
+{
+    struct_xglCmdPipelineBarrier* pPacket = (struct_xglCmdPipelineBarrier*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->pBarrier = (const XGL_PIPELINE_BARRIER*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pBarrier);
+    if (pPacket->pBarrier != NULL)
+    {
+        XGL_PIPELINE_BARRIER* pBarrier = (XGL_PIPELINE_BARRIER*)pPacket->pBarrier;
+        pBarrier->pEvents = (XGL_SET_EVENT*) glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pBarrier->pEvents);
+        pBarrier->ppMemBarriers = (const void**) glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pBarrier->ppMemBarriers);
+        uint32_t i;
+        for (i = 0; i < pBarrier->memBarrierCount; i++) {
+            void** ppLocalMemBarriers = (void**)&pBarrier->ppMemBarriers[i];
+            *ppLocalMemBarriers = (void*) glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pBarrier->ppMemBarriers[i]);
+        }
+    }
+    return pPacket;
+}
+
+typedef struct struct_xglCmdBeginQuery {
+    glv_trace_packet_header* header;
+    XGL_CMD_BUFFER cmdBuffer;
+    XGL_QUERY_POOL queryPool;
+    uint32_t slot;
+    XGL_FLAGS flags;
+} struct_xglCmdBeginQuery;
+
+static struct_xglCmdBeginQuery* interpret_body_as_xglCmdBeginQuery(glv_trace_packet_header* pHeader)
+{
+    struct_xglCmdBeginQuery* pPacket = (struct_xglCmdBeginQuery*)pHeader->pBody;
+    pPacket->header = pHeader;
+    return pPacket;
+}
+
+typedef struct struct_xglCmdEndQuery {
+    glv_trace_packet_header* header;
+    XGL_CMD_BUFFER cmdBuffer;
+    XGL_QUERY_POOL queryPool;
+    uint32_t slot;
+} struct_xglCmdEndQuery;
+
+static struct_xglCmdEndQuery* interpret_body_as_xglCmdEndQuery(glv_trace_packet_header* pHeader)
+{
+    struct_xglCmdEndQuery* pPacket = (struct_xglCmdEndQuery*)pHeader->pBody;
+    pPacket->header = pHeader;
+    return pPacket;
+}
+
+typedef struct struct_xglCmdResetQueryPool {
+    glv_trace_packet_header* header;
+    XGL_CMD_BUFFER cmdBuffer;
+    XGL_QUERY_POOL queryPool;
+    uint32_t startQuery;
+    uint32_t queryCount;
+} struct_xglCmdResetQueryPool;
+
+static struct_xglCmdResetQueryPool* interpret_body_as_xglCmdResetQueryPool(glv_trace_packet_header* pHeader)
+{
+    struct_xglCmdResetQueryPool* pPacket = (struct_xglCmdResetQueryPool*)pHeader->pBody;
+    pPacket->header = pHeader;
+    return pPacket;
+}
+
+typedef struct struct_xglCmdWriteTimestamp {
+    glv_trace_packet_header* header;
+    XGL_CMD_BUFFER cmdBuffer;
+    XGL_TIMESTAMP_TYPE timestampType;
+    XGL_BUFFER destBuffer;
+    XGL_GPU_SIZE destOffset;
+} struct_xglCmdWriteTimestamp;
+
+static struct_xglCmdWriteTimestamp* interpret_body_as_xglCmdWriteTimestamp(glv_trace_packet_header* pHeader)
+{
+    struct_xglCmdWriteTimestamp* pPacket = (struct_xglCmdWriteTimestamp*)pHeader->pBody;
+    pPacket->header = pHeader;
+    return pPacket;
+}
+
+typedef struct struct_xglCmdInitAtomicCounters {
+    glv_trace_packet_header* header;
+    XGL_CMD_BUFFER cmdBuffer;
+    XGL_PIPELINE_BIND_POINT pipelineBindPoint;
+    uint32_t startCounter;
+    uint32_t counterCount;
+    const uint32_t* pData;
+} struct_xglCmdInitAtomicCounters;
+
+static struct_xglCmdInitAtomicCounters* interpret_body_as_xglCmdInitAtomicCounters(glv_trace_packet_header* pHeader)
+{
+    struct_xglCmdInitAtomicCounters* pPacket = (struct_xglCmdInitAtomicCounters*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->pData = (const uint32_t*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pData);
+    return pPacket;
+}
+
+typedef struct struct_xglCmdLoadAtomicCounters {
+    glv_trace_packet_header* header;
+    XGL_CMD_BUFFER cmdBuffer;
+    XGL_PIPELINE_BIND_POINT pipelineBindPoint;
+    uint32_t startCounter;
+    uint32_t counterCount;
+    XGL_BUFFER srcBuffer;
+    XGL_GPU_SIZE srcOffset;
+} struct_xglCmdLoadAtomicCounters;
+
+static struct_xglCmdLoadAtomicCounters* interpret_body_as_xglCmdLoadAtomicCounters(glv_trace_packet_header* pHeader)
+{
+    struct_xglCmdLoadAtomicCounters* pPacket = (struct_xglCmdLoadAtomicCounters*)pHeader->pBody;
+    pPacket->header = pHeader;
+    return pPacket;
+}
+
+typedef struct struct_xglCmdSaveAtomicCounters {
+    glv_trace_packet_header* header;
+    XGL_CMD_BUFFER cmdBuffer;
+    XGL_PIPELINE_BIND_POINT pipelineBindPoint;
+    uint32_t startCounter;
+    uint32_t counterCount;
+    XGL_BUFFER destBuffer;
+    XGL_GPU_SIZE destOffset;
+} struct_xglCmdSaveAtomicCounters;
+
+static struct_xglCmdSaveAtomicCounters* interpret_body_as_xglCmdSaveAtomicCounters(glv_trace_packet_header* pHeader)
+{
+    struct_xglCmdSaveAtomicCounters* pPacket = (struct_xglCmdSaveAtomicCounters*)pHeader->pBody;
+    pPacket->header = pHeader;
+    return pPacket;
+}
+
+typedef struct struct_xglCreateFramebuffer {
+    glv_trace_packet_header* header;
+    XGL_DEVICE device;
+    const XGL_FRAMEBUFFER_CREATE_INFO* pCreateInfo;
+    XGL_FRAMEBUFFER* pFramebuffer;
+    XGL_RESULT result;
+} struct_xglCreateFramebuffer;
+
+static struct_xglCreateFramebuffer* interpret_body_as_xglCreateFramebuffer(glv_trace_packet_header* pHeader)
+{
+    struct_xglCreateFramebuffer* pPacket = (struct_xglCreateFramebuffer*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->pCreateInfo = (const XGL_FRAMEBUFFER_CREATE_INFO*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pCreateInfo);
+    if (pPacket->pCreateInfo != NULL)
+    {
+        XGL_FRAMEBUFFER_CREATE_INFO* pInfo = (XGL_FRAMEBUFFER_CREATE_INFO*)pPacket->pCreateInfo;
+        pInfo->pColorAttachments = (XGL_COLOR_ATTACHMENT_BIND_INFO*) glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pCreateInfo->pColorAttachments);
+        pInfo->pDepthStencilAttachment = (XGL_DEPTH_STENCIL_BIND_INFO*) glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pCreateInfo->pDepthStencilAttachment);
+
+    }
+    pPacket->pFramebuffer = (XGL_FRAMEBUFFER*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pFramebuffer);
+    return pPacket;
+}
+
+typedef struct struct_xglCreateRenderPass {
+    glv_trace_packet_header* header;
+    XGL_DEVICE device;
+    const XGL_RENDER_PASS_CREATE_INFO* pCreateInfo;
+    XGL_RENDER_PASS* pRenderPass;
+    XGL_RESULT result;
+} struct_xglCreateRenderPass;
+
+static struct_xglCreateRenderPass* interpret_body_as_xglCreateRenderPass(glv_trace_packet_header* pHeader)
+{
+    struct_xglCreateRenderPass* pPacket = (struct_xglCreateRenderPass*)pHeader->pBody;
+    pPacket->header = pHeader;
+    pPacket->pCreateInfo = (const XGL_RENDER_PASS_CREATE_INFO*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pCreateInfo);
+    if (pPacket->pCreateInfo != NULL)
+    {
+        XGL_RENDER_PASS_CREATE_INFO* pInfo = (XGL_RENDER_PASS_CREATE_INFO*)pPacket->pCreateInfo;
+        pInfo->pColorLoadOps = (XGL_ATTACHMENT_LOAD_OP*) glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pCreateInfo->pColorLoadOps);
+        pInfo->pColorStoreOps = (XGL_ATTACHMENT_STORE_OP*) glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pCreateInfo->pColorStoreOps);
+        pInfo->pColorLoadClearValues = (XGL_CLEAR_COLOR*) glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pCreateInfo->pColorLoadClearValues);
+
+    }
+    pPacket->pRenderPass = (XGL_RENDER_PASS*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pRenderPass);
+    return pPacket;
+}
+
+typedef struct struct_xglCmdBeginRenderPass {
+    glv_trace_packet_header* header;
+    XGL_CMD_BUFFER cmdBuffer;
+    XGL_RENDER_PASS renderPass;
+} struct_xglCmdBeginRenderPass;
+
+static struct_xglCmdBeginRenderPass* interpret_body_as_xglCmdBeginRenderPass(glv_trace_packet_header* pHeader)
+{
+    struct_xglCmdBeginRenderPass* pPacket = (struct_xglCmdBeginRenderPass*)pHeader->pBody;
+    pPacket->header = pHeader;
+    return pPacket;
+}
+
+typedef struct struct_xglCmdEndRenderPass {
+    glv_trace_packet_header* header;
+    XGL_CMD_BUFFER cmdBuffer;
+    XGL_RENDER_PASS renderPass;
+} struct_xglCmdEndRenderPass;
+
+static struct_xglCmdEndRenderPass* interpret_body_as_xglCmdEndRenderPass(glv_trace_packet_header* pHeader)
+{
+    struct_xglCmdEndRenderPass* pPacket = (struct_xglCmdEndRenderPass*)pHeader->pBody;
+    pPacket->header = pHeader;
+    return pPacket;
+}
+
diff --git a/tools/glave/src/glv_extensions/glvtrace_xgl/codegen/glvtrace_xgl_xgldbg.c b/tools/glave/src/glv_extensions/glvtrace_xgl/codegen/glvtrace_xgl_xgldbg.c
new file mode 100644
index 0000000..a298093
--- /dev/null
+++ b/tools/glave/src/glv_extensions/glvtrace_xgl/codegen/glvtrace_xgl_xgldbg.c
@@ -0,0 +1,313 @@
+/* THIS FILE IS GENERATED.  DO NOT EDIT. */
+
+/*
+ * XGL
+ *
+ * Copyright (C) 2014 LunarG, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+#include "glv_platform.h"
+#include "glv_common.h"
+#include "glvtrace_xgl_xgl.h"
+#include "glvtrace_xgl_xgldbg.h"
+#include "glvtrace_xgl_xgldbg_structs.h"
+#include "glvtrace_xgl_packet_id.h"
+#ifdef WIN32
+#include "mhook/mhook-lib/mhook.h"
+#endif
+
+static XGL_RESULT( XGLAPI * real_xglDbgSetValidationLevel)(
+    XGL_DEVICE device,
+    XGL_VALIDATION_LEVEL validationLevel) = xglDbgSetValidationLevel;
+
+static XGL_RESULT( XGLAPI * real_xglDbgRegisterMsgCallback)(
+    XGL_DBG_MSG_CALLBACK_FUNCTION pfnMsgCallback,
+    void* pUserData) = xglDbgRegisterMsgCallback;
+
+static XGL_RESULT( XGLAPI * real_xglDbgUnregisterMsgCallback)(
+    XGL_DBG_MSG_CALLBACK_FUNCTION pfnMsgCallback) = xglDbgUnregisterMsgCallback;
+
+static XGL_RESULT( XGLAPI * real_xglDbgSetMessageFilter)(
+    XGL_DEVICE device,
+    int32_t msgCode,
+    XGL_DBG_MSG_FILTER filter) = xglDbgSetMessageFilter;
+
+static XGL_RESULT( XGLAPI * real_xglDbgSetObjectTag)(
+    XGL_BASE_OBJECT object,
+    size_t tagSize,
+    const void* pTag) = xglDbgSetObjectTag;
+
+static XGL_RESULT( XGLAPI * real_xglDbgSetGlobalOption)(
+    XGL_DBG_GLOBAL_OPTION dbgOption,
+    size_t dataSize,
+    const void* pData) = xglDbgSetGlobalOption;
+
+static XGL_RESULT( XGLAPI * real_xglDbgSetDeviceOption)(
+    XGL_DEVICE device,
+    XGL_DBG_DEVICE_OPTION dbgOption,
+    size_t dataSize,
+    const void* pData) = xglDbgSetDeviceOption;
+
+static void( XGLAPI * real_xglCmdDbgMarkerBegin)(
+    XGL_CMD_BUFFER cmdBuffer,
+    const char* pMarker) = xglCmdDbgMarkerBegin;
+
+static void( XGLAPI * real_xglCmdDbgMarkerEnd)(
+    XGL_CMD_BUFFER cmdBuffer) = xglCmdDbgMarkerEnd;
+
+void AttachHooks_xgldbg()
+{
+    BOOL hookSuccess = TRUE;
+#if defined(WIN32)
+    Mhook_BeginMultiOperation(FALSE);
+    if (real_xglDbgSetValidationLevel != NULL)
+    {
+        hookSuccess = Mhook_SetHook((PVOID*)&real_xglDbgSetValidationLevel, hooked_xglDbgSetValidationLevel);
+        hookSuccess &= Mhook_SetHook((PVOID*)&real_xglDbgRegisterMsgCallback, hooked_xglDbgRegisterMsgCallback);
+        hookSuccess &= Mhook_SetHook((PVOID*)&real_xglDbgUnregisterMsgCallback, hooked_xglDbgUnregisterMsgCallback);
+        hookSuccess &= Mhook_SetHook((PVOID*)&real_xglDbgSetMessageFilter, hooked_xglDbgSetMessageFilter);
+        hookSuccess &= Mhook_SetHook((PVOID*)&real_xglDbgSetObjectTag, hooked_xglDbgSetObjectTag);
+        hookSuccess &= Mhook_SetHook((PVOID*)&real_xglDbgSetGlobalOption, hooked_xglDbgSetGlobalOption);
+        hookSuccess &= Mhook_SetHook((PVOID*)&real_xglDbgSetDeviceOption, hooked_xglDbgSetDeviceOption);
+        hookSuccess &= Mhook_SetHook((PVOID*)&real_xglCmdDbgMarkerBegin, hooked_xglCmdDbgMarkerBegin);
+        hookSuccess &= Mhook_SetHook((PVOID*)&real_xglCmdDbgMarkerEnd, hooked_xglCmdDbgMarkerEnd);
+    }
+
+    if (!hookSuccess)
+    {
+        glv_LogError("Failed to hook XGL ext Dbg.");
+    }
+
+    Mhook_EndMultiOperation();
+
+#elif defined(__linux__)
+    hookSuccess = glv_platform_get_next_lib_sym((PVOID*)&real_xglDbgSetValidationLevel, "xglDbgSetValidationLevel");
+    hookSuccess &= glv_platform_get_next_lib_sym((PVOID*)&real_xglDbgRegisterMsgCallback, "xglDbgRegisterMsgCallback");
+    hookSuccess &= glv_platform_get_next_lib_sym((PVOID*)&real_xglDbgUnregisterMsgCallback, "xglDbgUnregisterMsgCallback");
+    hookSuccess &= glv_platform_get_next_lib_sym((PVOID*)&real_xglDbgSetMessageFilter, "xglDbgSetMessageFilter");
+    hookSuccess &= glv_platform_get_next_lib_sym((PVOID*)&real_xglDbgSetObjectTag, "xglDbgSetObjectTag");
+    hookSuccess &= glv_platform_get_next_lib_sym((PVOID*)&real_xglDbgSetGlobalOption, "xglDbgSetGlobalOption");
+    hookSuccess &= glv_platform_get_next_lib_sym((PVOID*)&real_xglDbgSetDeviceOption, "xglDbgSetDeviceOption");
+    hookSuccess &= glv_platform_get_next_lib_sym((PVOID*)&real_xglCmdDbgMarkerBegin, "xglCmdDbgMarkerBegin");
+    hookSuccess &= glv_platform_get_next_lib_sym((PVOID*)&real_xglCmdDbgMarkerEnd, "xglCmdDbgMarkerEnd");
+    if (!hookSuccess)
+    {
+        glv_LogError("Failed to hook XGL ext Dbg.");
+    }
+
+#endif
+}
+
+void DetachHooks_xgldbg()
+{
+#ifdef WIN32
+    BOOL unhookSuccess = TRUE;
+    if (real_xglDbgSetValidationLevel != NULL)
+    {
+        unhookSuccess = Mhook_Unhook((PVOID*)&real_xglDbgSetValidationLevel);
+        unhookSuccess &= Mhook_Unhook((PVOID*)&real_xglDbgRegisterMsgCallback);
+        unhookSuccess &= Mhook_Unhook((PVOID*)&real_xglDbgUnregisterMsgCallback);
+        unhookSuccess &= Mhook_Unhook((PVOID*)&real_xglDbgSetMessageFilter);
+        unhookSuccess &= Mhook_Unhook((PVOID*)&real_xglDbgSetObjectTag);
+        unhookSuccess &= Mhook_Unhook((PVOID*)&real_xglDbgSetGlobalOption);
+        unhookSuccess &= Mhook_Unhook((PVOID*)&real_xglDbgSetDeviceOption);
+        unhookSuccess &= Mhook_Unhook((PVOID*)&real_xglCmdDbgMarkerBegin);
+        unhookSuccess &= Mhook_Unhook((PVOID*)&real_xglCmdDbgMarkerEnd);
+    }
+    if (!unhookSuccess)
+    {
+        glv_LogError("Failed to unhook XGL ext Dbg.");
+    }
+#elif defined(__linux__)
+    return;
+#endif
+}
+
+GLVTRACER_EXPORT XGL_RESULT XGLAPI __HOOKED_xglDbgSetValidationLevel(
+    XGL_DEVICE device,
+    XGL_VALIDATION_LEVEL validationLevel)
+{
+    glv_trace_packet_header* pHeader;
+    XGL_RESULT result;
+    struct_xglDbgSetValidationLevel* pPacket = NULL;
+    SEND_ENTRYPOINT_ID(xglDbgSetValidationLevel);
+    CREATE_TRACE_PACKET(xglDbgSetValidationLevel, 0);
+    result = real_xglDbgSetValidationLevel(device, validationLevel);
+    pPacket = interpret_body_as_xglDbgSetValidationLevel(pHeader);
+    pPacket->device = device;
+    pPacket->validationLevel = validationLevel;
+    pPacket->result = result;
+    FINISH_TRACE_PACKET();
+    return result;
+}
+
+GLVTRACER_EXPORT XGL_RESULT XGLAPI __HOOKED_xglDbgRegisterMsgCallback(
+    XGL_DBG_MSG_CALLBACK_FUNCTION pfnMsgCallback,
+    void* pUserData)
+{
+    glv_trace_packet_header* pHeader;
+    XGL_RESULT result;
+    struct_xglDbgRegisterMsgCallback* pPacket = NULL;
+    glv_platform_thread_once(&gInitOnce, InitTracer);
+    SEND_ENTRYPOINT_ID(xglDbgRegisterMsgCallback);
+    CREATE_TRACE_PACKET(xglDbgRegisterMsgCallback, sizeof(char));
+    result = real_xglDbgRegisterMsgCallback(pfnMsgCallback, pUserData);
+    pPacket = interpret_body_as_xglDbgRegisterMsgCallback(pHeader);
+    pPacket->pfnMsgCallback = pfnMsgCallback;
+    glv_add_buffer_to_trace_packet(pHeader, (void**)&(pPacket->pUserData), sizeof(char), pUserData);
+    pPacket->result = result;
+    glv_finalize_buffer_address(pHeader, (void**)&(pPacket->pUserData));
+    FINISH_TRACE_PACKET();
+    return result;
+}
+
+GLVTRACER_EXPORT XGL_RESULT XGLAPI __HOOKED_xglDbgUnregisterMsgCallback(
+    XGL_DBG_MSG_CALLBACK_FUNCTION pfnMsgCallback)
+{
+    glv_trace_packet_header* pHeader;
+    XGL_RESULT result;
+    struct_xglDbgUnregisterMsgCallback* pPacket = NULL;
+    glv_platform_thread_once(&gInitOnce, InitTracer);
+    SEND_ENTRYPOINT_ID(xglDbgUnregisterMsgCallback);
+    CREATE_TRACE_PACKET(xglDbgUnregisterMsgCallback, 0);
+    result = real_xglDbgUnregisterMsgCallback(pfnMsgCallback);
+    pPacket = interpret_body_as_xglDbgUnregisterMsgCallback(pHeader);
+    pPacket->pfnMsgCallback = pfnMsgCallback;
+    pPacket->result = result;
+    FINISH_TRACE_PACKET();
+    return result;
+}
+
+GLVTRACER_EXPORT XGL_RESULT XGLAPI __HOOKED_xglDbgSetMessageFilter(
+    XGL_DEVICE device,
+    int32_t msgCode,
+    XGL_DBG_MSG_FILTER filter)
+{
+    glv_trace_packet_header* pHeader;
+    XGL_RESULT result;
+    struct_xglDbgSetMessageFilter* pPacket = NULL;
+    SEND_ENTRYPOINT_ID(xglDbgSetMessageFilter);
+    CREATE_TRACE_PACKET(xglDbgSetMessageFilter, 0);
+    result = real_xglDbgSetMessageFilter(device, msgCode, filter);
+    pPacket = interpret_body_as_xglDbgSetMessageFilter(pHeader);
+    pPacket->device = device;
+    pPacket->msgCode = msgCode;
+    pPacket->filter = filter;
+    pPacket->result = result;
+    FINISH_TRACE_PACKET();
+    return result;
+}
+
+GLVTRACER_EXPORT XGL_RESULT XGLAPI __HOOKED_xglDbgSetObjectTag(
+    XGL_BASE_OBJECT object,
+    size_t tagSize,
+    const void* pTag)
+{
+    glv_trace_packet_header* pHeader;
+    XGL_RESULT result;
+    struct_xglDbgSetObjectTag* pPacket = NULL;
+    SEND_ENTRYPOINT_ID(xglDbgSetObjectTag);
+    CREATE_TRACE_PACKET(xglDbgSetObjectTag, tagSize);
+    result = real_xglDbgSetObjectTag(object, tagSize, pTag);
+    pPacket = interpret_body_as_xglDbgSetObjectTag(pHeader);
+    pPacket->object = object;
+    pPacket->tagSize = tagSize;
+    glv_add_buffer_to_trace_packet(pHeader, (void**)&(pPacket->pTag), tagSize, pTag);
+    pPacket->result = result;
+    glv_finalize_buffer_address(pHeader, (void**)&(pPacket->pTag));
+    FINISH_TRACE_PACKET();
+    return result;
+}
+
+GLVTRACER_EXPORT XGL_RESULT XGLAPI __HOOKED_xglDbgSetGlobalOption(
+    XGL_DBG_GLOBAL_OPTION dbgOption,
+    size_t dataSize,
+    const void* pData)
+{
+    glv_trace_packet_header* pHeader;
+    XGL_RESULT result;
+    struct_xglDbgSetGlobalOption* pPacket = NULL;
+    glv_platform_thread_once(&gInitOnce, InitTracer);
+    SEND_ENTRYPOINT_ID(xglDbgSetGlobalOption);
+    CREATE_TRACE_PACKET(xglDbgSetGlobalOption, dataSize);
+    result = real_xglDbgSetGlobalOption(dbgOption, dataSize, pData);
+    pPacket = interpret_body_as_xglDbgSetGlobalOption(pHeader);
+    pPacket->dbgOption = dbgOption;
+    pPacket->dataSize = dataSize;
+    glv_add_buffer_to_trace_packet(pHeader, (void**)&(pPacket->pData), dataSize, pData);
+    pPacket->result = result;
+    glv_finalize_buffer_address(pHeader, (void**)&(pPacket->pData));
+    FINISH_TRACE_PACKET();
+    return result;
+}
+
+GLVTRACER_EXPORT XGL_RESULT XGLAPI __HOOKED_xglDbgSetDeviceOption(
+    XGL_DEVICE device,
+    XGL_DBG_DEVICE_OPTION dbgOption,
+    size_t dataSize,
+    const void* pData)
+{
+    glv_trace_packet_header* pHeader;
+    XGL_RESULT result;
+    struct_xglDbgSetDeviceOption* pPacket = NULL;
+    SEND_ENTRYPOINT_ID(xglDbgSetDeviceOption);
+    CREATE_TRACE_PACKET(xglDbgSetDeviceOption, dataSize);
+    result = real_xglDbgSetDeviceOption(device, dbgOption, dataSize, pData);
+    pPacket = interpret_body_as_xglDbgSetDeviceOption(pHeader);
+    pPacket->device = device;
+    pPacket->dbgOption = dbgOption;
+    pPacket->dataSize = dataSize;
+    glv_add_buffer_to_trace_packet(pHeader, (void**)&(pPacket->pData), dataSize, pData);
+    pPacket->result = result;
+    glv_finalize_buffer_address(pHeader, (void**)&(pPacket->pData));
+    FINISH_TRACE_PACKET();
+    return result;
+}
+
+GLVTRACER_EXPORT void XGLAPI __HOOKED_xglCmdDbgMarkerBegin(
+    XGL_CMD_BUFFER cmdBuffer,
+    const char* pMarker)
+{
+    glv_trace_packet_header* pHeader;
+    struct_xglCmdDbgMarkerBegin* pPacket = NULL;
+    SEND_ENTRYPOINT_ID(xglCmdDbgMarkerBegin);
+    CREATE_TRACE_PACKET(xglCmdDbgMarkerBegin, ((pMarker != NULL) ? strlen(pMarker) + 1 : 0));
+    real_xglCmdDbgMarkerBegin(cmdBuffer, pMarker);
+    pPacket = interpret_body_as_xglCmdDbgMarkerBegin(pHeader);
+    pPacket->cmdBuffer = cmdBuffer;
+    glv_add_buffer_to_trace_packet(pHeader, (void**)&(pPacket->pMarker), ((pMarker != NULL) ? strlen(pMarker) + 1 : 0), pMarker);
+    glv_finalize_buffer_address(pHeader, (void**)&(pPacket->pMarker));
+    FINISH_TRACE_PACKET();
+}
+
+GLVTRACER_EXPORT void XGLAPI __HOOKED_xglCmdDbgMarkerEnd(
+    XGL_CMD_BUFFER cmdBuffer)
+{
+    glv_trace_packet_header* pHeader;
+    struct_xglCmdDbgMarkerEnd* pPacket = NULL;
+    SEND_ENTRYPOINT_ID(xglCmdDbgMarkerEnd);
+    CREATE_TRACE_PACKET(xglCmdDbgMarkerEnd, 0);
+    real_xglCmdDbgMarkerEnd(cmdBuffer);
+    pPacket = interpret_body_as_xglCmdDbgMarkerEnd(pHeader);
+    pPacket->cmdBuffer = cmdBuffer;
+    FINISH_TRACE_PACKET();
+}
+
diff --git a/tools/glave/src/glv_extensions/glvtrace_xgl/codegen/glvtrace_xgl_xgldbg.h b/tools/glave/src/glv_extensions/glvtrace_xgl/codegen/glvtrace_xgl_xgldbg.h
new file mode 100644
index 0000000..a094473
--- /dev/null
+++ b/tools/glave/src/glv_extensions/glvtrace_xgl/codegen/glvtrace_xgl_xgldbg.h
@@ -0,0 +1,67 @@
+/* THIS FILE IS GENERATED.  DO NOT EDIT. */
+
+/*
+ * XGL
+ *
+ * Copyright (C) 2014 LunarG, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+#pragma once
+
+#include "xgl.h"
+#include "xglDbg.h"
+
+void AttachHooks_xgldbg();
+void DetachHooks_xgldbg();
+
+#ifdef WIN32
+#define __HOOKED_xglDbgSetValidationLevel hooked_xglDbgSetValidationLevel
+#define __HOOKED_xglDbgRegisterMsgCallback hooked_xglDbgRegisterMsgCallback
+#define __HOOKED_xglDbgUnregisterMsgCallback hooked_xglDbgUnregisterMsgCallback
+#define __HOOKED_xglDbgSetMessageFilter hooked_xglDbgSetMessageFilter
+#define __HOOKED_xglDbgSetObjectTag hooked_xglDbgSetObjectTag
+#define __HOOKED_xglDbgSetGlobalOption hooked_xglDbgSetGlobalOption
+#define __HOOKED_xglDbgSetDeviceOption hooked_xglDbgSetDeviceOption
+#define __HOOKED_xglCmdDbgMarkerBegin hooked_xglCmdDbgMarkerBegin
+#define __HOOKED_xglCmdDbgMarkerEnd hooked_xglCmdDbgMarkerEnd
+#elif defined(__linux__)
+#define __HOOKED_xglDbgSetValidationLevel xglDbgSetValidationLevel
+#define __HOOKED_xglDbgRegisterMsgCallback xglDbgRegisterMsgCallback
+#define __HOOKED_xglDbgUnregisterMsgCallback xglDbgUnregisterMsgCallback
+#define __HOOKED_xglDbgSetMessageFilter xglDbgSetMessageFilter
+#define __HOOKED_xglDbgSetObjectTag xglDbgSetObjectTag
+#define __HOOKED_xglDbgSetGlobalOption xglDbgSetGlobalOption
+#define __HOOKED_xglDbgSetDeviceOption xglDbgSetDeviceOption
+#define __HOOKED_xglCmdDbgMarkerBegin xglCmdDbgMarkerBegin
+#define __HOOKED_xglCmdDbgMarkerEnd xglCmdDbgMarkerEnd
+#endif
+
+// Hooked function prototypes
+
+GLVTRACER_EXPORT XGL_RESULT XGLAPI __HOOKED_xglDbgSetValidationLevel(XGL_DEVICE device, XGL_VALIDATION_LEVEL validationLevel);
+GLVTRACER_EXPORT XGL_RESULT XGLAPI __HOOKED_xglDbgRegisterMsgCallback(XGL_DBG_MSG_CALLBACK_FUNCTION pfnMsgCallback, void* pUserData);
+GLVTRACER_EXPORT XGL_RESULT XGLAPI __HOOKED_xglDbgUnregisterMsgCallback(XGL_DBG_MSG_CALLBACK_FUNCTION pfnMsgCallback);
+GLVTRACER_EXPORT XGL_RESULT XGLAPI __HOOKED_xglDbgSetMessageFilter(XGL_DEVICE device, int32_t msgCode, XGL_DBG_MSG_FILTER filter);
+GLVTRACER_EXPORT XGL_RESULT XGLAPI __HOOKED_xglDbgSetObjectTag(XGL_BASE_OBJECT object, size_t tagSize, const void* pTag);
+GLVTRACER_EXPORT XGL_RESULT XGLAPI __HOOKED_xglDbgSetGlobalOption(XGL_DBG_GLOBAL_OPTION dbgOption, size_t dataSize, const void* pData);
+GLVTRACER_EXPORT XGL_RESULT XGLAPI __HOOKED_xglDbgSetDeviceOption(XGL_DEVICE device, XGL_DBG_DEVICE_OPTION dbgOption, size_t dataSize, const void* pData);
+GLVTRACER_EXPORT void XGLAPI __HOOKED_xglCmdDbgMarkerBegin(XGL_CMD_BUFFER cmdBuffer, const char* pMarker);
+GLVTRACER_EXPORT void XGLAPI __HOOKED_xglCmdDbgMarkerEnd(XGL_CMD_BUFFER cmdBuffer);
diff --git a/tools/glave/src/glv_extensions/glvtrace_xgl/codegen/glvtrace_xgl_xgldbg_structs.h b/tools/glave/src/glv_extensions/glvtrace_xgl/codegen/glvtrace_xgl_xgldbg_structs.h
new file mode 100644
index 0000000..cfe77e6
--- /dev/null
+++ b/tools/glave/src/glv_extensions/glvtrace_xgl/codegen/glvtrace_xgl_xgldbg_structs.h
@@ -0,0 +1,164 @@
+/* THIS FILE IS GENERATED.  DO NOT EDIT. */
+
+/*
+ * XGL
+ *
+ * Copyright (C) 2014 LunarG, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+#pragma once
+
+#include "xglDbg.h"
+#include "glv_trace_packet_utils.h"
+
+
+typedef struct struct_xglDbgSetValidationLevel {
+    glv_trace_packet_header* pHeader;
+    XGL_DEVICE device;
+    XGL_VALIDATION_LEVEL validationLevel;
+    XGL_RESULT result;
+} struct_xglDbgSetValidationLevel;
+
+static struct_xglDbgSetValidationLevel* interpret_body_as_xglDbgSetValidationLevel(glv_trace_packet_header* pHeader)
+{
+    struct_xglDbgSetValidationLevel* pPacket = (struct_xglDbgSetValidationLevel*)pHeader->pBody;
+    pPacket->pHeader = pHeader;
+    return pPacket;
+}
+
+typedef struct struct_xglDbgRegisterMsgCallback {
+    glv_trace_packet_header* pHeader;
+    XGL_DBG_MSG_CALLBACK_FUNCTION pfnMsgCallback;
+    void* pUserData;
+    XGL_RESULT result;
+} struct_xglDbgRegisterMsgCallback;
+
+static struct_xglDbgRegisterMsgCallback* interpret_body_as_xglDbgRegisterMsgCallback(glv_trace_packet_header* pHeader)
+{
+    struct_xglDbgRegisterMsgCallback* pPacket = (struct_xglDbgRegisterMsgCallback*)pHeader->pBody;
+    pPacket->pHeader = pHeader;
+    pPacket->pUserData = (void*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pUserData);
+    return pPacket;
+}
+
+typedef struct struct_xglDbgUnregisterMsgCallback {
+    glv_trace_packet_header* pHeader;
+    XGL_DBG_MSG_CALLBACK_FUNCTION pfnMsgCallback;
+    XGL_RESULT result;
+} struct_xglDbgUnregisterMsgCallback;
+
+static struct_xglDbgUnregisterMsgCallback* interpret_body_as_xglDbgUnregisterMsgCallback(glv_trace_packet_header* pHeader)
+{
+    struct_xglDbgUnregisterMsgCallback* pPacket = (struct_xglDbgUnregisterMsgCallback*)pHeader->pBody;
+    pPacket->pHeader = pHeader;
+    return pPacket;
+}
+
+typedef struct struct_xglDbgSetMessageFilter {
+    glv_trace_packet_header* pHeader;
+    XGL_DEVICE device;
+    int32_t msgCode;
+    XGL_DBG_MSG_FILTER filter;
+    XGL_RESULT result;
+} struct_xglDbgSetMessageFilter;
+
+static struct_xglDbgSetMessageFilter* interpret_body_as_xglDbgSetMessageFilter(glv_trace_packet_header* pHeader)
+{
+    struct_xglDbgSetMessageFilter* pPacket = (struct_xglDbgSetMessageFilter*)pHeader->pBody;
+    pPacket->pHeader = pHeader;
+    return pPacket;
+}
+
+typedef struct struct_xglDbgSetObjectTag {
+    glv_trace_packet_header* pHeader;
+    XGL_BASE_OBJECT object;
+    size_t tagSize;
+    const void* pTag;
+    XGL_RESULT result;
+} struct_xglDbgSetObjectTag;
+
+static struct_xglDbgSetObjectTag* interpret_body_as_xglDbgSetObjectTag(glv_trace_packet_header* pHeader)
+{
+    struct_xglDbgSetObjectTag* pPacket = (struct_xglDbgSetObjectTag*)pHeader->pBody;
+    pPacket->pHeader = pHeader;
+    pPacket->pTag = (const void*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pTag);
+    return pPacket;
+}
+
+typedef struct struct_xglDbgSetGlobalOption {
+    glv_trace_packet_header* pHeader;
+    XGL_DBG_GLOBAL_OPTION dbgOption;
+    size_t dataSize;
+    const void* pData;
+    XGL_RESULT result;
+} struct_xglDbgSetGlobalOption;
+
+static struct_xglDbgSetGlobalOption* interpret_body_as_xglDbgSetGlobalOption(glv_trace_packet_header* pHeader)
+{
+    struct_xglDbgSetGlobalOption* pPacket = (struct_xglDbgSetGlobalOption*)pHeader->pBody;
+    pPacket->pHeader = pHeader;
+    pPacket->pData = (const void*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pData);
+    return pPacket;
+}
+
+typedef struct struct_xglDbgSetDeviceOption {
+    glv_trace_packet_header* pHeader;
+    XGL_DEVICE device;
+    XGL_DBG_DEVICE_OPTION dbgOption;
+    size_t dataSize;
+    const void* pData;
+    XGL_RESULT result;
+} struct_xglDbgSetDeviceOption;
+
+static struct_xglDbgSetDeviceOption* interpret_body_as_xglDbgSetDeviceOption(glv_trace_packet_header* pHeader)
+{
+    struct_xglDbgSetDeviceOption* pPacket = (struct_xglDbgSetDeviceOption*)pHeader->pBody;
+    pPacket->pHeader = pHeader;
+    pPacket->pData = (const void*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pData);
+    return pPacket;
+}
+
+typedef struct struct_xglCmdDbgMarkerBegin {
+    glv_trace_packet_header* pHeader;
+    XGL_CMD_BUFFER cmdBuffer;
+    const char* pMarker;
+} struct_xglCmdDbgMarkerBegin;
+
+static struct_xglCmdDbgMarkerBegin* interpret_body_as_xglCmdDbgMarkerBegin(glv_trace_packet_header* pHeader)
+{
+    struct_xglCmdDbgMarkerBegin* pPacket = (struct_xglCmdDbgMarkerBegin*)pHeader->pBody;
+    pPacket->pHeader = pHeader;
+    pPacket->pMarker = (const char*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pMarker);
+    return pPacket;
+}
+
+typedef struct struct_xglCmdDbgMarkerEnd {
+    glv_trace_packet_header* pHeader;
+    XGL_CMD_BUFFER cmdBuffer;
+} struct_xglCmdDbgMarkerEnd;
+
+static struct_xglCmdDbgMarkerEnd* interpret_body_as_xglCmdDbgMarkerEnd(glv_trace_packet_header* pHeader)
+{
+    struct_xglCmdDbgMarkerEnd* pPacket = (struct_xglCmdDbgMarkerEnd*)pHeader->pBody;
+    pPacket->pHeader = pHeader;
+    return pPacket;
+}
+
diff --git a/tools/glave/src/glv_extensions/glvtrace_xgl/codegen/glvtrace_xgl_xglwsix11ext.c b/tools/glave/src/glv_extensions/glvtrace_xgl/codegen/glvtrace_xgl_xglwsix11ext.c
new file mode 100644
index 0000000..8328257
--- /dev/null
+++ b/tools/glave/src/glv_extensions/glvtrace_xgl/codegen/glvtrace_xgl_xglwsix11ext.c
@@ -0,0 +1,201 @@
+/* THIS FILE IS GENERATED.  DO NOT EDIT. */
+
+/*
+ * XGL
+ *
+ * Copyright (C) 2014 LunarG, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+#include "glv_platform.h"
+#include "glv_common.h"
+#include "glvtrace_xgl_xglwsix11ext.h"
+#include "glvtrace_xgl_xglwsix11ext_structs.h"
+#include "glvtrace_xgl_packet_id.h"
+#ifdef WIN32
+#include "mhook/mhook-lib/mhook.h"
+#endif
+
+static XGL_RESULT( XGLAPI * real_xglWsiX11AssociateConnection)(
+    XGL_PHYSICAL_GPU gpu,
+    const XGL_WSI_X11_CONNECTION_INFO* pConnectionInfo) = xglWsiX11AssociateConnection;
+
+static XGL_RESULT( XGLAPI * real_xglWsiX11GetMSC)(
+    XGL_DEVICE device,
+    xcb_window_t window,
+    xcb_randr_crtc_t crtc,
+    uint64_t* pMsc) = xglWsiX11GetMSC;
+
+static XGL_RESULT( XGLAPI * real_xglWsiX11CreatePresentableImage)(
+    XGL_DEVICE device,
+    const XGL_WSI_X11_PRESENTABLE_IMAGE_CREATE_INFO* pCreateInfo,
+    XGL_IMAGE* pImage,
+    XGL_GPU_MEMORY* pMem) = xglWsiX11CreatePresentableImage;
+
+static XGL_RESULT( XGLAPI * real_xglWsiX11QueuePresent)(
+    XGL_QUEUE queue,
+    const XGL_WSI_X11_PRESENT_INFO* pPresentInfo,
+    XGL_FENCE fence) = xglWsiX11QueuePresent;
+
+void AttachHooks_xglwsix11ext()
+{
+    BOOL hookSuccess = TRUE;
+#if defined(WIN32)
+    Mhook_BeginMultiOperation(FALSE);
+    if (real_xglWsiX11AssociateConnection != NULL)
+    {
+        hookSuccess = Mhook_SetHook((PVOID*)&real_xglWsiX11AssociateConnection, hooked_xglWsiX11AssociateConnection);
+        hookSuccess &= Mhook_SetHook((PVOID*)&real_xglWsiX11GetMSC, hooked_xglWsiX11GetMSC);
+        hookSuccess &= Mhook_SetHook((PVOID*)&real_xglWsiX11CreatePresentableImage, hooked_xglWsiX11CreatePresentableImage);
+        hookSuccess &= Mhook_SetHook((PVOID*)&real_xglWsiX11QueuePresent, hooked_xglWsiX11QueuePresent);
+    }
+
+    if (!hookSuccess)
+    {
+        glv_LogError("Failed to hook XGL ext Wsi.");
+    }
+
+    Mhook_EndMultiOperation();
+
+#elif defined(__linux__)
+    hookSuccess = glv_platform_get_next_lib_sym((PVOID*)&real_xglWsiX11AssociateConnection, "xglWsiX11AssociateConnection");
+    hookSuccess &= glv_platform_get_next_lib_sym((PVOID*)&real_xglWsiX11GetMSC, "xglWsiX11GetMSC");
+    hookSuccess &= glv_platform_get_next_lib_sym((PVOID*)&real_xglWsiX11CreatePresentableImage, "xglWsiX11CreatePresentableImage");
+    hookSuccess &= glv_platform_get_next_lib_sym((PVOID*)&real_xglWsiX11QueuePresent, "xglWsiX11QueuePresent");
+    if (!hookSuccess)
+    {
+        glv_LogError("Failed to hook XGL ext Wsi.");
+    }
+
+#endif
+}
+
+void DetachHooks_xglwsix11ext()
+{
+#ifdef WIN32
+    BOOL unhookSuccess = TRUE;
+    if (real_xglWsiX11AssociateConnection != NULL)
+    {
+        unhookSuccess = Mhook_Unhook((PVOID*)&real_xglWsiX11AssociateConnection);
+        unhookSuccess &= Mhook_Unhook((PVOID*)&real_xglWsiX11GetMSC);
+        unhookSuccess &= Mhook_Unhook((PVOID*)&real_xglWsiX11CreatePresentableImage);
+        unhookSuccess &= Mhook_Unhook((PVOID*)&real_xglWsiX11QueuePresent);
+    }
+    if (!unhookSuccess)
+    {
+        glv_LogError("Failed to unhook XGL ext Wsi.");
+    }
+#elif defined(__linux__)
+    return;
+#endif
+}
+
+GLVTRACER_EXPORT XGL_RESULT XGLAPI __HOOKED_xglWsiX11AssociateConnection(
+    XGL_PHYSICAL_GPU gpu,
+    const XGL_WSI_X11_CONNECTION_INFO* pConnectionInfo)
+{
+    glv_trace_packet_header* pHeader;
+    XGL_RESULT result;
+    struct_xglWsiX11AssociateConnection* pPacket = NULL;
+    SEND_ENTRYPOINT_ID(xglWsiX11AssociateConnection);
+    CREATE_TRACE_PACKET(xglWsiX11AssociateConnection, sizeof(XGL_WSI_X11_CONNECTION_INFO) + ((pConnectionInfo->pConnection != NULL) ? sizeof(void *) : 0));
+    result = real_xglWsiX11AssociateConnection(gpu, pConnectionInfo);
+    pPacket = interpret_body_as_xglWsiX11AssociateConnection(pHeader);
+    pPacket->gpu = gpu;
+    glv_add_buffer_to_trace_packet(pHeader, (void**)&(pPacket->pConnectionInfo), sizeof(XGL_WSI_X11_CONNECTION_INFO), pConnectionInfo);
+    if (pConnectionInfo->pConnection != NULL) {
+        glv_add_buffer_to_trace_packet(pHeader, (void**) &(pPacket->pConnectionInfo->pConnection), sizeof(void *), pConnectionInfo->pConnection);
+        glv_finalize_buffer_address(pHeader, (void**) &(pPacket->pConnectionInfo->pConnection));
+    }
+    pPacket->result = result;
+    glv_finalize_buffer_address(pHeader, (void**)&(pPacket->pConnectionInfo));
+    FINISH_TRACE_PACKET();
+    return result;
+}
+
+GLVTRACER_EXPORT XGL_RESULT XGLAPI __HOOKED_xglWsiX11GetMSC(
+    XGL_DEVICE device,
+    xcb_window_t window,
+    xcb_randr_crtc_t crtc,
+    uint64_t* pMsc)
+{
+    glv_trace_packet_header* pHeader;
+    XGL_RESULT result;
+    struct_xglWsiX11GetMSC* pPacket = NULL;
+    SEND_ENTRYPOINT_ID(xglWsiX11GetMSC);
+    CREATE_TRACE_PACKET(xglWsiX11GetMSC, sizeof(uint64_t));
+    result = real_xglWsiX11GetMSC(device, window, crtc, pMsc);
+    pPacket = interpret_body_as_xglWsiX11GetMSC(pHeader);
+    pPacket->device = device;
+    pPacket->window = window;
+    pPacket->crtc = crtc;
+    glv_add_buffer_to_trace_packet(pHeader, (void**)&(pPacket->pMsc), sizeof(uint64_t), pMsc);
+    pPacket->result = result;
+    glv_finalize_buffer_address(pHeader, (void**)&(pPacket->pMsc));
+    FINISH_TRACE_PACKET();
+    return result;
+}
+
+GLVTRACER_EXPORT XGL_RESULT XGLAPI __HOOKED_xglWsiX11CreatePresentableImage(
+    XGL_DEVICE device,
+    const XGL_WSI_X11_PRESENTABLE_IMAGE_CREATE_INFO* pCreateInfo,
+    XGL_IMAGE* pImage,
+    XGL_GPU_MEMORY* pMem)
+{
+    glv_trace_packet_header* pHeader;
+    XGL_RESULT result;
+    struct_xglWsiX11CreatePresentableImage* pPacket = NULL;
+    SEND_ENTRYPOINT_ID(xglWsiX11CreatePresentableImage);
+    CREATE_TRACE_PACKET(xglWsiX11CreatePresentableImage, sizeof(XGL_WSI_X11_PRESENTABLE_IMAGE_CREATE_INFO) + sizeof(XGL_IMAGE) + sizeof(XGL_GPU_MEMORY));
+    result = real_xglWsiX11CreatePresentableImage(device, pCreateInfo, pImage, pMem);
+    pPacket = interpret_body_as_xglWsiX11CreatePresentableImage(pHeader);
+    pPacket->device = device;
+    glv_add_buffer_to_trace_packet(pHeader, (void**)&(pPacket->pCreateInfo), sizeof(XGL_WSI_X11_PRESENTABLE_IMAGE_CREATE_INFO), pCreateInfo);
+    glv_add_buffer_to_trace_packet(pHeader, (void**)&(pPacket->pImage), sizeof(XGL_IMAGE), pImage);
+    glv_add_buffer_to_trace_packet(pHeader, (void**)&(pPacket->pMem), sizeof(XGL_GPU_MEMORY), pMem);
+    pPacket->result = result;
+    glv_finalize_buffer_address(pHeader, (void**)&(pPacket->pCreateInfo));
+    glv_finalize_buffer_address(pHeader, (void**)&(pPacket->pImage));
+    glv_finalize_buffer_address(pHeader, (void**)&(pPacket->pMem));
+    FINISH_TRACE_PACKET();
+    return result;
+}
+
+GLVTRACER_EXPORT XGL_RESULT XGLAPI __HOOKED_xglWsiX11QueuePresent(
+    XGL_QUEUE queue,
+    const XGL_WSI_X11_PRESENT_INFO* pPresentInfo,
+    XGL_FENCE fence)
+{
+    glv_trace_packet_header* pHeader;
+    XGL_RESULT result;
+    struct_xglWsiX11QueuePresent* pPacket = NULL;
+    SEND_ENTRYPOINT_ID(xglWsiX11QueuePresent);
+    CREATE_TRACE_PACKET(xglWsiX11QueuePresent, sizeof(XGL_WSI_X11_PRESENT_INFO));
+    result = real_xglWsiX11QueuePresent(queue, pPresentInfo, fence);
+    pPacket = interpret_body_as_xglWsiX11QueuePresent(pHeader);
+    pPacket->queue = queue;
+    pPacket->fence = fence;
+    glv_add_buffer_to_trace_packet(pHeader, (void**)&(pPacket->pPresentInfo), sizeof(XGL_WSI_X11_PRESENT_INFO), pPresentInfo);
+    pPacket->result = result;
+    glv_finalize_buffer_address(pHeader, (void**)&(pPacket->pPresentInfo));
+    FINISH_TRACE_PACKET();
+    return result;
+}
+
diff --git a/tools/glave/src/glv_extensions/glvtrace_xgl/codegen/glvtrace_xgl_xglwsix11ext.h b/tools/glave/src/glv_extensions/glvtrace_xgl/codegen/glvtrace_xgl_xglwsix11ext.h
new file mode 100644
index 0000000..7d7d3cb
--- /dev/null
+++ b/tools/glave/src/glv_extensions/glvtrace_xgl/codegen/glvtrace_xgl_xglwsix11ext.h
@@ -0,0 +1,56 @@
+/* THIS FILE IS GENERATED.  DO NOT EDIT. */
+
+/*
+ * XGL
+ *
+ * Copyright (C) 2014 LunarG, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+#pragma once
+
+#include "xgl.h"
+#if defined(PLATFORM_LINUX) || defined(XCB_NVIDIA)
+#include "xglWsiX11Ext.h"
+
+#else
+#include "xglWsiWinExt.h"
+#endif
+void AttachHooks_xglwsix11ext();
+void DetachHooks_xglwsix11ext();
+
+#ifdef WIN32
+#define __HOOKED_xglWsiX11AssociateConnection hooked_xglWsiX11AssociateConnection
+#define __HOOKED_xglWsiX11GetMSC hooked_xglWsiX11GetMSC
+#define __HOOKED_xglWsiX11CreatePresentableImage hooked_xglWsiX11CreatePresentableImage
+#define __HOOKED_xglWsiX11QueuePresent hooked_xglWsiX11QueuePresent
+#elif defined(__linux__)
+#define __HOOKED_xglWsiX11AssociateConnection xglWsiX11AssociateConnection
+#define __HOOKED_xglWsiX11GetMSC xglWsiX11GetMSC
+#define __HOOKED_xglWsiX11CreatePresentableImage xglWsiX11CreatePresentableImage
+#define __HOOKED_xglWsiX11QueuePresent xglWsiX11QueuePresent
+#endif
+
+// Hooked function prototypes
+
+GLVTRACER_EXPORT XGL_RESULT XGLAPI __HOOKED_xglWsiX11AssociateConnection(XGL_PHYSICAL_GPU gpu, const XGL_WSI_X11_CONNECTION_INFO* pConnectionInfo);
+GLVTRACER_EXPORT XGL_RESULT XGLAPI __HOOKED_xglWsiX11GetMSC(XGL_DEVICE device, xcb_window_t window, xcb_randr_crtc_t crtc, uint64_t* pMsc);
+GLVTRACER_EXPORT XGL_RESULT XGLAPI __HOOKED_xglWsiX11CreatePresentableImage(XGL_DEVICE device, const XGL_WSI_X11_PRESENTABLE_IMAGE_CREATE_INFO* pCreateInfo, XGL_IMAGE* pImage, XGL_GPU_MEMORY* pMem);
+GLVTRACER_EXPORT XGL_RESULT XGLAPI __HOOKED_xglWsiX11QueuePresent(XGL_QUEUE queue, const XGL_WSI_X11_PRESENT_INFO* pPresentInfo, XGL_FENCE fence);
diff --git a/tools/glave/src/glv_extensions/glvtrace_xgl/codegen/glvtrace_xgl_xglwsix11ext_structs.h b/tools/glave/src/glv_extensions/glvtrace_xgl/codegen/glvtrace_xgl_xglwsix11ext_structs.h
new file mode 100644
index 0000000..9dd4da1
--- /dev/null
+++ b/tools/glave/src/glv_extensions/glvtrace_xgl/codegen/glvtrace_xgl_xglwsix11ext_structs.h
@@ -0,0 +1,103 @@
+/* THIS FILE IS GENERATED.  DO NOT EDIT. */
+
+/*
+ * XGL
+ *
+ * Copyright (C) 2014 LunarG, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+#pragma once
+
+#if defined(PLATFORM_LINUX) || defined(XCB_NVIDIA)
+#include "xglWsiX11Ext.h"
+#else
+#include "xglWsiWinExt.h"
+#endif
+#include "glv_trace_packet_utils.h"
+
+
+typedef struct struct_xglWsiX11AssociateConnection {
+    glv_trace_packet_header* pHeader;
+    XGL_PHYSICAL_GPU gpu;
+    const XGL_WSI_X11_CONNECTION_INFO* pConnectionInfo;
+    XGL_RESULT result;
+} struct_xglWsiX11AssociateConnection;
+
+static struct_xglWsiX11AssociateConnection* interpret_body_as_xglWsiX11AssociateConnection(glv_trace_packet_header* pHeader)
+{
+    struct_xglWsiX11AssociateConnection* pPacket = (struct_xglWsiX11AssociateConnection*)pHeader->pBody;
+    pPacket->pHeader = pHeader;
+    pPacket->pConnectionInfo = (const XGL_WSI_X11_CONNECTION_INFO*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pConnectionInfo);
+    return pPacket;
+}
+
+typedef struct struct_xglWsiX11GetMSC {
+    glv_trace_packet_header* pHeader;
+    XGL_DEVICE device;
+    xcb_window_t window;
+    xcb_randr_crtc_t crtc;
+    uint64_t* pMsc;
+    XGL_RESULT result;
+} struct_xglWsiX11GetMSC;
+
+static struct_xglWsiX11GetMSC* interpret_body_as_xglWsiX11GetMSC(glv_trace_packet_header* pHeader)
+{
+    struct_xglWsiX11GetMSC* pPacket = (struct_xglWsiX11GetMSC*)pHeader->pBody;
+    pPacket->pHeader = pHeader;
+    pPacket->pMsc = (uint64_t*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pMsc);
+    return pPacket;
+}
+
+typedef struct struct_xglWsiX11CreatePresentableImage {
+    glv_trace_packet_header* pHeader;
+    XGL_DEVICE device;
+    const XGL_WSI_X11_PRESENTABLE_IMAGE_CREATE_INFO* pCreateInfo;
+    XGL_IMAGE* pImage;
+    XGL_GPU_MEMORY* pMem;
+    XGL_RESULT result;
+} struct_xglWsiX11CreatePresentableImage;
+
+static struct_xglWsiX11CreatePresentableImage* interpret_body_as_xglWsiX11CreatePresentableImage(glv_trace_packet_header* pHeader)
+{
+    struct_xglWsiX11CreatePresentableImage* pPacket = (struct_xglWsiX11CreatePresentableImage*)pHeader->pBody;
+    pPacket->pHeader = pHeader;
+    pPacket->pCreateInfo = (const XGL_WSI_X11_PRESENTABLE_IMAGE_CREATE_INFO*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pCreateInfo);
+    pPacket->pImage = (XGL_IMAGE*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pImage);
+    pPacket->pMem = (XGL_GPU_MEMORY*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pMem);
+    return pPacket;
+}
+
+typedef struct struct_xglWsiX11QueuePresent {
+    glv_trace_packet_header* pHeader;
+    XGL_QUEUE queue;
+    const XGL_WSI_X11_PRESENT_INFO* pPresentInfo;
+    XGL_FENCE fence;
+    XGL_RESULT result;
+} struct_xglWsiX11QueuePresent;
+
+static struct_xglWsiX11QueuePresent* interpret_body_as_xglWsiX11QueuePresent(glv_trace_packet_header* pHeader)
+{
+    struct_xglWsiX11QueuePresent* pPacket = (struct_xglWsiX11QueuePresent*)pHeader->pBody;
+    pPacket->pHeader = pHeader;
+    pPacket->pPresentInfo = (const XGL_WSI_X11_PRESENT_INFO*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pPacket->pPresentInfo);
+    return pPacket;
+}
+