1 /**************************************************************************
3 * Copyright 2013-2014 RAD Game Tools and Valve Software
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to deal
8 * in the Software without restriction, including without limitation the rights
9 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 * copies of the Software, and to permit persons to whom the Software is
11 * furnished to do so, subject to the following conditions:
13 * The above copyright notice and this permission notice shall be included in
14 * all copies or substantial portions of the Software.
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24 **************************************************************************/
26 // File: vogl_display_list_state.h
27 #ifndef VOGL_DISPLAY_LIST_STATE_H
28 #define VOGL_DISPLAY_LIST_STATE_H
30 #include "vogl_core.h"
31 #include "vogl_context_info.h"
32 #include "vogl_general_context_state.h"
33 #include "vogl_blob_manager.h"
34 #include "vogl_trace_file_reader.h"
36 //----------------------------------------------------------------------------------------------------------------------
37 // class vogl_display_list
38 //----------------------------------------------------------------------------------------------------------------------
39 class vogl_display_list
46 GLuint get_handle() const
50 void set_handle(GLuint handle)
59 bool is_generating() const
64 const dynamic_string &get_xfont_name() const
68 int get_xfont_glyph() const
77 const vogl_trace_packet_array &get_packets() const
81 vogl_trace_packet_array &get_packets()
86 void init_xfont(const char *pName, int glyph);
91 bool serialize(json_node &node, vogl_blob_manager &blob_manager, const vogl_ctypes *pCtypes) const;
92 bool deserialize(const json_node &node, const vogl_blob_manager &blob_manager, const vogl_ctypes *pCtypes);
96 vogl_trace_packet_array m_packets;
98 dynamic_string m_xfont_name;
105 typedef vogl::map<GLuint, vogl_display_list> vogl_display_list_map;
107 //----------------------------------------------------------------------------------------------------------------------
108 // class vogl_display_list_state
109 //----------------------------------------------------------------------------------------------------------------------
110 class vogl_display_list_state
113 vogl_display_list_state();
114 vogl_display_list_state(const vogl_display_list_state &other);
115 ~vogl_display_list_state();
117 vogl_display_list_state &operator=(const vogl_display_list_state &rhs);
123 return m_display_lists.size();
126 vogl_display_list *find_list(GLuint list)
128 return m_display_lists.find_value(list);
131 const vogl_display_list_map &get_display_list_map() const
133 return m_display_lists;
135 vogl_display_list_map &get_display_list_map()
137 return m_display_lists;
140 bool remap_handles(vogl_handle_remapper &remapper);
142 bool serialize(json_node &node, vogl_blob_manager &blob_manager, const vogl_ctypes *pCtypes) const;
143 bool deserialize(const json_node &node, const vogl_blob_manager &blob_manager, const vogl_ctypes *pCtypes);
145 bool define_list(GLuint trace_handle, GLuint replay_handle, const vogl_display_list &list);
147 bool gen_lists(GLuint first, GLsizei n, GLuint *pObject_handles = NULL);
149 bool del_lists(GLuint first, GLsizei n);
151 bool glx_font(const char *pFont, int first, int count, int listBase);
153 static bool is_call_listable(gl_entrypoint_id_t func, const vogl_trace_packet &packet);
155 void new_list(GLuint trace_handle, GLuint replay_handle);
157 bool add_packet_to_list(GLuint handle, gl_entrypoint_id_t func, const vogl_trace_packet &packet);
159 bool end_list(GLuint trace_handle);
161 typedef void (*pBind_callback_func_ptr)(vogl_namespace_t handle_namespace, GLenum target, GLuint handle, void *pOpaque);
163 bool parse_list_and_update_shadows(GLuint handle, pBind_callback_func_ptr pBind_callback, void *pBind_callback_opaque);
164 bool parse_lists_and_update_shadows(GLsizei n, GLenum type, const GLvoid *lists, pBind_callback_func_ptr pBind_callback, void *pBind_callback_opaque);
167 vogl_display_list_map m_display_lists;
170 #endif // VOGL_DISPLAY_LIST_STATE_H