OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_test.h" | 5 #include "cc/test/layer_tree_pixel_test.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/path_service.h" | 8 #include "base/path_service.h" |
9 #include "cc/base/switches.h" | 9 #include "cc/base/switches.h" |
10 #include "cc/layers/solid_color_layer.h" | 10 #include "cc/layers/solid_color_layer.h" |
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
240 scoped_ptr<SkBitmap> LayerTreePixelTest::CopyTextureMailboxToBitmap( | 240 scoped_ptr<SkBitmap> LayerTreePixelTest::CopyTextureMailboxToBitmap( |
241 const gfx::Size& size, | 241 const gfx::Size& size, |
242 const TextureMailbox& texture_mailbox) { | 242 const TextureMailbox& texture_mailbox) { |
243 DCHECK(texture_mailbox.IsTexture()); | 243 DCHECK(texture_mailbox.IsTexture()); |
244 if (!texture_mailbox.IsTexture()) | 244 if (!texture_mailbox.IsTexture()) |
245 return nullptr; | 245 return nullptr; |
246 | 246 |
247 scoped_ptr<gpu::GLInProcessContext> context = CreateTestInProcessContext(); | 247 scoped_ptr<gpu::GLInProcessContext> context = CreateTestInProcessContext(); |
248 GLES2Interface* gl = context->GetImplementation(); | 248 GLES2Interface* gl = context->GetImplementation(); |
249 | 249 |
250 if (texture_mailbox.sync_point()) | 250 if (texture_mailbox.sync_token().HasData()) |
251 gl->WaitSyncPointCHROMIUM(texture_mailbox.sync_point()); | 251 gl->WaitSyncTokenCHROMIUM(texture_mailbox.sync_token().GetConstData()); |
252 | 252 |
253 GLuint texture_id = 0; | 253 GLuint texture_id = 0; |
254 gl->GenTextures(1, &texture_id); | 254 gl->GenTextures(1, &texture_id); |
255 gl->BindTexture(GL_TEXTURE_2D, texture_id); | 255 gl->BindTexture(GL_TEXTURE_2D, texture_id); |
256 gl->TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); | 256 gl->TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); |
257 gl->TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); | 257 gl->TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); |
258 gl->TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); | 258 gl->TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); |
259 gl->TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); | 259 gl->TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); |
260 gl->ConsumeTextureCHROMIUM(texture_mailbox.target(), texture_mailbox.name()); | 260 gl->ConsumeTextureCHROMIUM(texture_mailbox.target(), texture_mailbox.name()); |
261 gl->BindTexture(GL_TEXTURE_2D, 0); | 261 gl->BindTexture(GL_TEXTURE_2D, 0); |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
298 out_pixels[dest_y + x + SK_A32_SHIFT/8] = pixels.get()[src_y + x + 3]; | 298 out_pixels[dest_y + x + SK_A32_SHIFT/8] = pixels.get()[src_y + x + 3]; |
299 } | 299 } |
300 } | 300 } |
301 | 301 |
302 return bitmap.Pass(); | 302 return bitmap.Pass(); |
303 } | 303 } |
304 | 304 |
305 void LayerTreePixelTest::ReleaseTextureMailbox( | 305 void LayerTreePixelTest::ReleaseTextureMailbox( |
306 scoped_ptr<gpu::GLInProcessContext> context, | 306 scoped_ptr<gpu::GLInProcessContext> context, |
307 uint32 texture, | 307 uint32 texture, |
308 uint32 sync_point, | 308 const gpu::SyncToken& sync_token, |
309 bool lost_resource) { | 309 bool lost_resource) { |
310 GLES2Interface* gl = context->GetImplementation(); | 310 GLES2Interface* gl = context->GetImplementation(); |
311 if (sync_point) | 311 if (sync_token.HasData()) |
312 gl->WaitSyncPointCHROMIUM(sync_point); | 312 gl->WaitSyncTokenCHROMIUM(sync_token.GetConstData()); |
313 gl->DeleteTextures(1, &texture); | 313 gl->DeleteTextures(1, &texture); |
314 pending_texture_mailbox_callbacks_--; | 314 pending_texture_mailbox_callbacks_--; |
315 TryEndTest(); | 315 TryEndTest(); |
316 } | 316 } |
317 | 317 |
318 void LayerTreePixelTest::CopyBitmapToTextureMailboxAsTexture( | 318 void LayerTreePixelTest::CopyBitmapToTextureMailboxAsTexture( |
319 const SkBitmap& bitmap, | 319 const SkBitmap& bitmap, |
320 TextureMailbox* texture_mailbox, | 320 TextureMailbox* texture_mailbox, |
321 scoped_ptr<SingleReleaseCallback>* release_callback) { | 321 scoped_ptr<SingleReleaseCallback>* release_callback) { |
322 DCHECK_GT(bitmap.width(), 0); | 322 DCHECK_GT(bitmap.width(), 0); |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
366 GL_UNSIGNED_BYTE, | 366 GL_UNSIGNED_BYTE, |
367 gl_pixels.get()); | 367 gl_pixels.get()); |
368 } | 368 } |
369 | 369 |
370 gpu::Mailbox mailbox; | 370 gpu::Mailbox mailbox; |
371 gl->GenMailboxCHROMIUM(mailbox.name); | 371 gl->GenMailboxCHROMIUM(mailbox.name); |
372 gl->ProduceTextureCHROMIUM(GL_TEXTURE_2D, mailbox.name); | 372 gl->ProduceTextureCHROMIUM(GL_TEXTURE_2D, mailbox.name); |
373 gl->BindTexture(GL_TEXTURE_2D, 0); | 373 gl->BindTexture(GL_TEXTURE_2D, 0); |
374 uint32 sync_point = gl->InsertSyncPointCHROMIUM(); | 374 uint32 sync_point = gl->InsertSyncPointCHROMIUM(); |
375 | 375 |
376 *texture_mailbox = TextureMailbox(mailbox, GL_TEXTURE_2D, sync_point); | 376 *texture_mailbox = |
| 377 TextureMailbox(mailbox, gpu::SyncToken(sync_point), GL_TEXTURE_2D); |
377 *release_callback = SingleReleaseCallback::Create( | 378 *release_callback = SingleReleaseCallback::Create( |
378 base::Bind(&LayerTreePixelTest::ReleaseTextureMailbox, | 379 base::Bind(&LayerTreePixelTest::ReleaseTextureMailbox, |
379 base::Unretained(this), | 380 base::Unretained(this), |
380 base::Passed(&context), | 381 base::Passed(&context), |
381 texture_id)); | 382 texture_id)); |
382 } | 383 } |
383 | 384 |
384 void LayerTreePixelTest::Finish() { | 385 void LayerTreePixelTest::Finish() { |
385 scoped_ptr<gpu::GLInProcessContext> context = CreateTestInProcessContext(); | 386 scoped_ptr<gpu::GLInProcessContext> context = CreateTestInProcessContext(); |
386 GLES2Interface* gl = context->GetImplementation(); | 387 GLES2Interface* gl = context->GetImplementation(); |
387 gl->Finish(); | 388 gl->Finish(); |
388 } | 389 } |
389 | 390 |
390 } // namespace cc | 391 } // namespace cc |
OLD | NEW |