| OLD | NEW |
| 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 "base/location.h" | 9 #include "base/location.h" |
| 10 #include "base/single_thread_task_runner.h" | 10 #include "base/single_thread_task_runner.h" |
| (...skipping 911 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 922 renderer.SetVisible(false); | 922 renderer.SetVisible(false); |
| 923 EXPECT_TRUE(context->last_call_was_set_visibility()); | 923 EXPECT_TRUE(context->last_call_was_set_visibility()); |
| 924 } | 924 } |
| 925 | 925 |
| 926 class TextureStateTrackingContext : public TestWebGraphicsContext3D { | 926 class TextureStateTrackingContext : public TestWebGraphicsContext3D { |
| 927 public: | 927 public: |
| 928 TextureStateTrackingContext() : active_texture_(GL_INVALID_ENUM) { | 928 TextureStateTrackingContext() : active_texture_(GL_INVALID_ENUM) { |
| 929 test_capabilities_.gpu.egl_image_external = true; | 929 test_capabilities_.gpu.egl_image_external = true; |
| 930 } | 930 } |
| 931 | 931 |
| 932 MOCK_METHOD1(waitSyncPoint, void(unsigned sync_point)); | 932 MOCK_METHOD1(waitSyncPoint, |
| 933 void(unsigned sync_point, const gpu::SyncToken& sync_token)); |
| 933 MOCK_METHOD3(texParameteri, void(GLenum target, GLenum pname, GLint param)); | 934 MOCK_METHOD3(texParameteri, void(GLenum target, GLenum pname, GLint param)); |
| 934 MOCK_METHOD4(drawElements, | 935 MOCK_METHOD4(drawElements, |
| 935 void(GLenum mode, GLsizei count, GLenum type, GLintptr offset)); | 936 void(GLenum mode, GLsizei count, GLenum type, GLintptr offset)); |
| 936 | 937 |
| 937 virtual void activeTexture(GLenum texture) { | 938 virtual void activeTexture(GLenum texture) { |
| 938 EXPECT_NE(texture, active_texture_); | 939 EXPECT_NE(texture, active_texture_); |
| 939 active_texture_ = texture; | 940 active_texture_ = texture; |
| 940 } | 941 } |
| 941 | 942 |
| 942 GLenum active_texture() const { return active_texture_; } | 943 GLenum active_texture() const { return active_texture_; } |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 980 renderer.DecideRenderPassAllocationsForFrame(render_passes_in_draw_order_); | 981 renderer.DecideRenderPassAllocationsForFrame(render_passes_in_draw_order_); |
| 981 | 982 |
| 982 // Set up expected texture filter state transitions that match the quads | 983 // Set up expected texture filter state transitions that match the quads |
| 983 // created in AppendOneOfEveryQuadType(). | 984 // created in AppendOneOfEveryQuadType(). |
| 984 Mock::VerifyAndClearExpectations(context); | 985 Mock::VerifyAndClearExpectations(context); |
| 985 { | 986 { |
| 986 InSequence sequence; | 987 InSequence sequence; |
| 987 | 988 |
| 988 // The sync points for all quads are waited on first. This sync point is | 989 // The sync points for all quads are waited on first. This sync point is |
| 989 // for a texture quad drawn later in the frame. | 990 // for a texture quad drawn later in the frame. |
| 990 EXPECT_CALL(*context, waitSyncPoint(mailbox_sync_point)).Times(1); | 991 EXPECT_CALL(*context, waitSyncPoint(mailbox_sync_point, gpu::SyncToken())) |
| 992 .Times(1); |
| 991 | 993 |
| 992 // yuv_quad is drawn with the default linear filter. | 994 // yuv_quad is drawn with the default linear filter. |
| 993 EXPECT_CALL(*context, drawElements(_, _, _, _)); | 995 EXPECT_CALL(*context, drawElements(_, _, _, _)); |
| 994 | 996 |
| 995 // tile_quad is drawn with GL_NEAREST because it is not transformed or | 997 // tile_quad is drawn with GL_NEAREST because it is not transformed or |
| 996 // scaled. | 998 // scaled. |
| 997 EXPECT_CALL( | 999 EXPECT_CALL( |
| 998 *context, | 1000 *context, |
| 999 texParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST)); | 1001 texParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST)); |
| 1000 EXPECT_CALL( | 1002 EXPECT_CALL( |
| (...skipping 1133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2134 void Initialize() override { | 2136 void Initialize() override { |
| 2135 strategies_.push_back( | 2137 strategies_.push_back( |
| 2136 make_scoped_ptr(new OverlayStrategySingleOnTop(&validator_))); | 2138 make_scoped_ptr(new OverlayStrategySingleOnTop(&validator_))); |
| 2137 } | 2139 } |
| 2138 | 2140 |
| 2139 SingleOverlayValidator validator_; | 2141 SingleOverlayValidator validator_; |
| 2140 }; | 2142 }; |
| 2141 | 2143 |
| 2142 class WaitSyncPointCountingContext : public TestWebGraphicsContext3D { | 2144 class WaitSyncPointCountingContext : public TestWebGraphicsContext3D { |
| 2143 public: | 2145 public: |
| 2144 MOCK_METHOD1(waitSyncPoint, void(unsigned sync_point)); | 2146 MOCK_METHOD1(waitSyncPoint, |
| 2147 void(unsigned sync_point, const gpu::SyncToken& sync_Token)); |
| 2145 }; | 2148 }; |
| 2146 | 2149 |
| 2147 class MockOverlayScheduler { | 2150 class MockOverlayScheduler { |
| 2148 public: | 2151 public: |
| 2149 MOCK_METHOD5(Schedule, | 2152 MOCK_METHOD5(Schedule, |
| 2150 void(int plane_z_order, | 2153 void(int plane_z_order, |
| 2151 gfx::OverlayTransform plane_transform, | 2154 gfx::OverlayTransform plane_transform, |
| 2152 unsigned overlay_texture_id, | 2155 unsigned overlay_texture_id, |
| 2153 const gfx::Rect& display_bounds, | 2156 const gfx::Rect& display_bounds, |
| 2154 const gfx::RectF& uv_rect)); | 2157 const gfx::RectF& uv_rect)); |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2213 SharedQuadState* shared_state = root_pass->CreateAndAppendSharedQuadState(); | 2216 SharedQuadState* shared_state = root_pass->CreateAndAppendSharedQuadState(); |
| 2214 shared_state->SetAll(gfx::Transform(), viewport_rect.size(), viewport_rect, | 2217 shared_state->SetAll(gfx::Transform(), viewport_rect.size(), viewport_rect, |
| 2215 viewport_rect, false, 1, SkXfermode::kSrcOver_Mode, 0); | 2218 viewport_rect, false, 1, SkXfermode::kSrcOver_Mode, 0); |
| 2216 overlay_quad->SetNew(shared_state, viewport_rect, viewport_rect, | 2219 overlay_quad->SetNew(shared_state, viewport_rect, viewport_rect, |
| 2217 viewport_rect, resource_id, premultiplied_alpha, | 2220 viewport_rect, resource_id, premultiplied_alpha, |
| 2218 uv_top_left, uv_bottom_right, SK_ColorTRANSPARENT, | 2221 uv_top_left, uv_bottom_right, SK_ColorTRANSPARENT, |
| 2219 vertex_opacity, flipped, nearest_neighbor); | 2222 vertex_opacity, flipped, nearest_neighbor); |
| 2220 | 2223 |
| 2221 // Verify that overlay_quad actually gets turned into an overlay, and even | 2224 // Verify that overlay_quad actually gets turned into an overlay, and even |
| 2222 // though it's not drawn, that its sync point is waited on. | 2225 // though it's not drawn, that its sync point is waited on. |
| 2223 EXPECT_CALL(*context, waitSyncPoint(sync_point)).Times(1); | 2226 EXPECT_CALL(*context, waitSyncPoint(sync_point, gpu::SyncToken())).Times(1); |
| 2224 EXPECT_CALL(overlay_scheduler, | 2227 EXPECT_CALL(overlay_scheduler, |
| 2225 Schedule(1, gfx::OVERLAY_TRANSFORM_NONE, _, viewport_rect, | 2228 Schedule(1, gfx::OVERLAY_TRANSFORM_NONE, _, viewport_rect, |
| 2226 BoundingRect(uv_top_left, uv_bottom_right))).Times(1); | 2229 BoundingRect(uv_top_left, uv_bottom_right))).Times(1); |
| 2227 | 2230 |
| 2228 renderer.DrawFrame(&render_passes_in_draw_order_, 1.f, viewport_rect, | 2231 renderer.DrawFrame(&render_passes_in_draw_order_, 1.f, viewport_rect, |
| 2229 viewport_rect, false); | 2232 viewport_rect, false); |
| 2230 } | 2233 } |
| 2231 | 2234 |
| 2232 } // namespace | 2235 } // namespace |
| 2233 } // namespace cc | 2236 } // namespace cc |
| OLD | NEW |