Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(508)

Side by Side Diff: gpu/command_buffer/service/context_state.h

Issue 11301006: automate more GL state handling (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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 #include "gpu/command_buffer/service/context_state_autogen.h"
87
88 EnableFlags enable_flags;
89
84 // pack alignment as last set by glPixelStorei 90 // pack alignment as last set by glPixelStorei
85 GLint pack_alignment; 91 GLint pack_alignment;
86 92
87 // unpack alignment as last set by glPixelStorei 93 // unpack alignment as last set by glPixelStorei
88 GLint unpack_alignment; 94 GLint unpack_alignment;
89 95
90 // Current active texture by 0 - n index. 96 // Current active texture by 0 - n index.
91 // In other words, if we call glActiveTexture(GL_TEXTURE2) this value would 97 // In other words, if we call glActiveTexture(GL_TEXTURE2) this value would
92 // be 2. 98 // be 2.
93 GLuint active_texture_unit; 99 GLuint active_texture_unit;
94 100
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. 101 // 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; 102 GLsizei viewport_max_width;
126 GLsizei viewport_max_height; 103 GLsizei viewport_max_height;
127 104
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 105 // The currently bound array buffer. If this is 0 it is illegal to call
134 // glVertexAttribPointer. 106 // glVertexAttribPointer.
135 BufferManager::BufferInfo::Ref bound_array_buffer; 107 BufferManager::BufferInfo::Ref bound_array_buffer;
136 108
137 // Which textures are bound to texture units through glActiveTexture. 109 // Which textures are bound to texture units through glActiveTexture.
138 scoped_array<TextureUnit> texture_units; 110 scoped_array<TextureUnit> texture_units;
139 111
140 // Class that manages vertex attribs. 112 // Class that manages vertex attribs.
141 VertexAttribManager::Ref vertex_attrib_manager; 113 VertexAttribManager::Ref vertex_attrib_manager;
142 114
143 // The program in use by glUseProgram 115 // The program in use by glUseProgram
144 ProgramManager::ProgramInfo::Ref current_program; 116 ProgramManager::ProgramInfo::Ref current_program;
145 117
146 // The currently bound framebuffers 118 // The currently bound framebuffers
147 FramebufferManager::FramebufferInfo::Ref bound_read_framebuffer; 119 FramebufferManager::FramebufferInfo::Ref bound_read_framebuffer;
148 FramebufferManager::FramebufferInfo::Ref bound_draw_framebuffer; 120 FramebufferManager::FramebufferInfo::Ref bound_draw_framebuffer;
149 121
150 // The currently bound renderbuffer 122 // The currently bound renderbuffer
151 RenderbufferManager::RenderbufferInfo::Ref bound_renderbuffer; 123 RenderbufferManager::RenderbufferInfo::Ref bound_renderbuffer;
152 124
153 QueryManager::Query::Ref current_query; 125 QueryManager::Query::Ref current_query;
154 126
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; 127 GLenum hint_generate_mipmap;
194 GLenum hint_fragment_shader_derivative; 128 GLenum hint_fragment_shader_derivative;
195 129
196 bool pack_reverse_row_order; 130 bool pack_reverse_row_order;
197 }; 131 };
198 132
199 } // namespace gles2 133 } // namespace gles2
200 } // namespace gpu 134 } // namespace gpu
201 135
202 #endif // GPU_COMMAND_BUFFER_SERVICE_CONTEXT_STATE_H_ 136 #endif // GPU_COMMAND_BUFFER_SERVICE_CONTEXT_STATE_H_
203 137
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698