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) {
38 void ContextState::Initialize() {
39 blend_color_red
= 0.0f
;
40 blend_color_green
= 0.0f
;
41 blend_color_blue
= 0.0f
;
42 blend_color_alpha
= 0.0f
;
43 blend_equation_rgb
= GL_FUNC_ADD
;
44 blend_equation_alpha
= GL_FUNC_ADD
;
45 blend_source_rgb
= GL_ONE
;
46 blend_dest_rgb
= GL_ZERO
;
47 blend_source_alpha
= GL_ONE
;
48 blend_dest_alpha
= GL_ZERO
;
49 color_clear_red
= 0.0f
;
50 color_clear_green
= 0.0f
;
51 color_clear_blue
= 0.0f
;
52 color_clear_alpha
= 0.0f
;
55 color_mask_red
= true;
56 cached_color_mask_red
= true;
57 color_mask_green
= true;
58 cached_color_mask_green
= true;
59 color_mask_blue
= true;
60 cached_color_mask_blue
= true;
61 color_mask_alpha
= true;
62 cached_color_mask_alpha
= true;
66 cached_depth_mask
= true;
70 hint_generate_mipmap
= GL_DONT_CARE
;
71 hint_fragment_shader_derivative
= GL_DONT_CARE
;
73 modelview_matrix
[0] = 1.0f
;
74 modelview_matrix
[1] = 0.0f
;
75 modelview_matrix
[2] = 0.0f
;
76 modelview_matrix
[3] = 0.0f
;
77 modelview_matrix
[4] = 0.0f
;
78 modelview_matrix
[5] = 1.0f
;
79 modelview_matrix
[6] = 0.0f
;
80 modelview_matrix
[7] = 0.0f
;
81 modelview_matrix
[8] = 0.0f
;
82 modelview_matrix
[9] = 0.0f
;
83 modelview_matrix
[10] = 1.0f
;
84 modelview_matrix
[11] = 0.0f
;
85 modelview_matrix
[12] = 0.0f
;
86 modelview_matrix
[13] = 0.0f
;
87 modelview_matrix
[14] = 0.0f
;
88 modelview_matrix
[15] = 1.0f
;
89 projection_matrix
[0] = 1.0f
;
90 projection_matrix
[1] = 0.0f
;
91 projection_matrix
[2] = 0.0f
;
92 projection_matrix
[3] = 0.0f
;
93 projection_matrix
[4] = 0.0f
;
94 projection_matrix
[5] = 1.0f
;
95 projection_matrix
[6] = 0.0f
;
96 projection_matrix
[7] = 0.0f
;
97 projection_matrix
[8] = 0.0f
;
98 projection_matrix
[9] = 0.0f
;
99 projection_matrix
[10] = 1.0f
;
100 projection_matrix
[11] = 0.0f
;
101 projection_matrix
[12] = 0.0f
;
102 projection_matrix
[13] = 0.0f
;
103 projection_matrix
[14] = 0.0f
;
104 projection_matrix
[15] = 1.0f
;
106 unpack_alignment
= 4;
107 polygon_offset_factor
= 0.0f
;
108 polygon_offset_units
= 0.0f
;
109 sample_coverage_value
= 1.0f
;
110 sample_coverage_invert
= false;
115 stencil_front_func
= GL_ALWAYS
;
116 stencil_front_ref
= 0;
117 stencil_front_mask
= 0xFFFFFFFFU
;
118 stencil_back_func
= GL_ALWAYS
;
119 stencil_back_ref
= 0;
120 stencil_back_mask
= 0xFFFFFFFFU
;
121 stencil_front_writemask
= 0xFFFFFFFFU
;
122 cached_stencil_front_writemask
= 0xFFFFFFFFU
;
123 stencil_back_writemask
= 0xFFFFFFFFU
;
124 cached_stencil_back_writemask
= 0xFFFFFFFFU
;
125 stencil_front_fail_op
= GL_KEEP
;
126 stencil_front_z_fail_op
= GL_KEEP
;
127 stencil_front_z_pass_op
= GL_KEEP
;
128 stencil_back_fail_op
= GL_KEEP
;
129 stencil_back_z_fail_op
= GL_KEEP
;
130 stencil_back_z_pass_op
= GL_KEEP
;
137 void ContextState::InitCapabilities(const ContextState
* prev_state
) const {
139 if (prev_state
->enable_flags
.cached_blend
!= enable_flags
.cached_blend
) {
140 EnableDisable(GL_BLEND
, enable_flags
.cached_blend
);
142 if (prev_state
->enable_flags
.cached_cull_face
!=
143 enable_flags
.cached_cull_face
) {
144 EnableDisable(GL_CULL_FACE
, enable_flags
.cached_cull_face
);
146 if (prev_state
->enable_flags
.cached_depth_test
!=
147 enable_flags
.cached_depth_test
) {
148 EnableDisable(GL_DEPTH_TEST
, enable_flags
.cached_depth_test
);
150 if (prev_state
->enable_flags
.cached_dither
!= enable_flags
.cached_dither
) {
151 EnableDisable(GL_DITHER
, enable_flags
.cached_dither
);
153 if (prev_state
->enable_flags
.cached_polygon_offset_fill
!=
154 enable_flags
.cached_polygon_offset_fill
) {
155 EnableDisable(GL_POLYGON_OFFSET_FILL
,
156 enable_flags
.cached_polygon_offset_fill
);
158 if (prev_state
->enable_flags
.cached_sample_alpha_to_coverage
!=
159 enable_flags
.cached_sample_alpha_to_coverage
) {
160 EnableDisable(GL_SAMPLE_ALPHA_TO_COVERAGE
,
161 enable_flags
.cached_sample_alpha_to_coverage
);
163 if (prev_state
->enable_flags
.cached_sample_coverage
!=
164 enable_flags
.cached_sample_coverage
) {
165 EnableDisable(GL_SAMPLE_COVERAGE
, enable_flags
.cached_sample_coverage
);
167 if (prev_state
->enable_flags
.cached_scissor_test
!=
168 enable_flags
.cached_scissor_test
) {
169 EnableDisable(GL_SCISSOR_TEST
, enable_flags
.cached_scissor_test
);
171 if (prev_state
->enable_flags
.cached_stencil_test
!=
172 enable_flags
.cached_stencil_test
) {
173 EnableDisable(GL_STENCIL_TEST
, enable_flags
.cached_stencil_test
);
175 if (feature_info_
->IsES3Capable()) {
176 if (prev_state
->enable_flags
.cached_rasterizer_discard
!=
177 enable_flags
.cached_rasterizer_discard
) {
178 EnableDisable(GL_RASTERIZER_DISCARD
,
179 enable_flags
.cached_rasterizer_discard
);
183 EnableDisable(GL_BLEND
, enable_flags
.cached_blend
);
184 EnableDisable(GL_CULL_FACE
, enable_flags
.cached_cull_face
);
185 EnableDisable(GL_DEPTH_TEST
, enable_flags
.cached_depth_test
);
186 EnableDisable(GL_DITHER
, enable_flags
.cached_dither
);
187 EnableDisable(GL_POLYGON_OFFSET_FILL
,
188 enable_flags
.cached_polygon_offset_fill
);
189 EnableDisable(GL_SAMPLE_ALPHA_TO_COVERAGE
,
190 enable_flags
.cached_sample_alpha_to_coverage
);
191 EnableDisable(GL_SAMPLE_COVERAGE
, enable_flags
.cached_sample_coverage
);
192 EnableDisable(GL_SCISSOR_TEST
, enable_flags
.cached_scissor_test
);
193 EnableDisable(GL_STENCIL_TEST
, enable_flags
.cached_stencil_test
);
194 if (feature_info_
->IsES3Capable()) {
195 EnableDisable(GL_RASTERIZER_DISCARD
,
196 enable_flags
.cached_rasterizer_discard
);
201 void ContextState::InitState(const ContextState
* prev_state
) const {
203 if ((blend_color_red
!= prev_state
->blend_color_red
) ||
204 (blend_color_green
!= prev_state
->blend_color_green
) ||
205 (blend_color_blue
!= prev_state
->blend_color_blue
) ||
206 (blend_color_alpha
!= prev_state
->blend_color_alpha
))
207 glBlendColor(blend_color_red
, blend_color_green
, blend_color_blue
,
209 if ((blend_equation_rgb
!= prev_state
->blend_equation_rgb
) ||
210 (blend_equation_alpha
!= prev_state
->blend_equation_alpha
))
211 glBlendEquationSeparate(blend_equation_rgb
, blend_equation_alpha
);
212 if ((blend_source_rgb
!= prev_state
->blend_source_rgb
) ||
213 (blend_dest_rgb
!= prev_state
->blend_dest_rgb
) ||
214 (blend_source_alpha
!= prev_state
->blend_source_alpha
) ||
215 (blend_dest_alpha
!= prev_state
->blend_dest_alpha
))
216 glBlendFuncSeparate(blend_source_rgb
, blend_dest_rgb
, blend_source_alpha
,
218 if ((color_clear_red
!= prev_state
->color_clear_red
) ||
219 (color_clear_green
!= prev_state
->color_clear_green
) ||
220 (color_clear_blue
!= prev_state
->color_clear_blue
) ||
221 (color_clear_alpha
!= prev_state
->color_clear_alpha
))
222 glClearColor(color_clear_red
, color_clear_green
, color_clear_blue
,
224 if ((depth_clear
!= prev_state
->depth_clear
))
225 glClearDepth(depth_clear
);
226 if ((stencil_clear
!= prev_state
->stencil_clear
))
227 glClearStencil(stencil_clear
);
228 if ((cached_color_mask_red
!= prev_state
->cached_color_mask_red
) ||
229 (cached_color_mask_green
!= prev_state
->cached_color_mask_green
) ||
230 (cached_color_mask_blue
!= prev_state
->cached_color_mask_blue
) ||
231 (cached_color_mask_alpha
!= prev_state
->cached_color_mask_alpha
))
232 glColorMask(cached_color_mask_red
, cached_color_mask_green
,
233 cached_color_mask_blue
, cached_color_mask_alpha
);
234 if ((cull_mode
!= prev_state
->cull_mode
))
235 glCullFace(cull_mode
);
236 if ((depth_func
!= prev_state
->depth_func
))
237 glDepthFunc(depth_func
);
238 if ((cached_depth_mask
!= prev_state
->cached_depth_mask
))
239 glDepthMask(cached_depth_mask
);
240 if ((z_near
!= prev_state
->z_near
) || (z_far
!= prev_state
->z_far
))
241 glDepthRange(z_near
, z_far
);
242 if ((front_face
!= prev_state
->front_face
))
243 glFrontFace(front_face
);
244 if (prev_state
->hint_generate_mipmap
!= hint_generate_mipmap
) {
245 if (!feature_info_
->gl_version_info().is_desktop_core_profile
) {
246 glHint(GL_GENERATE_MIPMAP_HINT
, hint_generate_mipmap
);
249 if (feature_info_
->feature_flags().oes_standard_derivatives
) {
250 if (prev_state
->hint_fragment_shader_derivative
!=
251 hint_fragment_shader_derivative
) {
252 glHint(GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES
,
253 hint_fragment_shader_derivative
);
256 if ((line_width
!= prev_state
->line_width
))
257 glLineWidth(line_width
);
258 if (feature_info_
->feature_flags().chromium_path_rendering
) {
259 if (memcmp(prev_state
->modelview_matrix
, modelview_matrix
,
260 sizeof(GLfloat
) * 16)) {
261 glMatrixLoadfEXT(GL_PATH_MODELVIEW_CHROMIUM
, modelview_matrix
);
264 if (feature_info_
->feature_flags().chromium_path_rendering
) {
265 if (memcmp(prev_state
->projection_matrix
, projection_matrix
,
266 sizeof(GLfloat
) * 16)) {
267 glMatrixLoadfEXT(GL_PATH_PROJECTION_CHROMIUM
, projection_matrix
);
270 if (prev_state
->pack_alignment
!= pack_alignment
) {
271 glPixelStorei(GL_PACK_ALIGNMENT
, pack_alignment
);
273 if (prev_state
->unpack_alignment
!= unpack_alignment
) {
274 glPixelStorei(GL_UNPACK_ALIGNMENT
, unpack_alignment
);
276 if ((polygon_offset_factor
!= prev_state
->polygon_offset_factor
) ||
277 (polygon_offset_units
!= prev_state
->polygon_offset_units
))
278 glPolygonOffset(polygon_offset_factor
, polygon_offset_units
);
279 if ((sample_coverage_value
!= prev_state
->sample_coverage_value
) ||
280 (sample_coverage_invert
!= prev_state
->sample_coverage_invert
))
281 glSampleCoverage(sample_coverage_value
, sample_coverage_invert
);
282 if ((scissor_x
!= prev_state
->scissor_x
) ||
283 (scissor_y
!= prev_state
->scissor_y
) ||
284 (scissor_width
!= prev_state
->scissor_width
) ||
285 (scissor_height
!= prev_state
->scissor_height
))
286 glScissor(scissor_x
, scissor_y
, scissor_width
, scissor_height
);
287 if ((stencil_front_func
!= prev_state
->stencil_front_func
) ||
288 (stencil_front_ref
!= prev_state
->stencil_front_ref
) ||
289 (stencil_front_mask
!= prev_state
->stencil_front_mask
))
290 glStencilFuncSeparate(GL_FRONT
, stencil_front_func
, stencil_front_ref
,
292 if ((stencil_back_func
!= prev_state
->stencil_back_func
) ||
293 (stencil_back_ref
!= prev_state
->stencil_back_ref
) ||
294 (stencil_back_mask
!= prev_state
->stencil_back_mask
))
295 glStencilFuncSeparate(GL_BACK
, stencil_back_func
, stencil_back_ref
,
297 if ((cached_stencil_front_writemask
!=
298 prev_state
->cached_stencil_front_writemask
))
299 glStencilMaskSeparate(GL_FRONT
, cached_stencil_front_writemask
);
300 if ((cached_stencil_back_writemask
!=
301 prev_state
->cached_stencil_back_writemask
))
302 glStencilMaskSeparate(GL_BACK
, cached_stencil_back_writemask
);
303 if ((stencil_front_fail_op
!= prev_state
->stencil_front_fail_op
) ||
304 (stencil_front_z_fail_op
!= prev_state
->stencil_front_z_fail_op
) ||
305 (stencil_front_z_pass_op
!= prev_state
->stencil_front_z_pass_op
))
306 glStencilOpSeparate(GL_FRONT
, stencil_front_fail_op
,
307 stencil_front_z_fail_op
, stencil_front_z_pass_op
);
308 if ((stencil_back_fail_op
!= prev_state
->stencil_back_fail_op
) ||
309 (stencil_back_z_fail_op
!= prev_state
->stencil_back_z_fail_op
) ||
310 (stencil_back_z_pass_op
!= prev_state
->stencil_back_z_pass_op
))
311 glStencilOpSeparate(GL_BACK
, stencil_back_fail_op
, stencil_back_z_fail_op
,
312 stencil_back_z_pass_op
);
313 if ((viewport_x
!= prev_state
->viewport_x
) ||
314 (viewport_y
!= prev_state
->viewport_y
) ||
315 (viewport_width
!= prev_state
->viewport_width
) ||
316 (viewport_height
!= prev_state
->viewport_height
))
317 glViewport(viewport_x
, viewport_y
, viewport_width
, viewport_height
);
319 glBlendColor(blend_color_red
, blend_color_green
, blend_color_blue
,
321 glBlendEquationSeparate(blend_equation_rgb
, blend_equation_alpha
);
322 glBlendFuncSeparate(blend_source_rgb
, blend_dest_rgb
, blend_source_alpha
,
324 glClearColor(color_clear_red
, color_clear_green
, color_clear_blue
,
326 glClearDepth(depth_clear
);
327 glClearStencil(stencil_clear
);
328 glColorMask(cached_color_mask_red
, cached_color_mask_green
,
329 cached_color_mask_blue
, cached_color_mask_alpha
);
330 glCullFace(cull_mode
);
331 glDepthFunc(depth_func
);
332 glDepthMask(cached_depth_mask
);
333 glDepthRange(z_near
, z_far
);
334 glFrontFace(front_face
);
335 if (!feature_info_
->gl_version_info().is_desktop_core_profile
) {
336 glHint(GL_GENERATE_MIPMAP_HINT
, hint_generate_mipmap
);
338 if (feature_info_
->feature_flags().oes_standard_derivatives
) {
339 glHint(GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES
,
340 hint_fragment_shader_derivative
);
342 glLineWidth(line_width
);
343 if (feature_info_
->feature_flags().chromium_path_rendering
) {
344 glMatrixLoadfEXT(GL_PATH_MODELVIEW_CHROMIUM
, modelview_matrix
);
346 if (feature_info_
->feature_flags().chromium_path_rendering
) {
347 glMatrixLoadfEXT(GL_PATH_PROJECTION_CHROMIUM
, projection_matrix
);
349 glPixelStorei(GL_PACK_ALIGNMENT
, pack_alignment
);
350 glPixelStorei(GL_UNPACK_ALIGNMENT
, unpack_alignment
);
351 glPolygonOffset(polygon_offset_factor
, polygon_offset_units
);
352 glSampleCoverage(sample_coverage_value
, sample_coverage_invert
);
353 glScissor(scissor_x
, scissor_y
, scissor_width
, scissor_height
);
354 glStencilFuncSeparate(GL_FRONT
, stencil_front_func
, stencil_front_ref
,
356 glStencilFuncSeparate(GL_BACK
, stencil_back_func
, stencil_back_ref
,
358 glStencilMaskSeparate(GL_FRONT
, cached_stencil_front_writemask
);
359 glStencilMaskSeparate(GL_BACK
, cached_stencil_back_writemask
);
360 glStencilOpSeparate(GL_FRONT
, stencil_front_fail_op
,
361 stencil_front_z_fail_op
, stencil_front_z_pass_op
);
362 glStencilOpSeparate(GL_BACK
, stencil_back_fail_op
, stencil_back_z_fail_op
,
363 stencil_back_z_pass_op
);
364 glViewport(viewport_x
, viewport_y
, viewport_width
, viewport_height
);
367 bool ContextState::GetEnabled(GLenum cap
) const {
370 return enable_flags
.blend
;
372 return enable_flags
.cull_face
;
374 return enable_flags
.depth_test
;
376 return enable_flags
.dither
;
377 case GL_POLYGON_OFFSET_FILL
:
378 return enable_flags
.polygon_offset_fill
;
379 case GL_SAMPLE_ALPHA_TO_COVERAGE
:
380 return enable_flags
.sample_alpha_to_coverage
;
381 case GL_SAMPLE_COVERAGE
:
382 return enable_flags
.sample_coverage
;
383 case GL_SCISSOR_TEST
:
384 return enable_flags
.scissor_test
;
385 case GL_STENCIL_TEST
:
386 return enable_flags
.stencil_test
;
387 case GL_RASTERIZER_DISCARD
:
388 return enable_flags
.rasterizer_discard
;
395 bool ContextState::GetStateAsGLint(GLenum pname
,
397 GLsizei
* num_written
) const {
402 params
[0] = static_cast<GLint
>(blend_color_red
);
403 params
[1] = static_cast<GLint
>(blend_color_green
);
404 params
[2] = static_cast<GLint
>(blend_color_blue
);
405 params
[3] = static_cast<GLint
>(blend_color_alpha
);
408 case GL_BLEND_EQUATION_RGB
:
411 params
[0] = static_cast<GLint
>(blend_equation_rgb
);
414 case GL_BLEND_EQUATION_ALPHA
:
417 params
[0] = static_cast<GLint
>(blend_equation_alpha
);
420 case GL_BLEND_SRC_RGB
:
423 params
[0] = static_cast<GLint
>(blend_source_rgb
);
426 case GL_BLEND_DST_RGB
:
429 params
[0] = static_cast<GLint
>(blend_dest_rgb
);
432 case GL_BLEND_SRC_ALPHA
:
435 params
[0] = static_cast<GLint
>(blend_source_alpha
);
438 case GL_BLEND_DST_ALPHA
:
441 params
[0] = static_cast<GLint
>(blend_dest_alpha
);
444 case GL_COLOR_CLEAR_VALUE
:
447 params
[0] = static_cast<GLint
>(color_clear_red
);
448 params
[1] = static_cast<GLint
>(color_clear_green
);
449 params
[2] = static_cast<GLint
>(color_clear_blue
);
450 params
[3] = static_cast<GLint
>(color_clear_alpha
);
453 case GL_DEPTH_CLEAR_VALUE
:
456 params
[0] = static_cast<GLint
>(depth_clear
);
459 case GL_STENCIL_CLEAR_VALUE
:
462 params
[0] = static_cast<GLint
>(stencil_clear
);
465 case GL_COLOR_WRITEMASK
:
468 params
[0] = static_cast<GLint
>(color_mask_red
);
469 params
[1] = static_cast<GLint
>(color_mask_green
);
470 params
[2] = static_cast<GLint
>(color_mask_blue
);
471 params
[3] = static_cast<GLint
>(color_mask_alpha
);
474 case GL_CULL_FACE_MODE
:
477 params
[0] = static_cast<GLint
>(cull_mode
);
483 params
[0] = static_cast<GLint
>(depth_func
);
486 case GL_DEPTH_WRITEMASK
:
489 params
[0] = static_cast<GLint
>(depth_mask
);
495 params
[0] = static_cast<GLint
>(z_near
);
496 params
[1] = static_cast<GLint
>(z_far
);
502 params
[0] = static_cast<GLint
>(front_face
);
505 case GL_GENERATE_MIPMAP_HINT
:
508 params
[0] = static_cast<GLint
>(hint_generate_mipmap
);
511 case GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES
:
514 params
[0] = static_cast<GLint
>(hint_fragment_shader_derivative
);
520 params
[0] = static_cast<GLint
>(line_width
);
523 case GL_PATH_MODELVIEW_MATRIX_CHROMIUM
:
526 for (size_t i
= 0; i
< 16; ++i
) {
527 params
[i
] = static_cast<GLint
>(round(modelview_matrix
[i
]));
531 case GL_PATH_PROJECTION_MATRIX_CHROMIUM
:
534 for (size_t i
= 0; i
< 16; ++i
) {
535 params
[i
] = static_cast<GLint
>(round(projection_matrix
[i
]));
539 case GL_PACK_ALIGNMENT
:
542 params
[0] = static_cast<GLint
>(pack_alignment
);
545 case GL_UNPACK_ALIGNMENT
:
548 params
[0] = static_cast<GLint
>(unpack_alignment
);
551 case GL_POLYGON_OFFSET_FACTOR
:
554 params
[0] = static_cast<GLint
>(round(polygon_offset_factor
));
557 case GL_POLYGON_OFFSET_UNITS
:
560 params
[0] = static_cast<GLint
>(round(polygon_offset_units
));
563 case GL_SAMPLE_COVERAGE_VALUE
:
566 params
[0] = static_cast<GLint
>(sample_coverage_value
);
569 case GL_SAMPLE_COVERAGE_INVERT
:
572 params
[0] = static_cast<GLint
>(sample_coverage_invert
);
578 params
[0] = static_cast<GLint
>(scissor_x
);
579 params
[1] = static_cast<GLint
>(scissor_y
);
580 params
[2] = static_cast<GLint
>(scissor_width
);
581 params
[3] = static_cast<GLint
>(scissor_height
);
584 case GL_STENCIL_FUNC
:
587 params
[0] = static_cast<GLint
>(stencil_front_func
);
593 params
[0] = static_cast<GLint
>(stencil_front_ref
);
596 case GL_STENCIL_VALUE_MASK
:
599 params
[0] = static_cast<GLint
>(stencil_front_mask
);
602 case GL_STENCIL_BACK_FUNC
:
605 params
[0] = static_cast<GLint
>(stencil_back_func
);
608 case GL_STENCIL_BACK_REF
:
611 params
[0] = static_cast<GLint
>(stencil_back_ref
);
614 case GL_STENCIL_BACK_VALUE_MASK
:
617 params
[0] = static_cast<GLint
>(stencil_back_mask
);
620 case GL_STENCIL_WRITEMASK
:
623 params
[0] = static_cast<GLint
>(stencil_front_writemask
);
626 case GL_STENCIL_BACK_WRITEMASK
:
629 params
[0] = static_cast<GLint
>(stencil_back_writemask
);
632 case GL_STENCIL_FAIL
:
635 params
[0] = static_cast<GLint
>(stencil_front_fail_op
);
638 case GL_STENCIL_PASS_DEPTH_FAIL
:
641 params
[0] = static_cast<GLint
>(stencil_front_z_fail_op
);
644 case GL_STENCIL_PASS_DEPTH_PASS
:
647 params
[0] = static_cast<GLint
>(stencil_front_z_pass_op
);
650 case GL_STENCIL_BACK_FAIL
:
653 params
[0] = static_cast<GLint
>(stencil_back_fail_op
);
656 case GL_STENCIL_BACK_PASS_DEPTH_FAIL
:
659 params
[0] = static_cast<GLint
>(stencil_back_z_fail_op
);
662 case GL_STENCIL_BACK_PASS_DEPTH_PASS
:
665 params
[0] = static_cast<GLint
>(stencil_back_z_pass_op
);
671 params
[0] = static_cast<GLint
>(viewport_x
);
672 params
[1] = static_cast<GLint
>(viewport_y
);
673 params
[2] = static_cast<GLint
>(viewport_width
);
674 params
[3] = static_cast<GLint
>(viewport_height
);
680 params
[0] = static_cast<GLint
>(enable_flags
.blend
);
686 params
[0] = static_cast<GLint
>(enable_flags
.cull_face
);
692 params
[0] = static_cast<GLint
>(enable_flags
.depth_test
);
698 params
[0] = static_cast<GLint
>(enable_flags
.dither
);
701 case GL_POLYGON_OFFSET_FILL
:
704 params
[0] = static_cast<GLint
>(enable_flags
.polygon_offset_fill
);
707 case GL_SAMPLE_ALPHA_TO_COVERAGE
:
710 params
[0] = static_cast<GLint
>(enable_flags
.sample_alpha_to_coverage
);
713 case GL_SAMPLE_COVERAGE
:
716 params
[0] = static_cast<GLint
>(enable_flags
.sample_coverage
);
719 case GL_SCISSOR_TEST
:
722 params
[0] = static_cast<GLint
>(enable_flags
.scissor_test
);
725 case GL_STENCIL_TEST
:
728 params
[0] = static_cast<GLint
>(enable_flags
.stencil_test
);
731 case GL_RASTERIZER_DISCARD
:
734 params
[0] = static_cast<GLint
>(enable_flags
.rasterizer_discard
);
742 bool ContextState::GetStateAsGLfloat(GLenum pname
,
744 GLsizei
* num_written
) const {
749 params
[0] = static_cast<GLfloat
>(blend_color_red
);
750 params
[1] = static_cast<GLfloat
>(blend_color_green
);
751 params
[2] = static_cast<GLfloat
>(blend_color_blue
);
752 params
[3] = static_cast<GLfloat
>(blend_color_alpha
);
755 case GL_BLEND_EQUATION_RGB
:
758 params
[0] = static_cast<GLfloat
>(blend_equation_rgb
);
761 case GL_BLEND_EQUATION_ALPHA
:
764 params
[0] = static_cast<GLfloat
>(blend_equation_alpha
);
767 case GL_BLEND_SRC_RGB
:
770 params
[0] = static_cast<GLfloat
>(blend_source_rgb
);
773 case GL_BLEND_DST_RGB
:
776 params
[0] = static_cast<GLfloat
>(blend_dest_rgb
);
779 case GL_BLEND_SRC_ALPHA
:
782 params
[0] = static_cast<GLfloat
>(blend_source_alpha
);
785 case GL_BLEND_DST_ALPHA
:
788 params
[0] = static_cast<GLfloat
>(blend_dest_alpha
);
791 case GL_COLOR_CLEAR_VALUE
:
794 params
[0] = static_cast<GLfloat
>(color_clear_red
);
795 params
[1] = static_cast<GLfloat
>(color_clear_green
);
796 params
[2] = static_cast<GLfloat
>(color_clear_blue
);
797 params
[3] = static_cast<GLfloat
>(color_clear_alpha
);
800 case GL_DEPTH_CLEAR_VALUE
:
803 params
[0] = static_cast<GLfloat
>(depth_clear
);
806 case GL_STENCIL_CLEAR_VALUE
:
809 params
[0] = static_cast<GLfloat
>(stencil_clear
);
812 case GL_COLOR_WRITEMASK
:
815 params
[0] = static_cast<GLfloat
>(color_mask_red
);
816 params
[1] = static_cast<GLfloat
>(color_mask_green
);
817 params
[2] = static_cast<GLfloat
>(color_mask_blue
);
818 params
[3] = static_cast<GLfloat
>(color_mask_alpha
);
821 case GL_CULL_FACE_MODE
:
824 params
[0] = static_cast<GLfloat
>(cull_mode
);
830 params
[0] = static_cast<GLfloat
>(depth_func
);
833 case GL_DEPTH_WRITEMASK
:
836 params
[0] = static_cast<GLfloat
>(depth_mask
);
842 params
[0] = static_cast<GLfloat
>(z_near
);
843 params
[1] = static_cast<GLfloat
>(z_far
);
849 params
[0] = static_cast<GLfloat
>(front_face
);
852 case GL_GENERATE_MIPMAP_HINT
:
855 params
[0] = static_cast<GLfloat
>(hint_generate_mipmap
);
858 case GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES
:
861 params
[0] = static_cast<GLfloat
>(hint_fragment_shader_derivative
);
867 params
[0] = static_cast<GLfloat
>(line_width
);
870 case GL_PATH_MODELVIEW_MATRIX_CHROMIUM
:
873 memcpy(params
, modelview_matrix
, sizeof(GLfloat
) * 16);
876 case GL_PATH_PROJECTION_MATRIX_CHROMIUM
:
879 memcpy(params
, projection_matrix
, sizeof(GLfloat
) * 16);
882 case GL_PACK_ALIGNMENT
:
885 params
[0] = static_cast<GLfloat
>(pack_alignment
);
888 case GL_UNPACK_ALIGNMENT
:
891 params
[0] = static_cast<GLfloat
>(unpack_alignment
);
894 case GL_POLYGON_OFFSET_FACTOR
:
897 params
[0] = static_cast<GLfloat
>(polygon_offset_factor
);
900 case GL_POLYGON_OFFSET_UNITS
:
903 params
[0] = static_cast<GLfloat
>(polygon_offset_units
);
906 case GL_SAMPLE_COVERAGE_VALUE
:
909 params
[0] = static_cast<GLfloat
>(sample_coverage_value
);
912 case GL_SAMPLE_COVERAGE_INVERT
:
915 params
[0] = static_cast<GLfloat
>(sample_coverage_invert
);
921 params
[0] = static_cast<GLfloat
>(scissor_x
);
922 params
[1] = static_cast<GLfloat
>(scissor_y
);
923 params
[2] = static_cast<GLfloat
>(scissor_width
);
924 params
[3] = static_cast<GLfloat
>(scissor_height
);
927 case GL_STENCIL_FUNC
:
930 params
[0] = static_cast<GLfloat
>(stencil_front_func
);
936 params
[0] = static_cast<GLfloat
>(stencil_front_ref
);
939 case GL_STENCIL_VALUE_MASK
:
942 params
[0] = static_cast<GLfloat
>(stencil_front_mask
);
945 case GL_STENCIL_BACK_FUNC
:
948 params
[0] = static_cast<GLfloat
>(stencil_back_func
);
951 case GL_STENCIL_BACK_REF
:
954 params
[0] = static_cast<GLfloat
>(stencil_back_ref
);
957 case GL_STENCIL_BACK_VALUE_MASK
:
960 params
[0] = static_cast<GLfloat
>(stencil_back_mask
);
963 case GL_STENCIL_WRITEMASK
:
966 params
[0] = static_cast<GLfloat
>(stencil_front_writemask
);
969 case GL_STENCIL_BACK_WRITEMASK
:
972 params
[0] = static_cast<GLfloat
>(stencil_back_writemask
);
975 case GL_STENCIL_FAIL
:
978 params
[0] = static_cast<GLfloat
>(stencil_front_fail_op
);
981 case GL_STENCIL_PASS_DEPTH_FAIL
:
984 params
[0] = static_cast<GLfloat
>(stencil_front_z_fail_op
);
987 case GL_STENCIL_PASS_DEPTH_PASS
:
990 params
[0] = static_cast<GLfloat
>(stencil_front_z_pass_op
);
993 case GL_STENCIL_BACK_FAIL
:
996 params
[0] = static_cast<GLfloat
>(stencil_back_fail_op
);
999 case GL_STENCIL_BACK_PASS_DEPTH_FAIL
:
1002 params
[0] = static_cast<GLfloat
>(stencil_back_z_fail_op
);
1005 case GL_STENCIL_BACK_PASS_DEPTH_PASS
:
1008 params
[0] = static_cast<GLfloat
>(stencil_back_z_pass_op
);
1014 params
[0] = static_cast<GLfloat
>(viewport_x
);
1015 params
[1] = static_cast<GLfloat
>(viewport_y
);
1016 params
[2] = static_cast<GLfloat
>(viewport_width
);
1017 params
[3] = static_cast<GLfloat
>(viewport_height
);
1023 params
[0] = static_cast<GLfloat
>(enable_flags
.blend
);
1029 params
[0] = static_cast<GLfloat
>(enable_flags
.cull_face
);
1035 params
[0] = static_cast<GLfloat
>(enable_flags
.depth_test
);
1041 params
[0] = static_cast<GLfloat
>(enable_flags
.dither
);
1044 case GL_POLYGON_OFFSET_FILL
:
1047 params
[0] = static_cast<GLfloat
>(enable_flags
.polygon_offset_fill
);
1050 case GL_SAMPLE_ALPHA_TO_COVERAGE
:
1053 params
[0] = static_cast<GLfloat
>(enable_flags
.sample_alpha_to_coverage
);
1056 case GL_SAMPLE_COVERAGE
:
1059 params
[0] = static_cast<GLfloat
>(enable_flags
.sample_coverage
);
1062 case GL_SCISSOR_TEST
:
1065 params
[0] = static_cast<GLfloat
>(enable_flags
.scissor_test
);
1068 case GL_STENCIL_TEST
:
1071 params
[0] = static_cast<GLfloat
>(enable_flags
.stencil_test
);
1074 case GL_RASTERIZER_DISCARD
:
1077 params
[0] = static_cast<GLfloat
>(enable_flags
.rasterizer_discard
);
1084 #endif // GPU_COMMAND_BUFFER_SERVICE_CONTEXT_STATE_IMPL_AUTOGEN_H_