Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(172)

Side by Side Diff: gpu/command_buffer/service/context_state_impl_autogen.h

Issue 11363191: Cache more GL state both service and client side. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // This file is auto-generated from 5 // This file is auto-generated from
6 // gpu/command_buffer/build_gles2_cmd_buffer.py 6 // gpu/command_buffer/build_gles2_cmd_buffer.py
7 // DO NOT EDIT! 7 // DO NOT EDIT!
8 8
9 // It is included by context_state.cc 9 // It is included by context_state.cc
10 #ifndef GPU_COMMAND_BUFFER_SERVICE_CONTEXT_STATE_IMPL_AUTOGEN_H_ 10 #ifndef GPU_COMMAND_BUFFER_SERVICE_CONTEXT_STATE_IMPL_AUTOGEN_H_
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 glStencilMaskSeparate(GL_FRONT, stencil_front_writemask); 119 glStencilMaskSeparate(GL_FRONT, stencil_front_writemask);
120 glStencilMaskSeparate(GL_BACK, stencil_back_writemask); 120 glStencilMaskSeparate(GL_BACK, stencil_back_writemask);
121 glStencilOpSeparate( 121 glStencilOpSeparate(
122 GL_FRONT, stencil_front_fail_op, stencil_front_z_fail_op, 122 GL_FRONT, stencil_front_fail_op, stencil_front_z_fail_op,
123 stencil_front_z_pass_op); 123 stencil_front_z_pass_op);
124 glStencilOpSeparate( 124 glStencilOpSeparate(
125 GL_BACK, stencil_back_fail_op, stencil_back_z_fail_op, 125 GL_BACK, stencil_back_fail_op, stencil_back_z_fail_op,
126 stencil_back_z_pass_op); 126 stencil_back_z_pass_op);
127 glViewport(viewport_x, viewport_y, viewport_width, viewport_height); 127 glViewport(viewport_x, viewport_y, viewport_width, viewport_height);
128 } 128 }
129 bool ContextState::GetEnabled(GLenum cap) const {
130 switch (cap) {
131 case GL_BLEND:
132 return enable_flags.blend;
133 case GL_CULL_FACE:
134 return enable_flags.cull_face;
135 case GL_DEPTH_TEST:
136 return enable_flags.depth_test;
137 case GL_DITHER:
138 return enable_flags.dither;
139 case GL_POLYGON_OFFSET_FILL:
140 return enable_flags.polygon_offset_fill;
141 case GL_SAMPLE_ALPHA_TO_COVERAGE:
142 return enable_flags.sample_alpha_to_coverage;
143 case GL_SAMPLE_COVERAGE:
144 return enable_flags.sample_coverage;
145 case GL_SCISSOR_TEST:
146 return enable_flags.scissor_test;
147 case GL_STENCIL_TEST:
148 return enable_flags.stencil_test;
149 default:
150 GPU_NOTREACHED();
151 return false;
152 }
153 }
154
155 bool ContextState::GetStateAsGLint(
156 GLenum pname, GLint* params, GLsizei* num_written) const {
157 switch (pname) {
158 case GL_VIEWPORT:
159 *num_written = 4;
160 if (params) {
161 params[0] = static_cast<GLint>(viewport_x);
162 params[1] = static_cast<GLint>(viewport_y);
163 params[2] = static_cast<GLint>(viewport_width);
164 params[3] = static_cast<GLint>(viewport_height);
165 }
166 return true;
167 case GL_BLEND_SRC_RGB:
168 *num_written = 1;
169 if (params) {
170 params[0] = static_cast<GLint>(blend_source_rgb);
171 }
172 return true;
173 case GL_BLEND_DST_RGB:
174 *num_written = 1;
175 if (params) {
176 params[0] = static_cast<GLint>(blend_dest_rgb);
177 }
178 return true;
179 case GL_BLEND_SRC_ALPHA:
180 *num_written = 1;
181 if (params) {
182 params[0] = static_cast<GLint>(blend_source_alpha);
183 }
184 return true;
185 case GL_BLEND_DST_ALPHA:
186 *num_written = 1;
187 if (params) {
188 params[0] = static_cast<GLint>(blend_dest_alpha);
189 }
190 return true;
191 case GL_LINE_WIDTH:
192 *num_written = 1;
193 if (params) {
194 params[0] = static_cast<GLint>(line_width);
195 }
196 return true;
197 case GL_BLEND_COLOR:
198 *num_written = 4;
199 if (params) {
200 params[0] = static_cast<GLint>(blend_color_red);
201 params[1] = static_cast<GLint>(blend_color_green);
202 params[2] = static_cast<GLint>(blend_color_blue);
203 params[3] = static_cast<GLint>(blend_color_alpha);
204 }
205 return true;
206 case GL_STENCIL_CLEAR_VALUE:
207 *num_written = 1;
208 if (params) {
209 params[0] = static_cast<GLint>(stencil_clear);
210 }
211 return true;
212 case GL_COLOR_WRITEMASK:
213 *num_written = 4;
214 if (params) {
215 params[0] = static_cast<GLint>(color_mask_red);
216 params[1] = static_cast<GLint>(color_mask_green);
217 params[2] = static_cast<GLint>(color_mask_blue);
218 params[3] = static_cast<GLint>(color_mask_alpha);
219 }
220 return true;
221 case GL_COLOR_CLEAR_VALUE:
222 *num_written = 4;
223 if (params) {
224 params[0] = static_cast<GLint>(color_clear_red);
225 params[1] = static_cast<GLint>(color_clear_green);
226 params[2] = static_cast<GLint>(color_clear_blue);
227 params[3] = static_cast<GLint>(color_clear_alpha);
228 }
229 return true;
230 case GL_DEPTH_RANGE:
231 *num_written = 2;
232 if (params) {
233 params[0] = static_cast<GLint>(z_near);
234 params[1] = static_cast<GLint>(z_far);
235 }
236 return true;
237 case GL_DEPTH_CLEAR_VALUE:
238 *num_written = 1;
239 if (params) {
240 params[0] = static_cast<GLint>(depth_clear);
241 }
242 return true;
243 case GL_STENCIL_FAIL:
244 *num_written = 1;
245 if (params) {
246 params[0] = static_cast<GLint>(stencil_front_fail_op);
247 }
248 return true;
249 case GL_STENCIL_PASS_DEPTH_FAIL:
250 *num_written = 1;
251 if (params) {
252 params[0] = static_cast<GLint>(stencil_front_z_fail_op);
253 }
254 return true;
255 case GL_STENCIL_PASS_DEPTH_PASS:
256 *num_written = 1;
257 if (params) {
258 params[0] = static_cast<GLint>(stencil_front_z_pass_op);
259 }
260 return true;
261 case GL_STENCIL_BACK_FAIL:
262 *num_written = 1;
263 if (params) {
264 params[0] = static_cast<GLint>(stencil_back_fail_op);
265 }
266 return true;
267 case GL_STENCIL_BACK_PASS_DEPTH_FAIL:
268 *num_written = 1;
269 if (params) {
270 params[0] = static_cast<GLint>(stencil_back_z_fail_op);
271 }
272 return true;
273 case GL_STENCIL_BACK_PASS_DEPTH_PASS:
274 *num_written = 1;
275 if (params) {
276 params[0] = static_cast<GLint>(stencil_back_z_pass_op);
277 }
278 return true;
279 case GL_SCISSOR_BOX:
280 *num_written = 4;
281 if (params) {
282 params[0] = static_cast<GLint>(scissor_x);
283 params[1] = static_cast<GLint>(scissor_y);
284 params[2] = static_cast<GLint>(scissor_width);
285 params[3] = static_cast<GLint>(scissor_height);
286 }
287 return true;
288 case GL_FRONT_FACE:
289 *num_written = 1;
290 if (params) {
291 params[0] = static_cast<GLint>(front_face);
292 }
293 return true;
294 case GL_SAMPLE_COVERAGE_VALUE:
295 *num_written = 1;
296 if (params) {
297 params[0] = static_cast<GLint>(sample_coverage_value);
298 }
299 return true;
300 case GL_SAMPLE_COVERAGE_INVERT:
301 *num_written = 1;
302 if (params) {
303 params[0] = static_cast<GLint>(sample_coverage_invert);
304 }
305 return true;
306 case GL_POLYGON_OFFSET_FACTOR:
307 *num_written = 1;
308 if (params) {
309 params[0] = static_cast<GLint>(polygon_offset_factor);
310 }
311 return true;
312 case GL_POLYGON_OFFSET_UNITS:
313 *num_written = 1;
314 if (params) {
315 params[0] = static_cast<GLint>(polygon_offset_units);
316 }
317 return true;
318 case GL_CULL_FACE_MODE:
319 *num_written = 1;
320 if (params) {
321 params[0] = static_cast<GLint>(cull_mode);
322 }
323 return true;
324 case GL_DEPTH_FUNC:
325 *num_written = 1;
326 if (params) {
327 params[0] = static_cast<GLint>(depth_func);
328 }
329 return true;
330 case GL_STENCIL_FUNC:
331 *num_written = 1;
332 if (params) {
333 params[0] = static_cast<GLint>(stencil_front_func);
334 }
335 return true;
336 case GL_STENCIL_REF:
337 *num_written = 1;
338 if (params) {
339 params[0] = static_cast<GLint>(stencil_front_ref);
340 }
341 return true;
342 case GL_STENCIL_VALUE_MASK:
343 *num_written = 1;
344 if (params) {
345 params[0] = static_cast<GLint>(stencil_front_mask);
346 }
347 return true;
348 case GL_STENCIL_BACK_FUNC:
349 *num_written = 1;
350 if (params) {
351 params[0] = static_cast<GLint>(stencil_back_func);
352 }
353 return true;
354 case GL_STENCIL_BACK_REF:
355 *num_written = 1;
356 if (params) {
357 params[0] = static_cast<GLint>(stencil_back_ref);
358 }
359 return true;
360 case GL_STENCIL_BACK_VALUE_MASK:
361 *num_written = 1;
362 if (params) {
363 params[0] = static_cast<GLint>(stencil_back_mask);
364 }
365 return true;
366 case GL_DEPTH_WRITEMASK:
367 *num_written = 1;
368 if (params) {
369 params[0] = static_cast<GLint>(depth_mask);
370 }
371 return true;
372 case GL_BLEND_EQUATION_RGB:
373 *num_written = 1;
374 if (params) {
375 params[0] = static_cast<GLint>(blend_equation_rgb);
376 }
377 return true;
378 case GL_BLEND_EQUATION_ALPHA:
379 *num_written = 1;
380 if (params) {
381 params[0] = static_cast<GLint>(blend_equation_alpha);
382 }
383 return true;
384 case GL_STENCIL_WRITEMASK:
385 *num_written = 1;
386 if (params) {
387 params[0] = static_cast<GLint>(stencil_front_writemask);
388 }
389 return true;
390 case GL_STENCIL_BACK_WRITEMASK:
391 *num_written = 1;
392 if (params) {
393 params[0] = static_cast<GLint>(stencil_back_writemask);
394 }
395 return true;
396 case GL_BLEND:
397 *num_written = 1;
398 if (params) {
399 params[0] = static_cast<GLint>(enable_flags.blend);
400 }
401 return true;
402 case GL_CULL_FACE:
403 *num_written = 1;
404 if (params) {
405 params[0] = static_cast<GLint>(enable_flags.cull_face);
406 }
407 return true;
408 case GL_DEPTH_TEST:
409 *num_written = 1;
410 if (params) {
411 params[0] = static_cast<GLint>(enable_flags.depth_test);
412 }
413 return true;
414 case GL_DITHER:
415 *num_written = 1;
416 if (params) {
417 params[0] = static_cast<GLint>(enable_flags.dither);
418 }
419 return true;
420 case GL_POLYGON_OFFSET_FILL:
421 *num_written = 1;
422 if (params) {
423 params[0] = static_cast<GLint>(enable_flags.polygon_offset_fill);
424 }
425 return true;
426 case GL_SAMPLE_ALPHA_TO_COVERAGE:
427 *num_written = 1;
428 if (params) {
429 params[0] = static_cast<GLint>(enable_flags.sample_alpha_to_coverage);
430 }
431 return true;
432 case GL_SAMPLE_COVERAGE:
433 *num_written = 1;
434 if (params) {
435 params[0] = static_cast<GLint>(enable_flags.sample_coverage);
436 }
437 return true;
438 case GL_SCISSOR_TEST:
439 *num_written = 1;
440 if (params) {
441 params[0] = static_cast<GLint>(enable_flags.scissor_test);
442 }
443 return true;
444 case GL_STENCIL_TEST:
445 *num_written = 1;
446 if (params) {
447 params[0] = static_cast<GLint>(enable_flags.stencil_test);
448 }
449 return true;
450 default:
451 return false;
452 }
453 }
454
455 bool ContextState::GetStateAsGLfloat(
456 GLenum pname, GLfloat* params, GLsizei* num_written) const {
457 switch (pname) {
458 case GL_VIEWPORT:
459 *num_written = 4;
460 if (params) {
461 params[0] = static_cast<GLfloat>(viewport_x);
462 params[1] = static_cast<GLfloat>(viewport_y);
463 params[2] = static_cast<GLfloat>(viewport_width);
464 params[3] = static_cast<GLfloat>(viewport_height);
465 }
466 return true;
467 case GL_BLEND_SRC_RGB:
468 *num_written = 1;
469 if (params) {
470 params[0] = static_cast<GLfloat>(blend_source_rgb);
471 }
472 return true;
473 case GL_BLEND_DST_RGB:
474 *num_written = 1;
475 if (params) {
476 params[0] = static_cast<GLfloat>(blend_dest_rgb);
477 }
478 return true;
479 case GL_BLEND_SRC_ALPHA:
480 *num_written = 1;
481 if (params) {
482 params[0] = static_cast<GLfloat>(blend_source_alpha);
483 }
484 return true;
485 case GL_BLEND_DST_ALPHA:
486 *num_written = 1;
487 if (params) {
488 params[0] = static_cast<GLfloat>(blend_dest_alpha);
489 }
490 return true;
491 case GL_LINE_WIDTH:
492 *num_written = 1;
493 if (params) {
494 params[0] = static_cast<GLfloat>(line_width);
495 }
496 return true;
497 case GL_BLEND_COLOR:
498 *num_written = 4;
499 if (params) {
500 params[0] = static_cast<GLfloat>(blend_color_red);
501 params[1] = static_cast<GLfloat>(blend_color_green);
502 params[2] = static_cast<GLfloat>(blend_color_blue);
503 params[3] = static_cast<GLfloat>(blend_color_alpha);
504 }
505 return true;
506 case GL_STENCIL_CLEAR_VALUE:
507 *num_written = 1;
508 if (params) {
509 params[0] = static_cast<GLfloat>(stencil_clear);
510 }
511 return true;
512 case GL_COLOR_WRITEMASK:
513 *num_written = 4;
514 if (params) {
515 params[0] = static_cast<GLfloat>(color_mask_red);
516 params[1] = static_cast<GLfloat>(color_mask_green);
517 params[2] = static_cast<GLfloat>(color_mask_blue);
518 params[3] = static_cast<GLfloat>(color_mask_alpha);
519 }
520 return true;
521 case GL_COLOR_CLEAR_VALUE:
522 *num_written = 4;
523 if (params) {
524 params[0] = static_cast<GLfloat>(color_clear_red);
525 params[1] = static_cast<GLfloat>(color_clear_green);
526 params[2] = static_cast<GLfloat>(color_clear_blue);
527 params[3] = static_cast<GLfloat>(color_clear_alpha);
528 }
529 return true;
530 case GL_DEPTH_RANGE:
531 *num_written = 2;
532 if (params) {
533 params[0] = static_cast<GLfloat>(z_near);
534 params[1] = static_cast<GLfloat>(z_far);
535 }
536 return true;
537 case GL_DEPTH_CLEAR_VALUE:
538 *num_written = 1;
539 if (params) {
540 params[0] = static_cast<GLfloat>(depth_clear);
541 }
542 return true;
543 case GL_STENCIL_FAIL:
544 *num_written = 1;
545 if (params) {
546 params[0] = static_cast<GLfloat>(stencil_front_fail_op);
547 }
548 return true;
549 case GL_STENCIL_PASS_DEPTH_FAIL:
550 *num_written = 1;
551 if (params) {
552 params[0] = static_cast<GLfloat>(stencil_front_z_fail_op);
553 }
554 return true;
555 case GL_STENCIL_PASS_DEPTH_PASS:
556 *num_written = 1;
557 if (params) {
558 params[0] = static_cast<GLfloat>(stencil_front_z_pass_op);
559 }
560 return true;
561 case GL_STENCIL_BACK_FAIL:
562 *num_written = 1;
563 if (params) {
564 params[0] = static_cast<GLfloat>(stencil_back_fail_op);
565 }
566 return true;
567 case GL_STENCIL_BACK_PASS_DEPTH_FAIL:
568 *num_written = 1;
569 if (params) {
570 params[0] = static_cast<GLfloat>(stencil_back_z_fail_op);
571 }
572 return true;
573 case GL_STENCIL_BACK_PASS_DEPTH_PASS:
574 *num_written = 1;
575 if (params) {
576 params[0] = static_cast<GLfloat>(stencil_back_z_pass_op);
577 }
578 return true;
579 case GL_SCISSOR_BOX:
580 *num_written = 4;
581 if (params) {
582 params[0] = static_cast<GLfloat>(scissor_x);
583 params[1] = static_cast<GLfloat>(scissor_y);
584 params[2] = static_cast<GLfloat>(scissor_width);
585 params[3] = static_cast<GLfloat>(scissor_height);
586 }
587 return true;
588 case GL_FRONT_FACE:
589 *num_written = 1;
590 if (params) {
591 params[0] = static_cast<GLfloat>(front_face);
592 }
593 return true;
594 case GL_SAMPLE_COVERAGE_VALUE:
595 *num_written = 1;
596 if (params) {
597 params[0] = static_cast<GLfloat>(sample_coverage_value);
598 }
599 return true;
600 case GL_SAMPLE_COVERAGE_INVERT:
601 *num_written = 1;
602 if (params) {
603 params[0] = static_cast<GLfloat>(sample_coverage_invert);
604 }
605 return true;
606 case GL_POLYGON_OFFSET_FACTOR:
607 *num_written = 1;
608 if (params) {
609 params[0] = static_cast<GLfloat>(polygon_offset_factor);
610 }
611 return true;
612 case GL_POLYGON_OFFSET_UNITS:
613 *num_written = 1;
614 if (params) {
615 params[0] = static_cast<GLfloat>(polygon_offset_units);
616 }
617 return true;
618 case GL_CULL_FACE_MODE:
619 *num_written = 1;
620 if (params) {
621 params[0] = static_cast<GLfloat>(cull_mode);
622 }
623 return true;
624 case GL_DEPTH_FUNC:
625 *num_written = 1;
626 if (params) {
627 params[0] = static_cast<GLfloat>(depth_func);
628 }
629 return true;
630 case GL_STENCIL_FUNC:
631 *num_written = 1;
632 if (params) {
633 params[0] = static_cast<GLfloat>(stencil_front_func);
634 }
635 return true;
636 case GL_STENCIL_REF:
637 *num_written = 1;
638 if (params) {
639 params[0] = static_cast<GLfloat>(stencil_front_ref);
640 }
641 return true;
642 case GL_STENCIL_VALUE_MASK:
643 *num_written = 1;
644 if (params) {
645 params[0] = static_cast<GLfloat>(stencil_front_mask);
646 }
647 return true;
648 case GL_STENCIL_BACK_FUNC:
649 *num_written = 1;
650 if (params) {
651 params[0] = static_cast<GLfloat>(stencil_back_func);
652 }
653 return true;
654 case GL_STENCIL_BACK_REF:
655 *num_written = 1;
656 if (params) {
657 params[0] = static_cast<GLfloat>(stencil_back_ref);
658 }
659 return true;
660 case GL_STENCIL_BACK_VALUE_MASK:
661 *num_written = 1;
662 if (params) {
663 params[0] = static_cast<GLfloat>(stencil_back_mask);
664 }
665 return true;
666 case GL_DEPTH_WRITEMASK:
667 *num_written = 1;
668 if (params) {
669 params[0] = static_cast<GLfloat>(depth_mask);
670 }
671 return true;
672 case GL_BLEND_EQUATION_RGB:
673 *num_written = 1;
674 if (params) {
675 params[0] = static_cast<GLfloat>(blend_equation_rgb);
676 }
677 return true;
678 case GL_BLEND_EQUATION_ALPHA:
679 *num_written = 1;
680 if (params) {
681 params[0] = static_cast<GLfloat>(blend_equation_alpha);
682 }
683 return true;
684 case GL_STENCIL_WRITEMASK:
685 *num_written = 1;
686 if (params) {
687 params[0] = static_cast<GLfloat>(stencil_front_writemask);
688 }
689 return true;
690 case GL_STENCIL_BACK_WRITEMASK:
691 *num_written = 1;
692 if (params) {
693 params[0] = static_cast<GLfloat>(stencil_back_writemask);
694 }
695 return true;
696 case GL_BLEND:
697 *num_written = 1;
698 if (params) {
699 params[0] = static_cast<GLfloat>(enable_flags.blend);
700 }
701 return true;
702 case GL_CULL_FACE:
703 *num_written = 1;
704 if (params) {
705 params[0] = static_cast<GLfloat>(enable_flags.cull_face);
706 }
707 return true;
708 case GL_DEPTH_TEST:
709 *num_written = 1;
710 if (params) {
711 params[0] = static_cast<GLfloat>(enable_flags.depth_test);
712 }
713 return true;
714 case GL_DITHER:
715 *num_written = 1;
716 if (params) {
717 params[0] = static_cast<GLfloat>(enable_flags.dither);
718 }
719 return true;
720 case GL_POLYGON_OFFSET_FILL:
721 *num_written = 1;
722 if (params) {
723 params[0] = static_cast<GLfloat>(enable_flags.polygon_offset_fill);
724 }
725 return true;
726 case GL_SAMPLE_ALPHA_TO_COVERAGE:
727 *num_written = 1;
728 if (params) {
729 params[0] =
730 static_cast<GLfloat>(enable_flags.sample_alpha_to_coverage);
731 }
732 return true;
733 case GL_SAMPLE_COVERAGE:
734 *num_written = 1;
735 if (params) {
736 params[0] = static_cast<GLfloat>(enable_flags.sample_coverage);
737 }
738 return true;
739 case GL_SCISSOR_TEST:
740 *num_written = 1;
741 if (params) {
742 params[0] = static_cast<GLfloat>(enable_flags.scissor_test);
743 }
744 return true;
745 case GL_STENCIL_TEST:
746 *num_written = 1;
747 if (params) {
748 params[0] = static_cast<GLfloat>(enable_flags.stencil_test);
749 }
750 return true;
751 default:
752 return false;
753 }
754 }
129 #endif // GPU_COMMAND_BUFFER_SERVICE_CONTEXT_STATE_IMPL_AUTOGEN_H_ 755 #endif // GPU_COMMAND_BUFFER_SERVICE_CONTEXT_STATE_IMPL_AUTOGEN_H_
130 756
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/context_state.h ('k') | gpu/command_buffer/service/gles2_cmd_decoder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698