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