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