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

Side by Side Diff: cc/trees/layer_tree_host_impl_unittest.cc

Issue 1781093002: Add CONTEXT_TYPE_OPENGLES2_PEPPER (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rev bug list json version Created 4 years, 9 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/test/test_web_graphics_context_3d.h ('k') | gpu/command_buffer/common/capabilities.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 2011 The Chromium Authors. All rights reserved. 1 // Copyright 2011 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/trees/layer_tree_host_impl.h" 5 #include "cc/trees/layer_tree_host_impl.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <cmath> 10 #include <cmath>
(...skipping 10170 matching lines...) Expand 10 before | Expand all | Expand 10 after
10181 settings.gpu_rasterization_forced = true; 10181 settings.gpu_rasterization_forced = true;
10182 EXPECT_TRUE(CreateHostImpl(settings, FakeOutputSurface::Create3d())); 10182 EXPECT_TRUE(CreateHostImpl(settings, FakeOutputSurface::Create3d()));
10183 10183
10184 host_impl_->SetHasGpuRasterizationTrigger(false); 10184 host_impl_->SetHasGpuRasterizationTrigger(false);
10185 host_impl_->SetContentIsSuitableForGpuRasterization(false); 10185 host_impl_->SetContentIsSuitableForGpuRasterization(false);
10186 EXPECT_EQ(GpuRasterizationStatus::ON_FORCED, 10186 EXPECT_EQ(GpuRasterizationStatus::ON_FORCED,
10187 host_impl_->gpu_rasterization_status()); 10187 host_impl_->gpu_rasterization_status());
10188 EXPECT_TRUE(host_impl_->use_gpu_rasterization()); 10188 EXPECT_TRUE(host_impl_->use_gpu_rasterization());
10189 } 10189 }
10190 10190
10191 class MsaaIsSlowLayerTreeHostImplTest : public LayerTreeHostImplTest {
10192 public:
10193 void CreateHostImplWithMsaaIsSlow(bool msaa_is_slow) {
10194 LayerTreeSettings settings = DefaultSettings();
10195 settings.gpu_rasterization_enabled = true;
10196 settings.gpu_rasterization_msaa_sample_count = 4;
10197 auto context_provider = TestContextProvider::Create();
10198 context_provider->UnboundTestContext3d()->SetMaxSamples(4);
10199 context_provider->UnboundTestContext3d()->set_msaa_is_slow(msaa_is_slow);
10200 auto msaa_is_normal_output_surface =
10201 FakeOutputSurface::Create3d(context_provider);
10202 EXPECT_TRUE(
10203 CreateHostImpl(settings, std::move(msaa_is_normal_output_surface)));
10204 }
10205 };
10206
10207 TEST_F(MsaaIsSlowLayerTreeHostImplTest, GpuRasterizationStatusMsaaIsSlow) {
10208 // Ensure that without the msaa_is_slow cap we raster unsuitable content with
10209 // msaa.
10210 CreateHostImplWithMsaaIsSlow(false);
10211 host_impl_->SetHasGpuRasterizationTrigger(true);
10212 host_impl_->SetContentIsSuitableForGpuRasterization(false);
10213 EXPECT_EQ(GpuRasterizationStatus::MSAA_CONTENT,
10214 host_impl_->gpu_rasterization_status());
10215 EXPECT_TRUE(host_impl_->use_gpu_rasterization());
10216
10217 // Ensure that with the msaa_is_slow cap we don't raster unsuitable content
10218 // with msaa.
10219 CreateHostImplWithMsaaIsSlow(true);
10220 host_impl_->SetHasGpuRasterizationTrigger(true);
10221 host_impl_->SetContentIsSuitableForGpuRasterization(false);
10222 EXPECT_EQ(GpuRasterizationStatus::OFF_CONTENT,
10223 host_impl_->gpu_rasterization_status());
10224 EXPECT_FALSE(host_impl_->use_gpu_rasterization());
10225 }
10226
10191 // A mock output surface which lets us detect calls to ForceReclaimResources. 10227 // A mock output surface which lets us detect calls to ForceReclaimResources.
10192 class MockReclaimResourcesOutputSurface : public FakeOutputSurface { 10228 class MockReclaimResourcesOutputSurface : public FakeOutputSurface {
10193 public: 10229 public:
10194 static scoped_ptr<MockReclaimResourcesOutputSurface> Create3d() { 10230 static scoped_ptr<MockReclaimResourcesOutputSurface> Create3d() {
10195 return make_scoped_ptr(new MockReclaimResourcesOutputSurface( 10231 return make_scoped_ptr(new MockReclaimResourcesOutputSurface(
10196 TestContextProvider::Create(), TestContextProvider::CreateWorker(), 10232 TestContextProvider::Create(), TestContextProvider::CreateWorker(),
10197 false)); 10233 false));
10198 } 10234 }
10199 10235
10200 MOCK_METHOD0(ForceReclaimResources, void()); 10236 MOCK_METHOD0(ForceReclaimResources, void());
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
10357 // There should not be any jitter measured till we hit the fixed point hits 10393 // There should not be any jitter measured till we hit the fixed point hits
10358 // threshold. 10394 // threshold.
10359 float expected_jitter = 10395 float expected_jitter =
10360 (i == pending_tree->kFixedPointHitsThreshold) ? 500 : 0; 10396 (i == pending_tree->kFixedPointHitsThreshold) ? 500 : 0;
10361 EXPECT_EQ(jitter, expected_jitter); 10397 EXPECT_EQ(jitter, expected_jitter);
10362 } 10398 }
10363 } 10399 }
10364 10400
10365 } // namespace 10401 } // namespace
10366 } // namespace cc 10402 } // namespace cc
OLDNEW
« no previous file with comments | « cc/test/test_web_graphics_context_3d.h ('k') | gpu/command_buffer/common/capabilities.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698