Chromium Code Reviews| Index: cc/resources/resource_provider.cc |
| diff --git a/cc/resources/resource_provider.cc b/cc/resources/resource_provider.cc |
| index 506d1d97954cd14f49c1a8422c5987a6519288c3..3b2c0cd79b5ac05008e08b76a1f7fbd6cc9d1080 100644 |
| --- a/cc/resources/resource_provider.cc |
| +++ b/cc/resources/resource_provider.cc |
| @@ -1135,26 +1135,35 @@ void ResourceProvider::PrepareSendToParent(const ResourceIdArray& resources, |
| TransferableResourceArray* list) { |
| DCHECK(thread_checker_.CalledOnValidThread()); |
| GLES2Interface* gl = ContextGL(); |
| - bool need_sync_token = false; |
| + |
| + gpu::SyncToken new_sync_token; |
| + std::vector<GLbyte*> unverified_sync_tokens; |
| for (ResourceIdArray::const_iterator it = resources.begin(); |
| it != resources.end(); |
| ++it) { |
| TransferableResource resource; |
| TransferResource(gl, *it, &resource); |
| - need_sync_token |= (!resource.mailbox_holder.sync_token.HasData() && |
| - !resource.is_software); |
| + if (!resource.is_software && |
| + !resource.mailbox_holder.sync_token.HasData()) { |
| + if (!new_sync_token.HasData()) { |
| + const uint64_t fence_sync = gl->InsertFenceSyncCHROMIUM(); |
| + gl->OrderingBarrierCHROMIUM(); |
| + GenUnverifiedSyncTokenCHROMIUM(fence_sync, new_sync_token.GetData()); |
| + unverified_sync_tokens.push_back(new_sync_token.GetData()); |
|
piman
2015/11/26 02:32:44
Actually, the VerifySyncTokensCHROMIUM below will
David Yen
2015/12/08 00:57:56
Done.
|
| + } |
| + resource.mailbox_holder.sync_token = new_sync_token; |
| + } else if (!resource.mailbox_holder.sync_token.verified_flush()) { |
| + unverified_sync_tokens.push_back( |
| + resource.mailbox_holder.sync_token.GetData()); |
| + } |
| + |
| ++resources_.find(*it)->second.exported_count; |
| list->push_back(resource); |
| } |
| - if (need_sync_token && |
| - output_surface_->capabilities().delegated_sync_points_required) { |
| - gpu::SyncToken sync_token(gl->InsertSyncPointCHROMIUM()); |
| - for (TransferableResourceArray::iterator it = list->begin(); |
| - it != list->end(); |
| - ++it) { |
| - if (!it->mailbox_holder.sync_token.HasData()) |
| - it->mailbox_holder.sync_token = sync_token; |
| - } |
| + |
| + if (!unverified_sync_tokens.empty()) { |
| + gl->VerifySyncTokensCHROMIUM(unverified_sync_tokens.data(), |
| + unverified_sync_tokens.size()); |
| } |
| } |