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),
34 rasterizer_discard(false),
35 cached_rasterizer_discard(false),
36 primitive_restart_fixed_index(false),
37 cached_primitive_restart_fixed_index(false) {
40 void ContextState::Initialize() {
41 blend_color_red
= 0.0f
;
42 blend_color_green
= 0.0f
;
43 blend_color_blue
= 0.0f
;
44 blend_color_alpha
= 0.0f
;
45 blend_equation_rgb
= GL_FUNC_ADD
;
46 blend_equation_alpha
= GL_FUNC_ADD
;
47 blend_source_rgb
= GL_ONE
;
48 blend_dest_rgb
= GL_ZERO
;
49 blend_source_alpha
= GL_ONE
;
50 blend_dest_alpha
= GL_ZERO
;
51 color_clear_red
= 0.0f
;
52 color_clear_green
= 0.0f
;
53 color_clear_blue
= 0.0f
;
54 color_clear_alpha
= 0.0f
;
57 color_mask_red
= true;
58 cached_color_mask_red
= true;
59 color_mask_green
= true;
60 cached_color_mask_green
= true;
61 color_mask_blue
= true;
62 cached_color_mask_blue
= true;
63 color_mask_alpha
= true;
64 cached_color_mask_alpha
= true;
68 cached_depth_mask
= true;
72 hint_generate_mipmap
= GL_DONT_CARE
;
73 hint_fragment_shader_derivative
= GL_DONT_CARE
;
75 modelview_matrix
[0] = 1.0f
;
76 modelview_matrix
[1] = 0.0f
;
77 modelview_matrix
[2] = 0.0f
;
78 modelview_matrix
[3] = 0.0f
;
79 modelview_matrix
[4] = 0.0f
;
80 modelview_matrix
[5] = 1.0f
;
81 modelview_matrix
[6] = 0.0f
;
82 modelview_matrix
[7] = 0.0f
;
83 modelview_matrix
[8] = 0.0f
;
84 modelview_matrix
[9] = 0.0f
;
85 modelview_matrix
[10] = 1.0f
;
86 modelview_matrix
[11] = 0.0f
;
87 modelview_matrix
[12] = 0.0f
;
88 modelview_matrix
[13] = 0.0f
;
89 modelview_matrix
[14] = 0.0f
;
90 modelview_matrix
[15] = 1.0f
;
91 projection_matrix
[0] = 1.0f
;
92 projection_matrix
[1] = 0.0f
;
93 projection_matrix
[2] = 0.0f
;
94 projection_matrix
[3] = 0.0f
;
95 projection_matrix
[4] = 0.0f
;
96 projection_matrix
[5] = 1.0f
;
97 projection_matrix
[6] = 0.0f
;
98 projection_matrix
[7] = 0.0f
;
99 projection_matrix
[8] = 0.0f
;
100 projection_matrix
[9] = 0.0f
;
101 projection_matrix
[10] = 1.0f
;
102 projection_matrix
[11] = 0.0f
;
103 projection_matrix
[12] = 0.0f
;
104 projection_matrix
[13] = 0.0f
;
105 projection_matrix
[14] = 0.0f
;
106 projection_matrix
[15] = 1.0f
;
108 unpack_alignment
= 4;
109 polygon_offset_factor
= 0.0f
;
110 polygon_offset_units
= 0.0f
;
111 sample_coverage_value
= 1.0f
;
112 sample_coverage_invert
= false;
117 stencil_front_func
= GL_ALWAYS
;
118 stencil_front_ref
= 0;
119 stencil_front_mask
= 0xFFFFFFFFU
;
120 stencil_back_func
= GL_ALWAYS
;
121 stencil_back_ref
= 0;
122 stencil_back_mask
= 0xFFFFFFFFU
;
123 stencil_front_writemask
= 0xFFFFFFFFU
;
124 cached_stencil_front_writemask
= 0xFFFFFFFFU
;
125 stencil_back_writemask
= 0xFFFFFFFFU
;
126 cached_stencil_back_writemask
= 0xFFFFFFFFU
;
127 stencil_front_fail_op
= GL_KEEP
;
128 stencil_front_z_fail_op
= GL_KEEP
;
129 stencil_front_z_pass_op
= GL_KEEP
;
130 stencil_back_fail_op
= GL_KEEP
;
131 stencil_back_z_fail_op
= GL_KEEP
;
132 stencil_back_z_pass_op
= GL_KEEP
;
139 void ContextState::InitCapabilities(const ContextState
* prev_state
) const {
141 if (prev_state
->enable_flags
.cached_blend
!= enable_flags
.cached_blend
) {
142 EnableDisable(GL_BLEND
, enable_flags
.cached_blend
);
144 if (prev_state
->enable_flags
.cached_cull_face
!=
145 enable_flags
.cached_cull_face
) {
146 EnableDisable(GL_CULL_FACE
, enable_flags
.cached_cull_face
);
148 if (prev_state
->enable_flags
.cached_depth_test
!=
149 enable_flags
.cached_depth_test
) {
150 EnableDisable(GL_DEPTH_TEST
, enable_flags
.cached_depth_test
);
152 if (prev_state
->enable_flags
.cached_dither
!= enable_flags
.cached_dither
) {
153 EnableDisable(GL_DITHER
, enable_flags
.cached_dither
);
155 if (prev_state
->enable_flags
.cached_polygon_offset_fill
!=
156 enable_flags
.cached_polygon_offset_fill
) {
157 EnableDisable(GL_POLYGON_OFFSET_FILL
,
158 enable_flags
.cached_polygon_offset_fill
);
160 if (prev_state
->enable_flags
.cached_sample_alpha_to_coverage
!=
161 enable_flags
.cached_sample_alpha_to_coverage
) {
162 EnableDisable(GL_SAMPLE_ALPHA_TO_COVERAGE
,
163 enable_flags
.cached_sample_alpha_to_coverage
);
165 if (prev_state
->enable_flags
.cached_sample_coverage
!=
166 enable_flags
.cached_sample_coverage
) {
167 EnableDisable(GL_SAMPLE_COVERAGE
, enable_flags
.cached_sample_coverage
);
169 if (prev_state
->enable_flags
.cached_scissor_test
!=
170 enable_flags
.cached_scissor_test
) {
171 EnableDisable(GL_SCISSOR_TEST
, enable_flags
.cached_scissor_test
);
173 if (prev_state
->enable_flags
.cached_stencil_test
!=
174 enable_flags
.cached_stencil_test
) {
175 EnableDisable(GL_STENCIL_TEST
, enable_flags
.cached_stencil_test
);
177 if (feature_info_
->IsES3Capable()) {
178 if (prev_state
->enable_flags
.cached_rasterizer_discard
!=
179 enable_flags
.cached_rasterizer_discard
) {
180 EnableDisable(GL_RASTERIZER_DISCARD
,
181 enable_flags
.cached_rasterizer_discard
);
183 if (prev_state
->enable_flags
.cached_primitive_restart_fixed_index
!=
184 enable_flags
.cached_primitive_restart_fixed_index
) {
185 EnableDisable(GL_PRIMITIVE_RESTART_FIXED_INDEX
,
186 enable_flags
.cached_primitive_restart_fixed_index
);
190 EnableDisable(GL_BLEND
, enable_flags
.cached_blend
);
191 EnableDisable(GL_CULL_FACE
, enable_flags
.cached_cull_face
);
192 EnableDisable(GL_DEPTH_TEST
, enable_flags
.cached_depth_test
);
193 EnableDisable(GL_DITHER
, enable_flags
.cached_dither
);
194 EnableDisable(GL_POLYGON_OFFSET_FILL
,
195 enable_flags
.cached_polygon_offset_fill
);
196 EnableDisable(GL_SAMPLE_ALPHA_TO_COVERAGE
,
197 enable_flags
.cached_sample_alpha_to_coverage
);
198 EnableDisable(GL_SAMPLE_COVERAGE
, enable_flags
.cached_sample_coverage
);
199 EnableDisable(GL_SCISSOR_TEST
, enable_flags
.cached_scissor_test
);
200 EnableDisable(GL_STENCIL_TEST
, enable_flags
.cached_stencil_test
);
201 if (feature_info_
->IsES3Capable()) {
202 EnableDisable(GL_RASTERIZER_DISCARD
,
203 enable_flags
.cached_rasterizer_discard
);
204 EnableDisable(GL_PRIMITIVE_RESTART_FIXED_INDEX
,
205 enable_flags
.cached_primitive_restart_fixed_index
);
210 void ContextState::InitState(const ContextState
* prev_state
) const {
212 if ((blend_color_red
!= prev_state
->blend_color_red
) ||
213 (blend_color_green
!= prev_state
->blend_color_green
) ||
214 (blend_color_blue
!= prev_state
->blend_color_blue
) ||
215 (blend_color_alpha
!= prev_state
->blend_color_alpha
))
216 glBlendColor(blend_color_red
, blend_color_green
, blend_color_blue
,
218 if ((blend_equation_rgb
!= prev_state
->blend_equation_rgb
) ||
219 (blend_equation_alpha
!= prev_state
->blend_equation_alpha
))
220 glBlendEquationSeparate(blend_equation_rgb
, blend_equation_alpha
);
221 if ((blend_source_rgb
!= prev_state
->blend_source_rgb
) ||
222 (blend_dest_rgb
!= prev_state
->blend_dest_rgb
) ||
223 (blend_source_alpha
!= prev_state
->blend_source_alpha
) ||
224 (blend_dest_alpha
!= prev_state
->blend_dest_alpha
))
225 glBlendFuncSeparate(blend_source_rgb
, blend_dest_rgb
, blend_source_alpha
,
227 if ((color_clear_red
!= prev_state
->color_clear_red
) ||
228 (color_clear_green
!= prev_state
->color_clear_green
) ||
229 (color_clear_blue
!= prev_state
->color_clear_blue
) ||
230 (color_clear_alpha
!= prev_state
->color_clear_alpha
))
231 glClearColor(color_clear_red
, color_clear_green
, color_clear_blue
,
233 if ((depth_clear
!= prev_state
->depth_clear
))
234 glClearDepth(depth_clear
);
235 if ((stencil_clear
!= prev_state
->stencil_clear
))
236 glClearStencil(stencil_clear
);
237 if ((cached_color_mask_red
!= prev_state
->cached_color_mask_red
) ||
238 (cached_color_mask_green
!= prev_state
->cached_color_mask_green
) ||
239 (cached_color_mask_blue
!= prev_state
->cached_color_mask_blue
) ||
240 (cached_color_mask_alpha
!= prev_state
->cached_color_mask_alpha
))
241 glColorMask(cached_color_mask_red
, cached_color_mask_green
,
242 cached_color_mask_blue
, cached_color_mask_alpha
);
243 if ((cull_mode
!= prev_state
->cull_mode
))
244 glCullFace(cull_mode
);
245 if ((depth_func
!= prev_state
->depth_func
))
246 glDepthFunc(depth_func
);
247 if ((cached_depth_mask
!= prev_state
->cached_depth_mask
))
248 glDepthMask(cached_depth_mask
);
249 if ((z_near
!= prev_state
->z_near
) || (z_far
!= prev_state
->z_far
))
250 glDepthRange(z_near
, z_far
);
251 if ((front_face
!= prev_state
->front_face
))
252 glFrontFace(front_face
);
253 if (prev_state
->hint_generate_mipmap
!= hint_generate_mipmap
) {
254 if (!feature_info_
->gl_version_info().is_desktop_core_profile
) {
255 glHint(GL_GENERATE_MIPMAP_HINT
, hint_generate_mipmap
);
258 if (feature_info_
->feature_flags().oes_standard_derivatives
) {
259 if (prev_state
->hint_fragment_shader_derivative
!=
260 hint_fragment_shader_derivative
) {
261 glHint(GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES
,
262 hint_fragment_shader_derivative
);
265 if ((line_width
!= prev_state
->line_width
))
266 glLineWidth(line_width
);
267 if (feature_info_
->feature_flags().chromium_path_rendering
) {
268 if (memcmp(prev_state
->modelview_matrix
, modelview_matrix
,
269 sizeof(GLfloat
) * 16)) {
270 glMatrixLoadfEXT(GL_PATH_MODELVIEW_CHROMIUM
, modelview_matrix
);
273 if (feature_info_
->feature_flags().chromium_path_rendering
) {
274 if (memcmp(prev_state
->projection_matrix
, projection_matrix
,
275 sizeof(GLfloat
) * 16)) {
276 glMatrixLoadfEXT(GL_PATH_PROJECTION_CHROMIUM
, projection_matrix
);
279 if (prev_state
->pack_alignment
!= pack_alignment
) {
280 glPixelStorei(GL_PACK_ALIGNMENT
, pack_alignment
);
282 if (prev_state
->unpack_alignment
!= unpack_alignment
) {
283 glPixelStorei(GL_UNPACK_ALIGNMENT
, unpack_alignment
);
285 if ((polygon_offset_factor
!= prev_state
->polygon_offset_factor
) ||
286 (polygon_offset_units
!= prev_state
->polygon_offset_units
))
287 glPolygonOffset(polygon_offset_factor
, polygon_offset_units
);
288 if ((sample_coverage_value
!= prev_state
->sample_coverage_value
) ||
289 (sample_coverage_invert
!= prev_state
->sample_coverage_invert
))
290 glSampleCoverage(sample_coverage_value
, sample_coverage_invert
);
291 if ((scissor_x
!= prev_state
->scissor_x
) ||
292 (scissor_y
!= prev_state
->scissor_y
) ||
293 (scissor_width
!= prev_state
->scissor_width
) ||
294 (scissor_height
!= prev_state
->scissor_height
))
295 glScissor(scissor_x
, scissor_y
, scissor_width
, scissor_height
);
296 if ((stencil_front_func
!= prev_state
->stencil_front_func
) ||
297 (stencil_front_ref
!= prev_state
->stencil_front_ref
) ||
298 (stencil_front_mask
!= prev_state
->stencil_front_mask
))
299 glStencilFuncSeparate(GL_FRONT
, stencil_front_func
, stencil_front_ref
,
301 if ((stencil_back_func
!= prev_state
->stencil_back_func
) ||
302 (stencil_back_ref
!= prev_state
->stencil_back_ref
) ||
303 (stencil_back_mask
!= prev_state
->stencil_back_mask
))
304 glStencilFuncSeparate(GL_BACK
, stencil_back_func
, stencil_back_ref
,
306 if ((cached_stencil_front_writemask
!=
307 prev_state
->cached_stencil_front_writemask
))
308 glStencilMaskSeparate(GL_FRONT
, cached_stencil_front_writemask
);
309 if ((cached_stencil_back_writemask
!=
310 prev_state
->cached_stencil_back_writemask
))
311 glStencilMaskSeparate(GL_BACK
, cached_stencil_back_writemask
);
312 if ((stencil_front_fail_op
!= prev_state
->stencil_front_fail_op
) ||
313 (stencil_front_z_fail_op
!= prev_state
->stencil_front_z_fail_op
) ||
314 (stencil_front_z_pass_op
!= prev_state
->stencil_front_z_pass_op
))
315 glStencilOpSeparate(GL_FRONT
, stencil_front_fail_op
,
316 stencil_front_z_fail_op
, stencil_front_z_pass_op
);
317 if ((stencil_back_fail_op
!= prev_state
->stencil_back_fail_op
) ||
318 (stencil_back_z_fail_op
!= prev_state
->stencil_back_z_fail_op
) ||
319 (stencil_back_z_pass_op
!= prev_state
->stencil_back_z_pass_op
))
320 glStencilOpSeparate(GL_BACK
, stencil_back_fail_op
, stencil_back_z_fail_op
,
321 stencil_back_z_pass_op
);
322 if ((viewport_x
!= prev_state
->viewport_x
) ||
323 (viewport_y
!= prev_state
->viewport_y
) ||
324 (viewport_width
!= prev_state
->viewport_width
) ||
325 (viewport_height
!= prev_state
->viewport_height
))
326 glViewport(viewport_x
, viewport_y
, viewport_width
, viewport_height
);
328 glBlendColor(blend_color_red
, blend_color_green
, blend_color_blue
,
330 glBlendEquationSeparate(blend_equation_rgb
, blend_equation_alpha
);
331 glBlendFuncSeparate(blend_source_rgb
, blend_dest_rgb
, blend_source_alpha
,
333 glClearColor(color_clear_red
, color_clear_green
, color_clear_blue
,
335 glClearDepth(depth_clear
);
336 glClearStencil(stencil_clear
);
337 glColorMask(cached_color_mask_red
, cached_color_mask_green
,
338 cached_color_mask_blue
, cached_color_mask_alpha
);
339 glCullFace(cull_mode
);
340 glDepthFunc(depth_func
);
341 glDepthMask(cached_depth_mask
);
342 glDepthRange(z_near
, z_far
);
343 glFrontFace(front_face
);
344 if (!feature_info_
->gl_version_info().is_desktop_core_profile
) {
345 glHint(GL_GENERATE_MIPMAP_HINT
, hint_generate_mipmap
);
347 if (feature_info_
->feature_flags().oes_standard_derivatives
) {
348 glHint(GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES
,
349 hint_fragment_shader_derivative
);
351 glLineWidth(line_width
);
352 if (feature_info_
->feature_flags().chromium_path_rendering
) {
353 glMatrixLoadfEXT(GL_PATH_MODELVIEW_CHROMIUM
, modelview_matrix
);
355 if (feature_info_
->feature_flags().chromium_path_rendering
) {
356 glMatrixLoadfEXT(GL_PATH_PROJECTION_CHROMIUM
, projection_matrix
);
358 glPixelStorei(GL_PACK_ALIGNMENT
, pack_alignment
);
359 glPixelStorei(GL_UNPACK_ALIGNMENT
, unpack_alignment
);
360 glPolygonOffset(polygon_offset_factor
, polygon_offset_units
);
361 glSampleCoverage(sample_coverage_value
, sample_coverage_invert
);
362 glScissor(scissor_x
, scissor_y
, scissor_width
, scissor_height
);
363 glStencilFuncSeparate(GL_FRONT
, stencil_front_func
, stencil_front_ref
,
365 glStencilFuncSeparate(GL_BACK
, stencil_back_func
, stencil_back_ref
,
367 glStencilMaskSeparate(GL_FRONT
, cached_stencil_front_writemask
);
368 glStencilMaskSeparate(GL_BACK
, cached_stencil_back_writemask
);
369 glStencilOpSeparate(GL_FRONT
, stencil_front_fail_op
,
370 stencil_front_z_fail_op
, stencil_front_z_pass_op
);
371 glStencilOpSeparate(GL_BACK
, stencil_back_fail_op
, stencil_back_z_fail_op
,
372 stencil_back_z_pass_op
);
373 glViewport(viewport_x
, viewport_y
, viewport_width
, viewport_height
);
376 bool ContextState::GetEnabled(GLenum cap
) const {
379 return enable_flags
.blend
;
381 return enable_flags
.cull_face
;
383 return enable_flags
.depth_test
;
385 return enable_flags
.dither
;
386 case GL_POLYGON_OFFSET_FILL
:
387 return enable_flags
.polygon_offset_fill
;
388 case GL_SAMPLE_ALPHA_TO_COVERAGE
:
389 return enable_flags
.sample_alpha_to_coverage
;
390 case GL_SAMPLE_COVERAGE
:
391 return enable_flags
.sample_coverage
;
392 case GL_SCISSOR_TEST
:
393 return enable_flags
.scissor_test
;
394 case GL_STENCIL_TEST
:
395 return enable_flags
.stencil_test
;
396 case GL_RASTERIZER_DISCARD
:
397 return enable_flags
.rasterizer_discard
;
398 case GL_PRIMITIVE_RESTART_FIXED_INDEX
:
399 return enable_flags
.primitive_restart_fixed_index
;
406 bool ContextState::GetStateAsGLint(GLenum pname
,
408 GLsizei
* num_written
) const {
413 params
[0] = static_cast<GLint
>(blend_color_red
);
414 params
[1] = static_cast<GLint
>(blend_color_green
);
415 params
[2] = static_cast<GLint
>(blend_color_blue
);
416 params
[3] = static_cast<GLint
>(blend_color_alpha
);
419 case GL_BLEND_EQUATION_RGB
:
422 params
[0] = static_cast<GLint
>(blend_equation_rgb
);
425 case GL_BLEND_EQUATION_ALPHA
:
428 params
[0] = static_cast<GLint
>(blend_equation_alpha
);
431 case GL_BLEND_SRC_RGB
:
434 params
[0] = static_cast<GLint
>(blend_source_rgb
);
437 case GL_BLEND_DST_RGB
:
440 params
[0] = static_cast<GLint
>(blend_dest_rgb
);
443 case GL_BLEND_SRC_ALPHA
:
446 params
[0] = static_cast<GLint
>(blend_source_alpha
);
449 case GL_BLEND_DST_ALPHA
:
452 params
[0] = static_cast<GLint
>(blend_dest_alpha
);
455 case GL_COLOR_CLEAR_VALUE
:
458 params
[0] = static_cast<GLint
>(color_clear_red
);
459 params
[1] = static_cast<GLint
>(color_clear_green
);
460 params
[2] = static_cast<GLint
>(color_clear_blue
);
461 params
[3] = static_cast<GLint
>(color_clear_alpha
);
464 case GL_DEPTH_CLEAR_VALUE
:
467 params
[0] = static_cast<GLint
>(depth_clear
);
470 case GL_STENCIL_CLEAR_VALUE
:
473 params
[0] = static_cast<GLint
>(stencil_clear
);
476 case GL_COLOR_WRITEMASK
:
479 params
[0] = static_cast<GLint
>(color_mask_red
);
480 params
[1] = static_cast<GLint
>(color_mask_green
);
481 params
[2] = static_cast<GLint
>(color_mask_blue
);
482 params
[3] = static_cast<GLint
>(color_mask_alpha
);
485 case GL_CULL_FACE_MODE
:
488 params
[0] = static_cast<GLint
>(cull_mode
);
494 params
[0] = static_cast<GLint
>(depth_func
);
497 case GL_DEPTH_WRITEMASK
:
500 params
[0] = static_cast<GLint
>(depth_mask
);
506 params
[0] = static_cast<GLint
>(z_near
);
507 params
[1] = static_cast<GLint
>(z_far
);
513 params
[0] = static_cast<GLint
>(front_face
);
516 case GL_GENERATE_MIPMAP_HINT
:
519 params
[0] = static_cast<GLint
>(hint_generate_mipmap
);
522 case GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES
:
525 params
[0] = static_cast<GLint
>(hint_fragment_shader_derivative
);
531 params
[0] = static_cast<GLint
>(line_width
);
534 case GL_PATH_MODELVIEW_MATRIX_CHROMIUM
:
537 for (size_t i
= 0; i
< 16; ++i
) {
538 params
[i
] = static_cast<GLint
>(round(modelview_matrix
[i
]));
542 case GL_PATH_PROJECTION_MATRIX_CHROMIUM
:
545 for (size_t i
= 0; i
< 16; ++i
) {
546 params
[i
] = static_cast<GLint
>(round(projection_matrix
[i
]));
550 case GL_PACK_ALIGNMENT
:
553 params
[0] = static_cast<GLint
>(pack_alignment
);
556 case GL_UNPACK_ALIGNMENT
:
559 params
[0] = static_cast<GLint
>(unpack_alignment
);
562 case GL_POLYGON_OFFSET_FACTOR
:
565 params
[0] = static_cast<GLint
>(round(polygon_offset_factor
));
568 case GL_POLYGON_OFFSET_UNITS
:
571 params
[0] = static_cast<GLint
>(round(polygon_offset_units
));
574 case GL_SAMPLE_COVERAGE_VALUE
:
577 params
[0] = static_cast<GLint
>(sample_coverage_value
);
580 case GL_SAMPLE_COVERAGE_INVERT
:
583 params
[0] = static_cast<GLint
>(sample_coverage_invert
);
589 params
[0] = static_cast<GLint
>(scissor_x
);
590 params
[1] = static_cast<GLint
>(scissor_y
);
591 params
[2] = static_cast<GLint
>(scissor_width
);
592 params
[3] = static_cast<GLint
>(scissor_height
);
595 case GL_STENCIL_FUNC
:
598 params
[0] = static_cast<GLint
>(stencil_front_func
);
604 params
[0] = static_cast<GLint
>(stencil_front_ref
);
607 case GL_STENCIL_VALUE_MASK
:
610 params
[0] = static_cast<GLint
>(stencil_front_mask
);
613 case GL_STENCIL_BACK_FUNC
:
616 params
[0] = static_cast<GLint
>(stencil_back_func
);
619 case GL_STENCIL_BACK_REF
:
622 params
[0] = static_cast<GLint
>(stencil_back_ref
);
625 case GL_STENCIL_BACK_VALUE_MASK
:
628 params
[0] = static_cast<GLint
>(stencil_back_mask
);
631 case GL_STENCIL_WRITEMASK
:
634 params
[0] = static_cast<GLint
>(stencil_front_writemask
);
637 case GL_STENCIL_BACK_WRITEMASK
:
640 params
[0] = static_cast<GLint
>(stencil_back_writemask
);
643 case GL_STENCIL_FAIL
:
646 params
[0] = static_cast<GLint
>(stencil_front_fail_op
);
649 case GL_STENCIL_PASS_DEPTH_FAIL
:
652 params
[0] = static_cast<GLint
>(stencil_front_z_fail_op
);
655 case GL_STENCIL_PASS_DEPTH_PASS
:
658 params
[0] = static_cast<GLint
>(stencil_front_z_pass_op
);
661 case GL_STENCIL_BACK_FAIL
:
664 params
[0] = static_cast<GLint
>(stencil_back_fail_op
);
667 case GL_STENCIL_BACK_PASS_DEPTH_FAIL
:
670 params
[0] = static_cast<GLint
>(stencil_back_z_fail_op
);
673 case GL_STENCIL_BACK_PASS_DEPTH_PASS
:
676 params
[0] = static_cast<GLint
>(stencil_back_z_pass_op
);
682 params
[0] = static_cast<GLint
>(viewport_x
);
683 params
[1] = static_cast<GLint
>(viewport_y
);
684 params
[2] = static_cast<GLint
>(viewport_width
);
685 params
[3] = static_cast<GLint
>(viewport_height
);
691 params
[0] = static_cast<GLint
>(enable_flags
.blend
);
697 params
[0] = static_cast<GLint
>(enable_flags
.cull_face
);
703 params
[0] = static_cast<GLint
>(enable_flags
.depth_test
);
709 params
[0] = static_cast<GLint
>(enable_flags
.dither
);
712 case GL_POLYGON_OFFSET_FILL
:
715 params
[0] = static_cast<GLint
>(enable_flags
.polygon_offset_fill
);
718 case GL_SAMPLE_ALPHA_TO_COVERAGE
:
721 params
[0] = static_cast<GLint
>(enable_flags
.sample_alpha_to_coverage
);
724 case GL_SAMPLE_COVERAGE
:
727 params
[0] = static_cast<GLint
>(enable_flags
.sample_coverage
);
730 case GL_SCISSOR_TEST
:
733 params
[0] = static_cast<GLint
>(enable_flags
.scissor_test
);
736 case GL_STENCIL_TEST
:
739 params
[0] = static_cast<GLint
>(enable_flags
.stencil_test
);
742 case GL_RASTERIZER_DISCARD
:
745 params
[0] = static_cast<GLint
>(enable_flags
.rasterizer_discard
);
748 case GL_PRIMITIVE_RESTART_FIXED_INDEX
:
752 static_cast<GLint
>(enable_flags
.primitive_restart_fixed_index
);
760 bool ContextState::GetStateAsGLfloat(GLenum pname
,
762 GLsizei
* num_written
) const {
767 params
[0] = static_cast<GLfloat
>(blend_color_red
);
768 params
[1] = static_cast<GLfloat
>(blend_color_green
);
769 params
[2] = static_cast<GLfloat
>(blend_color_blue
);
770 params
[3] = static_cast<GLfloat
>(blend_color_alpha
);
773 case GL_BLEND_EQUATION_RGB
:
776 params
[0] = static_cast<GLfloat
>(blend_equation_rgb
);
779 case GL_BLEND_EQUATION_ALPHA
:
782 params
[0] = static_cast<GLfloat
>(blend_equation_alpha
);
785 case GL_BLEND_SRC_RGB
:
788 params
[0] = static_cast<GLfloat
>(blend_source_rgb
);
791 case GL_BLEND_DST_RGB
:
794 params
[0] = static_cast<GLfloat
>(blend_dest_rgb
);
797 case GL_BLEND_SRC_ALPHA
:
800 params
[0] = static_cast<GLfloat
>(blend_source_alpha
);
803 case GL_BLEND_DST_ALPHA
:
806 params
[0] = static_cast<GLfloat
>(blend_dest_alpha
);
809 case GL_COLOR_CLEAR_VALUE
:
812 params
[0] = static_cast<GLfloat
>(color_clear_red
);
813 params
[1] = static_cast<GLfloat
>(color_clear_green
);
814 params
[2] = static_cast<GLfloat
>(color_clear_blue
);
815 params
[3] = static_cast<GLfloat
>(color_clear_alpha
);
818 case GL_DEPTH_CLEAR_VALUE
:
821 params
[0] = static_cast<GLfloat
>(depth_clear
);
824 case GL_STENCIL_CLEAR_VALUE
:
827 params
[0] = static_cast<GLfloat
>(stencil_clear
);
830 case GL_COLOR_WRITEMASK
:
833 params
[0] = static_cast<GLfloat
>(color_mask_red
);
834 params
[1] = static_cast<GLfloat
>(color_mask_green
);
835 params
[2] = static_cast<GLfloat
>(color_mask_blue
);
836 params
[3] = static_cast<GLfloat
>(color_mask_alpha
);
839 case GL_CULL_FACE_MODE
:
842 params
[0] = static_cast<GLfloat
>(cull_mode
);
848 params
[0] = static_cast<GLfloat
>(depth_func
);
851 case GL_DEPTH_WRITEMASK
:
854 params
[0] = static_cast<GLfloat
>(depth_mask
);
860 params
[0] = static_cast<GLfloat
>(z_near
);
861 params
[1] = static_cast<GLfloat
>(z_far
);
867 params
[0] = static_cast<GLfloat
>(front_face
);
870 case GL_GENERATE_MIPMAP_HINT
:
873 params
[0] = static_cast<GLfloat
>(hint_generate_mipmap
);
876 case GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES
:
879 params
[0] = static_cast<GLfloat
>(hint_fragment_shader_derivative
);
885 params
[0] = static_cast<GLfloat
>(line_width
);
888 case GL_PATH_MODELVIEW_MATRIX_CHROMIUM
:
891 memcpy(params
, modelview_matrix
, sizeof(GLfloat
) * 16);
894 case GL_PATH_PROJECTION_MATRIX_CHROMIUM
:
897 memcpy(params
, projection_matrix
, sizeof(GLfloat
) * 16);
900 case GL_PACK_ALIGNMENT
:
903 params
[0] = static_cast<GLfloat
>(pack_alignment
);
906 case GL_UNPACK_ALIGNMENT
:
909 params
[0] = static_cast<GLfloat
>(unpack_alignment
);
912 case GL_POLYGON_OFFSET_FACTOR
:
915 params
[0] = static_cast<GLfloat
>(polygon_offset_factor
);
918 case GL_POLYGON_OFFSET_UNITS
:
921 params
[0] = static_cast<GLfloat
>(polygon_offset_units
);
924 case GL_SAMPLE_COVERAGE_VALUE
:
927 params
[0] = static_cast<GLfloat
>(sample_coverage_value
);
930 case GL_SAMPLE_COVERAGE_INVERT
:
933 params
[0] = static_cast<GLfloat
>(sample_coverage_invert
);
939 params
[0] = static_cast<GLfloat
>(scissor_x
);
940 params
[1] = static_cast<GLfloat
>(scissor_y
);
941 params
[2] = static_cast<GLfloat
>(scissor_width
);
942 params
[3] = static_cast<GLfloat
>(scissor_height
);
945 case GL_STENCIL_FUNC
:
948 params
[0] = static_cast<GLfloat
>(stencil_front_func
);
954 params
[0] = static_cast<GLfloat
>(stencil_front_ref
);
957 case GL_STENCIL_VALUE_MASK
:
960 params
[0] = static_cast<GLfloat
>(stencil_front_mask
);
963 case GL_STENCIL_BACK_FUNC
:
966 params
[0] = static_cast<GLfloat
>(stencil_back_func
);
969 case GL_STENCIL_BACK_REF
:
972 params
[0] = static_cast<GLfloat
>(stencil_back_ref
);
975 case GL_STENCIL_BACK_VALUE_MASK
:
978 params
[0] = static_cast<GLfloat
>(stencil_back_mask
);
981 case GL_STENCIL_WRITEMASK
:
984 params
[0] = static_cast<GLfloat
>(stencil_front_writemask
);
987 case GL_STENCIL_BACK_WRITEMASK
:
990 params
[0] = static_cast<GLfloat
>(stencil_back_writemask
);
993 case GL_STENCIL_FAIL
:
996 params
[0] = static_cast<GLfloat
>(stencil_front_fail_op
);
999 case GL_STENCIL_PASS_DEPTH_FAIL
:
1002 params
[0] = static_cast<GLfloat
>(stencil_front_z_fail_op
);
1005 case GL_STENCIL_PASS_DEPTH_PASS
:
1008 params
[0] = static_cast<GLfloat
>(stencil_front_z_pass_op
);
1011 case GL_STENCIL_BACK_FAIL
:
1014 params
[0] = static_cast<GLfloat
>(stencil_back_fail_op
);
1017 case GL_STENCIL_BACK_PASS_DEPTH_FAIL
:
1020 params
[0] = static_cast<GLfloat
>(stencil_back_z_fail_op
);
1023 case GL_STENCIL_BACK_PASS_DEPTH_PASS
:
1026 params
[0] = static_cast<GLfloat
>(stencil_back_z_pass_op
);
1032 params
[0] = static_cast<GLfloat
>(viewport_x
);
1033 params
[1] = static_cast<GLfloat
>(viewport_y
);
1034 params
[2] = static_cast<GLfloat
>(viewport_width
);
1035 params
[3] = static_cast<GLfloat
>(viewport_height
);
1041 params
[0] = static_cast<GLfloat
>(enable_flags
.blend
);
1047 params
[0] = static_cast<GLfloat
>(enable_flags
.cull_face
);
1053 params
[0] = static_cast<GLfloat
>(enable_flags
.depth_test
);
1059 params
[0] = static_cast<GLfloat
>(enable_flags
.dither
);
1062 case GL_POLYGON_OFFSET_FILL
:
1065 params
[0] = static_cast<GLfloat
>(enable_flags
.polygon_offset_fill
);
1068 case GL_SAMPLE_ALPHA_TO_COVERAGE
:
1071 params
[0] = static_cast<GLfloat
>(enable_flags
.sample_alpha_to_coverage
);
1074 case GL_SAMPLE_COVERAGE
:
1077 params
[0] = static_cast<GLfloat
>(enable_flags
.sample_coverage
);
1080 case GL_SCISSOR_TEST
:
1083 params
[0] = static_cast<GLfloat
>(enable_flags
.scissor_test
);
1086 case GL_STENCIL_TEST
:
1089 params
[0] = static_cast<GLfloat
>(enable_flags
.stencil_test
);
1092 case GL_RASTERIZER_DISCARD
:
1095 params
[0] = static_cast<GLfloat
>(enable_flags
.rasterizer_discard
);
1098 case GL_PRIMITIVE_RESTART_FIXED_INDEX
:
1102 static_cast<GLfloat
>(enable_flags
.primitive_restart_fixed_index
);
1109 #endif // GPU_COMMAND_BUFFER_SERVICE_CONTEXT_STATE_IMPL_AUTOGEN_H_