glave: Add XGL_LAYER_CREATE_INFO structure to trace files
authorJon Ashburn <jon@lunarg.com>
Sat, 10 Jan 2015 00:30:41 +0000 (17:30 -0700)
committerCourtney Goeltzenleuchter <courtney@LunarG.com>
Thu, 5 Feb 2015 00:58:05 +0000 (17:58 -0700)
Recent test changes was adding this structure to the DEVICE_CREATE_INFO
structure.  this was causing a regresiion in Glave.

glave-generate.py

index b293bae3e71504891739c15a40489b4ed718b7c8..ddba2ede7be8fa0b7fc441db165820b46b59306f 100755 (executable)
@@ -1087,7 +1087,21 @@ class Subcommand(object):
         pid_enum.append('    {')
         pid_enum.append('        total_size_ppEnabledExtensionNames += strlen(pStruct->ppEnabledExtensionNames[i]) + 1;')
         pid_enum.append('    }')
-        pid_enum.append('    return sizeof(XGL_DEVICE_CREATE_INFO) + (pStruct->queueRecordCount*sizeof(XGL_DEVICE_CREATE_INFO)) + total_size_ppEnabledExtensionNames;')
+        pid_enum.append('    uint64_t total_size_layers = 0;')
+        pid_enum.append('    XGL_LAYER_CREATE_INFO *pNext = ( XGL_LAYER_CREATE_INFO *) pStruct->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('            total_size_layers += sizeof(XGL_LAYER_CREATE_INFO);')
+        pid_enum.append('            for (i = 0; i < pNext->layerCount; i++)')
+        pid_enum.append('            {')
+        pid_enum.append('                total_size_layers += strlen(pNext->ppActiveLayerNames[i]) + 1;')
+        pid_enum.append('            }')
+        pid_enum.append('        }')
+        pid_enum.append('        pNext = ( XGL_LAYER_CREATE_INFO *) pNext->pNext;')
+        pid_enum.append('    }')
+        pid_enum.append('    return sizeof(XGL_DEVICE_CREATE_INFO) + (pStruct->queueRecordCount*sizeof(XGL_DEVICE_CREATE_INFO)) + total_size_ppEnabledExtensionNames + total_size_layers;')
         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('{')
@@ -1105,6 +1119,24 @@ class Subcommand(object):
         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(XGL_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)')
@@ -1112,11 +1144,11 @@ class Subcommand(object):
         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 XGL_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('            const XGL_CHAR** pNames;')
-        pid_enum.append('            uint32_t i;')
         pid_enum.append('            pXGL_DEVICE_CREATE_INFO->ppEnabledExtensionNames = (const XGL_CHAR *const*)glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)pXGL_DEVICE_CREATE_INFO->ppEnabledExtensionNames);')
         pid_enum.append('            pNames = (const XGL_CHAR**)pXGL_DEVICE_CREATE_INFO->ppEnabledExtensionNames;')
         pid_enum.append('            for (i = 0; i < pXGL_DEVICE_CREATE_INFO->extensionCount; i++)')
@@ -1124,6 +1156,20 @@ class Subcommand(object):
         pid_enum.append('                pNames[i] = (const XGL_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 XGL_CHAR**) glv_trace_packet_interpret_buffer_pointer(pHeader, (intptr_t)(pNext->ppActiveLayerNames));')
+        pid_enum.append('                pNames = (const XGL_CHAR**)pNext->ppActiveLayerNames;')
+        pid_enum.append('                for (i = 0; i < pNext->layerCount; i++)')
+        pid_enum.append('                {')
+        pid_enum.append('                    pNames[i] = (const XGL_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')