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 "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 bound_texture_external_oes = NULL; | 74 bound_texture_external_oes = NULL; |
75 } | 75 } |
76 } | 76 } |
77 }; | 77 }; |
78 | 78 |
79 | 79 |
80 struct GPU_EXPORT ContextState { | 80 struct GPU_EXPORT ContextState { |
81 ContextState(); | 81 ContextState(); |
82 ~ContextState(); | 82 ~ContextState(); |
83 | 83 |
| 84 void Initialize(); |
| 85 |
| 86 void InitCapabilities(); |
| 87 void InitState(); |
| 88 |
| 89 #include "gpu/command_buffer/service/context_state_autogen.h" |
| 90 |
| 91 EnableFlags enable_flags; |
| 92 |
84 // pack alignment as last set by glPixelStorei | 93 // pack alignment as last set by glPixelStorei |
85 GLint pack_alignment; | 94 GLint pack_alignment; |
86 | 95 |
87 // unpack alignment as last set by glPixelStorei | 96 // unpack alignment as last set by glPixelStorei |
88 GLint unpack_alignment; | 97 GLint unpack_alignment; |
89 | 98 |
90 // Current active texture by 0 - n index. | 99 // Current active texture by 0 - n index. |
91 // In other words, if we call glActiveTexture(GL_TEXTURE2) this value would | 100 // In other words, if we call glActiveTexture(GL_TEXTURE2) this value would |
92 // be 2. | 101 // be 2. |
93 GLuint active_texture_unit; | 102 GLuint active_texture_unit; |
94 | 103 |
95 GLfloat color_clear_red; | |
96 GLfloat color_clear_green; | |
97 GLfloat color_clear_blue; | |
98 GLfloat color_clear_alpha; | |
99 GLboolean color_mask_red; | |
100 GLboolean color_mask_green; | |
101 GLboolean color_mask_blue; | |
102 GLboolean color_mask_alpha; | |
103 | |
104 GLclampf depth_clear; | |
105 GLboolean depth_mask; | |
106 GLenum depth_func; | |
107 float z_near; | |
108 float z_far; | |
109 | |
110 bool enable_blend; | |
111 bool enable_cull_face; | |
112 bool enable_scissor_test; | |
113 bool enable_depth_test; | |
114 bool enable_stencil_test; | |
115 bool enable_polygon_offset_fill; | |
116 bool enable_dither; | |
117 bool enable_sample_alpha_to_coverage; | |
118 bool enable_sample_coverage; | |
119 | |
120 // Cached values of the currently assigned viewport dimensions. | 104 // Cached values of the currently assigned viewport dimensions. |
121 GLint viewport_x; | |
122 GLint viewport_y; | |
123 GLsizei viewport_width; | |
124 GLsizei viewport_height; | |
125 GLsizei viewport_max_width; | 105 GLsizei viewport_max_width; |
126 GLsizei viewport_max_height; | 106 GLsizei viewport_max_height; |
127 | 107 |
128 GLint scissor_x; | |
129 GLint scissor_y; | |
130 GLsizei scissor_width; | |
131 GLsizei scissor_height; | |
132 | |
133 // The currently bound array buffer. If this is 0 it is illegal to call | 108 // The currently bound array buffer. If this is 0 it is illegal to call |
134 // glVertexAttribPointer. | 109 // glVertexAttribPointer. |
135 BufferManager::BufferInfo::Ref bound_array_buffer; | 110 BufferManager::BufferInfo::Ref bound_array_buffer; |
136 | 111 |
137 // Which textures are bound to texture units through glActiveTexture. | 112 // Which textures are bound to texture units through glActiveTexture. |
138 scoped_array<TextureUnit> texture_units; | 113 scoped_array<TextureUnit> texture_units; |
139 | 114 |
140 // Class that manages vertex attribs. | 115 // Class that manages vertex attribs. |
141 VertexAttribManager::Ref vertex_attrib_manager; | 116 VertexAttribManager::Ref vertex_attrib_manager; |
142 | 117 |
143 // The program in use by glUseProgram | 118 // The program in use by glUseProgram |
144 ProgramManager::ProgramInfo::Ref current_program; | 119 ProgramManager::ProgramInfo::Ref current_program; |
145 | 120 |
146 // The currently bound framebuffers | 121 // The currently bound framebuffers |
147 FramebufferManager::FramebufferInfo::Ref bound_read_framebuffer; | 122 FramebufferManager::FramebufferInfo::Ref bound_read_framebuffer; |
148 FramebufferManager::FramebufferInfo::Ref bound_draw_framebuffer; | 123 FramebufferManager::FramebufferInfo::Ref bound_draw_framebuffer; |
149 | 124 |
150 // The currently bound renderbuffer | 125 // The currently bound renderbuffer |
151 RenderbufferManager::RenderbufferInfo::Ref bound_renderbuffer; | 126 RenderbufferManager::RenderbufferInfo::Ref bound_renderbuffer; |
152 | 127 |
153 QueryManager::Query::Ref current_query; | 128 QueryManager::Query::Ref current_query; |
154 | 129 |
155 GLenum cull_mode; | |
156 GLenum front_face; | |
157 | |
158 GLenum blend_source_rgb; | |
159 GLenum blend_dest_rgb; | |
160 GLenum blend_source_alpha; | |
161 GLenum blend_dest_alpha; | |
162 GLenum blend_equation_rgb; | |
163 GLenum blend_equation_alpha; | |
164 GLfloat blend_color_red; | |
165 GLfloat blend_color_green; | |
166 GLfloat blend_color_blue; | |
167 GLfloat blend_color_alpha; | |
168 | |
169 GLint stencil_clear; | |
170 GLuint stencil_front_writemask; | |
171 GLenum stencil_front_func; | |
172 GLint stencil_front_ref; | |
173 GLuint stencil_front_mask; | |
174 GLenum stencil_front_fail_op; | |
175 GLenum stencil_front_z_fail_op; | |
176 GLenum stencil_front_z_pass_op; | |
177 GLuint stencil_back_writemask; | |
178 GLenum stencil_back_func; | |
179 GLint stencil_back_ref; | |
180 GLuint stencil_back_mask; | |
181 GLenum stencil_back_fail_op; | |
182 GLenum stencil_back_z_fail_op; | |
183 GLenum stencil_back_z_pass_op; | |
184 | |
185 GLfloat polygon_offset_factor; | |
186 GLfloat polygon_offset_units; | |
187 | |
188 GLclampf sample_coverage_value; | |
189 bool sample_coverage_invert; | |
190 | |
191 GLfloat line_width; | |
192 | |
193 GLenum hint_generate_mipmap; | 130 GLenum hint_generate_mipmap; |
194 GLenum hint_fragment_shader_derivative; | 131 GLenum hint_fragment_shader_derivative; |
195 | 132 |
196 bool pack_reverse_row_order; | 133 bool pack_reverse_row_order; |
197 }; | 134 }; |
198 | 135 |
199 } // namespace gles2 | 136 } // namespace gles2 |
200 } // namespace gpu | 137 } // namespace gpu |
201 | 138 |
202 #endif // GPU_COMMAND_BUFFER_SERVICE_CONTEXT_STATE_H_ | 139 #endif // GPU_COMMAND_BUFFER_SERVICE_CONTEXT_STATE_H_ |
203 | 140 |
OLD | NEW |