]> git.cworth.org Git - vogl/blob - src/vogleditor/vogleditor_statetreedisplaylistitem.cpp
Initial vogl checkin
[vogl] / src / vogleditor / vogleditor_statetreedisplaylistitem.cpp
1 #include "vogleditor_statetreedisplaylistitem.h"
2
3
4 vogleditor_stateTreeDisplaylistItem::vogleditor_stateTreeDisplaylistItem(QString name, QString value, vogleditor_stateTreeItem* parentNode, vogl_display_list_state* pState)
5    : vogleditor_stateTreeItem(name, value, parentNode),
6      m_pState(pState),
7      m_pDiffBaseState(NULL)
8 {
9     // TODO: (Richg) We don't currently support snapshotting while composing a display list, so the current display list and mode can't be printed.
10     //this->appendChild(new vogleditor_stateTreeItem("GL_LIST_INDEX", STR_INT(pState->get_current_display_list()), this));
11     //this->appendChild(new vogleditor_stateTreeItem("GL_LIST_MODE", STR_ENUM(pState->get_current_display_list_mode()), this));
12
13     vogl_display_list_map& displayLists = pState->get_display_list_map();
14     if (displayLists.size() == 0)
15     {
16         return;
17     }
18
19     QString tmp;
20
21     vogleditor_stateTreeItem* pDisplayListMapNode = new vogleditor_stateTreeItem("Existing Lists", "", this);
22     this->appendChild(pDisplayListMapNode);
23     for(vogl_display_list_map::iterator iter = displayLists.begin(); iter != displayLists.end(); iter++)
24     {
25         vogl_display_list* pDisplayList = &(iter->second);
26         if (pDisplayList->is_valid())
27         {
28             vogleditor_stateTreeItem* pDisplayListNode = new vogleditor_stateTreeItem(tmp.sprintf("%d", iter->first), tmp.sprintf("%u calls", pDisplayList->get_handle()), pDisplayListMapNode);
29             pDisplayListMapNode->appendChild(pDisplayListNode);
30
31             vogl_trace_packet_array& packets = pDisplayList->get_packets();
32             for (uint i = 0; i < packets.size(); i++)
33             {
34                 const vogl_trace_gl_entrypoint_packet& packet = packets.get_packet<vogl_trace_gl_entrypoint_packet>(i);
35                 const gl_entrypoint_desc_t &entrypoint_desc = g_vogl_entrypoint_descs[packet.m_entrypoint_id];
36
37                 QString funcCall = entrypoint_desc.m_pName;
38
39                 // format parameters
40                 if (entrypoint_desc.m_num_params > 0)
41                 {
42                     funcCall.append("(...)");
43                 }
44                 else
45                 {
46                     funcCall.append("()");
47                 }
48
49                 pDisplayListNode->appendChild(new vogleditor_stateTreeItem(tmp.sprintf("%u", i), funcCall, pDisplayListNode));
50             }
51         }
52         else
53         {
54             VOGL_ASSERT(!"Encountered an invalid displaylist.");
55         }
56     }
57 }