OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // This file contains the ContextState class. | 5 // This file contains the ContextState class. |
6 | 6 |
7 #ifndef GPU_COMMAND_BUFFER_SERVICE_CONTEXT_STATE_H_ | 7 #ifndef GPU_COMMAND_BUFFER_SERVICE_CONTEXT_STATE_H_ |
8 #define GPU_COMMAND_BUFFER_SERVICE_CONTEXT_STATE_H_ | 8 #define GPU_COMMAND_BUFFER_SERVICE_CONTEXT_STATE_H_ |
9 | 9 |
| 10 #include <vector> |
10 #include "base/logging.h" | 11 #include "base/logging.h" |
11 #include "gpu/command_buffer/service/gl_utils.h" | 12 #include "gpu/command_buffer/service/gl_utils.h" |
12 #include "gpu/command_buffer/service/buffer_manager.h" | 13 #include "gpu/command_buffer/service/buffer_manager.h" |
13 #include "gpu/command_buffer/service/framebuffer_manager.h" | 14 #include "gpu/command_buffer/service/framebuffer_manager.h" |
14 #include "gpu/command_buffer/service/program_manager.h" | 15 #include "gpu/command_buffer/service/program_manager.h" |
15 #include "gpu/command_buffer/service/query_manager.h" | 16 #include "gpu/command_buffer/service/query_manager.h" |
16 #include "gpu/command_buffer/service/renderbuffer_manager.h" | 17 #include "gpu/command_buffer/service/renderbuffer_manager.h" |
17 #include "gpu/command_buffer/service/texture_manager.h" | 18 #include "gpu/command_buffer/service/texture_manager.h" |
18 #include "gpu/command_buffer/service/vertex_attrib_manager.h" | 19 #include "gpu/command_buffer/service/vertex_attrib_manager.h" |
19 #include "gpu/command_buffer/service/vertex_array_manager.h" | 20 #include "gpu/command_buffer/service/vertex_array_manager.h" |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 } | 77 } |
77 }; | 78 }; |
78 | 79 |
79 | 80 |
80 struct GPU_EXPORT ContextState { | 81 struct GPU_EXPORT ContextState { |
81 ContextState(); | 82 ContextState(); |
82 ~ContextState(); | 83 ~ContextState(); |
83 | 84 |
84 void Initialize(); | 85 void Initialize(); |
85 | 86 |
86 void InitCapabilities(); | 87 void RestoreState() const; |
87 void InitState(); | 88 void InitCapabilities() const; |
| 89 void InitState() const; |
88 | 90 |
89 #include "gpu/command_buffer/service/context_state_autogen.h" | 91 #include "gpu/command_buffer/service/context_state_autogen.h" |
90 | 92 |
91 EnableFlags enable_flags; | 93 EnableFlags enable_flags; |
92 | 94 |
93 // pack alignment as last set by glPixelStorei | 95 // pack alignment as last set by glPixelStorei |
94 GLint pack_alignment; | 96 GLint pack_alignment; |
95 | 97 |
96 // unpack alignment as last set by glPixelStorei | 98 // unpack alignment as last set by glPixelStorei |
97 GLint unpack_alignment; | 99 GLint unpack_alignment; |
98 | 100 |
99 // Current active texture by 0 - n index. | 101 // Current active texture by 0 - n index. |
100 // In other words, if we call glActiveTexture(GL_TEXTURE2) this value would | 102 // In other words, if we call glActiveTexture(GL_TEXTURE2) this value would |
101 // be 2. | 103 // be 2. |
102 GLuint active_texture_unit; | 104 GLuint active_texture_unit; |
103 | 105 |
104 // Cached values of the currently assigned viewport dimensions. | |
105 GLsizei viewport_max_width; | |
106 GLsizei viewport_max_height; | |
107 | |
108 // The currently bound array buffer. If this is 0 it is illegal to call | 106 // The currently bound array buffer. If this is 0 it is illegal to call |
109 // glVertexAttribPointer. | 107 // glVertexAttribPointer. |
110 BufferManager::BufferInfo::Ref bound_array_buffer; | 108 BufferManager::BufferInfo::Ref bound_array_buffer; |
111 | 109 |
112 // Which textures are bound to texture units through glActiveTexture. | 110 // Which textures are bound to texture units through glActiveTexture. |
113 scoped_array<TextureUnit> texture_units; | 111 std::vector<TextureUnit> texture_units; |
114 | 112 |
115 // Class that manages vertex attribs. | 113 // Class that manages vertex attribs. |
116 VertexAttribManager::Ref vertex_attrib_manager; | 114 VertexAttribManager::Ref vertex_attrib_manager; |
117 | 115 |
118 // The program in use by glUseProgram | 116 // The program in use by glUseProgram |
119 ProgramManager::ProgramInfo::Ref current_program; | 117 ProgramManager::ProgramInfo::Ref current_program; |
120 | 118 |
121 // The currently bound framebuffers | 119 // The currently bound framebuffers |
122 FramebufferManager::FramebufferInfo::Ref bound_read_framebuffer; | 120 FramebufferManager::FramebufferInfo::Ref bound_read_framebuffer; |
123 FramebufferManager::FramebufferInfo::Ref bound_draw_framebuffer; | 121 FramebufferManager::FramebufferInfo::Ref bound_draw_framebuffer; |
124 | 122 |
125 // The currently bound renderbuffer | 123 // The currently bound renderbuffer |
126 RenderbufferManager::RenderbufferInfo::Ref bound_renderbuffer; | 124 RenderbufferManager::RenderbufferInfo::Ref bound_renderbuffer; |
127 | 125 |
128 QueryManager::Query::Ref current_query; | 126 QueryManager::Query::Ref current_query; |
129 | 127 |
130 GLenum hint_generate_mipmap; | 128 GLenum hint_generate_mipmap; |
131 GLenum hint_fragment_shader_derivative; | 129 GLenum hint_fragment_shader_derivative; |
132 | 130 |
133 bool pack_reverse_row_order; | 131 bool pack_reverse_row_order; |
134 }; | 132 }; |
135 | 133 |
136 } // namespace gles2 | 134 } // namespace gles2 |
137 } // namespace gpu | 135 } // namespace gpu |
138 | 136 |
139 #endif // GPU_COMMAND_BUFFER_SERVICE_CONTEXT_STATE_H_ | 137 #endif // GPU_COMMAND_BUFFER_SERVICE_CONTEXT_STATE_H_ |
140 | 138 |
OLD | NEW |