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 709 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
720 } | 720 } |
721 } | 721 } |
722 | 722 |
723 void GLES2DecoderTestBase::SetupExpectationsForDepthMask(bool mask) { | 723 void GLES2DecoderTestBase::SetupExpectationsForDepthMask(bool mask) { |
724 if (ignore_cached_state_for_test_ || cached_depth_mask_ != mask) { | 724 if (ignore_cached_state_for_test_ || cached_depth_mask_ != mask) { |
725 cached_depth_mask_ = mask; | 725 cached_depth_mask_ = mask; |
726 EXPECT_CALL(*gl_, DepthMask(mask)).Times(1).RetiresOnSaturation(); | 726 EXPECT_CALL(*gl_, DepthMask(mask)).Times(1).RetiresOnSaturation(); |
727 } | 727 } |
728 } | 728 } |
729 | 729 |
730 void GLES2DecoderTestBase::SetupExpectationsForStencilMask(uint32 front_mask, | |
731 uint32 back_mask) { | |
732 if (ignore_cached_state_for_test_ || | |
Zhenyao Mo
2014/06/02 20:33:53
indent is 2 instead of 4
| |
733 cached_stencil_front_mask_ != front_mask) { | |
734 cached_stencil_front_mask_ = front_mask; | |
735 EXPECT_CALL(*gl_, StencilMaskSeparate(GL_FRONT, front_mask)) | |
736 .Times(1) | |
737 .RetiresOnSaturation(); | |
738 } | |
739 | |
740 if (ignore_cached_state_for_test_ || | |
741 cached_stencil_back_mask_ != back_mask) { | |
742 cached_stencil_back_mask_ = back_mask; | |
743 EXPECT_CALL(*gl_, StencilMaskSeparate(GL_BACK, back_mask)) | |
744 .Times(1) | |
745 .RetiresOnSaturation(); | |
746 } | |
747 } | |
748 | |
730 void GLES2DecoderTestBase::SetupExpectationsForEnableDisable(GLenum cap, | 749 void GLES2DecoderTestBase::SetupExpectationsForEnableDisable(GLenum cap, |
731 bool enable) { | 750 bool enable) { |
732 switch (cap) { | 751 switch (cap) { |
733 case GL_BLEND: | 752 case GL_BLEND: |
734 if (enable_flags_.cached_blend == enable && | 753 if (enable_flags_.cached_blend == enable && |
735 !ignore_cached_state_for_test_) | 754 !ignore_cached_state_for_test_) |
736 return; | 755 return; |
737 enable_flags_.cached_blend = enable; | 756 enable_flags_.cached_blend = enable; |
738 break; | 757 break; |
739 case GL_CULL_FACE: | 758 case GL_CULL_FACE: |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
806 GLuint back_stencil_mask, | 825 GLuint back_stencil_mask, |
807 bool stencil_enabled) { | 826 bool stencil_enabled) { |
808 bool color_mask_red = (color_bits & 0x1000) != 0; | 827 bool color_mask_red = (color_bits & 0x1000) != 0; |
809 bool color_mask_green = (color_bits & 0x0100) != 0; | 828 bool color_mask_green = (color_bits & 0x0100) != 0; |
810 bool color_mask_blue = (color_bits & 0x0010) != 0; | 829 bool color_mask_blue = (color_bits & 0x0010) != 0; |
811 bool color_mask_alpha = (color_bits & 0x0001) && !framebuffer_is_rgb; | 830 bool color_mask_alpha = (color_bits & 0x0001) && !framebuffer_is_rgb; |
812 | 831 |
813 SetupExpectationsForColorMask( | 832 SetupExpectationsForColorMask( |
814 color_mask_red, color_mask_green, color_mask_blue, color_mask_alpha); | 833 color_mask_red, color_mask_green, color_mask_blue, color_mask_alpha); |
815 SetupExpectationsForDepthMask(depth_mask); | 834 SetupExpectationsForDepthMask(depth_mask); |
816 | 835 SetupExpectationsForStencilMask(front_stencil_mask, back_stencil_mask); |
817 if (ignore_cached_state_for_test_ || | |
818 cached_stencil_front_mask_ != front_stencil_mask) { | |
819 cached_stencil_front_mask_ = front_stencil_mask; | |
820 EXPECT_CALL(*gl_, StencilMaskSeparate(GL_FRONT, front_stencil_mask)) | |
821 .Times(1) | |
822 .RetiresOnSaturation(); | |
823 } | |
824 | |
825 if (ignore_cached_state_for_test_ || | |
826 cached_stencil_back_mask_ != back_stencil_mask) { | |
827 cached_stencil_back_mask_ = back_stencil_mask; | |
828 EXPECT_CALL(*gl_, StencilMaskSeparate(GL_BACK, back_stencil_mask)) | |
829 .Times(1) | |
830 .RetiresOnSaturation(); | |
831 } | |
832 | |
833 SetupExpectationsForEnableDisable(GL_DEPTH_TEST, | 836 SetupExpectationsForEnableDisable(GL_DEPTH_TEST, |
834 framebuffer_has_depth && depth_enabled); | 837 framebuffer_has_depth && depth_enabled); |
835 SetupExpectationsForEnableDisable(GL_STENCIL_TEST, | 838 SetupExpectationsForEnableDisable(GL_STENCIL_TEST, |
836 framebuffer_has_stencil && stencil_enabled); | 839 framebuffer_has_stencil && stencil_enabled); |
837 } | 840 } |
838 | 841 |
839 void GLES2DecoderTestBase::SetupExpectationsForApplyingDefaultDirtyState() { | 842 void GLES2DecoderTestBase::SetupExpectationsForApplyingDefaultDirtyState() { |
840 SetupExpectationsForApplyingDirtyState(false, // Framebuffer is RGB | 843 SetupExpectationsForApplyingDirtyState(false, // Framebuffer is RGB |
841 false, // Framebuffer has depth | 844 false, // Framebuffer has depth |
842 false, // Framebuffer has stencil | 845 false, // Framebuffer has stencil |
(...skipping 768 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1611 SetupDefaultProgram(); | 1614 SetupDefaultProgram(); |
1612 } | 1615 } |
1613 | 1616 |
1614 // Include the auto-generated part of this file. We split this because it means | 1617 // Include the auto-generated part of this file. We split this because it means |
1615 // we can easily edit the non-auto generated parts right here in this file | 1618 // we can easily edit the non-auto generated parts right here in this file |
1616 // instead of having to edit some template or the code generator. | 1619 // instead of having to edit some template or the code generator. |
1617 #include "gpu/command_buffer/service/gles2_cmd_decoder_unittest_0_autogen.h" | 1620 #include "gpu/command_buffer/service/gles2_cmd_decoder_unittest_0_autogen.h" |
1618 | 1621 |
1619 } // namespace gles2 | 1622 } // namespace gles2 |
1620 } // namespace gpu | 1623 } // namespace gpu |
OLD | NEW |