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.
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
11 // It is included by context_state.cc
12 #ifndef GPU_COMMAND_BUFFER_SERVICE_CONTEXT_STATE_IMPL_AUTOGEN_H_
13 #define GPU_COMMAND_BUFFER_SERVICE_CONTEXT_STATE_IMPL_AUTOGEN_H_
15 ContextState::EnableFlags::EnableFlags()
19 cached_cull_face(false),
21 cached_depth_test(false),
24 polygon_offset_fill(false),
25 cached_polygon_offset_fill(false),
26 sample_alpha_to_coverage(false),
27 cached_sample_alpha_to_coverage(false),
28 sample_coverage(false),
29 cached_sample_coverage(false),
31 cached_scissor_test(false),
33 cached_stencil_test(false) {
36 void ContextState::Initialize() {
37 blend_color_red
= 0.0f
;
38 blend_color_green
= 0.0f
;
39 blend_color_blue
= 0.0f
;
40 blend_color_alpha
= 0.0f
;
41 blend_equation_rgb
= GL_FUNC_ADD
;
42 blend_equation_alpha
= GL_FUNC_ADD
;
43 blend_source_rgb
= GL_ONE
;
44 blend_dest_rgb
= GL_ZERO
;
45 blend_source_alpha
= GL_ONE
;
46 blend_dest_alpha
= GL_ZERO
;
47 color_clear_red
= 0.0f
;
48 color_clear_green
= 0.0f
;
49 color_clear_blue
= 0.0f
;
50 color_clear_alpha
= 0.0f
;
53 color_mask_red
= true;
54 cached_color_mask_red
= true;
55 color_mask_green
= true;
56 cached_color_mask_green
= true;
57 color_mask_blue
= true;
58 cached_color_mask_blue
= true;
59 color_mask_alpha
= true;
60 cached_color_mask_alpha
= true;
64 cached_depth_mask
= true;
68 hint_generate_mipmap
= GL_DONT_CARE
;
69 hint_fragment_shader_derivative
= GL_DONT_CARE
;
71 modelview_matrix
[0] = 1.0f
;
72 modelview_matrix
[1] = 0.0f
;
73 modelview_matrix
[2] = 0.0f
;
74 modelview_matrix
[3] = 0.0f
;
75 modelview_matrix
[4] = 0.0f
;
76 modelview_matrix
[5] = 1.0f
;
77 modelview_matrix
[6] = 0.0f
;
78 modelview_matrix
[7] = 0.0f
;
79 modelview_matrix
[8] = 0.0f
;
80 modelview_matrix
[9] = 0.0f
;
81 modelview_matrix
[10] = 1.0f
;
82 modelview_matrix
[11] = 0.0f
;
83 modelview_matrix
[12] = 0.0f
;
84 modelview_matrix
[13] = 0.0f
;
85 modelview_matrix
[14] = 0.0f
;
86 modelview_matrix
[15] = 1.0f
;
87 projection_matrix
[0] = 1.0f
;
88 projection_matrix
[1] = 0.0f
;
89 projection_matrix
[2] = 0.0f
;
90 projection_matrix
[3] = 0.0f
;
91 projection_matrix
[4] = 0.0f
;
92 projection_matrix
[5] = 1.0f
;
93 projection_matrix
[6] = 0.0f
;
94 projection_matrix
[7] = 0.0f
;
95 projection_matrix
[8] = 0.0f
;
96 projection_matrix
[9] = 0.0f
;
97 projection_matrix
[10] = 1.0f
;
98 projection_matrix
[11] = 0.0f
;
99 projection_matrix
[12] = 0.0f
;
100 projection_matrix
[13] = 0.0f
;
101 projection_matrix
[14] = 0.0f
;
102 projection_matrix
[15] = 1.0f
;
104 unpack_alignment
= 4;
105 polygon_offset_factor
= 0.0f
;
106 polygon_offset_units
= 0.0f
;
107 sample_coverage_value
= 1.0f
;
108 sample_coverage_invert
= false;
113 stencil_front_func
= GL_ALWAYS
;
114 stencil_front_ref
= 0;
115 stencil_front_mask
= 0xFFFFFFFFU
;
116 stencil_back_func
= GL_ALWAYS
;
117 stencil_back_ref
= 0;
118 stencil_back_mask
= 0xFFFFFFFFU
;
119 stencil_front_writemask
= 0xFFFFFFFFU
;
120 cached_stencil_front_writemask
= 0xFFFFFFFFU
;
121 stencil_back_writemask
= 0xFFFFFFFFU
;
122 cached_stencil_back_writemask
= 0xFFFFFFFFU
;
123 stencil_front_fail_op
= GL_KEEP
;
124 stencil_front_z_fail_op
= GL_KEEP
;
125 stencil_front_z_pass_op
= GL_KEEP
;
126 stencil_back_fail_op
= GL_KEEP
;
127 stencil_back_z_fail_op
= GL_KEEP
;
128 stencil_back_z_pass_op
= GL_KEEP
;
135 void ContextState::InitCapabilities(const ContextState
* prev_state
) const {
137 if (prev_state
->enable_flags
.cached_blend
!= enable_flags
.cached_blend
)
138 EnableDisable(GL_BLEND
, enable_flags
.cached_blend
);
139 if (prev_state
->enable_flags
.cached_cull_face
!=
140 enable_flags
.cached_cull_face
)
141 EnableDisable(GL_CULL_FACE
, enable_flags
.cached_cull_face
);
142 if (prev_state
->enable_flags
.cached_depth_test
!=
143 enable_flags
.cached_depth_test
)
144 EnableDisable(GL_DEPTH_TEST
, enable_flags
.cached_depth_test
);
145 if (prev_state
->enable_flags
.cached_dither
!= enable_flags
.cached_dither
)
146 EnableDisable(GL_DITHER
, enable_flags
.cached_dither
);
147 if (prev_state
->enable_flags
.cached_polygon_offset_fill
!=
148 enable_flags
.cached_polygon_offset_fill
)
149 EnableDisable(GL_POLYGON_OFFSET_FILL
,
150 enable_flags
.cached_polygon_offset_fill
);
151 if (prev_state
->enable_flags
.cached_sample_alpha_to_coverage
!=
152 enable_flags
.cached_sample_alpha_to_coverage
)
153 EnableDisable(GL_SAMPLE_ALPHA_TO_COVERAGE
,
154 enable_flags
.cached_sample_alpha_to_coverage
);
155 if (prev_state
->enable_flags
.cached_sample_coverage
!=
156 enable_flags
.cached_sample_coverage
)
157 EnableDisable(GL_SAMPLE_COVERAGE
, enable_flags
.cached_sample_coverage
);
158 if (prev_state
->enable_flags
.cached_scissor_test
!=
159 enable_flags
.cached_scissor_test
)
160 EnableDisable(GL_SCISSOR_TEST
, enable_flags
.cached_scissor_test
);
161 if (prev_state
->enable_flags
.cached_stencil_test
!=
162 enable_flags
.cached_stencil_test
)
163 EnableDisable(GL_STENCIL_TEST
, enable_flags
.cached_stencil_test
);
165 EnableDisable(GL_BLEND
, enable_flags
.cached_blend
);
166 EnableDisable(GL_CULL_FACE
, enable_flags
.cached_cull_face
);
167 EnableDisable(GL_DEPTH_TEST
, enable_flags
.cached_depth_test
);
168 EnableDisable(GL_DITHER
, enable_flags
.cached_dither
);
169 EnableDisable(GL_POLYGON_OFFSET_FILL
,
170 enable_flags
.cached_polygon_offset_fill
);
171 EnableDisable(GL_SAMPLE_ALPHA_TO_COVERAGE
,
172 enable_flags
.cached_sample_alpha_to_coverage
);
173 EnableDisable(GL_SAMPLE_COVERAGE
, enable_flags
.cached_sample_coverage
);
174 EnableDisable(GL_SCISSOR_TEST
, enable_flags
.cached_scissor_test
);
175 EnableDisable(GL_STENCIL_TEST
, enable_flags
.cached_stencil_test
);
179 void ContextState::InitState(const ContextState
* prev_state
) const {
181 if ((blend_color_red
!= prev_state
->blend_color_red
) ||
182 (blend_color_green
!= prev_state
->blend_color_green
) ||
183 (blend_color_blue
!= prev_state
->blend_color_blue
) ||
184 (blend_color_alpha
!= prev_state
->blend_color_alpha
))
185 glBlendColor(blend_color_red
, blend_color_green
, blend_color_blue
,
187 if ((blend_equation_rgb
!= prev_state
->blend_equation_rgb
) ||
188 (blend_equation_alpha
!= prev_state
->blend_equation_alpha
))
189 glBlendEquationSeparate(blend_equation_rgb
, blend_equation_alpha
);
190 if ((blend_source_rgb
!= prev_state
->blend_source_rgb
) ||
191 (blend_dest_rgb
!= prev_state
->blend_dest_rgb
) ||
192 (blend_source_alpha
!= prev_state
->blend_source_alpha
) ||
193 (blend_dest_alpha
!= prev_state
->blend_dest_alpha
))
194 glBlendFuncSeparate(blend_source_rgb
, blend_dest_rgb
, blend_source_alpha
,
196 if ((color_clear_red
!= prev_state
->color_clear_red
) ||
197 (color_clear_green
!= prev_state
->color_clear_green
) ||
198 (color_clear_blue
!= prev_state
->color_clear_blue
) ||
199 (color_clear_alpha
!= prev_state
->color_clear_alpha
))
200 glClearColor(color_clear_red
, color_clear_green
, color_clear_blue
,
202 if ((depth_clear
!= prev_state
->depth_clear
))
203 glClearDepth(depth_clear
);
204 if ((stencil_clear
!= prev_state
->stencil_clear
))
205 glClearStencil(stencil_clear
);
206 if ((cached_color_mask_red
!= prev_state
->cached_color_mask_red
) ||
207 (cached_color_mask_green
!= prev_state
->cached_color_mask_green
) ||
208 (cached_color_mask_blue
!= prev_state
->cached_color_mask_blue
) ||
209 (cached_color_mask_alpha
!= prev_state
->cached_color_mask_alpha
))
210 glColorMask(cached_color_mask_red
, cached_color_mask_green
,
211 cached_color_mask_blue
, cached_color_mask_alpha
);
212 if ((cull_mode
!= prev_state
->cull_mode
))
213 glCullFace(cull_mode
);
214 if ((depth_func
!= prev_state
->depth_func
))
215 glDepthFunc(depth_func
);
216 if ((cached_depth_mask
!= prev_state
->cached_depth_mask
))
217 glDepthMask(cached_depth_mask
);
218 if ((z_near
!= prev_state
->z_near
) || (z_far
!= prev_state
->z_far
))
219 glDepthRange(z_near
, z_far
);
220 if ((front_face
!= prev_state
->front_face
))
221 glFrontFace(front_face
);
222 if (prev_state
->hint_generate_mipmap
!= hint_generate_mipmap
) {
223 glHint(GL_GENERATE_MIPMAP_HINT
, hint_generate_mipmap
);
225 if (feature_info_
->feature_flags().oes_standard_derivatives
) {
226 if (prev_state
->hint_fragment_shader_derivative
!=
227 hint_fragment_shader_derivative
) {
228 glHint(GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES
,
229 hint_fragment_shader_derivative
);
232 if ((line_width
!= prev_state
->line_width
))
233 glLineWidth(line_width
);
234 if (feature_info_
->feature_flags().chromium_path_rendering
) {
235 if (memcmp(prev_state
->modelview_matrix
, modelview_matrix
,
236 sizeof(GLfloat
) * 16)) {
237 glMatrixLoadfEXT(GL_PATH_MODELVIEW_CHROMIUM
, modelview_matrix
);
240 if (feature_info_
->feature_flags().chromium_path_rendering
) {
241 if (memcmp(prev_state
->projection_matrix
, projection_matrix
,
242 sizeof(GLfloat
) * 16)) {
243 glMatrixLoadfEXT(GL_PATH_PROJECTION_CHROMIUM
, projection_matrix
);
246 if (prev_state
->pack_alignment
!= pack_alignment
) {
247 glPixelStorei(GL_PACK_ALIGNMENT
, pack_alignment
);
249 if (prev_state
->unpack_alignment
!= unpack_alignment
) {
250 glPixelStorei(GL_UNPACK_ALIGNMENT
, unpack_alignment
);
252 if ((polygon_offset_factor
!= prev_state
->polygon_offset_factor
) ||
253 (polygon_offset_units
!= prev_state
->polygon_offset_units
))
254 glPolygonOffset(polygon_offset_factor
, polygon_offset_units
);
255 if ((sample_coverage_value
!= prev_state
->sample_coverage_value
) ||
256 (sample_coverage_invert
!= prev_state
->sample_coverage_invert
))
257 glSampleCoverage(sample_coverage_value
, sample_coverage_invert
);
258 if ((scissor_x
!= prev_state
->scissor_x
) ||
259 (scissor_y
!= prev_state
->scissor_y
) ||
260 (scissor_width
!= prev_state
->scissor_width
) ||
261 (scissor_height
!= prev_state
->scissor_height
))
262 glScissor(scissor_x
, scissor_y
, scissor_width
, scissor_height
);
263 if ((stencil_front_func
!= prev_state
->stencil_front_func
) ||
264 (stencil_front_ref
!= prev_state
->stencil_front_ref
) ||
265 (stencil_front_mask
!= prev_state
->stencil_front_mask
))
266 glStencilFuncSeparate(GL_FRONT
, stencil_front_func
, stencil_front_ref
,
268 if ((stencil_back_func
!= prev_state
->stencil_back_func
) ||
269 (stencil_back_ref
!= prev_state
->stencil_back_ref
) ||
270 (stencil_back_mask
!= prev_state
->stencil_back_mask
))
271 glStencilFuncSeparate(GL_BACK
, stencil_back_func
, stencil_back_ref
,
273 if ((cached_stencil_front_writemask
!=
274 prev_state
->cached_stencil_front_writemask
))
275 glStencilMaskSeparate(GL_FRONT
, cached_stencil_front_writemask
);
276 if ((cached_stencil_back_writemask
!=
277 prev_state
->cached_stencil_back_writemask
))
278 glStencilMaskSeparate(GL_BACK
, cached_stencil_back_writemask
);
279 if ((stencil_front_fail_op
!= prev_state
->stencil_front_fail_op
) ||
280 (stencil_front_z_fail_op
!= prev_state
->stencil_front_z_fail_op
) ||
281 (stencil_front_z_pass_op
!= prev_state
->stencil_front_z_pass_op
))
282 glStencilOpSeparate(GL_FRONT
, stencil_front_fail_op
,
283 stencil_front_z_fail_op
, stencil_front_z_pass_op
);
284 if ((stencil_back_fail_op
!= prev_state
->stencil_back_fail_op
) ||
285 (stencil_back_z_fail_op
!= prev_state
->stencil_back_z_fail_op
) ||
286 (stencil_back_z_pass_op
!= prev_state
->stencil_back_z_pass_op
))
287 glStencilOpSeparate(GL_BACK
, stencil_back_fail_op
, stencil_back_z_fail_op
,
288 stencil_back_z_pass_op
);
289 if ((viewport_x
!= prev_state
->viewport_x
) ||
290 (viewport_y
!= prev_state
->viewport_y
) ||
291 (viewport_width
!= prev_state
->viewport_width
) ||
292 (viewport_height
!= prev_state
->viewport_height
))
293 glViewport(viewport_x
, viewport_y
, viewport_width
, viewport_height
);
295 glBlendColor(blend_color_red
, blend_color_green
, blend_color_blue
,
297 glBlendEquationSeparate(blend_equation_rgb
, blend_equation_alpha
);
298 glBlendFuncSeparate(blend_source_rgb
, blend_dest_rgb
, blend_source_alpha
,
300 glClearColor(color_clear_red
, color_clear_green
, color_clear_blue
,
302 glClearDepth(depth_clear
);
303 glClearStencil(stencil_clear
);
304 glColorMask(cached_color_mask_red
, cached_color_mask_green
,
305 cached_color_mask_blue
, cached_color_mask_alpha
);
306 glCullFace(cull_mode
);
307 glDepthFunc(depth_func
);
308 glDepthMask(cached_depth_mask
);
309 glDepthRange(z_near
, z_far
);
310 glFrontFace(front_face
);
311 glHint(GL_GENERATE_MIPMAP_HINT
, hint_generate_mipmap
);
312 if (feature_info_
->feature_flags().oes_standard_derivatives
) {
313 glHint(GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES
,
314 hint_fragment_shader_derivative
);
316 glLineWidth(line_width
);
317 if (feature_info_
->feature_flags().chromium_path_rendering
) {
318 glMatrixLoadfEXT(GL_PATH_MODELVIEW_CHROMIUM
, modelview_matrix
);
320 if (feature_info_
->feature_flags().chromium_path_rendering
) {
321 glMatrixLoadfEXT(GL_PATH_PROJECTION_CHROMIUM
, projection_matrix
);
323 glPixelStorei(GL_PACK_ALIGNMENT
, pack_alignment
);
324 glPixelStorei(GL_UNPACK_ALIGNMENT
, unpack_alignment
);
325 glPolygonOffset(polygon_offset_factor
, polygon_offset_units
);
326 glSampleCoverage(sample_coverage_value
, sample_coverage_invert
);
327 glScissor(scissor_x
, scissor_y
, scissor_width
, scissor_height
);
328 glStencilFuncSeparate(GL_FRONT
, stencil_front_func
, stencil_front_ref
,
330 glStencilFuncSeparate(GL_BACK
, stencil_back_func
, stencil_back_ref
,
332 glStencilMaskSeparate(GL_FRONT
, cached_stencil_front_writemask
);
333 glStencilMaskSeparate(GL_BACK
, cached_stencil_back_writemask
);
334 glStencilOpSeparate(GL_FRONT
, stencil_front_fail_op
,
335 stencil_front_z_fail_op
, stencil_front_z_pass_op
);
336 glStencilOpSeparate(GL_BACK
, stencil_back_fail_op
, stencil_back_z_fail_op
,
337 stencil_back_z_pass_op
);
338 glViewport(viewport_x
, viewport_y
, viewport_width
, viewport_height
);
341 bool ContextState::GetEnabled(GLenum cap
) const {
344 return enable_flags
.blend
;
346 return enable_flags
.cull_face
;
348 return enable_flags
.depth_test
;
350 return enable_flags
.dither
;
351 case GL_POLYGON_OFFSET_FILL
:
352 return enable_flags
.polygon_offset_fill
;
353 case GL_SAMPLE_ALPHA_TO_COVERAGE
:
354 return enable_flags
.sample_alpha_to_coverage
;
355 case GL_SAMPLE_COVERAGE
:
356 return enable_flags
.sample_coverage
;
357 case GL_SCISSOR_TEST
:
358 return enable_flags
.scissor_test
;
359 case GL_STENCIL_TEST
:
360 return enable_flags
.stencil_test
;
367 bool ContextState::GetStateAsGLint(GLenum pname
,
369 GLsizei
* num_written
) const {
374 params
[0] = static_cast<GLint
>(blend_color_red
);
375 params
[1] = static_cast<GLint
>(blend_color_green
);
376 params
[2] = static_cast<GLint
>(blend_color_blue
);
377 params
[3] = static_cast<GLint
>(blend_color_alpha
);
380 case GL_BLEND_EQUATION_RGB
:
383 params
[0] = static_cast<GLint
>(blend_equation_rgb
);
386 case GL_BLEND_EQUATION_ALPHA
:
389 params
[0] = static_cast<GLint
>(blend_equation_alpha
);
392 case GL_BLEND_SRC_RGB
:
395 params
[0] = static_cast<GLint
>(blend_source_rgb
);
398 case GL_BLEND_DST_RGB
:
401 params
[0] = static_cast<GLint
>(blend_dest_rgb
);
404 case GL_BLEND_SRC_ALPHA
:
407 params
[0] = static_cast<GLint
>(blend_source_alpha
);
410 case GL_BLEND_DST_ALPHA
:
413 params
[0] = static_cast<GLint
>(blend_dest_alpha
);
416 case GL_COLOR_CLEAR_VALUE
:
419 params
[0] = static_cast<GLint
>(color_clear_red
);
420 params
[1] = static_cast<GLint
>(color_clear_green
);
421 params
[2] = static_cast<GLint
>(color_clear_blue
);
422 params
[3] = static_cast<GLint
>(color_clear_alpha
);
425 case GL_DEPTH_CLEAR_VALUE
:
428 params
[0] = static_cast<GLint
>(depth_clear
);
431 case GL_STENCIL_CLEAR_VALUE
:
434 params
[0] = static_cast<GLint
>(stencil_clear
);
437 case GL_COLOR_WRITEMASK
:
440 params
[0] = static_cast<GLint
>(color_mask_red
);
441 params
[1] = static_cast<GLint
>(color_mask_green
);
442 params
[2] = static_cast<GLint
>(color_mask_blue
);
443 params
[3] = static_cast<GLint
>(color_mask_alpha
);
446 case GL_CULL_FACE_MODE
:
449 params
[0] = static_cast<GLint
>(cull_mode
);
455 params
[0] = static_cast<GLint
>(depth_func
);
458 case GL_DEPTH_WRITEMASK
:
461 params
[0] = static_cast<GLint
>(depth_mask
);
467 params
[0] = static_cast<GLint
>(z_near
);
468 params
[1] = static_cast<GLint
>(z_far
);
474 params
[0] = static_cast<GLint
>(front_face
);
477 case GL_GENERATE_MIPMAP_HINT
:
480 params
[0] = static_cast<GLint
>(hint_generate_mipmap
);
483 case GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES
:
486 params
[0] = static_cast<GLint
>(hint_fragment_shader_derivative
);
492 params
[0] = static_cast<GLint
>(line_width
);
495 case GL_PATH_MODELVIEW_MATRIX_CHROMIUM
:
498 for (size_t i
= 0; i
< 16; ++i
) {
499 params
[i
] = static_cast<GLint
>(round(modelview_matrix
[i
]));
503 case GL_PATH_PROJECTION_MATRIX_CHROMIUM
:
506 for (size_t i
= 0; i
< 16; ++i
) {
507 params
[i
] = static_cast<GLint
>(round(projection_matrix
[i
]));
511 case GL_PACK_ALIGNMENT
:
514 params
[0] = static_cast<GLint
>(pack_alignment
);
517 case GL_UNPACK_ALIGNMENT
:
520 params
[0] = static_cast<GLint
>(unpack_alignment
);
523 case GL_POLYGON_OFFSET_FACTOR
:
526 params
[0] = static_cast<GLint
>(round(polygon_offset_factor
));
529 case GL_POLYGON_OFFSET_UNITS
:
532 params
[0] = static_cast<GLint
>(round(polygon_offset_units
));
535 case GL_SAMPLE_COVERAGE_VALUE
:
538 params
[0] = static_cast<GLint
>(sample_coverage_value
);
541 case GL_SAMPLE_COVERAGE_INVERT
:
544 params
[0] = static_cast<GLint
>(sample_coverage_invert
);
550 params
[0] = static_cast<GLint
>(scissor_x
);
551 params
[1] = static_cast<GLint
>(scissor_y
);
552 params
[2] = static_cast<GLint
>(scissor_width
);
553 params
[3] = static_cast<GLint
>(scissor_height
);
556 case GL_STENCIL_FUNC
:
559 params
[0] = static_cast<GLint
>(stencil_front_func
);
565 params
[0] = static_cast<GLint
>(stencil_front_ref
);
568 case GL_STENCIL_VALUE_MASK
:
571 params
[0] = static_cast<GLint
>(stencil_front_mask
);
574 case GL_STENCIL_BACK_FUNC
:
577 params
[0] = static_cast<GLint
>(stencil_back_func
);
580 case GL_STENCIL_BACK_REF
:
583 params
[0] = static_cast<GLint
>(stencil_back_ref
);
586 case GL_STENCIL_BACK_VALUE_MASK
:
589 params
[0] = static_cast<GLint
>(stencil_back_mask
);
592 case GL_STENCIL_WRITEMASK
:
595 params
[0] = static_cast<GLint
>(stencil_front_writemask
);
598 case GL_STENCIL_BACK_WRITEMASK
:
601 params
[0] = static_cast<GLint
>(stencil_back_writemask
);
604 case GL_STENCIL_FAIL
:
607 params
[0] = static_cast<GLint
>(stencil_front_fail_op
);
610 case GL_STENCIL_PASS_DEPTH_FAIL
:
613 params
[0] = static_cast<GLint
>(stencil_front_z_fail_op
);
616 case GL_STENCIL_PASS_DEPTH_PASS
:
619 params
[0] = static_cast<GLint
>(stencil_front_z_pass_op
);
622 case GL_STENCIL_BACK_FAIL
:
625 params
[0] = static_cast<GLint
>(stencil_back_fail_op
);
628 case GL_STENCIL_BACK_PASS_DEPTH_FAIL
:
631 params
[0] = static_cast<GLint
>(stencil_back_z_fail_op
);
634 case GL_STENCIL_BACK_PASS_DEPTH_PASS
:
637 params
[0] = static_cast<GLint
>(stencil_back_z_pass_op
);
643 params
[0] = static_cast<GLint
>(viewport_x
);
644 params
[1] = static_cast<GLint
>(viewport_y
);
645 params
[2] = static_cast<GLint
>(viewport_width
);
646 params
[3] = static_cast<GLint
>(viewport_height
);
652 params
[0] = static_cast<GLint
>(enable_flags
.blend
);
658 params
[0] = static_cast<GLint
>(enable_flags
.cull_face
);
664 params
[0] = static_cast<GLint
>(enable_flags
.depth_test
);
670 params
[0] = static_cast<GLint
>(enable_flags
.dither
);
673 case GL_POLYGON_OFFSET_FILL
:
676 params
[0] = static_cast<GLint
>(enable_flags
.polygon_offset_fill
);
679 case GL_SAMPLE_ALPHA_TO_COVERAGE
:
682 params
[0] = static_cast<GLint
>(enable_flags
.sample_alpha_to_coverage
);
685 case GL_SAMPLE_COVERAGE
:
688 params
[0] = static_cast<GLint
>(enable_flags
.sample_coverage
);
691 case GL_SCISSOR_TEST
:
694 params
[0] = static_cast<GLint
>(enable_flags
.scissor_test
);
697 case GL_STENCIL_TEST
:
700 params
[0] = static_cast<GLint
>(enable_flags
.stencil_test
);
708 bool ContextState::GetStateAsGLfloat(GLenum pname
,
710 GLsizei
* num_written
) const {
715 params
[0] = static_cast<GLfloat
>(blend_color_red
);
716 params
[1] = static_cast<GLfloat
>(blend_color_green
);
717 params
[2] = static_cast<GLfloat
>(blend_color_blue
);
718 params
[3] = static_cast<GLfloat
>(blend_color_alpha
);
721 case GL_BLEND_EQUATION_RGB
:
724 params
[0] = static_cast<GLfloat
>(blend_equation_rgb
);
727 case GL_BLEND_EQUATION_ALPHA
:
730 params
[0] = static_cast<GLfloat
>(blend_equation_alpha
);
733 case GL_BLEND_SRC_RGB
:
736 params
[0] = static_cast<GLfloat
>(blend_source_rgb
);
739 case GL_BLEND_DST_RGB
:
742 params
[0] = static_cast<GLfloat
>(blend_dest_rgb
);
745 case GL_BLEND_SRC_ALPHA
:
748 params
[0] = static_cast<GLfloat
>(blend_source_alpha
);
751 case GL_BLEND_DST_ALPHA
:
754 params
[0] = static_cast<GLfloat
>(blend_dest_alpha
);
757 case GL_COLOR_CLEAR_VALUE
:
760 params
[0] = static_cast<GLfloat
>(color_clear_red
);
761 params
[1] = static_cast<GLfloat
>(color_clear_green
);
762 params
[2] = static_cast<GLfloat
>(color_clear_blue
);
763 params
[3] = static_cast<GLfloat
>(color_clear_alpha
);
766 case GL_DEPTH_CLEAR_VALUE
:
769 params
[0] = static_cast<GLfloat
>(depth_clear
);
772 case GL_STENCIL_CLEAR_VALUE
:
775 params
[0] = static_cast<GLfloat
>(stencil_clear
);
778 case GL_COLOR_WRITEMASK
:
781 params
[0] = static_cast<GLfloat
>(color_mask_red
);
782 params
[1] = static_cast<GLfloat
>(color_mask_green
);
783 params
[2] = static_cast<GLfloat
>(color_mask_blue
);
784 params
[3] = static_cast<GLfloat
>(color_mask_alpha
);
787 case GL_CULL_FACE_MODE
:
790 params
[0] = static_cast<GLfloat
>(cull_mode
);
796 params
[0] = static_cast<GLfloat
>(depth_func
);
799 case GL_DEPTH_WRITEMASK
:
802 params
[0] = static_cast<GLfloat
>(depth_mask
);
808 params
[0] = static_cast<GLfloat
>(z_near
);
809 params
[1] = static_cast<GLfloat
>(z_far
);
815 params
[0] = static_cast<GLfloat
>(front_face
);
818 case GL_GENERATE_MIPMAP_HINT
:
821 params
[0] = static_cast<GLfloat
>(hint_generate_mipmap
);
824 case GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES
:
827 params
[0] = static_cast<GLfloat
>(hint_fragment_shader_derivative
);
833 params
[0] = static_cast<GLfloat
>(line_width
);
836 case GL_PATH_MODELVIEW_MATRIX_CHROMIUM
:
839 memcpy(params
, modelview_matrix
, sizeof(GLfloat
) * 16);
842 case GL_PATH_PROJECTION_MATRIX_CHROMIUM
:
845 memcpy(params
, projection_matrix
, sizeof(GLfloat
) * 16);
848 case GL_PACK_ALIGNMENT
:
851 params
[0] = static_cast<GLfloat
>(pack_alignment
);
854 case GL_UNPACK_ALIGNMENT
:
857 params
[0] = static_cast<GLfloat
>(unpack_alignment
);
860 case GL_POLYGON_OFFSET_FACTOR
:
863 params
[0] = static_cast<GLfloat
>(polygon_offset_factor
);
866 case GL_POLYGON_OFFSET_UNITS
:
869 params
[0] = static_cast<GLfloat
>(polygon_offset_units
);
872 case GL_SAMPLE_COVERAGE_VALUE
:
875 params
[0] = static_cast<GLfloat
>(sample_coverage_value
);
878 case GL_SAMPLE_COVERAGE_INVERT
:
881 params
[0] = static_cast<GLfloat
>(sample_coverage_invert
);
887 params
[0] = static_cast<GLfloat
>(scissor_x
);
888 params
[1] = static_cast<GLfloat
>(scissor_y
);
889 params
[2] = static_cast<GLfloat
>(scissor_width
);
890 params
[3] = static_cast<GLfloat
>(scissor_height
);
893 case GL_STENCIL_FUNC
:
896 params
[0] = static_cast<GLfloat
>(stencil_front_func
);
902 params
[0] = static_cast<GLfloat
>(stencil_front_ref
);
905 case GL_STENCIL_VALUE_MASK
:
908 params
[0] = static_cast<GLfloat
>(stencil_front_mask
);
911 case GL_STENCIL_BACK_FUNC
:
914 params
[0] = static_cast<GLfloat
>(stencil_back_func
);
917 case GL_STENCIL_BACK_REF
:
920 params
[0] = static_cast<GLfloat
>(stencil_back_ref
);
923 case GL_STENCIL_BACK_VALUE_MASK
:
926 params
[0] = static_cast<GLfloat
>(stencil_back_mask
);
929 case GL_STENCIL_WRITEMASK
:
932 params
[0] = static_cast<GLfloat
>(stencil_front_writemask
);
935 case GL_STENCIL_BACK_WRITEMASK
:
938 params
[0] = static_cast<GLfloat
>(stencil_back_writemask
);
941 case GL_STENCIL_FAIL
:
944 params
[0] = static_cast<GLfloat
>(stencil_front_fail_op
);
947 case GL_STENCIL_PASS_DEPTH_FAIL
:
950 params
[0] = static_cast<GLfloat
>(stencil_front_z_fail_op
);
953 case GL_STENCIL_PASS_DEPTH_PASS
:
956 params
[0] = static_cast<GLfloat
>(stencil_front_z_pass_op
);
959 case GL_STENCIL_BACK_FAIL
:
962 params
[0] = static_cast<GLfloat
>(stencil_back_fail_op
);
965 case GL_STENCIL_BACK_PASS_DEPTH_FAIL
:
968 params
[0] = static_cast<GLfloat
>(stencil_back_z_fail_op
);
971 case GL_STENCIL_BACK_PASS_DEPTH_PASS
:
974 params
[0] = static_cast<GLfloat
>(stencil_back_z_pass_op
);
980 params
[0] = static_cast<GLfloat
>(viewport_x
);
981 params
[1] = static_cast<GLfloat
>(viewport_y
);
982 params
[2] = static_cast<GLfloat
>(viewport_width
);
983 params
[3] = static_cast<GLfloat
>(viewport_height
);
989 params
[0] = static_cast<GLfloat
>(enable_flags
.blend
);
995 params
[0] = static_cast<GLfloat
>(enable_flags
.cull_face
);
1001 params
[0] = static_cast<GLfloat
>(enable_flags
.depth_test
);
1007 params
[0] = static_cast<GLfloat
>(enable_flags
.dither
);
1010 case GL_POLYGON_OFFSET_FILL
:
1013 params
[0] = static_cast<GLfloat
>(enable_flags
.polygon_offset_fill
);
1016 case GL_SAMPLE_ALPHA_TO_COVERAGE
:
1019 params
[0] = static_cast<GLfloat
>(enable_flags
.sample_alpha_to_coverage
);
1022 case GL_SAMPLE_COVERAGE
:
1025 params
[0] = static_cast<GLfloat
>(enable_flags
.sample_coverage
);
1028 case GL_SCISSOR_TEST
:
1031 params
[0] = static_cast<GLfloat
>(enable_flags
.scissor_test
);
1034 case GL_STENCIL_TEST
:
1037 params
[0] = static_cast<GLfloat
>(enable_flags
.stencil_test
);
1044 #endif // GPU_COMMAND_BUFFER_SERVICE_CONTEXT_STATE_IMPL_AUTOGEN_H_