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
;
107 stencil_path_func
= GL_ALWAYS
;
108 stencil_path_ref
= 0;
109 stencil_path_mask
= 0xFFFFFFFFU
;
111 unpack_alignment
= 4;
112 polygon_offset_factor
= 0.0f
;
113 polygon_offset_units
= 0.0f
;
114 sample_coverage_value
= 1.0f
;
115 sample_coverage_invert
= false;
120 stencil_front_func
= GL_ALWAYS
;
121 stencil_front_ref
= 0;
122 stencil_front_mask
= 0xFFFFFFFFU
;
123 stencil_back_func
= GL_ALWAYS
;
124 stencil_back_ref
= 0;
125 stencil_back_mask
= 0xFFFFFFFFU
;
126 stencil_front_writemask
= 0xFFFFFFFFU
;
127 cached_stencil_front_writemask
= 0xFFFFFFFFU
;
128 stencil_back_writemask
= 0xFFFFFFFFU
;
129 cached_stencil_back_writemask
= 0xFFFFFFFFU
;
130 stencil_front_fail_op
= GL_KEEP
;
131 stencil_front_z_fail_op
= GL_KEEP
;
132 stencil_front_z_pass_op
= GL_KEEP
;
133 stencil_back_fail_op
= GL_KEEP
;
134 stencil_back_z_fail_op
= GL_KEEP
;
135 stencil_back_z_pass_op
= GL_KEEP
;
142 void ContextState::InitCapabilities(const ContextState
* prev_state
) const {
144 if (prev_state
->enable_flags
.cached_blend
!= enable_flags
.cached_blend
) {
145 EnableDisable(GL_BLEND
, enable_flags
.cached_blend
);
147 if (prev_state
->enable_flags
.cached_cull_face
!=
148 enable_flags
.cached_cull_face
) {
149 EnableDisable(GL_CULL_FACE
, enable_flags
.cached_cull_face
);
151 if (prev_state
->enable_flags
.cached_depth_test
!=
152 enable_flags
.cached_depth_test
) {
153 EnableDisable(GL_DEPTH_TEST
, enable_flags
.cached_depth_test
);
155 if (prev_state
->enable_flags
.cached_dither
!= enable_flags
.cached_dither
) {
156 EnableDisable(GL_DITHER
, enable_flags
.cached_dither
);
158 if (prev_state
->enable_flags
.cached_polygon_offset_fill
!=
159 enable_flags
.cached_polygon_offset_fill
) {
160 EnableDisable(GL_POLYGON_OFFSET_FILL
,
161 enable_flags
.cached_polygon_offset_fill
);
163 if (prev_state
->enable_flags
.cached_sample_alpha_to_coverage
!=
164 enable_flags
.cached_sample_alpha_to_coverage
) {
165 EnableDisable(GL_SAMPLE_ALPHA_TO_COVERAGE
,
166 enable_flags
.cached_sample_alpha_to_coverage
);
168 if (prev_state
->enable_flags
.cached_sample_coverage
!=
169 enable_flags
.cached_sample_coverage
) {
170 EnableDisable(GL_SAMPLE_COVERAGE
, enable_flags
.cached_sample_coverage
);
172 if (prev_state
->enable_flags
.cached_scissor_test
!=
173 enable_flags
.cached_scissor_test
) {
174 EnableDisable(GL_SCISSOR_TEST
, enable_flags
.cached_scissor_test
);
176 if (prev_state
->enable_flags
.cached_stencil_test
!=
177 enable_flags
.cached_stencil_test
) {
178 EnableDisable(GL_STENCIL_TEST
, enable_flags
.cached_stencil_test
);
180 if (feature_info_
->IsES3Capable()) {
181 if (prev_state
->enable_flags
.cached_rasterizer_discard
!=
182 enable_flags
.cached_rasterizer_discard
) {
183 EnableDisable(GL_RASTERIZER_DISCARD
,
184 enable_flags
.cached_rasterizer_discard
);
186 if (prev_state
->enable_flags
.cached_primitive_restart_fixed_index
!=
187 enable_flags
.cached_primitive_restart_fixed_index
) {
188 EnableDisable(GL_PRIMITIVE_RESTART_FIXED_INDEX
,
189 enable_flags
.cached_primitive_restart_fixed_index
);
193 EnableDisable(GL_BLEND
, enable_flags
.cached_blend
);
194 EnableDisable(GL_CULL_FACE
, enable_flags
.cached_cull_face
);
195 EnableDisable(GL_DEPTH_TEST
, enable_flags
.cached_depth_test
);
196 EnableDisable(GL_DITHER
, enable_flags
.cached_dither
);
197 EnableDisable(GL_POLYGON_OFFSET_FILL
,
198 enable_flags
.cached_polygon_offset_fill
);
199 EnableDisable(GL_SAMPLE_ALPHA_TO_COVERAGE
,
200 enable_flags
.cached_sample_alpha_to_coverage
);
201 EnableDisable(GL_SAMPLE_COVERAGE
, enable_flags
.cached_sample_coverage
);
202 EnableDisable(GL_SCISSOR_TEST
, enable_flags
.cached_scissor_test
);
203 EnableDisable(GL_STENCIL_TEST
, enable_flags
.cached_stencil_test
);
204 if (feature_info_
->IsES3Capable()) {
205 EnableDisable(GL_RASTERIZER_DISCARD
,
206 enable_flags
.cached_rasterizer_discard
);
207 EnableDisable(GL_PRIMITIVE_RESTART_FIXED_INDEX
,
208 enable_flags
.cached_primitive_restart_fixed_index
);
213 void ContextState::InitState(const ContextState
* prev_state
) const {
215 if ((blend_color_red
!= prev_state
->blend_color_red
) ||
216 (blend_color_green
!= prev_state
->blend_color_green
) ||
217 (blend_color_blue
!= prev_state
->blend_color_blue
) ||
218 (blend_color_alpha
!= prev_state
->blend_color_alpha
))
219 glBlendColor(blend_color_red
, blend_color_green
, blend_color_blue
,
221 if ((blend_equation_rgb
!= prev_state
->blend_equation_rgb
) ||
222 (blend_equation_alpha
!= prev_state
->blend_equation_alpha
))
223 glBlendEquationSeparate(blend_equation_rgb
, blend_equation_alpha
);
224 if ((blend_source_rgb
!= prev_state
->blend_source_rgb
) ||
225 (blend_dest_rgb
!= prev_state
->blend_dest_rgb
) ||
226 (blend_source_alpha
!= prev_state
->blend_source_alpha
) ||
227 (blend_dest_alpha
!= prev_state
->blend_dest_alpha
))
228 glBlendFuncSeparate(blend_source_rgb
, blend_dest_rgb
, blend_source_alpha
,
230 if ((color_clear_red
!= prev_state
->color_clear_red
) ||
231 (color_clear_green
!= prev_state
->color_clear_green
) ||
232 (color_clear_blue
!= prev_state
->color_clear_blue
) ||
233 (color_clear_alpha
!= prev_state
->color_clear_alpha
))
234 glClearColor(color_clear_red
, color_clear_green
, color_clear_blue
,
236 if ((depth_clear
!= prev_state
->depth_clear
))
237 glClearDepth(depth_clear
);
238 if ((stencil_clear
!= prev_state
->stencil_clear
))
239 glClearStencil(stencil_clear
);
240 if ((cached_color_mask_red
!= prev_state
->cached_color_mask_red
) ||
241 (cached_color_mask_green
!= prev_state
->cached_color_mask_green
) ||
242 (cached_color_mask_blue
!= prev_state
->cached_color_mask_blue
) ||
243 (cached_color_mask_alpha
!= prev_state
->cached_color_mask_alpha
))
244 glColorMask(cached_color_mask_red
, cached_color_mask_green
,
245 cached_color_mask_blue
, cached_color_mask_alpha
);
246 if ((cull_mode
!= prev_state
->cull_mode
))
247 glCullFace(cull_mode
);
248 if ((depth_func
!= prev_state
->depth_func
))
249 glDepthFunc(depth_func
);
250 if ((cached_depth_mask
!= prev_state
->cached_depth_mask
))
251 glDepthMask(cached_depth_mask
);
252 if ((z_near
!= prev_state
->z_near
) || (z_far
!= prev_state
->z_far
))
253 glDepthRange(z_near
, z_far
);
254 if ((front_face
!= prev_state
->front_face
))
255 glFrontFace(front_face
);
256 if (prev_state
->hint_generate_mipmap
!= hint_generate_mipmap
) {
257 if (!feature_info_
->gl_version_info().is_desktop_core_profile
) {
258 glHint(GL_GENERATE_MIPMAP_HINT
, hint_generate_mipmap
);
261 if (feature_info_
->feature_flags().oes_standard_derivatives
) {
262 if (prev_state
->hint_fragment_shader_derivative
!=
263 hint_fragment_shader_derivative
) {
264 glHint(GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES
,
265 hint_fragment_shader_derivative
);
268 if ((line_width
!= prev_state
->line_width
))
269 glLineWidth(line_width
);
270 if (feature_info_
->feature_flags().chromium_path_rendering
) {
271 if (memcmp(prev_state
->modelview_matrix
, modelview_matrix
,
272 sizeof(GLfloat
) * 16)) {
273 glMatrixLoadfEXT(GL_PATH_MODELVIEW_CHROMIUM
, modelview_matrix
);
276 if (feature_info_
->feature_flags().chromium_path_rendering
) {
277 if (memcmp(prev_state
->projection_matrix
, projection_matrix
,
278 sizeof(GLfloat
) * 16)) {
279 glMatrixLoadfEXT(GL_PATH_PROJECTION_CHROMIUM
, projection_matrix
);
282 if (feature_info_
->feature_flags().chromium_path_rendering
)
283 if ((stencil_path_func
!= prev_state
->stencil_path_func
) ||
284 (stencil_path_ref
!= prev_state
->stencil_path_ref
) ||
285 (stencil_path_mask
!= prev_state
->stencil_path_mask
))
286 glPathStencilFuncNV(stencil_path_func
, stencil_path_ref
,
288 if (prev_state
->pack_alignment
!= pack_alignment
) {
289 glPixelStorei(GL_PACK_ALIGNMENT
, pack_alignment
);
291 if (prev_state
->unpack_alignment
!= unpack_alignment
) {
292 glPixelStorei(GL_UNPACK_ALIGNMENT
, unpack_alignment
);
294 if ((polygon_offset_factor
!= prev_state
->polygon_offset_factor
) ||
295 (polygon_offset_units
!= prev_state
->polygon_offset_units
))
296 glPolygonOffset(polygon_offset_factor
, polygon_offset_units
);
297 if ((sample_coverage_value
!= prev_state
->sample_coverage_value
) ||
298 (sample_coverage_invert
!= prev_state
->sample_coverage_invert
))
299 glSampleCoverage(sample_coverage_value
, sample_coverage_invert
);
300 if ((scissor_x
!= prev_state
->scissor_x
) ||
301 (scissor_y
!= prev_state
->scissor_y
) ||
302 (scissor_width
!= prev_state
->scissor_width
) ||
303 (scissor_height
!= prev_state
->scissor_height
))
304 glScissor(scissor_x
, scissor_y
, scissor_width
, scissor_height
);
305 if ((stencil_front_func
!= prev_state
->stencil_front_func
) ||
306 (stencil_front_ref
!= prev_state
->stencil_front_ref
) ||
307 (stencil_front_mask
!= prev_state
->stencil_front_mask
))
308 glStencilFuncSeparate(GL_FRONT
, stencil_front_func
, stencil_front_ref
,
310 if ((stencil_back_func
!= prev_state
->stencil_back_func
) ||
311 (stencil_back_ref
!= prev_state
->stencil_back_ref
) ||
312 (stencil_back_mask
!= prev_state
->stencil_back_mask
))
313 glStencilFuncSeparate(GL_BACK
, stencil_back_func
, stencil_back_ref
,
315 if ((cached_stencil_front_writemask
!=
316 prev_state
->cached_stencil_front_writemask
))
317 glStencilMaskSeparate(GL_FRONT
, cached_stencil_front_writemask
);
318 if ((cached_stencil_back_writemask
!=
319 prev_state
->cached_stencil_back_writemask
))
320 glStencilMaskSeparate(GL_BACK
, cached_stencil_back_writemask
);
321 if ((stencil_front_fail_op
!= prev_state
->stencil_front_fail_op
) ||
322 (stencil_front_z_fail_op
!= prev_state
->stencil_front_z_fail_op
) ||
323 (stencil_front_z_pass_op
!= prev_state
->stencil_front_z_pass_op
))
324 glStencilOpSeparate(GL_FRONT
, stencil_front_fail_op
,
325 stencil_front_z_fail_op
, stencil_front_z_pass_op
);
326 if ((stencil_back_fail_op
!= prev_state
->stencil_back_fail_op
) ||
327 (stencil_back_z_fail_op
!= prev_state
->stencil_back_z_fail_op
) ||
328 (stencil_back_z_pass_op
!= prev_state
->stencil_back_z_pass_op
))
329 glStencilOpSeparate(GL_BACK
, stencil_back_fail_op
, stencil_back_z_fail_op
,
330 stencil_back_z_pass_op
);
331 if ((viewport_x
!= prev_state
->viewport_x
) ||
332 (viewport_y
!= prev_state
->viewport_y
) ||
333 (viewport_width
!= prev_state
->viewport_width
) ||
334 (viewport_height
!= prev_state
->viewport_height
))
335 glViewport(viewport_x
, viewport_y
, viewport_width
, viewport_height
);
337 glBlendColor(blend_color_red
, blend_color_green
, blend_color_blue
,
339 glBlendEquationSeparate(blend_equation_rgb
, blend_equation_alpha
);
340 glBlendFuncSeparate(blend_source_rgb
, blend_dest_rgb
, blend_source_alpha
,
342 glClearColor(color_clear_red
, color_clear_green
, color_clear_blue
,
344 glClearDepth(depth_clear
);
345 glClearStencil(stencil_clear
);
346 glColorMask(cached_color_mask_red
, cached_color_mask_green
,
347 cached_color_mask_blue
, cached_color_mask_alpha
);
348 glCullFace(cull_mode
);
349 glDepthFunc(depth_func
);
350 glDepthMask(cached_depth_mask
);
351 glDepthRange(z_near
, z_far
);
352 glFrontFace(front_face
);
353 if (!feature_info_
->gl_version_info().is_desktop_core_profile
) {
354 glHint(GL_GENERATE_MIPMAP_HINT
, hint_generate_mipmap
);
356 if (feature_info_
->feature_flags().oes_standard_derivatives
) {
357 glHint(GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES
,
358 hint_fragment_shader_derivative
);
360 glLineWidth(line_width
);
361 if (feature_info_
->feature_flags().chromium_path_rendering
) {
362 glMatrixLoadfEXT(GL_PATH_MODELVIEW_CHROMIUM
, modelview_matrix
);
364 if (feature_info_
->feature_flags().chromium_path_rendering
) {
365 glMatrixLoadfEXT(GL_PATH_PROJECTION_CHROMIUM
, projection_matrix
);
367 if (feature_info_
->feature_flags().chromium_path_rendering
)
368 glPathStencilFuncNV(stencil_path_func
, stencil_path_ref
,
370 glPixelStorei(GL_PACK_ALIGNMENT
, pack_alignment
);
371 glPixelStorei(GL_UNPACK_ALIGNMENT
, unpack_alignment
);
372 glPolygonOffset(polygon_offset_factor
, polygon_offset_units
);
373 glSampleCoverage(sample_coverage_value
, sample_coverage_invert
);
374 glScissor(scissor_x
, scissor_y
, scissor_width
, scissor_height
);
375 glStencilFuncSeparate(GL_FRONT
, stencil_front_func
, stencil_front_ref
,
377 glStencilFuncSeparate(GL_BACK
, stencil_back_func
, stencil_back_ref
,
379 glStencilMaskSeparate(GL_FRONT
, cached_stencil_front_writemask
);
380 glStencilMaskSeparate(GL_BACK
, cached_stencil_back_writemask
);
381 glStencilOpSeparate(GL_FRONT
, stencil_front_fail_op
,
382 stencil_front_z_fail_op
, stencil_front_z_pass_op
);
383 glStencilOpSeparate(GL_BACK
, stencil_back_fail_op
, stencil_back_z_fail_op
,
384 stencil_back_z_pass_op
);
385 glViewport(viewport_x
, viewport_y
, viewport_width
, viewport_height
);
388 bool ContextState::GetEnabled(GLenum cap
) const {
391 return enable_flags
.blend
;
393 return enable_flags
.cull_face
;
395 return enable_flags
.depth_test
;
397 return enable_flags
.dither
;
398 case GL_POLYGON_OFFSET_FILL
:
399 return enable_flags
.polygon_offset_fill
;
400 case GL_SAMPLE_ALPHA_TO_COVERAGE
:
401 return enable_flags
.sample_alpha_to_coverage
;
402 case GL_SAMPLE_COVERAGE
:
403 return enable_flags
.sample_coverage
;
404 case GL_SCISSOR_TEST
:
405 return enable_flags
.scissor_test
;
406 case GL_STENCIL_TEST
:
407 return enable_flags
.stencil_test
;
408 case GL_RASTERIZER_DISCARD
:
409 return enable_flags
.rasterizer_discard
;
410 case GL_PRIMITIVE_RESTART_FIXED_INDEX
:
411 return enable_flags
.primitive_restart_fixed_index
;
418 bool ContextState::GetStateAsGLint(GLenum pname
,
420 GLsizei
* num_written
) const {
425 params
[0] = static_cast<GLint
>(blend_color_red
);
426 params
[1] = static_cast<GLint
>(blend_color_green
);
427 params
[2] = static_cast<GLint
>(blend_color_blue
);
428 params
[3] = static_cast<GLint
>(blend_color_alpha
);
431 case GL_BLEND_EQUATION_RGB
:
434 params
[0] = static_cast<GLint
>(blend_equation_rgb
);
437 case GL_BLEND_EQUATION_ALPHA
:
440 params
[0] = static_cast<GLint
>(blend_equation_alpha
);
443 case GL_BLEND_SRC_RGB
:
446 params
[0] = static_cast<GLint
>(blend_source_rgb
);
449 case GL_BLEND_DST_RGB
:
452 params
[0] = static_cast<GLint
>(blend_dest_rgb
);
455 case GL_BLEND_SRC_ALPHA
:
458 params
[0] = static_cast<GLint
>(blend_source_alpha
);
461 case GL_BLEND_DST_ALPHA
:
464 params
[0] = static_cast<GLint
>(blend_dest_alpha
);
467 case GL_COLOR_CLEAR_VALUE
:
470 params
[0] = static_cast<GLint
>(color_clear_red
);
471 params
[1] = static_cast<GLint
>(color_clear_green
);
472 params
[2] = static_cast<GLint
>(color_clear_blue
);
473 params
[3] = static_cast<GLint
>(color_clear_alpha
);
476 case GL_DEPTH_CLEAR_VALUE
:
479 params
[0] = static_cast<GLint
>(depth_clear
);
482 case GL_STENCIL_CLEAR_VALUE
:
485 params
[0] = static_cast<GLint
>(stencil_clear
);
488 case GL_COLOR_WRITEMASK
:
491 params
[0] = static_cast<GLint
>(color_mask_red
);
492 params
[1] = static_cast<GLint
>(color_mask_green
);
493 params
[2] = static_cast<GLint
>(color_mask_blue
);
494 params
[3] = static_cast<GLint
>(color_mask_alpha
);
497 case GL_CULL_FACE_MODE
:
500 params
[0] = static_cast<GLint
>(cull_mode
);
506 params
[0] = static_cast<GLint
>(depth_func
);
509 case GL_DEPTH_WRITEMASK
:
512 params
[0] = static_cast<GLint
>(depth_mask
);
518 params
[0] = static_cast<GLint
>(z_near
);
519 params
[1] = static_cast<GLint
>(z_far
);
525 params
[0] = static_cast<GLint
>(front_face
);
528 case GL_GENERATE_MIPMAP_HINT
:
531 params
[0] = static_cast<GLint
>(hint_generate_mipmap
);
534 case GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES
:
537 params
[0] = static_cast<GLint
>(hint_fragment_shader_derivative
);
543 params
[0] = static_cast<GLint
>(line_width
);
546 case GL_PATH_MODELVIEW_MATRIX_CHROMIUM
:
549 for (size_t i
= 0; i
< 16; ++i
) {
550 params
[i
] = static_cast<GLint
>(round(modelview_matrix
[i
]));
554 case GL_PATH_PROJECTION_MATRIX_CHROMIUM
:
557 for (size_t i
= 0; i
< 16; ++i
) {
558 params
[i
] = static_cast<GLint
>(round(projection_matrix
[i
]));
562 case GL_PATH_STENCIL_FUNC_CHROMIUM
:
565 params
[0] = static_cast<GLint
>(stencil_path_func
);
568 case GL_PATH_STENCIL_REF_CHROMIUM
:
571 params
[0] = static_cast<GLint
>(stencil_path_ref
);
574 case GL_PATH_STENCIL_VALUE_MASK_CHROMIUM
:
577 params
[0] = static_cast<GLint
>(stencil_path_mask
);
580 case GL_PACK_ALIGNMENT
:
583 params
[0] = static_cast<GLint
>(pack_alignment
);
586 case GL_UNPACK_ALIGNMENT
:
589 params
[0] = static_cast<GLint
>(unpack_alignment
);
592 case GL_POLYGON_OFFSET_FACTOR
:
595 params
[0] = static_cast<GLint
>(round(polygon_offset_factor
));
598 case GL_POLYGON_OFFSET_UNITS
:
601 params
[0] = static_cast<GLint
>(round(polygon_offset_units
));
604 case GL_SAMPLE_COVERAGE_VALUE
:
607 params
[0] = static_cast<GLint
>(sample_coverage_value
);
610 case GL_SAMPLE_COVERAGE_INVERT
:
613 params
[0] = static_cast<GLint
>(sample_coverage_invert
);
619 params
[0] = static_cast<GLint
>(scissor_x
);
620 params
[1] = static_cast<GLint
>(scissor_y
);
621 params
[2] = static_cast<GLint
>(scissor_width
);
622 params
[3] = static_cast<GLint
>(scissor_height
);
625 case GL_STENCIL_FUNC
:
628 params
[0] = static_cast<GLint
>(stencil_front_func
);
634 params
[0] = static_cast<GLint
>(stencil_front_ref
);
637 case GL_STENCIL_VALUE_MASK
:
640 params
[0] = static_cast<GLint
>(stencil_front_mask
);
643 case GL_STENCIL_BACK_FUNC
:
646 params
[0] = static_cast<GLint
>(stencil_back_func
);
649 case GL_STENCIL_BACK_REF
:
652 params
[0] = static_cast<GLint
>(stencil_back_ref
);
655 case GL_STENCIL_BACK_VALUE_MASK
:
658 params
[0] = static_cast<GLint
>(stencil_back_mask
);
661 case GL_STENCIL_WRITEMASK
:
664 params
[0] = static_cast<GLint
>(stencil_front_writemask
);
667 case GL_STENCIL_BACK_WRITEMASK
:
670 params
[0] = static_cast<GLint
>(stencil_back_writemask
);
673 case GL_STENCIL_FAIL
:
676 params
[0] = static_cast<GLint
>(stencil_front_fail_op
);
679 case GL_STENCIL_PASS_DEPTH_FAIL
:
682 params
[0] = static_cast<GLint
>(stencil_front_z_fail_op
);
685 case GL_STENCIL_PASS_DEPTH_PASS
:
688 params
[0] = static_cast<GLint
>(stencil_front_z_pass_op
);
691 case GL_STENCIL_BACK_FAIL
:
694 params
[0] = static_cast<GLint
>(stencil_back_fail_op
);
697 case GL_STENCIL_BACK_PASS_DEPTH_FAIL
:
700 params
[0] = static_cast<GLint
>(stencil_back_z_fail_op
);
703 case GL_STENCIL_BACK_PASS_DEPTH_PASS
:
706 params
[0] = static_cast<GLint
>(stencil_back_z_pass_op
);
712 params
[0] = static_cast<GLint
>(viewport_x
);
713 params
[1] = static_cast<GLint
>(viewport_y
);
714 params
[2] = static_cast<GLint
>(viewport_width
);
715 params
[3] = static_cast<GLint
>(viewport_height
);
721 params
[0] = static_cast<GLint
>(enable_flags
.blend
);
727 params
[0] = static_cast<GLint
>(enable_flags
.cull_face
);
733 params
[0] = static_cast<GLint
>(enable_flags
.depth_test
);
739 params
[0] = static_cast<GLint
>(enable_flags
.dither
);
742 case GL_POLYGON_OFFSET_FILL
:
745 params
[0] = static_cast<GLint
>(enable_flags
.polygon_offset_fill
);
748 case GL_SAMPLE_ALPHA_TO_COVERAGE
:
751 params
[0] = static_cast<GLint
>(enable_flags
.sample_alpha_to_coverage
);
754 case GL_SAMPLE_COVERAGE
:
757 params
[0] = static_cast<GLint
>(enable_flags
.sample_coverage
);
760 case GL_SCISSOR_TEST
:
763 params
[0] = static_cast<GLint
>(enable_flags
.scissor_test
);
766 case GL_STENCIL_TEST
:
769 params
[0] = static_cast<GLint
>(enable_flags
.stencil_test
);
772 case GL_RASTERIZER_DISCARD
:
775 params
[0] = static_cast<GLint
>(enable_flags
.rasterizer_discard
);
778 case GL_PRIMITIVE_RESTART_FIXED_INDEX
:
782 static_cast<GLint
>(enable_flags
.primitive_restart_fixed_index
);
790 bool ContextState::GetStateAsGLfloat(GLenum pname
,
792 GLsizei
* num_written
) const {
797 params
[0] = static_cast<GLfloat
>(blend_color_red
);
798 params
[1] = static_cast<GLfloat
>(blend_color_green
);
799 params
[2] = static_cast<GLfloat
>(blend_color_blue
);
800 params
[3] = static_cast<GLfloat
>(blend_color_alpha
);
803 case GL_BLEND_EQUATION_RGB
:
806 params
[0] = static_cast<GLfloat
>(blend_equation_rgb
);
809 case GL_BLEND_EQUATION_ALPHA
:
812 params
[0] = static_cast<GLfloat
>(blend_equation_alpha
);
815 case GL_BLEND_SRC_RGB
:
818 params
[0] = static_cast<GLfloat
>(blend_source_rgb
);
821 case GL_BLEND_DST_RGB
:
824 params
[0] = static_cast<GLfloat
>(blend_dest_rgb
);
827 case GL_BLEND_SRC_ALPHA
:
830 params
[0] = static_cast<GLfloat
>(blend_source_alpha
);
833 case GL_BLEND_DST_ALPHA
:
836 params
[0] = static_cast<GLfloat
>(blend_dest_alpha
);
839 case GL_COLOR_CLEAR_VALUE
:
842 params
[0] = static_cast<GLfloat
>(color_clear_red
);
843 params
[1] = static_cast<GLfloat
>(color_clear_green
);
844 params
[2] = static_cast<GLfloat
>(color_clear_blue
);
845 params
[3] = static_cast<GLfloat
>(color_clear_alpha
);
848 case GL_DEPTH_CLEAR_VALUE
:
851 params
[0] = static_cast<GLfloat
>(depth_clear
);
854 case GL_STENCIL_CLEAR_VALUE
:
857 params
[0] = static_cast<GLfloat
>(stencil_clear
);
860 case GL_COLOR_WRITEMASK
:
863 params
[0] = static_cast<GLfloat
>(color_mask_red
);
864 params
[1] = static_cast<GLfloat
>(color_mask_green
);
865 params
[2] = static_cast<GLfloat
>(color_mask_blue
);
866 params
[3] = static_cast<GLfloat
>(color_mask_alpha
);
869 case GL_CULL_FACE_MODE
:
872 params
[0] = static_cast<GLfloat
>(cull_mode
);
878 params
[0] = static_cast<GLfloat
>(depth_func
);
881 case GL_DEPTH_WRITEMASK
:
884 params
[0] = static_cast<GLfloat
>(depth_mask
);
890 params
[0] = static_cast<GLfloat
>(z_near
);
891 params
[1] = static_cast<GLfloat
>(z_far
);
897 params
[0] = static_cast<GLfloat
>(front_face
);
900 case GL_GENERATE_MIPMAP_HINT
:
903 params
[0] = static_cast<GLfloat
>(hint_generate_mipmap
);
906 case GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES
:
909 params
[0] = static_cast<GLfloat
>(hint_fragment_shader_derivative
);
915 params
[0] = static_cast<GLfloat
>(line_width
);
918 case GL_PATH_MODELVIEW_MATRIX_CHROMIUM
:
921 memcpy(params
, modelview_matrix
, sizeof(GLfloat
) * 16);
924 case GL_PATH_PROJECTION_MATRIX_CHROMIUM
:
927 memcpy(params
, projection_matrix
, sizeof(GLfloat
) * 16);
930 case GL_PATH_STENCIL_FUNC_CHROMIUM
:
933 params
[0] = static_cast<GLfloat
>(stencil_path_func
);
936 case GL_PATH_STENCIL_REF_CHROMIUM
:
939 params
[0] = static_cast<GLfloat
>(stencil_path_ref
);
942 case GL_PATH_STENCIL_VALUE_MASK_CHROMIUM
:
945 params
[0] = static_cast<GLfloat
>(stencil_path_mask
);
948 case GL_PACK_ALIGNMENT
:
951 params
[0] = static_cast<GLfloat
>(pack_alignment
);
954 case GL_UNPACK_ALIGNMENT
:
957 params
[0] = static_cast<GLfloat
>(unpack_alignment
);
960 case GL_POLYGON_OFFSET_FACTOR
:
963 params
[0] = static_cast<GLfloat
>(polygon_offset_factor
);
966 case GL_POLYGON_OFFSET_UNITS
:
969 params
[0] = static_cast<GLfloat
>(polygon_offset_units
);
972 case GL_SAMPLE_COVERAGE_VALUE
:
975 params
[0] = static_cast<GLfloat
>(sample_coverage_value
);
978 case GL_SAMPLE_COVERAGE_INVERT
:
981 params
[0] = static_cast<GLfloat
>(sample_coverage_invert
);
987 params
[0] = static_cast<GLfloat
>(scissor_x
);
988 params
[1] = static_cast<GLfloat
>(scissor_y
);
989 params
[2] = static_cast<GLfloat
>(scissor_width
);
990 params
[3] = static_cast<GLfloat
>(scissor_height
);
993 case GL_STENCIL_FUNC
:
996 params
[0] = static_cast<GLfloat
>(stencil_front_func
);
1002 params
[0] = static_cast<GLfloat
>(stencil_front_ref
);
1005 case GL_STENCIL_VALUE_MASK
:
1008 params
[0] = static_cast<GLfloat
>(stencil_front_mask
);
1011 case GL_STENCIL_BACK_FUNC
:
1014 params
[0] = static_cast<GLfloat
>(stencil_back_func
);
1017 case GL_STENCIL_BACK_REF
:
1020 params
[0] = static_cast<GLfloat
>(stencil_back_ref
);
1023 case GL_STENCIL_BACK_VALUE_MASK
:
1026 params
[0] = static_cast<GLfloat
>(stencil_back_mask
);
1029 case GL_STENCIL_WRITEMASK
:
1032 params
[0] = static_cast<GLfloat
>(stencil_front_writemask
);
1035 case GL_STENCIL_BACK_WRITEMASK
:
1038 params
[0] = static_cast<GLfloat
>(stencil_back_writemask
);
1041 case GL_STENCIL_FAIL
:
1044 params
[0] = static_cast<GLfloat
>(stencil_front_fail_op
);
1047 case GL_STENCIL_PASS_DEPTH_FAIL
:
1050 params
[0] = static_cast<GLfloat
>(stencil_front_z_fail_op
);
1053 case GL_STENCIL_PASS_DEPTH_PASS
:
1056 params
[0] = static_cast<GLfloat
>(stencil_front_z_pass_op
);
1059 case GL_STENCIL_BACK_FAIL
:
1062 params
[0] = static_cast<GLfloat
>(stencil_back_fail_op
);
1065 case GL_STENCIL_BACK_PASS_DEPTH_FAIL
:
1068 params
[0] = static_cast<GLfloat
>(stencil_back_z_fail_op
);
1071 case GL_STENCIL_BACK_PASS_DEPTH_PASS
:
1074 params
[0] = static_cast<GLfloat
>(stencil_back_z_pass_op
);
1080 params
[0] = static_cast<GLfloat
>(viewport_x
);
1081 params
[1] = static_cast<GLfloat
>(viewport_y
);
1082 params
[2] = static_cast<GLfloat
>(viewport_width
);
1083 params
[3] = static_cast<GLfloat
>(viewport_height
);
1089 params
[0] = static_cast<GLfloat
>(enable_flags
.blend
);
1095 params
[0] = static_cast<GLfloat
>(enable_flags
.cull_face
);
1101 params
[0] = static_cast<GLfloat
>(enable_flags
.depth_test
);
1107 params
[0] = static_cast<GLfloat
>(enable_flags
.dither
);
1110 case GL_POLYGON_OFFSET_FILL
:
1113 params
[0] = static_cast<GLfloat
>(enable_flags
.polygon_offset_fill
);
1116 case GL_SAMPLE_ALPHA_TO_COVERAGE
:
1119 params
[0] = static_cast<GLfloat
>(enable_flags
.sample_alpha_to_coverage
);
1122 case GL_SAMPLE_COVERAGE
:
1125 params
[0] = static_cast<GLfloat
>(enable_flags
.sample_coverage
);
1128 case GL_SCISSOR_TEST
:
1131 params
[0] = static_cast<GLfloat
>(enable_flags
.scissor_test
);
1134 case GL_STENCIL_TEST
:
1137 params
[0] = static_cast<GLfloat
>(enable_flags
.stencil_test
);
1140 case GL_RASTERIZER_DISCARD
:
1143 params
[0] = static_cast<GLfloat
>(enable_flags
.rasterizer_discard
);
1146 case GL_PRIMITIVE_RESTART_FIXED_INDEX
:
1150 static_cast<GLfloat
>(enable_flags
.primitive_restart_fixed_index
);
1157 #endif // GPU_COMMAND_BUFFER_SERVICE_CONTEXT_STATE_IMPL_AUTOGEN_H_