OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 is auto-generated from | 5 // This file is auto-generated from |
6 // gpu/command_buffer/build_gles2_cmd_buffer.py | 6 // gpu/command_buffer/build_gles2_cmd_buffer.py |
7 // It's formatted by clang-format using chromium coding style: | 7 // It's formatted by clang-format using chromium coding style: |
8 // clang-format -i -style=chromium filename | 8 // clang-format -i -style=chromium filename |
9 // DO NOT EDIT! | 9 // DO NOT EDIT! |
10 | 10 |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 EnableDisable(GL_SCISSOR_TEST, enable_flags.cached_scissor_test); | 142 EnableDisable(GL_SCISSOR_TEST, enable_flags.cached_scissor_test); |
143 EnableDisable(GL_STENCIL_TEST, enable_flags.cached_stencil_test); | 143 EnableDisable(GL_STENCIL_TEST, enable_flags.cached_stencil_test); |
144 } | 144 } |
145 } | 145 } |
146 | 146 |
147 void ContextState::InitState(const ContextState* prev_state) const { | 147 void ContextState::InitState(const ContextState* prev_state) const { |
148 if (prev_state) { | 148 if (prev_state) { |
149 if ((blend_color_red != prev_state->blend_color_red) || | 149 if ((blend_color_red != prev_state->blend_color_red) || |
150 (blend_color_green != prev_state->blend_color_green) || | 150 (blend_color_green != prev_state->blend_color_green) || |
151 (blend_color_blue != prev_state->blend_color_blue) || | 151 (blend_color_blue != prev_state->blend_color_blue) || |
152 (blend_color_alpha != prev_state->blend_color_alpha)) | 152 (blend_color_alpha != prev_state->blend_color_alpha)) { |
153 glBlendColor(blend_color_red, | 153 glBlendColor(blend_color_red, |
154 blend_color_green, | 154 blend_color_green, |
155 blend_color_blue, | 155 blend_color_blue, |
156 blend_color_alpha); | 156 blend_color_alpha); |
| 157 } |
157 if ((blend_equation_rgb != prev_state->blend_equation_rgb) || | 158 if ((blend_equation_rgb != prev_state->blend_equation_rgb) || |
158 (blend_equation_alpha != prev_state->blend_equation_alpha)) | 159 (blend_equation_alpha != prev_state->blend_equation_alpha)) { |
159 glBlendEquationSeparate(blend_equation_rgb, blend_equation_alpha); | 160 glBlendEquationSeparate(blend_equation_rgb, blend_equation_alpha); |
| 161 } |
160 if ((blend_source_rgb != prev_state->blend_source_rgb) || | 162 if ((blend_source_rgb != prev_state->blend_source_rgb) || |
161 (blend_dest_rgb != prev_state->blend_dest_rgb) || | 163 (blend_dest_rgb != prev_state->blend_dest_rgb) || |
162 (blend_source_alpha != prev_state->blend_source_alpha) || | 164 (blend_source_alpha != prev_state->blend_source_alpha) || |
163 (blend_dest_alpha != prev_state->blend_dest_alpha)) | 165 (blend_dest_alpha != prev_state->blend_dest_alpha)) { |
164 glBlendFuncSeparate(blend_source_rgb, | 166 glBlendFuncSeparate(blend_source_rgb, |
165 blend_dest_rgb, | 167 blend_dest_rgb, |
166 blend_source_alpha, | 168 blend_source_alpha, |
167 blend_dest_alpha); | 169 blend_dest_alpha); |
| 170 } |
168 if ((color_clear_red != prev_state->color_clear_red) || | 171 if ((color_clear_red != prev_state->color_clear_red) || |
169 (color_clear_green != prev_state->color_clear_green) || | 172 (color_clear_green != prev_state->color_clear_green) || |
170 (color_clear_blue != prev_state->color_clear_blue) || | 173 (color_clear_blue != prev_state->color_clear_blue) || |
171 (color_clear_alpha != prev_state->color_clear_alpha)) | 174 (color_clear_alpha != prev_state->color_clear_alpha)) { |
172 glClearColor(color_clear_red, | 175 glClearColor(color_clear_red, |
173 color_clear_green, | 176 color_clear_green, |
174 color_clear_blue, | 177 color_clear_blue, |
175 color_clear_alpha); | 178 color_clear_alpha); |
176 if ((depth_clear != prev_state->depth_clear)) | 179 } |
| 180 if ((depth_clear != prev_state->depth_clear)) { |
177 glClearDepth(depth_clear); | 181 glClearDepth(depth_clear); |
178 if ((stencil_clear != prev_state->stencil_clear)) | 182 } |
| 183 if ((stencil_clear != prev_state->stencil_clear)) { |
179 glClearStencil(stencil_clear); | 184 glClearStencil(stencil_clear); |
| 185 } |
180 if ((cached_color_mask_red != prev_state->cached_color_mask_red) || | 186 if ((cached_color_mask_red != prev_state->cached_color_mask_red) || |
181 (cached_color_mask_green != prev_state->cached_color_mask_green) || | 187 (cached_color_mask_green != prev_state->cached_color_mask_green) || |
182 (cached_color_mask_blue != prev_state->cached_color_mask_blue) || | 188 (cached_color_mask_blue != prev_state->cached_color_mask_blue) || |
183 (cached_color_mask_alpha != prev_state->cached_color_mask_alpha)) | 189 (cached_color_mask_alpha != prev_state->cached_color_mask_alpha)) { |
184 glColorMask(cached_color_mask_red, | 190 glColorMask(cached_color_mask_red, |
185 cached_color_mask_green, | 191 cached_color_mask_green, |
186 cached_color_mask_blue, | 192 cached_color_mask_blue, |
187 cached_color_mask_alpha); | 193 cached_color_mask_alpha); |
188 if ((cull_mode != prev_state->cull_mode)) | 194 } |
| 195 if ((cull_mode != prev_state->cull_mode)) { |
189 glCullFace(cull_mode); | 196 glCullFace(cull_mode); |
190 if ((depth_func != prev_state->depth_func)) | 197 } |
| 198 if ((depth_func != prev_state->depth_func)) { |
191 glDepthFunc(depth_func); | 199 glDepthFunc(depth_func); |
192 if ((cached_depth_mask != prev_state->cached_depth_mask)) | 200 } |
| 201 if ((cached_depth_mask != prev_state->cached_depth_mask)) { |
193 glDepthMask(cached_depth_mask); | 202 glDepthMask(cached_depth_mask); |
194 if ((z_near != prev_state->z_near) || (z_far != prev_state->z_far)) | 203 } |
| 204 if ((z_near != prev_state->z_near) || (z_far != prev_state->z_far)) { |
195 glDepthRange(z_near, z_far); | 205 glDepthRange(z_near, z_far); |
196 if ((front_face != prev_state->front_face)) | 206 } |
| 207 if ((front_face != prev_state->front_face)) { |
197 glFrontFace(front_face); | 208 glFrontFace(front_face); |
| 209 } |
198 if (prev_state->hint_generate_mipmap != hint_generate_mipmap) | 210 if (prev_state->hint_generate_mipmap != hint_generate_mipmap) |
199 glHint(GL_GENERATE_MIPMAP_HINT, hint_generate_mipmap); | 211 glHint(GL_GENERATE_MIPMAP_HINT, hint_generate_mipmap); |
200 if (feature_info_->feature_flags().oes_standard_derivatives) | 212 if (feature_info_->feature_flags().oes_standard_derivatives) |
201 if (prev_state->hint_fragment_shader_derivative != | 213 if (prev_state->hint_fragment_shader_derivative != |
202 hint_fragment_shader_derivative) | 214 hint_fragment_shader_derivative) |
203 glHint(GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES, | 215 glHint(GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES, |
204 hint_fragment_shader_derivative); | 216 hint_fragment_shader_derivative); |
205 if ((line_width != prev_state->line_width)) | 217 if ((line_width != prev_state->line_width)) { |
206 glLineWidth(line_width); | 218 GLfloat sanitized_line_width = line_width; |
| 219 if (base::IsNaN(line_width)) |
| 220 sanitized_line_width = 1.0f; |
| 221 glLineWidth(sanitized_line_width); |
| 222 } |
207 if (prev_state->pack_alignment != pack_alignment) | 223 if (prev_state->pack_alignment != pack_alignment) |
208 glPixelStorei(GL_PACK_ALIGNMENT, pack_alignment); | 224 glPixelStorei(GL_PACK_ALIGNMENT, pack_alignment); |
209 if (prev_state->unpack_alignment != unpack_alignment) | 225 if (prev_state->unpack_alignment != unpack_alignment) |
210 glPixelStorei(GL_UNPACK_ALIGNMENT, unpack_alignment); | 226 glPixelStorei(GL_UNPACK_ALIGNMENT, unpack_alignment); |
211 if ((polygon_offset_factor != prev_state->polygon_offset_factor) || | 227 if ((polygon_offset_factor != prev_state->polygon_offset_factor) || |
212 (polygon_offset_units != prev_state->polygon_offset_units)) | 228 (polygon_offset_units != prev_state->polygon_offset_units)) { |
213 glPolygonOffset(polygon_offset_factor, polygon_offset_units); | 229 glPolygonOffset(polygon_offset_factor, polygon_offset_units); |
| 230 } |
214 if ((sample_coverage_value != prev_state->sample_coverage_value) || | 231 if ((sample_coverage_value != prev_state->sample_coverage_value) || |
215 (sample_coverage_invert != prev_state->sample_coverage_invert)) | 232 (sample_coverage_invert != prev_state->sample_coverage_invert)) { |
216 glSampleCoverage(sample_coverage_value, sample_coverage_invert); | 233 glSampleCoverage(sample_coverage_value, sample_coverage_invert); |
| 234 } |
217 if ((scissor_x != prev_state->scissor_x) || | 235 if ((scissor_x != prev_state->scissor_x) || |
218 (scissor_y != prev_state->scissor_y) || | 236 (scissor_y != prev_state->scissor_y) || |
219 (scissor_width != prev_state->scissor_width) || | 237 (scissor_width != prev_state->scissor_width) || |
220 (scissor_height != prev_state->scissor_height)) | 238 (scissor_height != prev_state->scissor_height)) { |
221 glScissor(scissor_x, scissor_y, scissor_width, scissor_height); | 239 glScissor(scissor_x, scissor_y, scissor_width, scissor_height); |
| 240 } |
222 if ((stencil_front_func != prev_state->stencil_front_func) || | 241 if ((stencil_front_func != prev_state->stencil_front_func) || |
223 (stencil_front_ref != prev_state->stencil_front_ref) || | 242 (stencil_front_ref != prev_state->stencil_front_ref) || |
224 (stencil_front_mask != prev_state->stencil_front_mask)) | 243 (stencil_front_mask != prev_state->stencil_front_mask)) |
225 glStencilFuncSeparate( | 244 glStencilFuncSeparate( |
226 GL_FRONT, stencil_front_func, stencil_front_ref, stencil_front_mask); | 245 GL_FRONT, stencil_front_func, stencil_front_ref, stencil_front_mask); |
227 if ((stencil_back_func != prev_state->stencil_back_func) || | 246 if ((stencil_back_func != prev_state->stencil_back_func) || |
228 (stencil_back_ref != prev_state->stencil_back_ref) || | 247 (stencil_back_ref != prev_state->stencil_back_ref) || |
229 (stencil_back_mask != prev_state->stencil_back_mask)) | 248 (stencil_back_mask != prev_state->stencil_back_mask)) |
230 glStencilFuncSeparate( | 249 glStencilFuncSeparate( |
231 GL_BACK, stencil_back_func, stencil_back_ref, stencil_back_mask); | 250 GL_BACK, stencil_back_func, stencil_back_ref, stencil_back_mask); |
(...skipping 13 matching lines...) Expand all Loading... |
245 if ((stencil_back_fail_op != prev_state->stencil_back_fail_op) || | 264 if ((stencil_back_fail_op != prev_state->stencil_back_fail_op) || |
246 (stencil_back_z_fail_op != prev_state->stencil_back_z_fail_op) || | 265 (stencil_back_z_fail_op != prev_state->stencil_back_z_fail_op) || |
247 (stencil_back_z_pass_op != prev_state->stencil_back_z_pass_op)) | 266 (stencil_back_z_pass_op != prev_state->stencil_back_z_pass_op)) |
248 glStencilOpSeparate(GL_BACK, | 267 glStencilOpSeparate(GL_BACK, |
249 stencil_back_fail_op, | 268 stencil_back_fail_op, |
250 stencil_back_z_fail_op, | 269 stencil_back_z_fail_op, |
251 stencil_back_z_pass_op); | 270 stencil_back_z_pass_op); |
252 if ((viewport_x != prev_state->viewport_x) || | 271 if ((viewport_x != prev_state->viewport_x) || |
253 (viewport_y != prev_state->viewport_y) || | 272 (viewport_y != prev_state->viewport_y) || |
254 (viewport_width != prev_state->viewport_width) || | 273 (viewport_width != prev_state->viewport_width) || |
255 (viewport_height != prev_state->viewport_height)) | 274 (viewport_height != prev_state->viewport_height)) { |
256 glViewport(viewport_x, viewport_y, viewport_width, viewport_height); | 275 glViewport(viewport_x, viewport_y, viewport_width, viewport_height); |
| 276 } |
257 } else { | 277 } else { |
258 glBlendColor(blend_color_red, | 278 glBlendColor(blend_color_red, |
259 blend_color_green, | 279 blend_color_green, |
260 blend_color_blue, | 280 blend_color_blue, |
261 blend_color_alpha); | 281 blend_color_alpha); |
262 glBlendEquationSeparate(blend_equation_rgb, blend_equation_alpha); | 282 glBlendEquationSeparate(blend_equation_rgb, blend_equation_alpha); |
263 glBlendFuncSeparate( | 283 glBlendFuncSeparate( |
264 blend_source_rgb, blend_dest_rgb, blend_source_alpha, blend_dest_alpha); | 284 blend_source_rgb, blend_dest_rgb, blend_source_alpha, blend_dest_alpha); |
265 glClearColor(color_clear_red, | 285 glClearColor(color_clear_red, |
266 color_clear_green, | 286 color_clear_green, |
267 color_clear_blue, | 287 color_clear_blue, |
268 color_clear_alpha); | 288 color_clear_alpha); |
269 glClearDepth(depth_clear); | 289 glClearDepth(depth_clear); |
270 glClearStencil(stencil_clear); | 290 glClearStencil(stencil_clear); |
271 glColorMask(cached_color_mask_red, | 291 glColorMask(cached_color_mask_red, |
272 cached_color_mask_green, | 292 cached_color_mask_green, |
273 cached_color_mask_blue, | 293 cached_color_mask_blue, |
274 cached_color_mask_alpha); | 294 cached_color_mask_alpha); |
275 glCullFace(cull_mode); | 295 glCullFace(cull_mode); |
276 glDepthFunc(depth_func); | 296 glDepthFunc(depth_func); |
277 glDepthMask(cached_depth_mask); | 297 glDepthMask(cached_depth_mask); |
278 glDepthRange(z_near, z_far); | 298 glDepthRange(z_near, z_far); |
279 glFrontFace(front_face); | 299 glFrontFace(front_face); |
280 glHint(GL_GENERATE_MIPMAP_HINT, hint_generate_mipmap); | 300 glHint(GL_GENERATE_MIPMAP_HINT, hint_generate_mipmap); |
281 if (feature_info_->feature_flags().oes_standard_derivatives) | 301 if (feature_info_->feature_flags().oes_standard_derivatives) |
282 glHint(GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES, | 302 glHint(GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES, |
283 hint_fragment_shader_derivative); | 303 hint_fragment_shader_derivative); |
284 glLineWidth(line_width); | 304 GLfloat sanitized_line_width = line_width; |
| 305 if (base::IsNaN(line_width)) |
| 306 sanitized_line_width = 1.0f; |
| 307 glLineWidth(sanitized_line_width); |
285 glPixelStorei(GL_PACK_ALIGNMENT, pack_alignment); | 308 glPixelStorei(GL_PACK_ALIGNMENT, pack_alignment); |
286 glPixelStorei(GL_UNPACK_ALIGNMENT, unpack_alignment); | 309 glPixelStorei(GL_UNPACK_ALIGNMENT, unpack_alignment); |
287 glPolygonOffset(polygon_offset_factor, polygon_offset_units); | 310 glPolygonOffset(polygon_offset_factor, polygon_offset_units); |
288 glSampleCoverage(sample_coverage_value, sample_coverage_invert); | 311 glSampleCoverage(sample_coverage_value, sample_coverage_invert); |
289 glScissor(scissor_x, scissor_y, scissor_width, scissor_height); | 312 glScissor(scissor_x, scissor_y, scissor_width, scissor_height); |
290 glStencilFuncSeparate( | 313 glStencilFuncSeparate( |
291 GL_FRONT, stencil_front_func, stencil_front_ref, stencil_front_mask); | 314 GL_FRONT, stencil_front_func, stencil_front_ref, stencil_front_mask); |
292 glStencilFuncSeparate( | 315 glStencilFuncSeparate( |
293 GL_BACK, stencil_back_func, stencil_back_ref, stencil_back_mask); | 316 GL_BACK, stencil_back_func, stencil_back_ref, stencil_back_mask); |
294 glStencilMaskSeparate(GL_FRONT, cached_stencil_front_writemask); | 317 glStencilMaskSeparate(GL_FRONT, cached_stencil_front_writemask); |
(...skipping 678 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
973 *num_written = 1; | 996 *num_written = 1; |
974 if (params) { | 997 if (params) { |
975 params[0] = static_cast<GLfloat>(enable_flags.stencil_test); | 998 params[0] = static_cast<GLfloat>(enable_flags.stencil_test); |
976 } | 999 } |
977 return true; | 1000 return true; |
978 default: | 1001 default: |
979 return false; | 1002 return false; |
980 } | 1003 } |
981 } | 1004 } |
982 #endif // GPU_COMMAND_BUFFER_SERVICE_CONTEXT_STATE_IMPL_AUTOGEN_H_ | 1005 #endif // GPU_COMMAND_BUFFER_SERVICE_CONTEXT_STATE_IMPL_AUTOGEN_H_ |
OLD | NEW |