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_general_context_state.h
27 #ifndef VOGL_BASIC_CONTEXT_STATE_H
28 #define VOGL_BASIC_CONTEXT_STATE_H
30 #include "vogl_context_info.h"
31 #include "vogl_state_vector.h"
32 #include "vogl_blob_manager.h"
33 #include "vogl_gl_object.h"
35 bool vogl_gl_enum_is_dependent_on_client_active_texture(GLenum enum_val);
36 bool vogl_gl_enum_is_dependent_on_active_texture(GLenum enum_val);
38 class vogl_general_context_state : public vogl_state_vector
41 vogl_general_context_state();
43 // Snapshots current context
44 bool snapshot(const vogl_context_info &context_info);
46 // Restores state to current context
47 class vogl_persistent_restore_state
50 vogl_persistent_restore_state()
51 : m_pSelect_buffer(NULL)
60 m_pSelect_buffer = NULL;
63 // May be NULL, if so the selection buffer can't be restored
64 vogl::vector<GLuint> *m_pSelect_buffer;
67 bool restore(const vogl_context_info &context_info, vogl_handle_remapper &remapper, vogl_persistent_restore_state &persistent_state) const;
69 bool remap_handles(vogl_handle_remapper &remapper);
72 bool can_snapshot_state(const vogl_context_info &context_info, vogl_snapshot_context_info &context, uint get_desc_index);
73 bool snapshot_state(const vogl_context_info &context_info, vogl_snapshot_context_info &context, uint get_desc_index, uint index, bool indexed_variant);
74 bool restore_buffer_binding(GLenum binding_enum, GLenum set_enum, vogl_handle_remapper &remapper) const;
75 bool restore_buffer_binding_range(GLenum binding_enum, GLenum start_enum, GLenum size_enum, GLenum set_enum, uint index, bool indexed_variant, vogl_handle_remapper &remapper) const;
76 bool snapshot_active_queries(const vogl_context_info &context_info);
79 class vogl_polygon_stipple_state
82 vogl_polygon_stipple_state();
83 ~vogl_polygon_stipple_state();
85 bool snapshot(const vogl_context_info &context_info);
86 bool restore(const vogl_context_info &context_info) const;
95 bool serialize(json_node &node, vogl_blob_manager &blob_manager) const;
96 bool deserialize(const json_node &node, const vogl_blob_manager &blob_manager);
98 uint get_num_pattern_rows() const;
99 uint32 get_pattern_row(uint rowIndex) const;
103 uint32 m_pattern[32];
106 #endif // VOGL_BASIC_CONTEXT_STATE_H