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

Side by Side Diff: cc/output/gl_renderer_unittest.cc

Issue 411643002: Early wait on texture resource sync points in gl_renderer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix missing calls to WaitSyncPointIfNeeded in ResourceProvider tests. Created 6 years, 4 months 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
« no previous file with comments | « cc/output/gl_renderer.cc ('k') | cc/resources/resource_provider.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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 "cc/output/gl_renderer.h" 5 #include "cc/output/gl_renderer.h"
6 6
7 #include <set> 7 #include <set>
8 8
9 #include "cc/base/math_util.h" 9 #include "cc/base/math_util.h"
10 #include "cc/output/compositor_frame_metadata.h" 10 #include "cc/output/compositor_frame_metadata.h"
(...skipping 729 matching lines...) Expand 10 before | Expand all | Expand 10 after
740 renderer.SetVisible(false); 740 renderer.SetVisible(false);
741 EXPECT_TRUE(context->last_call_was_set_visibility()); 741 EXPECT_TRUE(context->last_call_was_set_visibility());
742 } 742 }
743 743
744 class TextureStateTrackingContext : public TestWebGraphicsContext3D { 744 class TextureStateTrackingContext : public TestWebGraphicsContext3D {
745 public: 745 public:
746 TextureStateTrackingContext() : active_texture_(GL_INVALID_ENUM) { 746 TextureStateTrackingContext() : active_texture_(GL_INVALID_ENUM) {
747 test_capabilities_.gpu.egl_image_external = true; 747 test_capabilities_.gpu.egl_image_external = true;
748 } 748 }
749 749
750 MOCK_METHOD1(waitSyncPoint, void(unsigned sync_point));
750 MOCK_METHOD3(texParameteri, void(GLenum target, GLenum pname, GLint param)); 751 MOCK_METHOD3(texParameteri, void(GLenum target, GLenum pname, GLint param));
751 MOCK_METHOD4(drawElements, 752 MOCK_METHOD4(drawElements,
752 void(GLenum mode, GLsizei count, GLenum type, GLintptr offset)); 753 void(GLenum mode, GLsizei count, GLenum type, GLintptr offset));
753 754
754 virtual void activeTexture(GLenum texture) { 755 virtual void activeTexture(GLenum texture) {
755 EXPECT_NE(texture, active_texture_); 756 EXPECT_NE(texture, active_texture_);
756 active_texture_ = texture; 757 active_texture_ = texture;
757 } 758 }
758 759
759 GLenum active_texture() const { return active_texture_; } 760 GLenum active_texture() const { return active_texture_; }
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
794 RenderPass::Id(2, 1)); 795 RenderPass::Id(2, 1));
795 796
796 renderer.DecideRenderPassAllocationsForFrame(render_passes_in_draw_order_); 797 renderer.DecideRenderPassAllocationsForFrame(render_passes_in_draw_order_);
797 798
798 // Set up expected texture filter state transitions that match the quads 799 // Set up expected texture filter state transitions that match the quads
799 // created in AppendOneOfEveryQuadType(). 800 // created in AppendOneOfEveryQuadType().
800 Mock::VerifyAndClearExpectations(context); 801 Mock::VerifyAndClearExpectations(context);
801 { 802 {
802 InSequence sequence; 803 InSequence sequence;
803 804
805 // The sync points for all quads are waited on first. This sync point is
806 // for a texture quad drawn later in the frame.
807 EXPECT_CALL(*context,
808 waitSyncPoint(TestRenderPass::kSyncPointForMailboxTextureQuad))
809 .Times(1);
810
804 // yuv_quad is drawn with the default linear filter. 811 // yuv_quad is drawn with the default linear filter.
805 EXPECT_CALL(*context, drawElements(_, _, _, _)); 812 EXPECT_CALL(*context, drawElements(_, _, _, _));
806 813
807 // tile_quad is drawn with GL_NEAREST because it is not transformed or 814 // tile_quad is drawn with GL_NEAREST because it is not transformed or
808 // scaled. 815 // scaled.
809 EXPECT_CALL( 816 EXPECT_CALL(
810 *context, 817 *context,
811 texParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST)); 818 texParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST));
812 EXPECT_CALL( 819 EXPECT_CALL(
813 *context, 820 *context,
814 texParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST)); 821 texParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST));
815 EXPECT_CALL(*context, drawElements(_, _, _, _)); 822 EXPECT_CALL(*context, drawElements(_, _, _, _));
816 823
817 // transformed_tile_quad uses GL_LINEAR. 824 // transformed_tile_quad uses GL_LINEAR.
818 EXPECT_CALL(*context, drawElements(_, _, _, _)); 825 EXPECT_CALL(*context, drawElements(_, _, _, _));
819 826
820 // scaled_tile_quad also uses GL_LINEAR. 827 // scaled_tile_quad also uses GL_LINEAR.
821 EXPECT_CALL(*context, drawElements(_, _, _, _)); 828 EXPECT_CALL(*context, drawElements(_, _, _, _));
822 829
823 // The remaining quads also use GL_LINEAR because nearest neighbor 830 // The remaining quads also use GL_LINEAR because nearest neighbor
824 // filtering is currently only used with tile quads. 831 // filtering is currently only used with tile quads.
825 EXPECT_CALL(*context, drawElements(_, _, _, _)).Times(6); 832 EXPECT_CALL(*context, drawElements(_, _, _, _)).Times(7);
826 } 833 }
827 834
828 gfx::Rect viewport_rect(100, 100); 835 gfx::Rect viewport_rect(100, 100);
829 renderer.DrawFrame(&render_passes_in_draw_order_, 836 renderer.DrawFrame(&render_passes_in_draw_order_,
830 1.f, 837 1.f,
831 viewport_rect, 838 viewport_rect,
832 viewport_rect, 839 viewport_rect,
833 false); 840 false);
834 Mock::VerifyAndClearExpectations(context); 841 Mock::VerifyAndClearExpectations(context);
835 } 842 }
(...skipping 919 matching lines...) Expand 10 before | Expand all | Expand 10 after
1755 base::MessageLoop::current()->Run(); 1762 base::MessageLoop::current()->Run();
1756 1763
1757 // The sync point should have happened. 1764 // The sync point should have happened.
1758 EXPECT_EQ(1, sync_point_callback_count); 1765 EXPECT_EQ(1, sync_point_callback_count);
1759 EXPECT_EQ(1, other_callback_count); 1766 EXPECT_EQ(1, other_callback_count);
1760 } 1767 }
1761 #endif // OS_ANDROID 1768 #endif // OS_ANDROID
1762 1769
1763 } // namespace 1770 } // namespace
1764 } // namespace cc 1771 } // namespace cc
OLDNEW
« no previous file with comments | « cc/output/gl_renderer.cc ('k') | cc/resources/resource_provider.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698