OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/test/layer_tree_pixel_resource_test.h" | 5 #include "cc/test/layer_tree_pixel_resource_test.h" |
6 | 6 |
7 #include "cc/layers/layer.h" | 7 #include "cc/layers/layer.h" |
8 #include "cc/resources/bitmap_tile_task_worker_pool.h" | 8 #include "cc/resources/bitmap_tile_task_worker_pool.h" |
9 #include "cc/resources/gpu_rasterizer.h" | 9 #include "cc/resources/gpu_rasterizer.h" |
10 #include "cc/resources/gpu_tile_task_worker_pool.h" | 10 #include "cc/resources/gpu_tile_task_worker_pool.h" |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 host_impl->output_surface()->context_provider(); | 161 host_impl->output_surface()->context_provider(); |
162 ResourceProvider* resource_provider = host_impl->resource_provider(); | 162 ResourceProvider* resource_provider = host_impl->resource_provider(); |
163 size_t max_transfer_buffer_usage_bytes = 1024u * 1024u * 60u; | 163 size_t max_transfer_buffer_usage_bytes = 1024u * 1024u * 60u; |
164 | 164 |
165 switch (resource_pool_option_) { | 165 switch (resource_pool_option_) { |
166 case BITMAP_TILE_TASK_WORKER_POOL: | 166 case BITMAP_TILE_TASK_WORKER_POOL: |
167 EXPECT_FALSE(context_provider); | 167 EXPECT_FALSE(context_provider); |
168 EXPECT_EQ(PIXEL_TEST_SOFTWARE, test_type_); | 168 EXPECT_EQ(PIXEL_TEST_SOFTWARE, test_type_); |
169 *resource_pool = | 169 *resource_pool = |
170 ResourcePool::Create(resource_provider, | 170 ResourcePool::Create(resource_provider, |
171 draw_texture_target_, | 171 draw_texture_target_); |
172 resource_provider->best_texture_format()); | |
173 | 172 |
174 *tile_task_worker_pool = BitmapTileTaskWorkerPool::Create( | 173 *tile_task_worker_pool = BitmapTileTaskWorkerPool::Create( |
175 task_runner, TileTaskWorkerPool::GetTaskGraphRunner(), | 174 task_runner, TileTaskWorkerPool::GetTaskGraphRunner(), |
176 resource_provider); | 175 resource_provider); |
177 break; | 176 break; |
178 case GPU_TILE_TASK_WORKER_POOL: | 177 case GPU_TILE_TASK_WORKER_POOL: |
179 EXPECT_TRUE(context_provider); | 178 EXPECT_TRUE(context_provider); |
180 EXPECT_EQ(PIXEL_TEST_GL, test_type_); | 179 EXPECT_EQ(PIXEL_TEST_GL, test_type_); |
181 *resource_pool = | 180 *resource_pool = |
182 ResourcePool::Create(resource_provider, | 181 ResourcePool::Create(resource_provider, |
183 draw_texture_target_, | 182 draw_texture_target_); |
184 resource_provider->best_texture_format()); | |
185 | 183 |
186 *tile_task_worker_pool = GpuTileTaskWorkerPool::Create( | 184 *tile_task_worker_pool = GpuTileTaskWorkerPool::Create( |
187 task_runner, TileTaskWorkerPool::GetTaskGraphRunner()); | 185 task_runner, TileTaskWorkerPool::GetTaskGraphRunner(), |
| 186 resource_provider->best_texture_format()); |
188 break; | 187 break; |
189 case ZERO_COPY_TILE_TASK_WORKER_POOL: | 188 case ZERO_COPY_TILE_TASK_WORKER_POOL: |
190 EXPECT_TRUE(context_provider); | 189 EXPECT_TRUE(context_provider); |
191 EXPECT_EQ(PIXEL_TEST_GL, test_type_); | 190 EXPECT_EQ(PIXEL_TEST_GL, test_type_); |
192 EXPECT_TRUE(host_impl->GetRendererCapabilities().using_image); | 191 EXPECT_TRUE(host_impl->GetRendererCapabilities().using_image); |
193 *resource_pool = | 192 *resource_pool = |
194 ResourcePool::Create(resource_provider, | 193 ResourcePool::Create(resource_provider, draw_texture_target_); |
195 draw_texture_target_, | |
196 resource_provider->best_texture_format()); | |
197 | 194 |
198 *tile_task_worker_pool = ZeroCopyTileTaskWorkerPool::Create( | 195 *tile_task_worker_pool = ZeroCopyTileTaskWorkerPool::Create( |
199 task_runner, TileTaskWorkerPool::GetTaskGraphRunner(), | 196 task_runner, TileTaskWorkerPool::GetTaskGraphRunner(), |
200 resource_provider); | 197 resource_provider); |
201 break; | 198 break; |
202 case ONE_COPY_TILE_TASK_WORKER_POOL: | 199 case ONE_COPY_TILE_TASK_WORKER_POOL: |
203 EXPECT_TRUE(context_provider); | 200 EXPECT_TRUE(context_provider); |
204 EXPECT_EQ(PIXEL_TEST_GL, test_type_); | 201 EXPECT_EQ(PIXEL_TEST_GL, test_type_); |
205 EXPECT_TRUE(host_impl->GetRendererCapabilities().using_image); | 202 EXPECT_TRUE(host_impl->GetRendererCapabilities().using_image); |
206 // We need to create a staging resource pool when using copy rasterizer. | 203 // We need to create a staging resource pool when using copy rasterizer. |
207 *staging_resource_pool = | 204 *staging_resource_pool = |
208 ResourcePool::Create(resource_provider, | 205 ResourcePool::Create(resource_provider, staging_texture_target_); |
209 staging_texture_target_, | |
210 resource_provider->best_texture_format()); | |
211 *resource_pool = | 206 *resource_pool = |
212 ResourcePool::Create(resource_provider, | 207 ResourcePool::Create(resource_provider, draw_texture_target_); |
213 draw_texture_target_, | |
214 resource_provider->best_texture_format()); | |
215 | 208 |
216 *tile_task_worker_pool = OneCopyTileTaskWorkerPool::Create( | 209 *tile_task_worker_pool = OneCopyTileTaskWorkerPool::Create( |
217 task_runner, TileTaskWorkerPool::GetTaskGraphRunner(), | 210 task_runner, TileTaskWorkerPool::GetTaskGraphRunner(), |
218 context_provider, resource_provider, staging_resource_pool->get()); | 211 context_provider, resource_provider, staging_resource_pool->get()); |
219 break; | 212 break; |
220 case PIXEL_BUFFER_TILE_TASK_WORKER_POOL: | 213 case PIXEL_BUFFER_TILE_TASK_WORKER_POOL: |
221 EXPECT_TRUE(context_provider); | 214 EXPECT_TRUE(context_provider); |
222 EXPECT_EQ(PIXEL_TEST_GL, test_type_); | 215 EXPECT_EQ(PIXEL_TEST_GL, test_type_); |
223 *resource_pool = ResourcePool::Create( | 216 *resource_pool = ResourcePool::Create( |
224 resource_provider, | 217 resource_provider, draw_texture_target_); |
225 draw_texture_target_, | |
226 resource_provider->memory_efficient_texture_format()); | |
227 | 218 |
228 *tile_task_worker_pool = PixelBufferTileTaskWorkerPool::Create( | 219 *tile_task_worker_pool = PixelBufferTileTaskWorkerPool::Create( |
229 task_runner, TileTaskWorkerPool::GetTaskGraphRunner(), | 220 task_runner, TileTaskWorkerPool::GetTaskGraphRunner(), |
230 context_provider, resource_provider, max_transfer_buffer_usage_bytes); | 221 context_provider, resource_provider, max_transfer_buffer_usage_bytes); |
231 break; | 222 break; |
232 } | 223 } |
233 } | 224 } |
234 | 225 |
235 void LayerTreeHostPixelResourceTest::RunPixelResourceTest( | 226 void LayerTreeHostPixelResourceTest::RunPixelResourceTest( |
236 scoped_refptr<Layer> content_root, | 227 scoped_refptr<Layer> content_root, |
237 base::FilePath file_name) { | 228 base::FilePath file_name) { |
238 if (!IsTestCaseSupported(test_case_)) | 229 if (!IsTestCaseSupported(test_case_)) |
239 return; | 230 return; |
240 RunPixelTest(test_type_, content_root, file_name); | 231 RunPixelTest(test_type_, content_root, file_name); |
241 | 232 |
242 if (layer_tree_host()) | 233 if (layer_tree_host()) |
243 EXPECT_TRUE(layer_tree_host()->settings().impl_side_painting); | 234 EXPECT_TRUE(layer_tree_host()->settings().impl_side_painting); |
244 } | 235 } |
245 | 236 |
246 ParameterizedPixelResourceTest::ParameterizedPixelResourceTest() | 237 ParameterizedPixelResourceTest::ParameterizedPixelResourceTest() |
247 : LayerTreeHostPixelResourceTest(GetParam()) { | 238 : LayerTreeHostPixelResourceTest(GetParam()) { |
248 } | 239 } |
249 | 240 |
250 } // namespace cc | 241 } // namespace cc |
OLD | NEW |