| 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 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 EnableDisable(GL_STENCIL_TEST, enable_flags.cached_stencil_test); | 175 EnableDisable(GL_STENCIL_TEST, enable_flags.cached_stencil_test); |
| 176 } | 176 } |
| 177 } | 177 } |
| 178 | 178 |
| 179 void ContextState::InitState(const ContextState* prev_state) const { | 179 void ContextState::InitState(const ContextState* prev_state) const { |
| 180 if (prev_state) { | 180 if (prev_state) { |
| 181 if ((blend_color_red != prev_state->blend_color_red) || | 181 if ((blend_color_red != prev_state->blend_color_red) || |
| 182 (blend_color_green != prev_state->blend_color_green) || | 182 (blend_color_green != prev_state->blend_color_green) || |
| 183 (blend_color_blue != prev_state->blend_color_blue) || | 183 (blend_color_blue != prev_state->blend_color_blue) || |
| 184 (blend_color_alpha != prev_state->blend_color_alpha)) | 184 (blend_color_alpha != prev_state->blend_color_alpha)) |
| 185 glBlendColor(blend_color_red, | 185 glBlendColor(blend_color_red, blend_color_green, blend_color_blue, |
| 186 blend_color_green, | |
| 187 blend_color_blue, | |
| 188 blend_color_alpha); | 186 blend_color_alpha); |
| 189 if ((blend_equation_rgb != prev_state->blend_equation_rgb) || | 187 if ((blend_equation_rgb != prev_state->blend_equation_rgb) || |
| 190 (blend_equation_alpha != prev_state->blend_equation_alpha)) | 188 (blend_equation_alpha != prev_state->blend_equation_alpha)) |
| 191 glBlendEquationSeparate(blend_equation_rgb, blend_equation_alpha); | 189 glBlendEquationSeparate(blend_equation_rgb, blend_equation_alpha); |
| 192 if ((blend_source_rgb != prev_state->blend_source_rgb) || | 190 if ((blend_source_rgb != prev_state->blend_source_rgb) || |
| 193 (blend_dest_rgb != prev_state->blend_dest_rgb) || | 191 (blend_dest_rgb != prev_state->blend_dest_rgb) || |
| 194 (blend_source_alpha != prev_state->blend_source_alpha) || | 192 (blend_source_alpha != prev_state->blend_source_alpha) || |
| 195 (blend_dest_alpha != prev_state->blend_dest_alpha)) | 193 (blend_dest_alpha != prev_state->blend_dest_alpha)) |
| 196 glBlendFuncSeparate(blend_source_rgb, | 194 glBlendFuncSeparate(blend_source_rgb, blend_dest_rgb, blend_source_alpha, |
| 197 blend_dest_rgb, | |
| 198 blend_source_alpha, | |
| 199 blend_dest_alpha); | 195 blend_dest_alpha); |
| 200 if ((color_clear_red != prev_state->color_clear_red) || | 196 if ((color_clear_red != prev_state->color_clear_red) || |
| 201 (color_clear_green != prev_state->color_clear_green) || | 197 (color_clear_green != prev_state->color_clear_green) || |
| 202 (color_clear_blue != prev_state->color_clear_blue) || | 198 (color_clear_blue != prev_state->color_clear_blue) || |
| 203 (color_clear_alpha != prev_state->color_clear_alpha)) | 199 (color_clear_alpha != prev_state->color_clear_alpha)) |
| 204 glClearColor(color_clear_red, | 200 glClearColor(color_clear_red, color_clear_green, color_clear_blue, |
| 205 color_clear_green, | |
| 206 color_clear_blue, | |
| 207 color_clear_alpha); | 201 color_clear_alpha); |
| 208 if ((depth_clear != prev_state->depth_clear)) | 202 if ((depth_clear != prev_state->depth_clear)) |
| 209 glClearDepth(depth_clear); | 203 glClearDepth(depth_clear); |
| 210 if ((stencil_clear != prev_state->stencil_clear)) | 204 if ((stencil_clear != prev_state->stencil_clear)) |
| 211 glClearStencil(stencil_clear); | 205 glClearStencil(stencil_clear); |
| 212 if ((cached_color_mask_red != prev_state->cached_color_mask_red) || | 206 if ((cached_color_mask_red != prev_state->cached_color_mask_red) || |
| 213 (cached_color_mask_green != prev_state->cached_color_mask_green) || | 207 (cached_color_mask_green != prev_state->cached_color_mask_green) || |
| 214 (cached_color_mask_blue != prev_state->cached_color_mask_blue) || | 208 (cached_color_mask_blue != prev_state->cached_color_mask_blue) || |
| 215 (cached_color_mask_alpha != prev_state->cached_color_mask_alpha)) | 209 (cached_color_mask_alpha != prev_state->cached_color_mask_alpha)) |
| 216 glColorMask(cached_color_mask_red, | 210 glColorMask(cached_color_mask_red, cached_color_mask_green, |
| 217 cached_color_mask_green, | 211 cached_color_mask_blue, cached_color_mask_alpha); |
| 218 cached_color_mask_blue, | |
| 219 cached_color_mask_alpha); | |
| 220 if ((cull_mode != prev_state->cull_mode)) | 212 if ((cull_mode != prev_state->cull_mode)) |
| 221 glCullFace(cull_mode); | 213 glCullFace(cull_mode); |
| 222 if ((depth_func != prev_state->depth_func)) | 214 if ((depth_func != prev_state->depth_func)) |
| 223 glDepthFunc(depth_func); | 215 glDepthFunc(depth_func); |
| 224 if ((cached_depth_mask != prev_state->cached_depth_mask)) | 216 if ((cached_depth_mask != prev_state->cached_depth_mask)) |
| 225 glDepthMask(cached_depth_mask); | 217 glDepthMask(cached_depth_mask); |
| 226 if ((z_near != prev_state->z_near) || (z_far != prev_state->z_far)) | 218 if ((z_near != prev_state->z_near) || (z_far != prev_state->z_far)) |
| 227 glDepthRange(z_near, z_far); | 219 glDepthRange(z_near, z_far); |
| 228 if ((front_face != prev_state->front_face)) | 220 if ((front_face != prev_state->front_face)) |
| 229 glFrontFace(front_face); | 221 glFrontFace(front_face); |
| 230 if (prev_state->hint_generate_mipmap != hint_generate_mipmap) { | 222 if (prev_state->hint_generate_mipmap != hint_generate_mipmap) { |
| 231 glHint(GL_GENERATE_MIPMAP_HINT, hint_generate_mipmap); | 223 glHint(GL_GENERATE_MIPMAP_HINT, hint_generate_mipmap); |
| 232 } | 224 } |
| 233 if (feature_info_->feature_flags().oes_standard_derivatives) { | 225 if (feature_info_->feature_flags().oes_standard_derivatives) { |
| 234 if (prev_state->hint_fragment_shader_derivative != | 226 if (prev_state->hint_fragment_shader_derivative != |
| 235 hint_fragment_shader_derivative) { | 227 hint_fragment_shader_derivative) { |
| 236 glHint(GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES, | 228 glHint(GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES, |
| 237 hint_fragment_shader_derivative); | 229 hint_fragment_shader_derivative); |
| 238 } | 230 } |
| 239 } | 231 } |
| 240 if ((line_width != prev_state->line_width)) | 232 if ((line_width != prev_state->line_width)) |
| 241 glLineWidth(line_width); | 233 glLineWidth(line_width); |
| 242 if (feature_info_->feature_flags().chromium_path_rendering) { | 234 if (feature_info_->feature_flags().chromium_path_rendering) { |
| 243 if (memcmp(prev_state->modelview_matrix, | 235 if (memcmp(prev_state->modelview_matrix, modelview_matrix, |
| 244 modelview_matrix, | |
| 245 sizeof(GLfloat) * 16)) { | 236 sizeof(GLfloat) * 16)) { |
| 246 glMatrixLoadfEXT(GL_PATH_MODELVIEW_CHROMIUM, modelview_matrix); | 237 glMatrixLoadfEXT(GL_PATH_MODELVIEW_CHROMIUM, modelview_matrix); |
| 247 } | 238 } |
| 248 } | 239 } |
| 249 if (feature_info_->feature_flags().chromium_path_rendering) { | 240 if (feature_info_->feature_flags().chromium_path_rendering) { |
| 250 if (memcmp(prev_state->projection_matrix, | 241 if (memcmp(prev_state->projection_matrix, projection_matrix, |
| 251 projection_matrix, | |
| 252 sizeof(GLfloat) * 16)) { | 242 sizeof(GLfloat) * 16)) { |
| 253 glMatrixLoadfEXT(GL_PATH_PROJECTION_CHROMIUM, projection_matrix); | 243 glMatrixLoadfEXT(GL_PATH_PROJECTION_CHROMIUM, projection_matrix); |
| 254 } | 244 } |
| 255 } | 245 } |
| 256 if (prev_state->pack_alignment != pack_alignment) { | 246 if (prev_state->pack_alignment != pack_alignment) { |
| 257 glPixelStorei(GL_PACK_ALIGNMENT, pack_alignment); | 247 glPixelStorei(GL_PACK_ALIGNMENT, pack_alignment); |
| 258 } | 248 } |
| 259 if (prev_state->unpack_alignment != unpack_alignment) { | 249 if (prev_state->unpack_alignment != unpack_alignment) { |
| 260 glPixelStorei(GL_UNPACK_ALIGNMENT, unpack_alignment); | 250 glPixelStorei(GL_UNPACK_ALIGNMENT, unpack_alignment); |
| 261 } | 251 } |
| 262 if ((polygon_offset_factor != prev_state->polygon_offset_factor) || | 252 if ((polygon_offset_factor != prev_state->polygon_offset_factor) || |
| 263 (polygon_offset_units != prev_state->polygon_offset_units)) | 253 (polygon_offset_units != prev_state->polygon_offset_units)) |
| 264 glPolygonOffset(polygon_offset_factor, polygon_offset_units); | 254 glPolygonOffset(polygon_offset_factor, polygon_offset_units); |
| 265 if ((sample_coverage_value != prev_state->sample_coverage_value) || | 255 if ((sample_coverage_value != prev_state->sample_coverage_value) || |
| 266 (sample_coverage_invert != prev_state->sample_coverage_invert)) | 256 (sample_coverage_invert != prev_state->sample_coverage_invert)) |
| 267 glSampleCoverage(sample_coverage_value, sample_coverage_invert); | 257 glSampleCoverage(sample_coverage_value, sample_coverage_invert); |
| 268 if ((scissor_x != prev_state->scissor_x) || | 258 if ((scissor_x != prev_state->scissor_x) || |
| 269 (scissor_y != prev_state->scissor_y) || | 259 (scissor_y != prev_state->scissor_y) || |
| 270 (scissor_width != prev_state->scissor_width) || | 260 (scissor_width != prev_state->scissor_width) || |
| 271 (scissor_height != prev_state->scissor_height)) | 261 (scissor_height != prev_state->scissor_height)) |
| 272 glScissor(scissor_x, scissor_y, scissor_width, scissor_height); | 262 glScissor(scissor_x, scissor_y, scissor_width, scissor_height); |
| 273 if ((stencil_front_func != prev_state->stencil_front_func) || | 263 if ((stencil_front_func != prev_state->stencil_front_func) || |
| 274 (stencil_front_ref != prev_state->stencil_front_ref) || | 264 (stencil_front_ref != prev_state->stencil_front_ref) || |
| 275 (stencil_front_mask != prev_state->stencil_front_mask)) | 265 (stencil_front_mask != prev_state->stencil_front_mask)) |
| 276 glStencilFuncSeparate( | 266 glStencilFuncSeparate(GL_FRONT, stencil_front_func, stencil_front_ref, |
| 277 GL_FRONT, stencil_front_func, stencil_front_ref, stencil_front_mask); | 267 stencil_front_mask); |
| 278 if ((stencil_back_func != prev_state->stencil_back_func) || | 268 if ((stencil_back_func != prev_state->stencil_back_func) || |
| 279 (stencil_back_ref != prev_state->stencil_back_ref) || | 269 (stencil_back_ref != prev_state->stencil_back_ref) || |
| 280 (stencil_back_mask != prev_state->stencil_back_mask)) | 270 (stencil_back_mask != prev_state->stencil_back_mask)) |
| 281 glStencilFuncSeparate( | 271 glStencilFuncSeparate(GL_BACK, stencil_back_func, stencil_back_ref, |
| 282 GL_BACK, stencil_back_func, stencil_back_ref, stencil_back_mask); | 272 stencil_back_mask); |
| 283 if ((cached_stencil_front_writemask != | 273 if ((cached_stencil_front_writemask != |
| 284 prev_state->cached_stencil_front_writemask)) | 274 prev_state->cached_stencil_front_writemask)) |
| 285 glStencilMaskSeparate(GL_FRONT, cached_stencil_front_writemask); | 275 glStencilMaskSeparate(GL_FRONT, cached_stencil_front_writemask); |
| 286 if ((cached_stencil_back_writemask != | 276 if ((cached_stencil_back_writemask != |
| 287 prev_state->cached_stencil_back_writemask)) | 277 prev_state->cached_stencil_back_writemask)) |
| 288 glStencilMaskSeparate(GL_BACK, cached_stencil_back_writemask); | 278 glStencilMaskSeparate(GL_BACK, cached_stencil_back_writemask); |
| 289 if ((stencil_front_fail_op != prev_state->stencil_front_fail_op) || | 279 if ((stencil_front_fail_op != prev_state->stencil_front_fail_op) || |
| 290 (stencil_front_z_fail_op != prev_state->stencil_front_z_fail_op) || | 280 (stencil_front_z_fail_op != prev_state->stencil_front_z_fail_op) || |
| 291 (stencil_front_z_pass_op != prev_state->stencil_front_z_pass_op)) | 281 (stencil_front_z_pass_op != prev_state->stencil_front_z_pass_op)) |
| 292 glStencilOpSeparate(GL_FRONT, | 282 glStencilOpSeparate(GL_FRONT, stencil_front_fail_op, |
| 293 stencil_front_fail_op, | 283 stencil_front_z_fail_op, stencil_front_z_pass_op); |
| 294 stencil_front_z_fail_op, | |
| 295 stencil_front_z_pass_op); | |
| 296 if ((stencil_back_fail_op != prev_state->stencil_back_fail_op) || | 284 if ((stencil_back_fail_op != prev_state->stencil_back_fail_op) || |
| 297 (stencil_back_z_fail_op != prev_state->stencil_back_z_fail_op) || | 285 (stencil_back_z_fail_op != prev_state->stencil_back_z_fail_op) || |
| 298 (stencil_back_z_pass_op != prev_state->stencil_back_z_pass_op)) | 286 (stencil_back_z_pass_op != prev_state->stencil_back_z_pass_op)) |
| 299 glStencilOpSeparate(GL_BACK, | 287 glStencilOpSeparate(GL_BACK, stencil_back_fail_op, stencil_back_z_fail_op, |
| 300 stencil_back_fail_op, | |
| 301 stencil_back_z_fail_op, | |
| 302 stencil_back_z_pass_op); | 288 stencil_back_z_pass_op); |
| 303 if ((viewport_x != prev_state->viewport_x) || | 289 if ((viewport_x != prev_state->viewport_x) || |
| 304 (viewport_y != prev_state->viewport_y) || | 290 (viewport_y != prev_state->viewport_y) || |
| 305 (viewport_width != prev_state->viewport_width) || | 291 (viewport_width != prev_state->viewport_width) || |
| 306 (viewport_height != prev_state->viewport_height)) | 292 (viewport_height != prev_state->viewport_height)) |
| 307 glViewport(viewport_x, viewport_y, viewport_width, viewport_height); | 293 glViewport(viewport_x, viewport_y, viewport_width, viewport_height); |
| 308 } else { | 294 } else { |
| 309 glBlendColor(blend_color_red, | 295 glBlendColor(blend_color_red, blend_color_green, blend_color_blue, |
| 310 blend_color_green, | |
| 311 blend_color_blue, | |
| 312 blend_color_alpha); | 296 blend_color_alpha); |
| 313 glBlendEquationSeparate(blend_equation_rgb, blend_equation_alpha); | 297 glBlendEquationSeparate(blend_equation_rgb, blend_equation_alpha); |
| 314 glBlendFuncSeparate( | 298 glBlendFuncSeparate(blend_source_rgb, blend_dest_rgb, blend_source_alpha, |
| 315 blend_source_rgb, blend_dest_rgb, blend_source_alpha, blend_dest_alpha); | 299 blend_dest_alpha); |
| 316 glClearColor(color_clear_red, | 300 glClearColor(color_clear_red, color_clear_green, color_clear_blue, |
| 317 color_clear_green, | |
| 318 color_clear_blue, | |
| 319 color_clear_alpha); | 301 color_clear_alpha); |
| 320 glClearDepth(depth_clear); | 302 glClearDepth(depth_clear); |
| 321 glClearStencil(stencil_clear); | 303 glClearStencil(stencil_clear); |
| 322 glColorMask(cached_color_mask_red, | 304 glColorMask(cached_color_mask_red, cached_color_mask_green, |
| 323 cached_color_mask_green, | 305 cached_color_mask_blue, cached_color_mask_alpha); |
| 324 cached_color_mask_blue, | |
| 325 cached_color_mask_alpha); | |
| 326 glCullFace(cull_mode); | 306 glCullFace(cull_mode); |
| 327 glDepthFunc(depth_func); | 307 glDepthFunc(depth_func); |
| 328 glDepthMask(cached_depth_mask); | 308 glDepthMask(cached_depth_mask); |
| 329 glDepthRange(z_near, z_far); | 309 glDepthRange(z_near, z_far); |
| 330 glFrontFace(front_face); | 310 glFrontFace(front_face); |
| 331 glHint(GL_GENERATE_MIPMAP_HINT, hint_generate_mipmap); | 311 glHint(GL_GENERATE_MIPMAP_HINT, hint_generate_mipmap); |
| 332 if (feature_info_->feature_flags().oes_standard_derivatives) { | 312 if (feature_info_->feature_flags().oes_standard_derivatives) { |
| 333 glHint(GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES, | 313 glHint(GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES, |
| 334 hint_fragment_shader_derivative); | 314 hint_fragment_shader_derivative); |
| 335 } | 315 } |
| 336 glLineWidth(line_width); | 316 glLineWidth(line_width); |
| 337 if (feature_info_->feature_flags().chromium_path_rendering) { | 317 if (feature_info_->feature_flags().chromium_path_rendering) { |
| 338 glMatrixLoadfEXT(GL_PATH_MODELVIEW_CHROMIUM, modelview_matrix); | 318 glMatrixLoadfEXT(GL_PATH_MODELVIEW_CHROMIUM, modelview_matrix); |
| 339 } | 319 } |
| 340 if (feature_info_->feature_flags().chromium_path_rendering) { | 320 if (feature_info_->feature_flags().chromium_path_rendering) { |
| 341 glMatrixLoadfEXT(GL_PATH_PROJECTION_CHROMIUM, projection_matrix); | 321 glMatrixLoadfEXT(GL_PATH_PROJECTION_CHROMIUM, projection_matrix); |
| 342 } | 322 } |
| 343 glPixelStorei(GL_PACK_ALIGNMENT, pack_alignment); | 323 glPixelStorei(GL_PACK_ALIGNMENT, pack_alignment); |
| 344 glPixelStorei(GL_UNPACK_ALIGNMENT, unpack_alignment); | 324 glPixelStorei(GL_UNPACK_ALIGNMENT, unpack_alignment); |
| 345 glPolygonOffset(polygon_offset_factor, polygon_offset_units); | 325 glPolygonOffset(polygon_offset_factor, polygon_offset_units); |
| 346 glSampleCoverage(sample_coverage_value, sample_coverage_invert); | 326 glSampleCoverage(sample_coverage_value, sample_coverage_invert); |
| 347 glScissor(scissor_x, scissor_y, scissor_width, scissor_height); | 327 glScissor(scissor_x, scissor_y, scissor_width, scissor_height); |
| 348 glStencilFuncSeparate( | 328 glStencilFuncSeparate(GL_FRONT, stencil_front_func, stencil_front_ref, |
| 349 GL_FRONT, stencil_front_func, stencil_front_ref, stencil_front_mask); | 329 stencil_front_mask); |
| 350 glStencilFuncSeparate( | 330 glStencilFuncSeparate(GL_BACK, stencil_back_func, stencil_back_ref, |
| 351 GL_BACK, stencil_back_func, stencil_back_ref, stencil_back_mask); | 331 stencil_back_mask); |
| 352 glStencilMaskSeparate(GL_FRONT, cached_stencil_front_writemask); | 332 glStencilMaskSeparate(GL_FRONT, cached_stencil_front_writemask); |
| 353 glStencilMaskSeparate(GL_BACK, cached_stencil_back_writemask); | 333 glStencilMaskSeparate(GL_BACK, cached_stencil_back_writemask); |
| 354 glStencilOpSeparate(GL_FRONT, | 334 glStencilOpSeparate(GL_FRONT, stencil_front_fail_op, |
| 355 stencil_front_fail_op, | 335 stencil_front_z_fail_op, stencil_front_z_pass_op); |
| 356 stencil_front_z_fail_op, | 336 glStencilOpSeparate(GL_BACK, stencil_back_fail_op, stencil_back_z_fail_op, |
| 357 stencil_front_z_pass_op); | |
| 358 glStencilOpSeparate(GL_BACK, | |
| 359 stencil_back_fail_op, | |
| 360 stencil_back_z_fail_op, | |
| 361 stencil_back_z_pass_op); | 337 stencil_back_z_pass_op); |
| 362 glViewport(viewport_x, viewport_y, viewport_width, viewport_height); | 338 glViewport(viewport_x, viewport_y, viewport_width, viewport_height); |
| 363 } | 339 } |
| 364 } | 340 } |
| 365 bool ContextState::GetEnabled(GLenum cap) const { | 341 bool ContextState::GetEnabled(GLenum cap) const { |
| 366 switch (cap) { | 342 switch (cap) { |
| 367 case GL_BLEND: | 343 case GL_BLEND: |
| 368 return enable_flags.blend; | 344 return enable_flags.blend; |
| 369 case GL_CULL_FACE: | 345 case GL_CULL_FACE: |
| 370 return enable_flags.cull_face; | 346 return enable_flags.cull_face; |
| (...skipping 688 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1059 *num_written = 1; | 1035 *num_written = 1; |
| 1060 if (params) { | 1036 if (params) { |
| 1061 params[0] = static_cast<GLfloat>(enable_flags.stencil_test); | 1037 params[0] = static_cast<GLfloat>(enable_flags.stencil_test); |
| 1062 } | 1038 } |
| 1063 return true; | 1039 return true; |
| 1064 default: | 1040 default: |
| 1065 return false; | 1041 return false; |
| 1066 } | 1042 } |
| 1067 } | 1043 } |
| 1068 #endif // GPU_COMMAND_BUFFER_SERVICE_CONTEXT_STATE_IMPL_AUTOGEN_H_ | 1044 #endif // GPU_COMMAND_BUFFER_SERVICE_CONTEXT_STATE_IMPL_AUTOGEN_H_ |
| OLD | NEW |