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

Side by Side Diff: cc/test/layer_tree_pixel_test.cc

Issue 1427543002: Modified old wait sync point functions to also accept new sync tokens. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix mock gpu video accelerator factory Created 5 years, 1 month 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
OLDNEW
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
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_point() || texture_mailbox.sync_token().HasData()) {
251 gl->WaitSyncPointCHROMIUM(texture_mailbox.sync_point()); 251 gl->WaitSyncPointCHROMIUM(texture_mailbox.sync_point(),
252 texture_mailbox.sync_token().GetConstData());
253 }
252 254
253 GLuint texture_id = 0; 255 GLuint texture_id = 0;
254 gl->GenTextures(1, &texture_id); 256 gl->GenTextures(1, &texture_id);
255 gl->BindTexture(GL_TEXTURE_2D, texture_id); 257 gl->BindTexture(GL_TEXTURE_2D, texture_id);
256 gl->TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); 258 gl->TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
257 gl->TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); 259 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); 260 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); 261 gl->TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
260 gl->ConsumeTextureCHROMIUM(texture_mailbox.target(), texture_mailbox.name()); 262 gl->ConsumeTextureCHROMIUM(texture_mailbox.target(), texture_mailbox.name());
261 gl->BindTexture(GL_TEXTURE_2D, 0); 263 gl->BindTexture(GL_TEXTURE_2D, 0);
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
299 } 301 }
300 } 302 }
301 303
302 return bitmap.Pass(); 304 return bitmap.Pass();
303 } 305 }
304 306
305 void LayerTreePixelTest::ReleaseTextureMailbox( 307 void LayerTreePixelTest::ReleaseTextureMailbox(
306 scoped_ptr<gpu::GLInProcessContext> context, 308 scoped_ptr<gpu::GLInProcessContext> context,
307 uint32 texture, 309 uint32 texture,
308 uint32 sync_point, 310 uint32 sync_point,
311 const gpu::SyncToken& sync_token,
309 bool lost_resource) { 312 bool lost_resource) {
310 GLES2Interface* gl = context->GetImplementation(); 313 GLES2Interface* gl = context->GetImplementation();
311 if (sync_point) 314 if (sync_point || sync_token.HasData())
312 gl->WaitSyncPointCHROMIUM(sync_point); 315 gl->WaitSyncPointCHROMIUM(sync_point, sync_token.GetConstData());
313 gl->DeleteTextures(1, &texture); 316 gl->DeleteTextures(1, &texture);
314 pending_texture_mailbox_callbacks_--; 317 pending_texture_mailbox_callbacks_--;
315 TryEndTest(); 318 TryEndTest();
316 } 319 }
317 320
318 void LayerTreePixelTest::CopyBitmapToTextureMailboxAsTexture( 321 void LayerTreePixelTest::CopyBitmapToTextureMailboxAsTexture(
319 const SkBitmap& bitmap, 322 const SkBitmap& bitmap,
320 TextureMailbox* texture_mailbox, 323 TextureMailbox* texture_mailbox,
321 scoped_ptr<SingleReleaseCallback>* release_callback) { 324 scoped_ptr<SingleReleaseCallback>* release_callback) {
322 DCHECK_GT(bitmap.width(), 0); 325 DCHECK_GT(bitmap.width(), 0);
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
366 GL_UNSIGNED_BYTE, 369 GL_UNSIGNED_BYTE,
367 gl_pixels.get()); 370 gl_pixels.get());
368 } 371 }
369 372
370 gpu::Mailbox mailbox; 373 gpu::Mailbox mailbox;
371 gl->GenMailboxCHROMIUM(mailbox.name); 374 gl->GenMailboxCHROMIUM(mailbox.name);
372 gl->ProduceTextureCHROMIUM(GL_TEXTURE_2D, mailbox.name); 375 gl->ProduceTextureCHROMIUM(GL_TEXTURE_2D, mailbox.name);
373 gl->BindTexture(GL_TEXTURE_2D, 0); 376 gl->BindTexture(GL_TEXTURE_2D, 0);
374 uint32 sync_point = gl->InsertSyncPointCHROMIUM(); 377 uint32 sync_point = gl->InsertSyncPointCHROMIUM();
375 378
376 *texture_mailbox = TextureMailbox(mailbox, GL_TEXTURE_2D, sync_point); 379 *texture_mailbox =
380 TextureMailbox(mailbox, GL_TEXTURE_2D, sync_point, gpu::SyncToken());
377 *release_callback = SingleReleaseCallback::Create( 381 *release_callback = SingleReleaseCallback::Create(
378 base::Bind(&LayerTreePixelTest::ReleaseTextureMailbox, 382 base::Bind(&LayerTreePixelTest::ReleaseTextureMailbox,
379 base::Unretained(this), 383 base::Unretained(this),
380 base::Passed(&context), 384 base::Passed(&context),
381 texture_id)); 385 texture_id));
382 } 386 }
383 387
384 void LayerTreePixelTest::Finish() { 388 void LayerTreePixelTest::Finish() {
385 scoped_ptr<gpu::GLInProcessContext> context = CreateTestInProcessContext(); 389 scoped_ptr<gpu::GLInProcessContext> context = CreateTestInProcessContext();
386 GLES2Interface* gl = context->GetImplementation(); 390 GLES2Interface* gl = context->GetImplementation();
387 gl->Finish(); 391 gl->Finish();
388 } 392 }
389 393
390 } // namespace cc 394 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698