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
3// found in the LICENSE file.
4
5// This file is auto-generated from
6// gpu/command_buffer/build_gles2_cmd_buffer.py
7// It's formatted by clang-format using chromium coding style:
8//    clang-format -i -style=chromium filename
9// DO NOT EDIT!
10
11// It is included by context_state.h
12#ifndef GPU_COMMAND_BUFFER_SERVICE_CONTEXT_STATE_AUTOGEN_H_
13#define GPU_COMMAND_BUFFER_SERVICE_CONTEXT_STATE_AUTOGEN_H_
14
15struct EnableFlags {
16  EnableFlags();
17  bool blend;
18  bool cached_blend;
19  bool cull_face;
20  bool cached_cull_face;
21  bool depth_test;
22  bool cached_depth_test;
23  bool dither;
24  bool cached_dither;
25  bool polygon_offset_fill;
26  bool cached_polygon_offset_fill;
27  bool sample_alpha_to_coverage;
28  bool cached_sample_alpha_to_coverage;
29  bool sample_coverage;
30  bool cached_sample_coverage;
31  bool scissor_test;
32  bool cached_scissor_test;
33  bool stencil_test;
34  bool cached_stencil_test;
35};
36
37GLfloat blend_color_red;
38GLfloat blend_color_green;
39GLfloat blend_color_blue;
40GLfloat blend_color_alpha;
41GLenum blend_equation_rgb;
42GLenum blend_equation_alpha;
43GLenum blend_source_rgb;
44GLenum blend_dest_rgb;
45GLenum blend_source_alpha;
46GLenum blend_dest_alpha;
47GLfloat color_clear_red;
48GLfloat color_clear_green;
49GLfloat color_clear_blue;
50GLfloat color_clear_alpha;
51GLclampf depth_clear;
52GLint stencil_clear;
53GLboolean color_mask_red;
54GLboolean cached_color_mask_red;
55GLboolean color_mask_green;
56GLboolean cached_color_mask_green;
57GLboolean color_mask_blue;
58GLboolean cached_color_mask_blue;
59GLboolean color_mask_alpha;
60GLboolean cached_color_mask_alpha;
61GLenum cull_mode;
62GLenum depth_func;
63GLboolean depth_mask;
64GLboolean cached_depth_mask;
65GLclampf z_near;
66GLclampf z_far;
67GLenum front_face;
68GLenum hint_generate_mipmap;
69GLenum hint_fragment_shader_derivative;
70GLfloat line_width;
71GLfloat modelview_matrix[16];
72GLfloat projection_matrix[16];
73GLint pack_alignment;
74GLint unpack_alignment;
75GLfloat polygon_offset_factor;
76GLfloat polygon_offset_units;
77GLclampf sample_coverage_value;
78GLboolean sample_coverage_invert;
79GLint scissor_x;
80GLint scissor_y;
81GLsizei scissor_width;
82GLsizei scissor_height;
83GLenum stencil_front_func;
84GLint stencil_front_ref;
85GLuint stencil_front_mask;
86GLenum stencil_back_func;
87GLint stencil_back_ref;
88GLuint stencil_back_mask;
89GLuint stencil_front_writemask;
90GLuint cached_stencil_front_writemask;
91GLuint stencil_back_writemask;
92GLuint cached_stencil_back_writemask;
93GLenum stencil_front_fail_op;
94GLenum stencil_front_z_fail_op;
95GLenum stencil_front_z_pass_op;
96GLenum stencil_back_fail_op;
97GLenum stencil_back_z_fail_op;
98GLenum stencil_back_z_pass_op;
99GLint viewport_x;
100GLint viewport_y;
101GLsizei viewport_width;
102GLsizei viewport_height;
103
104inline void SetDeviceCapabilityState(GLenum cap, bool enable) {
105  switch (cap) {
106    case GL_BLEND:
107      if (enable_flags.cached_blend == enable && !ignore_cached_state)
108        return;
109      enable_flags.cached_blend = enable;
110      break;
111    case GL_CULL_FACE:
112      if (enable_flags.cached_cull_face == enable && !ignore_cached_state)
113        return;
114      enable_flags.cached_cull_face = enable;
115      break;
116    case GL_DEPTH_TEST:
117      if (enable_flags.cached_depth_test == enable && !ignore_cached_state)
118        return;
119      enable_flags.cached_depth_test = enable;
120      break;
121    case GL_DITHER:
122      if (enable_flags.cached_dither == enable && !ignore_cached_state)
123        return;
124      enable_flags.cached_dither = enable;
125      break;
126    case GL_POLYGON_OFFSET_FILL:
127      if (enable_flags.cached_polygon_offset_fill == enable &&
128          !ignore_cached_state)
129        return;
130      enable_flags.cached_polygon_offset_fill = enable;
131      break;
132    case GL_SAMPLE_ALPHA_TO_COVERAGE:
133      if (enable_flags.cached_sample_alpha_to_coverage == enable &&
134          !ignore_cached_state)
135        return;
136      enable_flags.cached_sample_alpha_to_coverage = enable;
137      break;
138    case GL_SAMPLE_COVERAGE:
139      if (enable_flags.cached_sample_coverage == enable && !ignore_cached_state)
140        return;
141      enable_flags.cached_sample_coverage = enable;
142      break;
143    case GL_SCISSOR_TEST:
144      if (enable_flags.cached_scissor_test == enable && !ignore_cached_state)
145        return;
146      enable_flags.cached_scissor_test = enable;
147      break;
148    case GL_STENCIL_TEST:
149      if (enable_flags.cached_stencil_test == enable && !ignore_cached_state)
150        return;
151      enable_flags.cached_stencil_test = enable;
152      break;
153    default:
154      NOTREACHED();
155      return;
156  }
157  if (enable)
158    glEnable(cap);
159  else
160    glDisable(cap);
161}
162#endif  // GPU_COMMAND_BUFFER_SERVICE_CONTEXT_STATE_AUTOGEN_H_
163