OLD | NEW |
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 #include "gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.h" | 5 #include "gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 client_buffer_id_(100), | 46 client_buffer_id_(100), |
47 client_framebuffer_id_(101), | 47 client_framebuffer_id_(101), |
48 client_program_id_(102), | 48 client_program_id_(102), |
49 client_renderbuffer_id_(103), | 49 client_renderbuffer_id_(103), |
50 client_shader_id_(104), | 50 client_shader_id_(104), |
51 client_texture_id_(106), | 51 client_texture_id_(106), |
52 client_element_buffer_id_(107), | 52 client_element_buffer_id_(107), |
53 client_vertex_shader_id_(121), | 53 client_vertex_shader_id_(121), |
54 client_fragment_shader_id_(122), | 54 client_fragment_shader_id_(122), |
55 client_query_id_(123), | 55 client_query_id_(123), |
56 client_vertexarray_id_(124) { | 56 client_vertexarray_id_(124), |
| 57 ignore_cached_state_for_test_(GetParam()), |
| 58 cached_color_mask_red_(true), |
| 59 cached_color_mask_green_(true), |
| 60 cached_color_mask_blue_(true), |
| 61 cached_color_mask_alpha_(true), |
| 62 cached_depth_mask_(true), |
| 63 cached_stencil_front_mask_(0xFFFFFFFFU), |
| 64 cached_stencil_back_mask_(0xFFFFFFFFU) { |
57 memset(immediate_buffer_, 0xEE, sizeof(immediate_buffer_)); | 65 memset(immediate_buffer_, 0xEE, sizeof(immediate_buffer_)); |
58 } | 66 } |
59 | 67 |
60 GLES2DecoderTestBase::~GLES2DecoderTestBase() {} | 68 GLES2DecoderTestBase::~GLES2DecoderTestBase() {} |
61 | 69 |
62 void GLES2DecoderTestBase::SetUp() { | 70 void GLES2DecoderTestBase::SetUp() { |
63 InitState init; | 71 InitState init; |
64 init.gl_version = "3.0"; | 72 init.gl_version = "3.0"; |
65 init.has_alpha = true; | 73 init.has_alpha = true; |
66 init.has_depth = true; | 74 init.has_depth = true; |
(...skipping 12 matching lines...) Expand all Loading... |
79 } | 87 } |
80 | 88 |
81 GLES2DecoderTestBase::InitState::InitState() | 89 GLES2DecoderTestBase::InitState::InitState() |
82 : has_alpha(false), | 90 : has_alpha(false), |
83 has_depth(false), | 91 has_depth(false), |
84 has_stencil(false), | 92 has_stencil(false), |
85 request_alpha(false), | 93 request_alpha(false), |
86 request_depth(false), | 94 request_depth(false), |
87 request_stencil(false), | 95 request_stencil(false), |
88 bind_generates_resource(false), | 96 bind_generates_resource(false), |
89 lose_context_when_out_of_memory(false) {} | 97 lose_context_when_out_of_memory(false) { |
| 98 } |
90 | 99 |
91 void GLES2DecoderTestBase::InitDecoder(const InitState& init) { | 100 void GLES2DecoderTestBase::InitDecoder(const InitState& init) { |
92 InitDecoderWithCommandLine(init, NULL); | 101 InitDecoderWithCommandLine(init, NULL); |
93 } | 102 } |
94 | 103 |
95 void GLES2DecoderTestBase::InitDecoderWithCommandLine( | 104 void GLES2DecoderTestBase::InitDecoderWithCommandLine( |
96 const InitState& init, | 105 const InitState& init, |
97 const base::CommandLine* command_line) { | 106 const base::CommandLine* command_line) { |
98 Framebuffer::ClearFramebufferCompleteComboMap(); | 107 Framebuffer::ClearFramebufferCompleteComboMap(); |
99 | 108 |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
295 init.request_alpha ? 8 : 0, | 304 init.request_alpha ? 8 : 0, |
296 EGL_DEPTH_SIZE, | 305 EGL_DEPTH_SIZE, |
297 init.request_depth ? 24 : 0, | 306 init.request_depth ? 24 : 0, |
298 EGL_STENCIL_SIZE, | 307 EGL_STENCIL_SIZE, |
299 init.request_stencil ? 8 : 0, | 308 init.request_stencil ? 8 : 0, |
300 kLoseContextWhenOutOfMemory, | 309 kLoseContextWhenOutOfMemory, |
301 init.lose_context_when_out_of_memory ? 1 : 0, }; | 310 init.lose_context_when_out_of_memory ? 1 : 0, }; |
302 std::vector<int32> attribs(attributes, attributes + arraysize(attributes)); | 311 std::vector<int32> attribs(attributes, attributes + arraysize(attributes)); |
303 | 312 |
304 decoder_.reset(GLES2Decoder::Create(group_.get())); | 313 decoder_.reset(GLES2Decoder::Create(group_.get())); |
| 314 decoder_->SetIgnoreCachedStateForTest(ignore_cached_state_for_test_); |
305 decoder_->GetLogger()->set_log_synthesized_gl_errors(false); | 315 decoder_->GetLogger()->set_log_synthesized_gl_errors(false); |
306 decoder_->Initialize(surface_, | 316 decoder_->Initialize(surface_, |
307 context_, | 317 context_, |
308 false, | 318 false, |
309 surface_->GetSize(), | 319 surface_->GetSize(), |
310 DisallowedFeatures(), | 320 DisallowedFeatures(), |
311 attribs); | 321 attribs); |
312 decoder_->MakeCurrent(); | 322 decoder_->MakeCurrent(); |
313 decoder_->set_engine(engine_.get()); | 323 decoder_->set_engine(engine_.get()); |
314 decoder_->BeginDecoding(); | 324 decoder_->BeginDecoding(); |
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
543 .RetiresOnSaturation(); | 553 .RetiresOnSaturation(); |
544 EXPECT_CALL(*gl_, BindFramebufferEXT( | 554 EXPECT_CALL(*gl_, BindFramebufferEXT( |
545 GL_DRAW_FRAMEBUFFER_EXT, read_framebuffer_service_id)) | 555 GL_DRAW_FRAMEBUFFER_EXT, read_framebuffer_service_id)) |
546 .Times(1) | 556 .Times(1) |
547 .RetiresOnSaturation(); | 557 .RetiresOnSaturation(); |
548 } | 558 } |
549 if ((clear_bits & GL_COLOR_BUFFER_BIT) != 0) { | 559 if ((clear_bits & GL_COLOR_BUFFER_BIT) != 0) { |
550 EXPECT_CALL(*gl_, ClearColor(0.0f, 0.0f, 0.0f, 0.0f)) | 560 EXPECT_CALL(*gl_, ClearColor(0.0f, 0.0f, 0.0f, 0.0f)) |
551 .Times(1) | 561 .Times(1) |
552 .RetiresOnSaturation(); | 562 .RetiresOnSaturation(); |
553 EXPECT_CALL(*gl_, ColorMask(true, true, true, true)) | 563 SetupExpectationsForColorMask(true, true, true, true); |
554 .Times(1) | |
555 .RetiresOnSaturation(); | |
556 } | 564 } |
557 if ((clear_bits & GL_STENCIL_BUFFER_BIT) != 0) { | 565 if ((clear_bits & GL_STENCIL_BUFFER_BIT) != 0) { |
558 EXPECT_CALL(*gl_, ClearStencil(0)) | 566 EXPECT_CALL(*gl_, ClearStencil(0)) |
559 .Times(1) | 567 .Times(1) |
560 .RetiresOnSaturation(); | 568 .RetiresOnSaturation(); |
561 EXPECT_CALL(*gl_, StencilMask(static_cast<GLuint>(-1))) | 569 EXPECT_CALL(*gl_, StencilMask(static_cast<GLuint>(-1))) |
562 .Times(1) | 570 .Times(1) |
563 .RetiresOnSaturation(); | 571 .RetiresOnSaturation(); |
564 } | 572 } |
565 if ((clear_bits & GL_DEPTH_BUFFER_BIT) != 0) { | 573 if ((clear_bits & GL_DEPTH_BUFFER_BIT) != 0) { |
566 EXPECT_CALL(*gl_, ClearDepth(1.0f)) | 574 EXPECT_CALL(*gl_, ClearDepth(1.0f)) |
567 .Times(1) | 575 .Times(1) |
568 .RetiresOnSaturation(); | 576 .RetiresOnSaturation(); |
569 EXPECT_CALL(*gl_, DepthMask(1)) | 577 SetupExpectationsForDepthMask(true); |
570 .Times(1) | |
571 .RetiresOnSaturation(); | |
572 } | 578 } |
573 EXPECT_CALL(*gl_, Disable(GL_SCISSOR_TEST)) | 579 SetupExpectationsForEnableDisable(GL_SCISSOR_TEST, false); |
574 .Times(1) | |
575 .RetiresOnSaturation(); | |
576 EXPECT_CALL(*gl_, Clear(clear_bits)) | 580 EXPECT_CALL(*gl_, Clear(clear_bits)) |
577 .Times(1) | 581 .Times(1) |
578 .RetiresOnSaturation(); | 582 .RetiresOnSaturation(); |
579 SetupExpectationsForRestoreClearState( | 583 SetupExpectationsForRestoreClearState( |
580 restore_red, restore_green, restore_blue, restore_alpha, | 584 restore_red, restore_green, restore_blue, restore_alpha, |
581 restore_stencil, restore_depth, restore_scissor_test); | 585 restore_stencil, restore_depth, restore_scissor_test); |
582 if (target == GL_READ_FRAMEBUFFER_EXT) { | 586 if (target == GL_READ_FRAMEBUFFER_EXT) { |
583 EXPECT_CALL(*gl_, BindFramebufferEXT( | 587 EXPECT_CALL(*gl_, BindFramebufferEXT( |
584 GL_READ_FRAMEBUFFER_EXT, read_framebuffer_service_id)) | 588 GL_READ_FRAMEBUFFER_EXT, read_framebuffer_service_id)) |
585 .Times(1) | 589 .Times(1) |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
635 GLuint client_id, GLuint service_id) { | 639 GLuint client_id, GLuint service_id) { |
636 EXPECT_CALL(*gl_, DeleteBuffersARB(1, Pointee(service_id))) | 640 EXPECT_CALL(*gl_, DeleteBuffersARB(1, Pointee(service_id))) |
637 .Times(1) | 641 .Times(1) |
638 .RetiresOnSaturation(); | 642 .RetiresOnSaturation(); |
639 cmds::DeleteBuffers cmd; | 643 cmds::DeleteBuffers cmd; |
640 cmd.Init(1, shared_memory_id_, shared_memory_offset_); | 644 cmd.Init(1, shared_memory_id_, shared_memory_offset_); |
641 memcpy(shared_memory_address_, &client_id, sizeof(client_id)); | 645 memcpy(shared_memory_address_, &client_id, sizeof(client_id)); |
642 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 646 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
643 } | 647 } |
644 | 648 |
| 649 void GLES2DecoderTestBase::SetupExpectationsForColorMask(bool red, |
| 650 bool green, |
| 651 bool blue, |
| 652 bool alpha) { |
| 653 if (ignore_cached_state_for_test_ || cached_color_mask_red_ != red || |
| 654 cached_color_mask_green_ != green || cached_color_mask_blue_ != blue || |
| 655 cached_color_mask_alpha_ != alpha) { |
| 656 cached_color_mask_red_ = red; |
| 657 cached_color_mask_green_ = green; |
| 658 cached_color_mask_blue_ = blue; |
| 659 cached_color_mask_alpha_ = alpha; |
| 660 EXPECT_CALL(*gl_, ColorMask(red, green, blue, alpha)) |
| 661 .Times(1) |
| 662 .RetiresOnSaturation(); |
| 663 } |
| 664 } |
| 665 |
| 666 void GLES2DecoderTestBase::SetupExpectationsForDepthMask(bool mask) { |
| 667 if (ignore_cached_state_for_test_ || cached_depth_mask_ != mask) { |
| 668 cached_depth_mask_ = mask; |
| 669 EXPECT_CALL(*gl_, DepthMask(mask)).Times(1).RetiresOnSaturation(); |
| 670 } |
| 671 } |
| 672 |
| 673 void GLES2DecoderTestBase::SetupExpectationsForEnableDisable(GLenum cap, |
| 674 bool enable) { |
| 675 switch (cap) { |
| 676 case GL_BLEND: |
| 677 if (enable_flags_.cached_blend == enable && |
| 678 !ignore_cached_state_for_test_) |
| 679 return; |
| 680 enable_flags_.cached_blend = enable; |
| 681 break; |
| 682 case GL_CULL_FACE: |
| 683 if (enable_flags_.cached_cull_face == enable && |
| 684 !ignore_cached_state_for_test_) |
| 685 return; |
| 686 enable_flags_.cached_cull_face = enable; |
| 687 break; |
| 688 case GL_DEPTH_TEST: |
| 689 if (enable_flags_.cached_depth_test == enable && |
| 690 !ignore_cached_state_for_test_) |
| 691 return; |
| 692 enable_flags_.cached_depth_test = enable; |
| 693 break; |
| 694 case GL_DITHER: |
| 695 if (enable_flags_.cached_dither == enable && |
| 696 !ignore_cached_state_for_test_) |
| 697 return; |
| 698 enable_flags_.cached_dither = enable; |
| 699 break; |
| 700 case GL_POLYGON_OFFSET_FILL: |
| 701 if (enable_flags_.cached_polygon_offset_fill == enable && |
| 702 !ignore_cached_state_for_test_) |
| 703 return; |
| 704 enable_flags_.cached_polygon_offset_fill = enable; |
| 705 break; |
| 706 case GL_SAMPLE_ALPHA_TO_COVERAGE: |
| 707 if (enable_flags_.cached_sample_alpha_to_coverage == enable && |
| 708 !ignore_cached_state_for_test_) |
| 709 return; |
| 710 enable_flags_.cached_sample_alpha_to_coverage = enable; |
| 711 break; |
| 712 case GL_SAMPLE_COVERAGE: |
| 713 if (enable_flags_.cached_sample_coverage == enable && |
| 714 !ignore_cached_state_for_test_) |
| 715 return; |
| 716 enable_flags_.cached_sample_coverage = enable; |
| 717 break; |
| 718 case GL_SCISSOR_TEST: |
| 719 if (enable_flags_.cached_scissor_test == enable && |
| 720 !ignore_cached_state_for_test_) |
| 721 return; |
| 722 enable_flags_.cached_scissor_test = enable; |
| 723 break; |
| 724 case GL_STENCIL_TEST: |
| 725 if (enable_flags_.cached_stencil_test == enable && |
| 726 !ignore_cached_state_for_test_) |
| 727 return; |
| 728 enable_flags_.cached_stencil_test = enable; |
| 729 break; |
| 730 default: |
| 731 NOTREACHED(); |
| 732 return; |
| 733 } |
| 734 if (enable) { |
| 735 EXPECT_CALL(*gl_, Enable(cap)).Times(1).RetiresOnSaturation(); |
| 736 } else { |
| 737 EXPECT_CALL(*gl_, Disable(cap)).Times(1).RetiresOnSaturation(); |
| 738 } |
| 739 } |
| 740 |
645 void GLES2DecoderTestBase::SetupExpectationsForApplyingDirtyState( | 741 void GLES2DecoderTestBase::SetupExpectationsForApplyingDirtyState( |
646 bool framebuffer_is_rgb, | 742 bool framebuffer_is_rgb, |
647 bool framebuffer_has_depth, | 743 bool framebuffer_has_depth, |
648 bool framebuffer_has_stencil, | 744 bool framebuffer_has_stencil, |
649 GLuint color_bits, | 745 GLuint color_bits, |
650 bool depth_mask, | 746 bool depth_mask, |
651 bool depth_enabled, | 747 bool depth_enabled, |
652 GLuint front_stencil_mask, | 748 GLuint front_stencil_mask, |
653 GLuint back_stencil_mask, | 749 GLuint back_stencil_mask, |
654 bool stencil_enabled, | 750 bool stencil_enabled) { |
655 bool cull_face_enabled, | 751 bool color_mask_red = (color_bits & 0x1000) != 0; |
656 bool scissor_test_enabled, | 752 bool color_mask_green = (color_bits & 0x0100) != 0; |
657 bool blend_enabled) { | 753 bool color_mask_blue = (color_bits & 0x0010) != 0; |
658 EXPECT_CALL(*gl_, ColorMask( | 754 bool color_mask_alpha = (color_bits & 0x0001) && !framebuffer_is_rgb; |
659 (color_bits & 0x1000) != 0, | 755 |
660 (color_bits & 0x0100) != 0, | 756 SetupExpectationsForColorMask( |
661 (color_bits & 0x0010) != 0, | 757 color_mask_red, color_mask_green, color_mask_blue, color_mask_alpha); |
662 (color_bits & 0x0001) && !framebuffer_is_rgb)) | 758 SetupExpectationsForDepthMask(depth_mask); |
663 .Times(1) | 759 |
664 .RetiresOnSaturation(); | 760 if (ignore_cached_state_for_test_ || |
665 EXPECT_CALL(*gl_, DepthMask(depth_mask)) | 761 cached_stencil_front_mask_ != front_stencil_mask) { |
666 .Times(1) | 762 cached_stencil_front_mask_ = front_stencil_mask; |
667 .RetiresOnSaturation(); | 763 EXPECT_CALL(*gl_, StencilMaskSeparate(GL_FRONT, front_stencil_mask)) |
668 if (framebuffer_has_depth && depth_enabled) { | |
669 EXPECT_CALL(*gl_, Enable(GL_DEPTH_TEST)) | |
670 .Times(1) | |
671 .RetiresOnSaturation(); | |
672 } else { | |
673 EXPECT_CALL(*gl_, Disable(GL_DEPTH_TEST)) | |
674 .Times(1) | 764 .Times(1) |
675 .RetiresOnSaturation(); | 765 .RetiresOnSaturation(); |
676 } | 766 } |
677 EXPECT_CALL(*gl_, StencilMaskSeparate(GL_FRONT, front_stencil_mask)) | 767 |
678 .Times(1) | 768 if (ignore_cached_state_for_test_ || |
679 .RetiresOnSaturation(); | 769 cached_stencil_back_mask_ != back_stencil_mask) { |
680 EXPECT_CALL(*gl_, StencilMaskSeparate(GL_BACK, back_stencil_mask)) | 770 cached_stencil_back_mask_ = back_stencil_mask; |
681 .Times(1) | 771 EXPECT_CALL(*gl_, StencilMaskSeparate(GL_BACK, back_stencil_mask)) |
682 .RetiresOnSaturation(); | |
683 if (framebuffer_has_stencil && stencil_enabled) { | |
684 EXPECT_CALL(*gl_, Enable(GL_STENCIL_TEST)) | |
685 .Times(1) | |
686 .RetiresOnSaturation(); | |
687 } else { | |
688 EXPECT_CALL(*gl_, Disable(GL_STENCIL_TEST)) | |
689 .Times(1) | 772 .Times(1) |
690 .RetiresOnSaturation(); | 773 .RetiresOnSaturation(); |
691 } | 774 } |
692 if (cull_face_enabled) { | 775 |
693 EXPECT_CALL(*gl_, Enable(GL_CULL_FACE)) | 776 SetupExpectationsForEnableDisable(GL_DEPTH_TEST, |
694 .Times(1) | 777 framebuffer_has_depth && depth_enabled); |
695 .RetiresOnSaturation(); | 778 SetupExpectationsForEnableDisable(GL_STENCIL_TEST, |
696 } else { | 779 framebuffer_has_stencil && stencil_enabled); |
697 EXPECT_CALL(*gl_, Disable(GL_CULL_FACE)) | |
698 .Times(1) | |
699 .RetiresOnSaturation(); | |
700 } | |
701 if (scissor_test_enabled) { | |
702 EXPECT_CALL(*gl_, Enable(GL_SCISSOR_TEST)) | |
703 .Times(1) | |
704 .RetiresOnSaturation(); | |
705 } else { | |
706 EXPECT_CALL(*gl_, Disable(GL_SCISSOR_TEST)) | |
707 .Times(1) | |
708 .RetiresOnSaturation(); | |
709 } | |
710 if (blend_enabled) { | |
711 EXPECT_CALL(*gl_, Enable(GL_BLEND)) | |
712 .Times(1) | |
713 .RetiresOnSaturation(); | |
714 } else { | |
715 EXPECT_CALL(*gl_, Disable(GL_BLEND)) | |
716 .Times(1) | |
717 .RetiresOnSaturation(); | |
718 } | |
719 } | 780 } |
720 | 781 |
721 void GLES2DecoderTestBase::SetupExpectationsForApplyingDefaultDirtyState() { | 782 void GLES2DecoderTestBase::SetupExpectationsForApplyingDefaultDirtyState() { |
722 SetupExpectationsForApplyingDirtyState( | 783 SetupExpectationsForApplyingDirtyState(false, // Framebuffer is RGB |
723 false, // Framebuffer is RGB | 784 false, // Framebuffer has depth |
724 false, // Framebuffer has depth | 785 false, // Framebuffer has stencil |
725 false, // Framebuffer has stencil | 786 0x1111, // color bits |
726 0x1111, // color bits | 787 true, // depth mask |
727 true, // depth mask | 788 false, // depth enabled |
728 false, // depth enabled | 789 0, // front stencil mask |
729 0, // front stencil mask | 790 0, // back stencil mask |
730 0, // back stencil mask | 791 false); // stencil enabled |
731 false, // stencil enabled | 792 } |
732 false, // cull_face_enabled | 793 |
733 false, // scissor_test_enabled | 794 GLES2DecoderTestBase::EnableFlags::EnableFlags() |
734 false); // blend_enabled | 795 : cached_blend(false), |
| 796 cached_cull_face(false), |
| 797 cached_depth_test(false), |
| 798 cached_dither(true), |
| 799 cached_polygon_offset_fill(false), |
| 800 cached_sample_alpha_to_coverage(false), |
| 801 cached_sample_coverage(false), |
| 802 cached_scissor_test(false), |
| 803 cached_stencil_test(false) { |
735 } | 804 } |
736 | 805 |
737 void GLES2DecoderTestBase::DoBindFramebuffer( | 806 void GLES2DecoderTestBase::DoBindFramebuffer( |
738 GLenum target, GLuint client_id, GLuint service_id) { | 807 GLenum target, GLuint client_id, GLuint service_id) { |
739 EXPECT_CALL(*gl_, BindFramebufferEXT(target, service_id)) | 808 EXPECT_CALL(*gl_, BindFramebufferEXT(target, service_id)) |
740 .Times(1) | 809 .Times(1) |
741 .RetiresOnSaturation(); | 810 .RetiresOnSaturation(); |
742 cmds::BindFramebuffer cmd; | 811 cmds::BindFramebuffer cmd; |
743 cmd.Init(target, client_id); | 812 cmd.Init(target, client_id); |
744 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 813 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
(...skipping 551 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1296 | 1365 |
1297 attach_cmd.Init(program_client_id, fragment_shader_client_id); | 1366 attach_cmd.Init(program_client_id, fragment_shader_client_id); |
1298 EXPECT_EQ(error::kNoError, ExecuteCmd(attach_cmd)); | 1367 EXPECT_EQ(error::kNoError, ExecuteCmd(attach_cmd)); |
1299 | 1368 |
1300 cmds::LinkProgram link_cmd; | 1369 cmds::LinkProgram link_cmd; |
1301 link_cmd.Init(program_client_id); | 1370 link_cmd.Init(program_client_id); |
1302 | 1371 |
1303 EXPECT_EQ(error::kNoError, ExecuteCmd(link_cmd)); | 1372 EXPECT_EQ(error::kNoError, ExecuteCmd(link_cmd)); |
1304 } | 1373 } |
1305 | 1374 |
| 1375 void GLES2DecoderTestBase::DoEnableDisable(GLenum cap, bool enable) { |
| 1376 SetupExpectationsForEnableDisable(cap, enable); |
| 1377 if (enable) { |
| 1378 cmds::Enable cmd; |
| 1379 cmd.Init(cap); |
| 1380 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 1381 } else { |
| 1382 cmds::Disable cmd; |
| 1383 cmd.Init(cap); |
| 1384 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 1385 } |
| 1386 } |
| 1387 |
1306 void GLES2DecoderTestBase::DoEnableVertexAttribArray(GLint index) { | 1388 void GLES2DecoderTestBase::DoEnableVertexAttribArray(GLint index) { |
1307 EXPECT_CALL(*gl_, EnableVertexAttribArray(index)) | 1389 EXPECT_CALL(*gl_, EnableVertexAttribArray(index)) |
1308 .Times(1) | 1390 .Times(1) |
1309 .RetiresOnSaturation(); | 1391 .RetiresOnSaturation(); |
1310 cmds::EnableVertexAttribArray cmd; | 1392 cmds::EnableVertexAttribArray cmd; |
1311 cmd.Init(index); | 1393 cmd.Init(index); |
1312 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 1394 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
1313 } | 1395 } |
1314 | 1396 |
1315 void GLES2DecoderTestBase::DoBufferData(GLenum target, GLsizei size) { | 1397 void GLES2DecoderTestBase::DoBufferData(GLenum target, GLsizei size) { |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1472 SetupDefaultProgram(); | 1554 SetupDefaultProgram(); |
1473 } | 1555 } |
1474 | 1556 |
1475 // Include the auto-generated part of this file. We split this because it means | 1557 // Include the auto-generated part of this file. We split this because it means |
1476 // we can easily edit the non-auto generated parts right here in this file | 1558 // we can easily edit the non-auto generated parts right here in this file |
1477 // instead of having to edit some template or the code generator. | 1559 // instead of having to edit some template or the code generator. |
1478 #include "gpu/command_buffer/service/gles2_cmd_decoder_unittest_0_autogen.h" | 1560 #include "gpu/command_buffer/service/gles2_cmd_decoder_unittest_0_autogen.h" |
1479 | 1561 |
1480 } // namespace gles2 | 1562 } // namespace gles2 |
1481 } // namespace gpu | 1563 } // namespace gpu |
OLD | NEW |