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

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

Issue 885443002: Roll Chrome into Mojo. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Rebase to ToT mojo Created 5 years, 10 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/layers/texture_layer.h ('k') | cc/quads/checkerboard_draw_quad.cc » ('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 1360 matching lines...) Expand 10 before | Expand all | Expand 10 after
1371 AddClippedQuad(root_pass, quad_rect, SK_ColorGREEN); 1371 AddClippedQuad(root_pass, quad_rect, SK_ColorGREEN);
1372 1372
1373 renderer.DecideRenderPassAllocationsForFrame(render_passes_in_draw_order_); 1373 renderer.DecideRenderPassAllocationsForFrame(render_passes_in_draw_order_);
1374 renderer.DrawFrame(&render_passes_in_draw_order_, 1374 renderer.DrawFrame(&render_passes_in_draw_order_,
1375 1.f, 1375 1.f,
1376 device_viewport_rect, 1376 device_viewport_rect,
1377 device_viewport_rect, 1377 device_viewport_rect,
1378 false); 1378 false);
1379 } 1379 }
1380 1380
1381 TEST_F(GLRendererTest, DrawFramePreservesFramebuffer) {
1382 // When using render-to-FBO to display the surface, all rendering is done
1383 // to a non-zero FBO. Make sure that the framebuffer is always restored to
1384 // the correct framebuffer during rendering, if changed.
1385 // Note: there is one path that will set it to 0, but that is after the render
1386 // has finished.
1387 FakeOutputSurfaceClient output_surface_client;
1388 scoped_ptr<FakeOutputSurface> output_surface(
1389 FakeOutputSurface::Create3d(TestWebGraphicsContext3D::Create().Pass()));
1390 CHECK(output_surface->BindToClient(&output_surface_client));
1391
1392 scoped_ptr<SharedBitmapManager> shared_bitmap_manager(
1393 new TestSharedBitmapManager());
1394 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create(
1395 output_surface.get(), shared_bitmap_manager.get(), NULL, NULL, 0, false,
1396 1));
1397
1398 RendererSettings settings;
1399 FakeRendererClient renderer_client;
1400 FakeRendererGL renderer(&renderer_client, &settings, output_surface.get(),
1401 resource_provider.get());
1402 EXPECT_FALSE(renderer.Capabilities().using_partial_swap);
1403
1404 gfx::Rect device_viewport_rect(0, 0, 100, 100);
1405 gfx::Rect viewport_rect(device_viewport_rect.size());
1406 gfx::Rect quad_rect = gfx::Rect(20, 20, 20, 20);
1407
1408 RenderPassId root_pass_id(1, 0);
1409 TestRenderPass* root_pass =
1410 AddRenderPass(&render_passes_in_draw_order_, root_pass_id, viewport_rect,
1411 gfx::Transform());
1412 AddClippedQuad(root_pass, quad_rect, SK_ColorGREEN);
1413
1414 unsigned fbo;
1415 gpu::gles2::GLES2Interface* gl =
1416 output_surface->context_provider()->ContextGL();
1417 gl->GenFramebuffers(1, &fbo);
1418 output_surface->set_framebuffer(fbo);
1419
1420 renderer.DecideRenderPassAllocationsForFrame(render_passes_in_draw_order_);
1421 renderer.DrawFrame(&render_passes_in_draw_order_, 1.f, device_viewport_rect,
1422 device_viewport_rect, false);
1423
1424 int bound_fbo;
1425 gl->GetIntegerv(GL_FRAMEBUFFER_BINDING, &bound_fbo);
1426 EXPECT_EQ(static_cast<int>(fbo), bound_fbo);
1427 }
1428
1381 TEST_F(GLRendererShaderTest, DrawRenderPassQuadShaderPermutations) { 1429 TEST_F(GLRendererShaderTest, DrawRenderPassQuadShaderPermutations) {
1382 gfx::Rect viewport_rect(1, 1); 1430 gfx::Rect viewport_rect(1, 1);
1383 1431
1384 gfx::Rect child_rect(50, 50); 1432 gfx::Rect child_rect(50, 50);
1385 RenderPassId child_pass_id(2, 0); 1433 RenderPassId child_pass_id(2, 0);
1386 TestRenderPass* child_pass; 1434 TestRenderPass* child_pass;
1387 1435
1388 RenderPassId root_pass_id(1, 0); 1436 RenderPassId root_pass_id(1, 0);
1389 TestRenderPass* root_pass; 1437 TestRenderPass* root_pass;
1390 1438
(...skipping 534 matching lines...) Expand 10 before | Expand all | Expand 10 after
1925 base::MessageLoop::current()->Run(); 1973 base::MessageLoop::current()->Run();
1926 1974
1927 // The sync point should have happened. 1975 // The sync point should have happened.
1928 EXPECT_EQ(1, sync_point_callback_count); 1976 EXPECT_EQ(1, sync_point_callback_count);
1929 EXPECT_EQ(1, other_callback_count); 1977 EXPECT_EQ(1, other_callback_count);
1930 } 1978 }
1931 #endif // OS_ANDROID 1979 #endif // OS_ANDROID
1932 1980
1933 } // namespace 1981 } // namespace
1934 } // namespace cc 1982 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/texture_layer.h ('k') | cc/quads/checkerboard_draw_quad.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698