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