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
,
189 if ((blend_equation_rgb
!= prev_state
->blend_equation_rgb
) ||
190 (blend_equation_alpha
!= prev_state
->blend_equation_alpha
))
191 glBlendEquationSeparate(blend_equation_rgb
, blend_equation_alpha
);
192 if ((blend_source_rgb
!= prev_state
->blend_source_rgb
) ||
193 (blend_dest_rgb
!= prev_state
->blend_dest_rgb
) ||
194 (blend_source_alpha
!= prev_state
->blend_source_alpha
) ||
195 (blend_dest_alpha
!= prev_state
->blend_dest_alpha
))
196 glBlendFuncSeparate(blend_source_rgb
,
200 if ((color_clear_red
!= prev_state
->color_clear_red
) ||
201 (color_clear_green
!= prev_state
->color_clear_green
) ||
202 (color_clear_blue
!= prev_state
->color_clear_blue
) ||
203 (color_clear_alpha
!= prev_state
->color_clear_alpha
))
204 glClearColor(color_clear_red
,
208 if ((depth_clear
!= prev_state
->depth_clear
))
209 glClearDepth(depth_clear
);
210 if ((stencil_clear
!= prev_state
->stencil_clear
))
211 glClearStencil(stencil_clear
);
212 if ((cached_color_mask_red
!= prev_state
->cached_color_mask_red
) ||
213 (cached_color_mask_green
!= prev_state
->cached_color_mask_green
) ||
214 (cached_color_mask_blue
!= prev_state
->cached_color_mask_blue
) ||
215 (cached_color_mask_alpha
!= prev_state
->cached_color_mask_alpha
))
216 glColorMask(cached_color_mask_red
,
217 cached_color_mask_green
,
218 cached_color_mask_blue
,
219 cached_color_mask_alpha
);
220 if ((cull_mode
!= prev_state
->cull_mode
))
221 glCullFace(cull_mode
);
222 if ((depth_func
!= prev_state
->depth_func
))
223 glDepthFunc(depth_func
);
224 if ((cached_depth_mask
!= prev_state
->cached_depth_mask
))
225 glDepthMask(cached_depth_mask
);
226 if ((z_near
!= prev_state
->z_near
) || (z_far
!= prev_state
->z_far
))
227 glDepthRange(z_near
, z_far
);
228 if ((front_face
!= prev_state
->front_face
))
229 glFrontFace(front_face
);
230 if (prev_state
->hint_generate_mipmap
!= hint_generate_mipmap
) {
231 glHint(GL_GENERATE_MIPMAP_HINT
, hint_generate_mipmap
);
233 if (feature_info_
->feature_flags().oes_standard_derivatives
) {
234 if (prev_state
->hint_fragment_shader_derivative
!=
235 hint_fragment_shader_derivative
) {
236 glHint(GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES
,
237 hint_fragment_shader_derivative
);
240 if ((line_width
!= prev_state
->line_width
))
241 glLineWidth(line_width
);
242 if (feature_info_
->feature_flags().chromium_path_rendering
) {
243 if (memcmp(prev_state
->modelview_matrix
,
245 sizeof(GLfloat
) * 16)) {
246 glMatrixLoadfEXT(GL_PATH_MODELVIEW_CHROMIUM
, modelview_matrix
);
249 if (feature_info_
->feature_flags().chromium_path_rendering
) {
250 if (memcmp(prev_state
->projection_matrix
,
252 sizeof(GLfloat
) * 16)) {
253 glMatrixLoadfEXT(GL_PATH_PROJECTION_CHROMIUM
, projection_matrix
);
256 if (prev_state
->pack_alignment
!= pack_alignment
) {
257 glPixelStorei(GL_PACK_ALIGNMENT
, pack_alignment
);
259 if (prev_state
->unpack_alignment
!= unpack_alignment
) {
260 glPixelStorei(GL_UNPACK_ALIGNMENT
, unpack_alignment
);
262 if ((polygon_offset_factor
!= prev_state
->polygon_offset_factor
) ||
263 (polygon_offset_units
!= prev_state
->polygon_offset_units
))
264 glPolygonOffset(polygon_offset_factor
, polygon_offset_units
);
265 if ((sample_coverage_value
!= prev_state
->sample_coverage_value
) ||
266 (sample_coverage_invert
!= prev_state
->sample_coverage_invert
))
267 glSampleCoverage(sample_coverage_value
, sample_coverage_invert
);
268 if ((scissor_x
!= prev_state
->scissor_x
) ||
269 (scissor_y
!= prev_state
->scissor_y
) ||
270 (scissor_width
!= prev_state
->scissor_width
) ||
271 (scissor_height
!= prev_state
->scissor_height
))
272 glScissor(scissor_x
, scissor_y
, scissor_width
, scissor_height
);
273 if ((stencil_front_func
!= prev_state
->stencil_front_func
) ||
274 (stencil_front_ref
!= prev_state
->stencil_front_ref
) ||
275 (stencil_front_mask
!= prev_state
->stencil_front_mask
))
276 glStencilFuncSeparate(
277 GL_FRONT
, stencil_front_func
, stencil_front_ref
, stencil_front_mask
);
278 if ((stencil_back_func
!= prev_state
->stencil_back_func
) ||
279 (stencil_back_ref
!= prev_state
->stencil_back_ref
) ||
280 (stencil_back_mask
!= prev_state
->stencil_back_mask
))
281 glStencilFuncSeparate(
282 GL_BACK
, stencil_back_func
, stencil_back_ref
, stencil_back_mask
);
283 if ((cached_stencil_front_writemask
!=
284 prev_state
->cached_stencil_front_writemask
))
285 glStencilMaskSeparate(GL_FRONT
, cached_stencil_front_writemask
);
286 if ((cached_stencil_back_writemask
!=
287 prev_state
->cached_stencil_back_writemask
))
288 glStencilMaskSeparate(GL_BACK
, cached_stencil_back_writemask
);
289 if ((stencil_front_fail_op
!= prev_state
->stencil_front_fail_op
) ||
290 (stencil_front_z_fail_op
!= prev_state
->stencil_front_z_fail_op
) ||
291 (stencil_front_z_pass_op
!= prev_state
->stencil_front_z_pass_op
))
292 glStencilOpSeparate(GL_FRONT
,
293 stencil_front_fail_op
,
294 stencil_front_z_fail_op
,
295 stencil_front_z_pass_op
);
296 if ((stencil_back_fail_op
!= prev_state
->stencil_back_fail_op
) ||
297 (stencil_back_z_fail_op
!= prev_state
->stencil_back_z_fail_op
) ||
298 (stencil_back_z_pass_op
!= prev_state
->stencil_back_z_pass_op
))
299 glStencilOpSeparate(GL_BACK
,
300 stencil_back_fail_op
,
301 stencil_back_z_fail_op
,
302 stencil_back_z_pass_op
);
303 if ((viewport_x
!= prev_state
->viewport_x
) ||
304 (viewport_y
!= prev_state
->viewport_y
) ||
305 (viewport_width
!= prev_state
->viewport_width
) ||
306 (viewport_height
!= prev_state
->viewport_height
))
307 glViewport(viewport_x
, viewport_y
, viewport_width
, viewport_height
);
309 glBlendColor(blend_color_red
,
313 glBlendEquationSeparate(blend_equation_rgb
, blend_equation_alpha
);
315 blend_source_rgb
, blend_dest_rgb
, blend_source_alpha
, blend_dest_alpha
);
316 glClearColor(color_clear_red
,
320 glClearDepth(depth_clear
);
321 glClearStencil(stencil_clear
);
322 glColorMask(cached_color_mask_red
,
323 cached_color_mask_green
,
324 cached_color_mask_blue
,
325 cached_color_mask_alpha
);
326 glCullFace(cull_mode
);
327 glDepthFunc(depth_func
);
328 glDepthMask(cached_depth_mask
);
329 glDepthRange(z_near
, z_far
);
330 glFrontFace(front_face
);
331 glHint(GL_GENERATE_MIPMAP_HINT
, hint_generate_mipmap
);
332 if (feature_info_
->feature_flags().oes_standard_derivatives
) {
333 glHint(GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES
,
334 hint_fragment_shader_derivative
);
336 glLineWidth(line_width
);
337 if (feature_info_
->feature_flags().chromium_path_rendering
) {
338 glMatrixLoadfEXT(GL_PATH_MODELVIEW_CHROMIUM
, modelview_matrix
);
340 if (feature_info_
->feature_flags().chromium_path_rendering
) {
341 glMatrixLoadfEXT(GL_PATH_PROJECTION_CHROMIUM
, projection_matrix
);
343 glPixelStorei(GL_PACK_ALIGNMENT
, pack_alignment
);
344 glPixelStorei(GL_UNPACK_ALIGNMENT
, unpack_alignment
);
345 glPolygonOffset(polygon_offset_factor
, polygon_offset_units
);
346 glSampleCoverage(sample_coverage_value
, sample_coverage_invert
);
347 glScissor(scissor_x
, scissor_y
, scissor_width
, scissor_height
);
348 glStencilFuncSeparate(
349 GL_FRONT
, stencil_front_func
, stencil_front_ref
, stencil_front_mask
);
350 glStencilFuncSeparate(
351 GL_BACK
, stencil_back_func
, stencil_back_ref
, stencil_back_mask
);
352 glStencilMaskSeparate(GL_FRONT
, cached_stencil_front_writemask
);
353 glStencilMaskSeparate(GL_BACK
, cached_stencil_back_writemask
);
354 glStencilOpSeparate(GL_FRONT
,
355 stencil_front_fail_op
,
356 stencil_front_z_fail_op
,
357 stencil_front_z_pass_op
);
358 glStencilOpSeparate(GL_BACK
,
359 stencil_back_fail_op
,
360 stencil_back_z_fail_op
,
361 stencil_back_z_pass_op
);
362 glViewport(viewport_x
, viewport_y
, viewport_width
, viewport_height
);
365 bool ContextState::GetEnabled(GLenum cap
) const {
368 return enable_flags
.blend
;
370 return enable_flags
.cull_face
;
372 return enable_flags
.depth_test
;
374 return enable_flags
.dither
;
375 case GL_POLYGON_OFFSET_FILL
:
376 return enable_flags
.polygon_offset_fill
;
377 case GL_SAMPLE_ALPHA_TO_COVERAGE
:
378 return enable_flags
.sample_alpha_to_coverage
;
379 case GL_SAMPLE_COVERAGE
:
380 return enable_flags
.sample_coverage
;
381 case GL_SCISSOR_TEST
:
382 return enable_flags
.scissor_test
;
383 case GL_STENCIL_TEST
:
384 return enable_flags
.stencil_test
;
391 bool ContextState::GetStateAsGLint(GLenum pname
,
393 GLsizei
* num_written
) const {
398 params
[0] = static_cast<GLint
>(blend_color_red
);
399 params
[1] = static_cast<GLint
>(blend_color_green
);
400 params
[2] = static_cast<GLint
>(blend_color_blue
);
401 params
[3] = static_cast<GLint
>(blend_color_alpha
);
404 case GL_BLEND_EQUATION_RGB
:
407 params
[0] = static_cast<GLint
>(blend_equation_rgb
);
410 case GL_BLEND_EQUATION_ALPHA
:
413 params
[0] = static_cast<GLint
>(blend_equation_alpha
);
416 case GL_BLEND_SRC_RGB
:
419 params
[0] = static_cast<GLint
>(blend_source_rgb
);
422 case GL_BLEND_DST_RGB
:
425 params
[0] = static_cast<GLint
>(blend_dest_rgb
);
428 case GL_BLEND_SRC_ALPHA
:
431 params
[0] = static_cast<GLint
>(blend_source_alpha
);
434 case GL_BLEND_DST_ALPHA
:
437 params
[0] = static_cast<GLint
>(blend_dest_alpha
);
440 case GL_COLOR_CLEAR_VALUE
:
443 params
[0] = static_cast<GLint
>(color_clear_red
);
444 params
[1] = static_cast<GLint
>(color_clear_green
);
445 params
[2] = static_cast<GLint
>(color_clear_blue
);
446 params
[3] = static_cast<GLint
>(color_clear_alpha
);
449 case GL_DEPTH_CLEAR_VALUE
:
452 params
[0] = static_cast<GLint
>(depth_clear
);
455 case GL_STENCIL_CLEAR_VALUE
:
458 params
[0] = static_cast<GLint
>(stencil_clear
);
461 case GL_COLOR_WRITEMASK
:
464 params
[0] = static_cast<GLint
>(color_mask_red
);
465 params
[1] = static_cast<GLint
>(color_mask_green
);
466 params
[2] = static_cast<GLint
>(color_mask_blue
);
467 params
[3] = static_cast<GLint
>(color_mask_alpha
);
470 case GL_CULL_FACE_MODE
:
473 params
[0] = static_cast<GLint
>(cull_mode
);
479 params
[0] = static_cast<GLint
>(depth_func
);
482 case GL_DEPTH_WRITEMASK
:
485 params
[0] = static_cast<GLint
>(depth_mask
);
491 params
[0] = static_cast<GLint
>(z_near
);
492 params
[1] = static_cast<GLint
>(z_far
);
498 params
[0] = static_cast<GLint
>(front_face
);
501 case GL_GENERATE_MIPMAP_HINT
:
504 params
[0] = static_cast<GLint
>(hint_generate_mipmap
);
507 case GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES
:
510 params
[0] = static_cast<GLint
>(hint_fragment_shader_derivative
);
516 params
[0] = static_cast<GLint
>(line_width
);
519 case GL_PATH_MODELVIEW_MATRIX_CHROMIUM
:
522 for (size_t i
= 0; i
< 16; ++i
) {
523 params
[i
] = static_cast<GLint
>(round(modelview_matrix
[i
]));
527 case GL_PATH_PROJECTION_MATRIX_CHROMIUM
:
530 for (size_t i
= 0; i
< 16; ++i
) {
531 params
[i
] = static_cast<GLint
>(round(projection_matrix
[i
]));
535 case GL_PACK_ALIGNMENT
:
538 params
[0] = static_cast<GLint
>(pack_alignment
);
541 case GL_UNPACK_ALIGNMENT
:
544 params
[0] = static_cast<GLint
>(unpack_alignment
);
547 case GL_POLYGON_OFFSET_FACTOR
:
550 params
[0] = static_cast<GLint
>(round(polygon_offset_factor
));
553 case GL_POLYGON_OFFSET_UNITS
:
556 params
[0] = static_cast<GLint
>(round(polygon_offset_units
));
559 case GL_SAMPLE_COVERAGE_VALUE
:
562 params
[0] = static_cast<GLint
>(sample_coverage_value
);
565 case GL_SAMPLE_COVERAGE_INVERT
:
568 params
[0] = static_cast<GLint
>(sample_coverage_invert
);
574 params
[0] = static_cast<GLint
>(scissor_x
);
575 params
[1] = static_cast<GLint
>(scissor_y
);
576 params
[2] = static_cast<GLint
>(scissor_width
);
577 params
[3] = static_cast<GLint
>(scissor_height
);
580 case GL_STENCIL_FUNC
:
583 params
[0] = static_cast<GLint
>(stencil_front_func
);
589 params
[0] = static_cast<GLint
>(stencil_front_ref
);
592 case GL_STENCIL_VALUE_MASK
:
595 params
[0] = static_cast<GLint
>(stencil_front_mask
);
598 case GL_STENCIL_BACK_FUNC
:
601 params
[0] = static_cast<GLint
>(stencil_back_func
);
604 case GL_STENCIL_BACK_REF
:
607 params
[0] = static_cast<GLint
>(stencil_back_ref
);
610 case GL_STENCIL_BACK_VALUE_MASK
:
613 params
[0] = static_cast<GLint
>(stencil_back_mask
);
616 case GL_STENCIL_WRITEMASK
:
619 params
[0] = static_cast<GLint
>(stencil_front_writemask
);
622 case GL_STENCIL_BACK_WRITEMASK
:
625 params
[0] = static_cast<GLint
>(stencil_back_writemask
);
628 case GL_STENCIL_FAIL
:
631 params
[0] = static_cast<GLint
>(stencil_front_fail_op
);
634 case GL_STENCIL_PASS_DEPTH_FAIL
:
637 params
[0] = static_cast<GLint
>(stencil_front_z_fail_op
);
640 case GL_STENCIL_PASS_DEPTH_PASS
:
643 params
[0] = static_cast<GLint
>(stencil_front_z_pass_op
);
646 case GL_STENCIL_BACK_FAIL
:
649 params
[0] = static_cast<GLint
>(stencil_back_fail_op
);
652 case GL_STENCIL_BACK_PASS_DEPTH_FAIL
:
655 params
[0] = static_cast<GLint
>(stencil_back_z_fail_op
);
658 case GL_STENCIL_BACK_PASS_DEPTH_PASS
:
661 params
[0] = static_cast<GLint
>(stencil_back_z_pass_op
);
667 params
[0] = static_cast<GLint
>(viewport_x
);
668 params
[1] = static_cast<GLint
>(viewport_y
);
669 params
[2] = static_cast<GLint
>(viewport_width
);
670 params
[3] = static_cast<GLint
>(viewport_height
);
676 params
[0] = static_cast<GLint
>(enable_flags
.blend
);
682 params
[0] = static_cast<GLint
>(enable_flags
.cull_face
);
688 params
[0] = static_cast<GLint
>(enable_flags
.depth_test
);
694 params
[0] = static_cast<GLint
>(enable_flags
.dither
);
697 case GL_POLYGON_OFFSET_FILL
:
700 params
[0] = static_cast<GLint
>(enable_flags
.polygon_offset_fill
);
703 case GL_SAMPLE_ALPHA_TO_COVERAGE
:
706 params
[0] = static_cast<GLint
>(enable_flags
.sample_alpha_to_coverage
);
709 case GL_SAMPLE_COVERAGE
:
712 params
[0] = static_cast<GLint
>(enable_flags
.sample_coverage
);
715 case GL_SCISSOR_TEST
:
718 params
[0] = static_cast<GLint
>(enable_flags
.scissor_test
);
721 case GL_STENCIL_TEST
:
724 params
[0] = static_cast<GLint
>(enable_flags
.stencil_test
);
732 bool ContextState::GetStateAsGLfloat(GLenum pname
,
734 GLsizei
* num_written
) const {
739 params
[0] = static_cast<GLfloat
>(blend_color_red
);
740 params
[1] = static_cast<GLfloat
>(blend_color_green
);
741 params
[2] = static_cast<GLfloat
>(blend_color_blue
);
742 params
[3] = static_cast<GLfloat
>(blend_color_alpha
);
745 case GL_BLEND_EQUATION_RGB
:
748 params
[0] = static_cast<GLfloat
>(blend_equation_rgb
);
751 case GL_BLEND_EQUATION_ALPHA
:
754 params
[0] = static_cast<GLfloat
>(blend_equation_alpha
);
757 case GL_BLEND_SRC_RGB
:
760 params
[0] = static_cast<GLfloat
>(blend_source_rgb
);
763 case GL_BLEND_DST_RGB
:
766 params
[0] = static_cast<GLfloat
>(blend_dest_rgb
);
769 case GL_BLEND_SRC_ALPHA
:
772 params
[0] = static_cast<GLfloat
>(blend_source_alpha
);
775 case GL_BLEND_DST_ALPHA
:
778 params
[0] = static_cast<GLfloat
>(blend_dest_alpha
);
781 case GL_COLOR_CLEAR_VALUE
:
784 params
[0] = static_cast<GLfloat
>(color_clear_red
);
785 params
[1] = static_cast<GLfloat
>(color_clear_green
);
786 params
[2] = static_cast<GLfloat
>(color_clear_blue
);
787 params
[3] = static_cast<GLfloat
>(color_clear_alpha
);
790 case GL_DEPTH_CLEAR_VALUE
:
793 params
[0] = static_cast<GLfloat
>(depth_clear
);
796 case GL_STENCIL_CLEAR_VALUE
:
799 params
[0] = static_cast<GLfloat
>(stencil_clear
);
802 case GL_COLOR_WRITEMASK
:
805 params
[0] = static_cast<GLfloat
>(color_mask_red
);
806 params
[1] = static_cast<GLfloat
>(color_mask_green
);
807 params
[2] = static_cast<GLfloat
>(color_mask_blue
);
808 params
[3] = static_cast<GLfloat
>(color_mask_alpha
);
811 case GL_CULL_FACE_MODE
:
814 params
[0] = static_cast<GLfloat
>(cull_mode
);
820 params
[0] = static_cast<GLfloat
>(depth_func
);
823 case GL_DEPTH_WRITEMASK
:
826 params
[0] = static_cast<GLfloat
>(depth_mask
);
832 params
[0] = static_cast<GLfloat
>(z_near
);
833 params
[1] = static_cast<GLfloat
>(z_far
);
839 params
[0] = static_cast<GLfloat
>(front_face
);
842 case GL_GENERATE_MIPMAP_HINT
:
845 params
[0] = static_cast<GLfloat
>(hint_generate_mipmap
);
848 case GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES
:
851 params
[0] = static_cast<GLfloat
>(hint_fragment_shader_derivative
);
857 params
[0] = static_cast<GLfloat
>(line_width
);
860 case GL_PATH_MODELVIEW_MATRIX_CHROMIUM
:
863 memcpy(params
, modelview_matrix
, sizeof(GLfloat
) * 16);
866 case GL_PATH_PROJECTION_MATRIX_CHROMIUM
:
869 memcpy(params
, projection_matrix
, sizeof(GLfloat
) * 16);
872 case GL_PACK_ALIGNMENT
:
875 params
[0] = static_cast<GLfloat
>(pack_alignment
);
878 case GL_UNPACK_ALIGNMENT
:
881 params
[0] = static_cast<GLfloat
>(unpack_alignment
);
884 case GL_POLYGON_OFFSET_FACTOR
:
887 params
[0] = static_cast<GLfloat
>(polygon_offset_factor
);
890 case GL_POLYGON_OFFSET_UNITS
:
893 params
[0] = static_cast<GLfloat
>(polygon_offset_units
);
896 case GL_SAMPLE_COVERAGE_VALUE
:
899 params
[0] = static_cast<GLfloat
>(sample_coverage_value
);
902 case GL_SAMPLE_COVERAGE_INVERT
:
905 params
[0] = static_cast<GLfloat
>(sample_coverage_invert
);
911 params
[0] = static_cast<GLfloat
>(scissor_x
);
912 params
[1] = static_cast<GLfloat
>(scissor_y
);
913 params
[2] = static_cast<GLfloat
>(scissor_width
);
914 params
[3] = static_cast<GLfloat
>(scissor_height
);
917 case GL_STENCIL_FUNC
:
920 params
[0] = static_cast<GLfloat
>(stencil_front_func
);
926 params
[0] = static_cast<GLfloat
>(stencil_front_ref
);
929 case GL_STENCIL_VALUE_MASK
:
932 params
[0] = static_cast<GLfloat
>(stencil_front_mask
);
935 case GL_STENCIL_BACK_FUNC
:
938 params
[0] = static_cast<GLfloat
>(stencil_back_func
);
941 case GL_STENCIL_BACK_REF
:
944 params
[0] = static_cast<GLfloat
>(stencil_back_ref
);
947 case GL_STENCIL_BACK_VALUE_MASK
:
950 params
[0] = static_cast<GLfloat
>(stencil_back_mask
);
953 case GL_STENCIL_WRITEMASK
:
956 params
[0] = static_cast<GLfloat
>(stencil_front_writemask
);
959 case GL_STENCIL_BACK_WRITEMASK
:
962 params
[0] = static_cast<GLfloat
>(stencil_back_writemask
);
965 case GL_STENCIL_FAIL
:
968 params
[0] = static_cast<GLfloat
>(stencil_front_fail_op
);
971 case GL_STENCIL_PASS_DEPTH_FAIL
:
974 params
[0] = static_cast<GLfloat
>(stencil_front_z_fail_op
);
977 case GL_STENCIL_PASS_DEPTH_PASS
:
980 params
[0] = static_cast<GLfloat
>(stencil_front_z_pass_op
);
983 case GL_STENCIL_BACK_FAIL
:
986 params
[0] = static_cast<GLfloat
>(stencil_back_fail_op
);
989 case GL_STENCIL_BACK_PASS_DEPTH_FAIL
:
992 params
[0] = static_cast<GLfloat
>(stencil_back_z_fail_op
);
995 case GL_STENCIL_BACK_PASS_DEPTH_PASS
:
998 params
[0] = static_cast<GLfloat
>(stencil_back_z_pass_op
);
1004 params
[0] = static_cast<GLfloat
>(viewport_x
);
1005 params
[1] = static_cast<GLfloat
>(viewport_y
);
1006 params
[2] = static_cast<GLfloat
>(viewport_width
);
1007 params
[3] = static_cast<GLfloat
>(viewport_height
);
1013 params
[0] = static_cast<GLfloat
>(enable_flags
.blend
);
1019 params
[0] = static_cast<GLfloat
>(enable_flags
.cull_face
);
1025 params
[0] = static_cast<GLfloat
>(enable_flags
.depth_test
);
1031 params
[0] = static_cast<GLfloat
>(enable_flags
.dither
);
1034 case GL_POLYGON_OFFSET_FILL
:
1037 params
[0] = static_cast<GLfloat
>(enable_flags
.polygon_offset_fill
);
1040 case GL_SAMPLE_ALPHA_TO_COVERAGE
:
1043 params
[0] = static_cast<GLfloat
>(enable_flags
.sample_alpha_to_coverage
);
1046 case GL_SAMPLE_COVERAGE
:
1049 params
[0] = static_cast<GLfloat
>(enable_flags
.sample_coverage
);
1052 case GL_SCISSOR_TEST
:
1055 params
[0] = static_cast<GLfloat
>(enable_flags
.scissor_test
);
1058 case GL_STENCIL_TEST
:
1061 params
[0] = static_cast<GLfloat
>(enable_flags
.stencil_test
);
1068 #endif // GPU_COMMAND_BUFFER_SERVICE_CONTEXT_STATE_IMPL_AUTOGEN_H_