context_state_impl_autogen.h revision 5821806d5e7f356e8fa4b058a389a808ea183019
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
3// found in the LICENSE file.
4
5// This file is auto-generated from
6// gpu/command_buffer/build_gles2_cmd_buffer.py
7// DO NOT EDIT!
8
9// It is included by context_state.cc
10#ifndef GPU_COMMAND_BUFFER_SERVICE_CONTEXT_STATE_IMPL_AUTOGEN_H_
11#define GPU_COMMAND_BUFFER_SERVICE_CONTEXT_STATE_IMPL_AUTOGEN_H_
12
13ContextState::EnableFlags::EnableFlags()
14    : blend(false),
15      cull_face(false),
16      depth_test(false),
17      dither(true),
18      polygon_offset_fill(false),
19      sample_alpha_to_coverage(false),
20      sample_coverage(false),
21      scissor_test(false),
22      stencil_test(false) {
23}
24
25void ContextState::Initialize() {
26  blend_color_red = 0.0f;
27  blend_color_green = 0.0f;
28  blend_color_blue = 0.0f;
29  blend_color_alpha = 0.0f;
30  blend_equation_rgb = GL_FUNC_ADD;
31  blend_equation_alpha = GL_FUNC_ADD;
32  blend_source_rgb = GL_ONE;
33  blend_dest_rgb = GL_ZERO;
34  blend_source_alpha = GL_ONE;
35  blend_dest_alpha = GL_ZERO;
36  color_clear_red = 0.0f;
37  color_clear_green = 0.0f;
38  color_clear_blue = 0.0f;
39  color_clear_alpha = 0.0f;
40  depth_clear = 1.0f;
41  stencil_clear = 0;
42  color_mask_red = true;
43  color_mask_green = true;
44  color_mask_blue = true;
45  color_mask_alpha = true;
46  cull_mode = GL_BACK;
47  depth_func = GL_LESS;
48  depth_mask = true;
49  z_near = 0.0f;
50  z_far = 1.0f;
51  front_face = GL_CCW;
52  line_width = 1.0f;
53  polygon_offset_factor = 0.0f;
54  polygon_offset_units = 0.0f;
55  sample_coverage_value = 1.0f;
56  sample_coverage_invert = false;
57  scissor_x = 0;
58  scissor_y = 0;
59  scissor_width = 1;
60  scissor_height = 1;
61  stencil_front_func = GL_ALWAYS;
62  stencil_front_ref = 0;
63  stencil_front_mask = 0xFFFFFFFFU;
64  stencil_back_func = GL_ALWAYS;
65  stencil_back_ref = 0;
66  stencil_back_mask = 0xFFFFFFFFU;
67  stencil_front_writemask = 0xFFFFFFFFU;
68  stencil_back_writemask = 0xFFFFFFFFU;
69  stencil_front_fail_op = GL_KEEP;
70  stencil_front_z_fail_op = GL_KEEP;
71  stencil_front_z_pass_op = GL_KEEP;
72  stencil_back_fail_op = GL_KEEP;
73  stencil_back_z_fail_op = GL_KEEP;
74  stencil_back_z_pass_op = GL_KEEP;
75  viewport_x = 0;
76  viewport_y = 0;
77  viewport_width = 1;
78  viewport_height = 1;
79}
80
81void ContextState::InitCapabilities() const {
82  EnableDisable(GL_BLEND, enable_flags.blend);
83  EnableDisable(GL_CULL_FACE, enable_flags.cull_face);
84  EnableDisable(GL_DEPTH_TEST, enable_flags.depth_test);
85  EnableDisable(GL_DITHER, enable_flags.dither);
86  EnableDisable(GL_POLYGON_OFFSET_FILL, enable_flags.polygon_offset_fill);
87  EnableDisable(
88      GL_SAMPLE_ALPHA_TO_COVERAGE, enable_flags.sample_alpha_to_coverage);
89  EnableDisable(GL_SAMPLE_COVERAGE, enable_flags.sample_coverage);
90  EnableDisable(GL_SCISSOR_TEST, enable_flags.scissor_test);
91  EnableDisable(GL_STENCIL_TEST, enable_flags.stencil_test);
92}
93
94void ContextState::InitState() const {
95  glBlendColor(
96      blend_color_red, blend_color_green, blend_color_blue, blend_color_alpha);
97  glBlendEquationSeparate(blend_equation_rgb, blend_equation_alpha);
98  glBlendFuncSeparate(
99      blend_source_rgb, blend_dest_rgb, blend_source_alpha, blend_dest_alpha);
100  glClearColor(
101      color_clear_red, color_clear_green, color_clear_blue, color_clear_alpha);
102  glClearDepth(depth_clear);
103  glClearStencil(stencil_clear);
104  glColorMask(
105      color_mask_red, color_mask_green, color_mask_blue, color_mask_alpha);
106  glCullFace(cull_mode);
107  glDepthFunc(depth_func);
108  glDepthMask(depth_mask);
109  glDepthRange(z_near, z_far);
110  glFrontFace(front_face);
111  glLineWidth(line_width);
112  glPolygonOffset(polygon_offset_factor, polygon_offset_units);
113  glSampleCoverage(sample_coverage_value, sample_coverage_invert);
114  glScissor(scissor_x, scissor_y, scissor_width, scissor_height);
115  glStencilFuncSeparate(
116      GL_FRONT, stencil_front_func, stencil_front_ref, stencil_front_mask);
117  glStencilFuncSeparate(
118      GL_BACK, stencil_back_func, stencil_back_ref, stencil_back_mask);
119  glStencilMaskSeparate(GL_FRONT, stencil_front_writemask);
120  glStencilMaskSeparate(GL_BACK, stencil_back_writemask);
121  glStencilOpSeparate(
122      GL_FRONT, stencil_front_fail_op, stencil_front_z_fail_op,
123      stencil_front_z_pass_op);
124  glStencilOpSeparate(
125      GL_BACK, stencil_back_fail_op, stencil_back_z_fail_op,
126      stencil_back_z_pass_op);
127  glViewport(viewport_x, viewport_y, viewport_width, viewport_height);
128}
129#endif  // GPU_COMMAND_BUFFER_SERVICE_CONTEXT_STATE_IMPL_AUTOGEN_H_
130
131