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) {}
39 void ContextState::Initialize() {
40 blend_color_red
= 0.0f
;
41 blend_color_green
= 0.0f
;
42 blend_color_blue
= 0.0f
;
43 blend_color_alpha
= 0.0f
;
44 blend_equation_rgb
= GL_FUNC_ADD
;
45 blend_equation_alpha
= GL_FUNC_ADD
;
46 blend_source_rgb
= GL_ONE
;
47 blend_dest_rgb
= GL_ZERO
;
48 blend_source_alpha
= GL_ONE
;
49 blend_dest_alpha
= GL_ZERO
;
50 color_clear_red
= 0.0f
;
51 color_clear_green
= 0.0f
;
52 color_clear_blue
= 0.0f
;
53 color_clear_alpha
= 0.0f
;
56 color_mask_red
= true;
57 cached_color_mask_red
= true;
58 color_mask_green
= true;
59 cached_color_mask_green
= true;
60 color_mask_blue
= true;
61 cached_color_mask_blue
= true;
62 color_mask_alpha
= true;
63 cached_color_mask_alpha
= true;
67 cached_depth_mask
= true;
71 hint_generate_mipmap
= GL_DONT_CARE
;
72 hint_fragment_shader_derivative
= GL_DONT_CARE
;
74 modelview_matrix
[0] = 1.0f
;
75 modelview_matrix
[1] = 0.0f
;
76 modelview_matrix
[2] = 0.0f
;
77 modelview_matrix
[3] = 0.0f
;
78 modelview_matrix
[4] = 0.0f
;
79 modelview_matrix
[5] = 1.0f
;
80 modelview_matrix
[6] = 0.0f
;
81 modelview_matrix
[7] = 0.0f
;
82 modelview_matrix
[8] = 0.0f
;
83 modelview_matrix
[9] = 0.0f
;
84 modelview_matrix
[10] = 1.0f
;
85 modelview_matrix
[11] = 0.0f
;
86 modelview_matrix
[12] = 0.0f
;
87 modelview_matrix
[13] = 0.0f
;
88 modelview_matrix
[14] = 0.0f
;
89 modelview_matrix
[15] = 1.0f
;
90 projection_matrix
[0] = 1.0f
;
91 projection_matrix
[1] = 0.0f
;
92 projection_matrix
[2] = 0.0f
;
93 projection_matrix
[3] = 0.0f
;
94 projection_matrix
[4] = 0.0f
;
95 projection_matrix
[5] = 1.0f
;
96 projection_matrix
[6] = 0.0f
;
97 projection_matrix
[7] = 0.0f
;
98 projection_matrix
[8] = 0.0f
;
99 projection_matrix
[9] = 0.0f
;
100 projection_matrix
[10] = 1.0f
;
101 projection_matrix
[11] = 0.0f
;
102 projection_matrix
[12] = 0.0f
;
103 projection_matrix
[13] = 0.0f
;
104 projection_matrix
[14] = 0.0f
;
105 projection_matrix
[15] = 1.0f
;
106 stencil_path_func
= GL_ALWAYS
;
107 stencil_path_ref
= 0;
108 stencil_path_mask
= 0xFFFFFFFFU
;
110 unpack_alignment
= 4;
111 polygon_offset_factor
= 0.0f
;
112 polygon_offset_units
= 0.0f
;
113 sample_coverage_value
= 1.0f
;
114 sample_coverage_invert
= false;
119 stencil_front_func
= GL_ALWAYS
;
120 stencil_front_ref
= 0;
121 stencil_front_mask
= 0xFFFFFFFFU
;
122 stencil_back_func
= GL_ALWAYS
;
123 stencil_back_ref
= 0;
124 stencil_back_mask
= 0xFFFFFFFFU
;
125 stencil_front_writemask
= 0xFFFFFFFFU
;
126 cached_stencil_front_writemask
= 0xFFFFFFFFU
;
127 stencil_back_writemask
= 0xFFFFFFFFU
;
128 cached_stencil_back_writemask
= 0xFFFFFFFFU
;
129 stencil_front_fail_op
= GL_KEEP
;
130 stencil_front_z_fail_op
= GL_KEEP
;
131 stencil_front_z_pass_op
= GL_KEEP
;
132 stencil_back_fail_op
= GL_KEEP
;
133 stencil_back_z_fail_op
= GL_KEEP
;
134 stencil_back_z_pass_op
= GL_KEEP
;
141 void ContextState::InitCapabilities(const ContextState
* prev_state
) const {
143 if (prev_state
->enable_flags
.cached_blend
!= enable_flags
.cached_blend
) {
144 EnableDisable(GL_BLEND
, enable_flags
.cached_blend
);
146 if (prev_state
->enable_flags
.cached_cull_face
!=
147 enable_flags
.cached_cull_face
) {
148 EnableDisable(GL_CULL_FACE
, enable_flags
.cached_cull_face
);
150 if (prev_state
->enable_flags
.cached_depth_test
!=
151 enable_flags
.cached_depth_test
) {
152 EnableDisable(GL_DEPTH_TEST
, enable_flags
.cached_depth_test
);
154 if (prev_state
->enable_flags
.cached_dither
!= enable_flags
.cached_dither
) {
155 EnableDisable(GL_DITHER
, enable_flags
.cached_dither
);
157 if (prev_state
->enable_flags
.cached_polygon_offset_fill
!=
158 enable_flags
.cached_polygon_offset_fill
) {
159 EnableDisable(GL_POLYGON_OFFSET_FILL
,
160 enable_flags
.cached_polygon_offset_fill
);
162 if (prev_state
->enable_flags
.cached_sample_alpha_to_coverage
!=
163 enable_flags
.cached_sample_alpha_to_coverage
) {
164 EnableDisable(GL_SAMPLE_ALPHA_TO_COVERAGE
,
165 enable_flags
.cached_sample_alpha_to_coverage
);
167 if (prev_state
->enable_flags
.cached_sample_coverage
!=
168 enable_flags
.cached_sample_coverage
) {
169 EnableDisable(GL_SAMPLE_COVERAGE
, enable_flags
.cached_sample_coverage
);
171 if (prev_state
->enable_flags
.cached_scissor_test
!=
172 enable_flags
.cached_scissor_test
) {
173 EnableDisable(GL_SCISSOR_TEST
, enable_flags
.cached_scissor_test
);
175 if (prev_state
->enable_flags
.cached_stencil_test
!=
176 enable_flags
.cached_stencil_test
) {
177 EnableDisable(GL_STENCIL_TEST
, enable_flags
.cached_stencil_test
);
179 if (feature_info_
->IsES3Capable()) {
180 if (prev_state
->enable_flags
.cached_rasterizer_discard
!=
181 enable_flags
.cached_rasterizer_discard
) {
182 EnableDisable(GL_RASTERIZER_DISCARD
,
183 enable_flags
.cached_rasterizer_discard
);
185 if (prev_state
->enable_flags
.cached_primitive_restart_fixed_index
!=
186 enable_flags
.cached_primitive_restart_fixed_index
) {
187 EnableDisable(GL_PRIMITIVE_RESTART_FIXED_INDEX
,
188 enable_flags
.cached_primitive_restart_fixed_index
);
192 EnableDisable(GL_BLEND
, enable_flags
.cached_blend
);
193 EnableDisable(GL_CULL_FACE
, enable_flags
.cached_cull_face
);
194 EnableDisable(GL_DEPTH_TEST
, enable_flags
.cached_depth_test
);
195 EnableDisable(GL_DITHER
, enable_flags
.cached_dither
);
196 EnableDisable(GL_POLYGON_OFFSET_FILL
,
197 enable_flags
.cached_polygon_offset_fill
);
198 EnableDisable(GL_SAMPLE_ALPHA_TO_COVERAGE
,
199 enable_flags
.cached_sample_alpha_to_coverage
);
200 EnableDisable(GL_SAMPLE_COVERAGE
, enable_flags
.cached_sample_coverage
);
201 EnableDisable(GL_SCISSOR_TEST
, enable_flags
.cached_scissor_test
);
202 EnableDisable(GL_STENCIL_TEST
, enable_flags
.cached_stencil_test
);
203 if (feature_info_
->IsES3Capable()) {
204 EnableDisable(GL_RASTERIZER_DISCARD
,
205 enable_flags
.cached_rasterizer_discard
);
206 EnableDisable(GL_PRIMITIVE_RESTART_FIXED_INDEX
,
207 enable_flags
.cached_primitive_restart_fixed_index
);
212 void ContextState::InitState(const ContextState
* prev_state
) const {
214 if ((blend_color_red
!= prev_state
->blend_color_red
) ||
215 (blend_color_green
!= prev_state
->blend_color_green
) ||
216 (blend_color_blue
!= prev_state
->blend_color_blue
) ||
217 (blend_color_alpha
!= prev_state
->blend_color_alpha
))
218 glBlendColor(blend_color_red
, blend_color_green
, blend_color_blue
,
220 if ((blend_equation_rgb
!= prev_state
->blend_equation_rgb
) ||
221 (blend_equation_alpha
!= prev_state
->blend_equation_alpha
))
222 glBlendEquationSeparate(blend_equation_rgb
, blend_equation_alpha
);
223 if ((blend_source_rgb
!= prev_state
->blend_source_rgb
) ||
224 (blend_dest_rgb
!= prev_state
->blend_dest_rgb
) ||
225 (blend_source_alpha
!= prev_state
->blend_source_alpha
) ||
226 (blend_dest_alpha
!= prev_state
->blend_dest_alpha
))
227 glBlendFuncSeparate(blend_source_rgb
, blend_dest_rgb
, blend_source_alpha
,
229 if ((color_clear_red
!= prev_state
->color_clear_red
) ||
230 (color_clear_green
!= prev_state
->color_clear_green
) ||
231 (color_clear_blue
!= prev_state
->color_clear_blue
) ||
232 (color_clear_alpha
!= prev_state
->color_clear_alpha
))
233 glClearColor(color_clear_red
, color_clear_green
, color_clear_blue
,
235 if ((depth_clear
!= prev_state
->depth_clear
))
236 glClearDepth(depth_clear
);
237 if ((stencil_clear
!= prev_state
->stencil_clear
))
238 glClearStencil(stencil_clear
);
239 if ((cached_color_mask_red
!= prev_state
->cached_color_mask_red
) ||
240 (cached_color_mask_green
!= prev_state
->cached_color_mask_green
) ||
241 (cached_color_mask_blue
!= prev_state
->cached_color_mask_blue
) ||
242 (cached_color_mask_alpha
!= prev_state
->cached_color_mask_alpha
))
243 glColorMask(cached_color_mask_red
, cached_color_mask_green
,
244 cached_color_mask_blue
, cached_color_mask_alpha
);
245 if ((cull_mode
!= prev_state
->cull_mode
))
246 glCullFace(cull_mode
);
247 if ((depth_func
!= prev_state
->depth_func
))
248 glDepthFunc(depth_func
);
249 if ((cached_depth_mask
!= prev_state
->cached_depth_mask
))
250 glDepthMask(cached_depth_mask
);
251 if ((z_near
!= prev_state
->z_near
) || (z_far
!= prev_state
->z_far
))
252 glDepthRange(z_near
, z_far
);
253 if ((front_face
!= prev_state
->front_face
))
254 glFrontFace(front_face
);
255 if (prev_state
->hint_generate_mipmap
!= hint_generate_mipmap
) {
256 if (!feature_info_
->gl_version_info().is_desktop_core_profile
) {
257 glHint(GL_GENERATE_MIPMAP_HINT
, hint_generate_mipmap
);
260 if (feature_info_
->feature_flags().oes_standard_derivatives
) {
261 if (prev_state
->hint_fragment_shader_derivative
!=
262 hint_fragment_shader_derivative
) {
263 glHint(GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES
,
264 hint_fragment_shader_derivative
);
267 if ((line_width
!= prev_state
->line_width
))
268 glLineWidth(line_width
);
269 if (feature_info_
->feature_flags().chromium_path_rendering
) {
270 if (memcmp(prev_state
->modelview_matrix
, modelview_matrix
,
271 sizeof(GLfloat
) * 16)) {
272 glMatrixLoadfEXT(GL_PATH_MODELVIEW_CHROMIUM
, modelview_matrix
);
275 if (feature_info_
->feature_flags().chromium_path_rendering
) {
276 if (memcmp(prev_state
->projection_matrix
, projection_matrix
,
277 sizeof(GLfloat
) * 16)) {
278 glMatrixLoadfEXT(GL_PATH_PROJECTION_CHROMIUM
, projection_matrix
);
281 if (feature_info_
->feature_flags().chromium_path_rendering
)
282 if ((stencil_path_func
!= prev_state
->stencil_path_func
) ||
283 (stencil_path_ref
!= prev_state
->stencil_path_ref
) ||
284 (stencil_path_mask
!= prev_state
->stencil_path_mask
))
285 glPathStencilFuncNV(stencil_path_func
, stencil_path_ref
,
287 if (prev_state
->pack_alignment
!= pack_alignment
) {
288 glPixelStorei(GL_PACK_ALIGNMENT
, pack_alignment
);
290 if (prev_state
->unpack_alignment
!= unpack_alignment
) {
291 glPixelStorei(GL_UNPACK_ALIGNMENT
, unpack_alignment
);
293 if ((polygon_offset_factor
!= prev_state
->polygon_offset_factor
) ||
294 (polygon_offset_units
!= prev_state
->polygon_offset_units
))
295 glPolygonOffset(polygon_offset_factor
, polygon_offset_units
);
296 if ((sample_coverage_value
!= prev_state
->sample_coverage_value
) ||
297 (sample_coverage_invert
!= prev_state
->sample_coverage_invert
))
298 glSampleCoverage(sample_coverage_value
, sample_coverage_invert
);
299 if ((scissor_x
!= prev_state
->scissor_x
) ||
300 (scissor_y
!= prev_state
->scissor_y
) ||
301 (scissor_width
!= prev_state
->scissor_width
) ||
302 (scissor_height
!= prev_state
->scissor_height
))
303 glScissor(scissor_x
, scissor_y
, scissor_width
, scissor_height
);
304 if ((stencil_front_func
!= prev_state
->stencil_front_func
) ||
305 (stencil_front_ref
!= prev_state
->stencil_front_ref
) ||
306 (stencil_front_mask
!= prev_state
->stencil_front_mask
))
307 glStencilFuncSeparate(GL_FRONT
, stencil_front_func
, stencil_front_ref
,
309 if ((stencil_back_func
!= prev_state
->stencil_back_func
) ||
310 (stencil_back_ref
!= prev_state
->stencil_back_ref
) ||
311 (stencil_back_mask
!= prev_state
->stencil_back_mask
))
312 glStencilFuncSeparate(GL_BACK
, stencil_back_func
, stencil_back_ref
,
314 if ((cached_stencil_front_writemask
!=
315 prev_state
->cached_stencil_front_writemask
))
316 glStencilMaskSeparate(GL_FRONT
, cached_stencil_front_writemask
);
317 if ((cached_stencil_back_writemask
!=
318 prev_state
->cached_stencil_back_writemask
))
319 glStencilMaskSeparate(GL_BACK
, cached_stencil_back_writemask
);
320 if ((stencil_front_fail_op
!= prev_state
->stencil_front_fail_op
) ||
321 (stencil_front_z_fail_op
!= prev_state
->stencil_front_z_fail_op
) ||
322 (stencil_front_z_pass_op
!= prev_state
->stencil_front_z_pass_op
))
323 glStencilOpSeparate(GL_FRONT
, stencil_front_fail_op
,
324 stencil_front_z_fail_op
, stencil_front_z_pass_op
);
325 if ((stencil_back_fail_op
!= prev_state
->stencil_back_fail_op
) ||
326 (stencil_back_z_fail_op
!= prev_state
->stencil_back_z_fail_op
) ||
327 (stencil_back_z_pass_op
!= prev_state
->stencil_back_z_pass_op
))
328 glStencilOpSeparate(GL_BACK
, stencil_back_fail_op
, stencil_back_z_fail_op
,
329 stencil_back_z_pass_op
);
330 if ((viewport_x
!= prev_state
->viewport_x
) ||
331 (viewport_y
!= prev_state
->viewport_y
) ||
332 (viewport_width
!= prev_state
->viewport_width
) ||
333 (viewport_height
!= prev_state
->viewport_height
))
334 glViewport(viewport_x
, viewport_y
, viewport_width
, viewport_height
);
336 glBlendColor(blend_color_red
, blend_color_green
, blend_color_blue
,
338 glBlendEquationSeparate(blend_equation_rgb
, blend_equation_alpha
);
339 glBlendFuncSeparate(blend_source_rgb
, blend_dest_rgb
, blend_source_alpha
,
341 glClearColor(color_clear_red
, color_clear_green
, color_clear_blue
,
343 glClearDepth(depth_clear
);
344 glClearStencil(stencil_clear
);
345 glColorMask(cached_color_mask_red
, cached_color_mask_green
,
346 cached_color_mask_blue
, cached_color_mask_alpha
);
347 glCullFace(cull_mode
);
348 glDepthFunc(depth_func
);
349 glDepthMask(cached_depth_mask
);
350 glDepthRange(z_near
, z_far
);
351 glFrontFace(front_face
);
352 if (!feature_info_
->gl_version_info().is_desktop_core_profile
) {
353 glHint(GL_GENERATE_MIPMAP_HINT
, hint_generate_mipmap
);
355 if (feature_info_
->feature_flags().oes_standard_derivatives
) {
356 glHint(GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES
,
357 hint_fragment_shader_derivative
);
359 glLineWidth(line_width
);
360 if (feature_info_
->feature_flags().chromium_path_rendering
) {
361 glMatrixLoadfEXT(GL_PATH_MODELVIEW_CHROMIUM
, modelview_matrix
);
363 if (feature_info_
->feature_flags().chromium_path_rendering
) {
364 glMatrixLoadfEXT(GL_PATH_PROJECTION_CHROMIUM
, projection_matrix
);
366 if (feature_info_
->feature_flags().chromium_path_rendering
)
367 glPathStencilFuncNV(stencil_path_func
, stencil_path_ref
,
369 glPixelStorei(GL_PACK_ALIGNMENT
, pack_alignment
);
370 glPixelStorei(GL_UNPACK_ALIGNMENT
, unpack_alignment
);
371 glPolygonOffset(polygon_offset_factor
, polygon_offset_units
);
372 glSampleCoverage(sample_coverage_value
, sample_coverage_invert
);
373 glScissor(scissor_x
, scissor_y
, scissor_width
, scissor_height
);
374 glStencilFuncSeparate(GL_FRONT
, stencil_front_func
, stencil_front_ref
,
376 glStencilFuncSeparate(GL_BACK
, stencil_back_func
, stencil_back_ref
,
378 glStencilMaskSeparate(GL_FRONT
, cached_stencil_front_writemask
);
379 glStencilMaskSeparate(GL_BACK
, cached_stencil_back_writemask
);
380 glStencilOpSeparate(GL_FRONT
, stencil_front_fail_op
,
381 stencil_front_z_fail_op
, stencil_front_z_pass_op
);
382 glStencilOpSeparate(GL_BACK
, stencil_back_fail_op
, stencil_back_z_fail_op
,
383 stencil_back_z_pass_op
);
384 glViewport(viewport_x
, viewport_y
, viewport_width
, viewport_height
);
387 bool ContextState::GetEnabled(GLenum cap
) const {
390 return enable_flags
.blend
;
392 return enable_flags
.cull_face
;
394 return enable_flags
.depth_test
;
396 return enable_flags
.dither
;
397 case GL_POLYGON_OFFSET_FILL
:
398 return enable_flags
.polygon_offset_fill
;
399 case GL_SAMPLE_ALPHA_TO_COVERAGE
:
400 return enable_flags
.sample_alpha_to_coverage
;
401 case GL_SAMPLE_COVERAGE
:
402 return enable_flags
.sample_coverage
;
403 case GL_SCISSOR_TEST
:
404 return enable_flags
.scissor_test
;
405 case GL_STENCIL_TEST
:
406 return enable_flags
.stencil_test
;
407 case GL_RASTERIZER_DISCARD
:
408 return enable_flags
.rasterizer_discard
;
409 case GL_PRIMITIVE_RESTART_FIXED_INDEX
:
410 return enable_flags
.primitive_restart_fixed_index
;
417 bool ContextState::GetStateAsGLint(GLenum pname
,
419 GLsizei
* num_written
) const {
424 params
[0] = static_cast<GLint
>(blend_color_red
);
425 params
[1] = static_cast<GLint
>(blend_color_green
);
426 params
[2] = static_cast<GLint
>(blend_color_blue
);
427 params
[3] = static_cast<GLint
>(blend_color_alpha
);
430 case GL_BLEND_EQUATION_RGB
:
433 params
[0] = static_cast<GLint
>(blend_equation_rgb
);
436 case GL_BLEND_EQUATION_ALPHA
:
439 params
[0] = static_cast<GLint
>(blend_equation_alpha
);
442 case GL_BLEND_SRC_RGB
:
445 params
[0] = static_cast<GLint
>(blend_source_rgb
);
448 case GL_BLEND_DST_RGB
:
451 params
[0] = static_cast<GLint
>(blend_dest_rgb
);
454 case GL_BLEND_SRC_ALPHA
:
457 params
[0] = static_cast<GLint
>(blend_source_alpha
);
460 case GL_BLEND_DST_ALPHA
:
463 params
[0] = static_cast<GLint
>(blend_dest_alpha
);
466 case GL_COLOR_CLEAR_VALUE
:
469 params
[0] = static_cast<GLint
>(color_clear_red
);
470 params
[1] = static_cast<GLint
>(color_clear_green
);
471 params
[2] = static_cast<GLint
>(color_clear_blue
);
472 params
[3] = static_cast<GLint
>(color_clear_alpha
);
475 case GL_DEPTH_CLEAR_VALUE
:
478 params
[0] = static_cast<GLint
>(depth_clear
);
481 case GL_STENCIL_CLEAR_VALUE
:
484 params
[0] = static_cast<GLint
>(stencil_clear
);
487 case GL_COLOR_WRITEMASK
:
490 params
[0] = static_cast<GLint
>(color_mask_red
);
491 params
[1] = static_cast<GLint
>(color_mask_green
);
492 params
[2] = static_cast<GLint
>(color_mask_blue
);
493 params
[3] = static_cast<GLint
>(color_mask_alpha
);
496 case GL_CULL_FACE_MODE
:
499 params
[0] = static_cast<GLint
>(cull_mode
);
505 params
[0] = static_cast<GLint
>(depth_func
);
508 case GL_DEPTH_WRITEMASK
:
511 params
[0] = static_cast<GLint
>(depth_mask
);
517 params
[0] = static_cast<GLint
>(z_near
);
518 params
[1] = static_cast<GLint
>(z_far
);
524 params
[0] = static_cast<GLint
>(front_face
);
527 case GL_GENERATE_MIPMAP_HINT
:
530 params
[0] = static_cast<GLint
>(hint_generate_mipmap
);
533 case GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES
:
536 params
[0] = static_cast<GLint
>(hint_fragment_shader_derivative
);
542 params
[0] = static_cast<GLint
>(line_width
);
545 case GL_PATH_MODELVIEW_MATRIX_CHROMIUM
:
548 for (size_t i
= 0; i
< 16; ++i
) {
549 params
[i
] = static_cast<GLint
>(round(modelview_matrix
[i
]));
553 case GL_PATH_PROJECTION_MATRIX_CHROMIUM
:
556 for (size_t i
= 0; i
< 16; ++i
) {
557 params
[i
] = static_cast<GLint
>(round(projection_matrix
[i
]));
561 case GL_PATH_STENCIL_FUNC_CHROMIUM
:
564 params
[0] = static_cast<GLint
>(stencil_path_func
);
567 case GL_PATH_STENCIL_REF_CHROMIUM
:
570 params
[0] = static_cast<GLint
>(stencil_path_ref
);
573 case GL_PATH_STENCIL_VALUE_MASK_CHROMIUM
:
576 params
[0] = static_cast<GLint
>(stencil_path_mask
);
579 case GL_PACK_ALIGNMENT
:
582 params
[0] = static_cast<GLint
>(pack_alignment
);
585 case GL_UNPACK_ALIGNMENT
:
588 params
[0] = static_cast<GLint
>(unpack_alignment
);
591 case GL_POLYGON_OFFSET_FACTOR
:
594 params
[0] = static_cast<GLint
>(round(polygon_offset_factor
));
597 case GL_POLYGON_OFFSET_UNITS
:
600 params
[0] = static_cast<GLint
>(round(polygon_offset_units
));
603 case GL_SAMPLE_COVERAGE_VALUE
:
606 params
[0] = static_cast<GLint
>(sample_coverage_value
);
609 case GL_SAMPLE_COVERAGE_INVERT
:
612 params
[0] = static_cast<GLint
>(sample_coverage_invert
);
618 params
[0] = static_cast<GLint
>(scissor_x
);
619 params
[1] = static_cast<GLint
>(scissor_y
);
620 params
[2] = static_cast<GLint
>(scissor_width
);
621 params
[3] = static_cast<GLint
>(scissor_height
);
624 case GL_STENCIL_FUNC
:
627 params
[0] = static_cast<GLint
>(stencil_front_func
);
633 params
[0] = static_cast<GLint
>(stencil_front_ref
);
636 case GL_STENCIL_VALUE_MASK
:
639 params
[0] = static_cast<GLint
>(stencil_front_mask
);
642 case GL_STENCIL_BACK_FUNC
:
645 params
[0] = static_cast<GLint
>(stencil_back_func
);
648 case GL_STENCIL_BACK_REF
:
651 params
[0] = static_cast<GLint
>(stencil_back_ref
);
654 case GL_STENCIL_BACK_VALUE_MASK
:
657 params
[0] = static_cast<GLint
>(stencil_back_mask
);
660 case GL_STENCIL_WRITEMASK
:
663 params
[0] = static_cast<GLint
>(stencil_front_writemask
);
666 case GL_STENCIL_BACK_WRITEMASK
:
669 params
[0] = static_cast<GLint
>(stencil_back_writemask
);
672 case GL_STENCIL_FAIL
:
675 params
[0] = static_cast<GLint
>(stencil_front_fail_op
);
678 case GL_STENCIL_PASS_DEPTH_FAIL
:
681 params
[0] = static_cast<GLint
>(stencil_front_z_fail_op
);
684 case GL_STENCIL_PASS_DEPTH_PASS
:
687 params
[0] = static_cast<GLint
>(stencil_front_z_pass_op
);
690 case GL_STENCIL_BACK_FAIL
:
693 params
[0] = static_cast<GLint
>(stencil_back_fail_op
);
696 case GL_STENCIL_BACK_PASS_DEPTH_FAIL
:
699 params
[0] = static_cast<GLint
>(stencil_back_z_fail_op
);
702 case GL_STENCIL_BACK_PASS_DEPTH_PASS
:
705 params
[0] = static_cast<GLint
>(stencil_back_z_pass_op
);
711 params
[0] = static_cast<GLint
>(viewport_x
);
712 params
[1] = static_cast<GLint
>(viewport_y
);
713 params
[2] = static_cast<GLint
>(viewport_width
);
714 params
[3] = static_cast<GLint
>(viewport_height
);
720 params
[0] = static_cast<GLint
>(enable_flags
.blend
);
726 params
[0] = static_cast<GLint
>(enable_flags
.cull_face
);
732 params
[0] = static_cast<GLint
>(enable_flags
.depth_test
);
738 params
[0] = static_cast<GLint
>(enable_flags
.dither
);
741 case GL_POLYGON_OFFSET_FILL
:
744 params
[0] = static_cast<GLint
>(enable_flags
.polygon_offset_fill
);
747 case GL_SAMPLE_ALPHA_TO_COVERAGE
:
750 params
[0] = static_cast<GLint
>(enable_flags
.sample_alpha_to_coverage
);
753 case GL_SAMPLE_COVERAGE
:
756 params
[0] = static_cast<GLint
>(enable_flags
.sample_coverage
);
759 case GL_SCISSOR_TEST
:
762 params
[0] = static_cast<GLint
>(enable_flags
.scissor_test
);
765 case GL_STENCIL_TEST
:
768 params
[0] = static_cast<GLint
>(enable_flags
.stencil_test
);
771 case GL_RASTERIZER_DISCARD
:
774 params
[0] = static_cast<GLint
>(enable_flags
.rasterizer_discard
);
777 case GL_PRIMITIVE_RESTART_FIXED_INDEX
:
781 static_cast<GLint
>(enable_flags
.primitive_restart_fixed_index
);
789 bool ContextState::GetStateAsGLfloat(GLenum pname
,
791 GLsizei
* num_written
) const {
796 params
[0] = static_cast<GLfloat
>(blend_color_red
);
797 params
[1] = static_cast<GLfloat
>(blend_color_green
);
798 params
[2] = static_cast<GLfloat
>(blend_color_blue
);
799 params
[3] = static_cast<GLfloat
>(blend_color_alpha
);
802 case GL_BLEND_EQUATION_RGB
:
805 params
[0] = static_cast<GLfloat
>(blend_equation_rgb
);
808 case GL_BLEND_EQUATION_ALPHA
:
811 params
[0] = static_cast<GLfloat
>(blend_equation_alpha
);
814 case GL_BLEND_SRC_RGB
:
817 params
[0] = static_cast<GLfloat
>(blend_source_rgb
);
820 case GL_BLEND_DST_RGB
:
823 params
[0] = static_cast<GLfloat
>(blend_dest_rgb
);
826 case GL_BLEND_SRC_ALPHA
:
829 params
[0] = static_cast<GLfloat
>(blend_source_alpha
);
832 case GL_BLEND_DST_ALPHA
:
835 params
[0] = static_cast<GLfloat
>(blend_dest_alpha
);
838 case GL_COLOR_CLEAR_VALUE
:
841 params
[0] = static_cast<GLfloat
>(color_clear_red
);
842 params
[1] = static_cast<GLfloat
>(color_clear_green
);
843 params
[2] = static_cast<GLfloat
>(color_clear_blue
);
844 params
[3] = static_cast<GLfloat
>(color_clear_alpha
);
847 case GL_DEPTH_CLEAR_VALUE
:
850 params
[0] = static_cast<GLfloat
>(depth_clear
);
853 case GL_STENCIL_CLEAR_VALUE
:
856 params
[0] = static_cast<GLfloat
>(stencil_clear
);
859 case GL_COLOR_WRITEMASK
:
862 params
[0] = static_cast<GLfloat
>(color_mask_red
);
863 params
[1] = static_cast<GLfloat
>(color_mask_green
);
864 params
[2] = static_cast<GLfloat
>(color_mask_blue
);
865 params
[3] = static_cast<GLfloat
>(color_mask_alpha
);
868 case GL_CULL_FACE_MODE
:
871 params
[0] = static_cast<GLfloat
>(cull_mode
);
877 params
[0] = static_cast<GLfloat
>(depth_func
);
880 case GL_DEPTH_WRITEMASK
:
883 params
[0] = static_cast<GLfloat
>(depth_mask
);
889 params
[0] = static_cast<GLfloat
>(z_near
);
890 params
[1] = static_cast<GLfloat
>(z_far
);
896 params
[0] = static_cast<GLfloat
>(front_face
);
899 case GL_GENERATE_MIPMAP_HINT
:
902 params
[0] = static_cast<GLfloat
>(hint_generate_mipmap
);
905 case GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES
:
908 params
[0] = static_cast<GLfloat
>(hint_fragment_shader_derivative
);
914 params
[0] = static_cast<GLfloat
>(line_width
);
917 case GL_PATH_MODELVIEW_MATRIX_CHROMIUM
:
920 memcpy(params
, modelview_matrix
, sizeof(GLfloat
) * 16);
923 case GL_PATH_PROJECTION_MATRIX_CHROMIUM
:
926 memcpy(params
, projection_matrix
, sizeof(GLfloat
) * 16);
929 case GL_PATH_STENCIL_FUNC_CHROMIUM
:
932 params
[0] = static_cast<GLfloat
>(stencil_path_func
);
935 case GL_PATH_STENCIL_REF_CHROMIUM
:
938 params
[0] = static_cast<GLfloat
>(stencil_path_ref
);
941 case GL_PATH_STENCIL_VALUE_MASK_CHROMIUM
:
944 params
[0] = static_cast<GLfloat
>(stencil_path_mask
);
947 case GL_PACK_ALIGNMENT
:
950 params
[0] = static_cast<GLfloat
>(pack_alignment
);
953 case GL_UNPACK_ALIGNMENT
:
956 params
[0] = static_cast<GLfloat
>(unpack_alignment
);
959 case GL_POLYGON_OFFSET_FACTOR
:
962 params
[0] = static_cast<GLfloat
>(polygon_offset_factor
);
965 case GL_POLYGON_OFFSET_UNITS
:
968 params
[0] = static_cast<GLfloat
>(polygon_offset_units
);
971 case GL_SAMPLE_COVERAGE_VALUE
:
974 params
[0] = static_cast<GLfloat
>(sample_coverage_value
);
977 case GL_SAMPLE_COVERAGE_INVERT
:
980 params
[0] = static_cast<GLfloat
>(sample_coverage_invert
);
986 params
[0] = static_cast<GLfloat
>(scissor_x
);
987 params
[1] = static_cast<GLfloat
>(scissor_y
);
988 params
[2] = static_cast<GLfloat
>(scissor_width
);
989 params
[3] = static_cast<GLfloat
>(scissor_height
);
992 case GL_STENCIL_FUNC
:
995 params
[0] = static_cast<GLfloat
>(stencil_front_func
);
1001 params
[0] = static_cast<GLfloat
>(stencil_front_ref
);
1004 case GL_STENCIL_VALUE_MASK
:
1007 params
[0] = static_cast<GLfloat
>(stencil_front_mask
);
1010 case GL_STENCIL_BACK_FUNC
:
1013 params
[0] = static_cast<GLfloat
>(stencil_back_func
);
1016 case GL_STENCIL_BACK_REF
:
1019 params
[0] = static_cast<GLfloat
>(stencil_back_ref
);
1022 case GL_STENCIL_BACK_VALUE_MASK
:
1025 params
[0] = static_cast<GLfloat
>(stencil_back_mask
);
1028 case GL_STENCIL_WRITEMASK
:
1031 params
[0] = static_cast<GLfloat
>(stencil_front_writemask
);
1034 case GL_STENCIL_BACK_WRITEMASK
:
1037 params
[0] = static_cast<GLfloat
>(stencil_back_writemask
);
1040 case GL_STENCIL_FAIL
:
1043 params
[0] = static_cast<GLfloat
>(stencil_front_fail_op
);
1046 case GL_STENCIL_PASS_DEPTH_FAIL
:
1049 params
[0] = static_cast<GLfloat
>(stencil_front_z_fail_op
);
1052 case GL_STENCIL_PASS_DEPTH_PASS
:
1055 params
[0] = static_cast<GLfloat
>(stencil_front_z_pass_op
);
1058 case GL_STENCIL_BACK_FAIL
:
1061 params
[0] = static_cast<GLfloat
>(stencil_back_fail_op
);
1064 case GL_STENCIL_BACK_PASS_DEPTH_FAIL
:
1067 params
[0] = static_cast<GLfloat
>(stencil_back_z_fail_op
);
1070 case GL_STENCIL_BACK_PASS_DEPTH_PASS
:
1073 params
[0] = static_cast<GLfloat
>(stencil_back_z_pass_op
);
1079 params
[0] = static_cast<GLfloat
>(viewport_x
);
1080 params
[1] = static_cast<GLfloat
>(viewport_y
);
1081 params
[2] = static_cast<GLfloat
>(viewport_width
);
1082 params
[3] = static_cast<GLfloat
>(viewport_height
);
1088 params
[0] = static_cast<GLfloat
>(enable_flags
.blend
);
1094 params
[0] = static_cast<GLfloat
>(enable_flags
.cull_face
);
1100 params
[0] = static_cast<GLfloat
>(enable_flags
.depth_test
);
1106 params
[0] = static_cast<GLfloat
>(enable_flags
.dither
);
1109 case GL_POLYGON_OFFSET_FILL
:
1112 params
[0] = static_cast<GLfloat
>(enable_flags
.polygon_offset_fill
);
1115 case GL_SAMPLE_ALPHA_TO_COVERAGE
:
1118 params
[0] = static_cast<GLfloat
>(enable_flags
.sample_alpha_to_coverage
);
1121 case GL_SAMPLE_COVERAGE
:
1124 params
[0] = static_cast<GLfloat
>(enable_flags
.sample_coverage
);
1127 case GL_SCISSOR_TEST
:
1130 params
[0] = static_cast<GLfloat
>(enable_flags
.scissor_test
);
1133 case GL_STENCIL_TEST
:
1136 params
[0] = static_cast<GLfloat
>(enable_flags
.stencil_test
);
1139 case GL_RASTERIZER_DISCARD
:
1142 params
[0] = static_cast<GLfloat
>(enable_flags
.rasterizer_discard
);
1145 case GL_PRIMITIVE_RESTART_FIXED_INDEX
:
1149 static_cast<GLfloat
>(enable_flags
.primitive_restart_fixed_index
);
1156 #endif // GPU_COMMAND_BUFFER_SERVICE_CONTEXT_STATE_IMPL_AUTOGEN_H_