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 "cc/output/compositor_frame_metadata.h" | 7 #include "cc/output/compositor_frame_metadata.h" |
8 #include "cc/resources/prioritized_resource_manager.h" | 8 #include "cc/resources/prioritized_resource_manager.h" |
9 #include "cc/resources/resource_provider.h" | 9 #include "cc/resources/resource_provider.h" |
10 #include "cc/test/fake_impl_proxy.h" | 10 #include "cc/test/fake_impl_proxy.h" |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 | 48 |
49 namespace cc { | 49 namespace cc { |
50 | 50 |
51 #define EXPECT_PROGRAM_VALID(program_binding) \ | 51 #define EXPECT_PROGRAM_VALID(program_binding) \ |
52 do { \ | 52 do { \ |
53 EXPECT_TRUE(program_binding->program()); \ | 53 EXPECT_TRUE(program_binding->program()); \ |
54 EXPECT_TRUE(program_binding->initialized()); \ | 54 EXPECT_TRUE(program_binding->initialized()); \ |
55 } while (false) | 55 } while (false) |
56 | 56 |
57 // Explicitly named to be a friend in GLRenderer for shader access. | 57 // Explicitly named to be a friend in GLRenderer for shader access. |
58 class GLRendererShaderPixelTest : public PixelTest { | 58 class GLRendererShaderPixelTest : public GLRendererPixelTest { |
59 public: | 59 public: |
60 void TestShaders() { | 60 void TestShaders() { |
61 ASSERT_FALSE(renderer_->IsContextLost()); | 61 ASSERT_FALSE(renderer()->IsContextLost()); |
62 EXPECT_PROGRAM_VALID(renderer_->GetTileCheckerboardProgram()); | 62 EXPECT_PROGRAM_VALID(renderer()->GetTileCheckerboardProgram()); |
63 EXPECT_PROGRAM_VALID(renderer_->GetDebugBorderProgram()); | 63 EXPECT_PROGRAM_VALID(renderer()->GetDebugBorderProgram()); |
64 EXPECT_PROGRAM_VALID(renderer_->GetSolidColorProgram()); | 64 EXPECT_PROGRAM_VALID(renderer()->GetSolidColorProgram()); |
65 EXPECT_PROGRAM_VALID(renderer_->GetSolidColorProgramAA()); | 65 EXPECT_PROGRAM_VALID(renderer()->GetSolidColorProgramAA()); |
66 TestShadersWithTexCoordPrecision(TexCoordPrecisionMedium); | 66 TestShadersWithTexCoordPrecision(TexCoordPrecisionMedium); |
67 TestShadersWithTexCoordPrecision(TexCoordPrecisionHigh); | 67 TestShadersWithTexCoordPrecision(TexCoordPrecisionHigh); |
68 ASSERT_FALSE(renderer_->IsContextLost()); | 68 ASSERT_FALSE(renderer()->IsContextLost()); |
69 } | 69 } |
70 | 70 |
71 void TestShadersWithTexCoordPrecision(TexCoordPrecision precision) { | 71 void TestShadersWithTexCoordPrecision(TexCoordPrecision precision) { |
72 EXPECT_PROGRAM_VALID(renderer_->GetTileProgram(precision)); | 72 EXPECT_PROGRAM_VALID(renderer()->GetTileProgram(precision)); |
73 EXPECT_PROGRAM_VALID(renderer_->GetTileProgramOpaque(precision)); | 73 EXPECT_PROGRAM_VALID(renderer()->GetTileProgramOpaque(precision)); |
74 EXPECT_PROGRAM_VALID(renderer_->GetTileProgramAA(precision)); | 74 EXPECT_PROGRAM_VALID(renderer()->GetTileProgramAA(precision)); |
75 EXPECT_PROGRAM_VALID(renderer_->GetTileProgramSwizzle(precision)); | 75 EXPECT_PROGRAM_VALID(renderer()->GetTileProgramSwizzle(precision)); |
76 EXPECT_PROGRAM_VALID(renderer_->GetTileProgramSwizzleOpaque(precision)); | 76 EXPECT_PROGRAM_VALID(renderer()->GetTileProgramSwizzleOpaque(precision)); |
77 EXPECT_PROGRAM_VALID(renderer_->GetTileProgramSwizzleAA(precision)); | 77 EXPECT_PROGRAM_VALID(renderer()->GetTileProgramSwizzleAA(precision)); |
78 EXPECT_PROGRAM_VALID(renderer_->GetRenderPassProgram(precision)); | 78 EXPECT_PROGRAM_VALID(renderer()->GetRenderPassProgram(precision)); |
79 EXPECT_PROGRAM_VALID(renderer_->GetRenderPassProgramAA(precision)); | 79 EXPECT_PROGRAM_VALID(renderer()->GetRenderPassProgramAA(precision)); |
80 EXPECT_PROGRAM_VALID(renderer_->GetRenderPassMaskProgram(precision)); | 80 EXPECT_PROGRAM_VALID(renderer()->GetRenderPassMaskProgram(precision)); |
81 EXPECT_PROGRAM_VALID(renderer_->GetRenderPassMaskProgramAA(precision)); | 81 EXPECT_PROGRAM_VALID(renderer()->GetRenderPassMaskProgramAA(precision)); |
82 EXPECT_PROGRAM_VALID( | 82 EXPECT_PROGRAM_VALID( |
83 renderer_->GetRenderPassColorMatrixProgram(precision)); | 83 renderer()->GetRenderPassColorMatrixProgram(precision)); |
84 EXPECT_PROGRAM_VALID( | 84 EXPECT_PROGRAM_VALID( |
85 renderer_->GetRenderPassMaskColorMatrixProgramAA(precision)); | 85 renderer()->GetRenderPassMaskColorMatrixProgramAA(precision)); |
86 EXPECT_PROGRAM_VALID( | 86 EXPECT_PROGRAM_VALID( |
87 renderer_->GetRenderPassColorMatrixProgramAA(precision)); | 87 renderer()->GetRenderPassColorMatrixProgramAA(precision)); |
88 EXPECT_PROGRAM_VALID( | 88 EXPECT_PROGRAM_VALID( |
89 renderer_->GetRenderPassMaskColorMatrixProgram(precision)); | 89 renderer()->GetRenderPassMaskColorMatrixProgram(precision)); |
90 EXPECT_PROGRAM_VALID(renderer_->GetTextureProgram(precision)); | 90 EXPECT_PROGRAM_VALID(renderer()->GetTextureProgram(precision)); |
91 EXPECT_PROGRAM_VALID(renderer_->GetTextureProgramFlip(precision)); | 91 EXPECT_PROGRAM_VALID(renderer()->GetTextureProgramFlip(precision)); |
92 EXPECT_PROGRAM_VALID(renderer_->GetTextureIOSurfaceProgram(precision)); | 92 EXPECT_PROGRAM_VALID(renderer()->GetTextureIOSurfaceProgram(precision)); |
93 EXPECT_PROGRAM_VALID(renderer_->GetVideoYUVProgram(precision)); | 93 EXPECT_PROGRAM_VALID(renderer()->GetVideoYUVProgram(precision)); |
94 // This is unlikely to be ever true in tests due to usage of osmesa. | 94 // This is unlikely to be ever true in tests due to usage of osmesa. |
95 if (renderer_->Capabilities().using_egl_image) | 95 if (renderer()->Capabilities().using_egl_image) |
96 EXPECT_PROGRAM_VALID(renderer_->GetVideoStreamTextureProgram(precision)); | 96 EXPECT_PROGRAM_VALID(renderer()->GetVideoStreamTextureProgram(precision)); |
97 else | 97 else |
98 EXPECT_FALSE(renderer_->GetVideoStreamTextureProgram(precision)); | 98 EXPECT_FALSE(renderer()->GetVideoStreamTextureProgram(precision)); |
99 } | 99 } |
100 }; | 100 }; |
101 | 101 |
102 namespace { | 102 namespace { |
103 | 103 |
104 #if !defined(OS_ANDROID) | 104 #if !defined(OS_ANDROID) |
105 TEST_F(GLRendererShaderPixelTest, AllShadersCompile) { TestShaders(); } | 105 TEST_F(GLRendererShaderPixelTest, AllShadersCompile) { TestShaders(); } |
106 #endif | 106 #endif |
107 | 107 |
108 class FrameCountingMemoryAllocationSettingContext | 108 class FrameCountingMemoryAllocationSettingContext |
(...skipping 1312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1421 } | 1421 } |
1422 }; | 1422 }; |
1423 | 1423 |
1424 TEST_F(MockOutputSurfaceTestWithSendCompositorFrame, DrawFrame) { | 1424 TEST_F(MockOutputSurfaceTestWithSendCompositorFrame, DrawFrame) { |
1425 EXPECT_CALL(output_surface_, SendFrameToParentCompositor(_)).Times(1); | 1425 EXPECT_CALL(output_surface_, SendFrameToParentCompositor(_)).Times(1); |
1426 DrawFrame(); | 1426 DrawFrame(); |
1427 } | 1427 } |
1428 | 1428 |
1429 } // namespace | 1429 } // namespace |
1430 } // namespace cc | 1430 } // namespace cc |
OLD | NEW |