Chromium Code Reviews| Index: cc/resources/resource_provider.cc |
| diff --git a/cc/resources/resource_provider.cc b/cc/resources/resource_provider.cc |
| index 9431d6aaa783f9f0e4c523961f7521314198fdff..dd27f589361132163996b8541ef9e1772d13b28d 100644 |
| --- a/cc/resources/resource_provider.cc |
| +++ b/cc/resources/resource_provider.cc |
| @@ -1039,12 +1039,13 @@ const ResourceProvider::Resource* ResourceProvider::LockForRead(ResourceId id) { |
| if (resource->type == GLTexture && !resource->gl_id) { |
| DCHECK(resource->origin != Resource::Internal); |
| DCHECK(resource->mailbox.IsTexture()); |
| + |
| + // Mailbox sync_points must be processed by a call to |
| + // WaitSyncPointIfNeeded() prior to calling LockForRead(). |
| + DCHECK(!resource->mailbox.sync_point()); |
| + |
| GLES2Interface* gl = ContextGL(); |
| DCHECK(gl); |
| - if (resource->mailbox.sync_point()) { |
| - GLC(gl, gl->WaitSyncPointCHROMIUM(resource->mailbox.sync_point())); |
| - resource->mailbox.set_sync_point(0); |
| - } |
| resource->gl_id = texture_id_allocator_->NextId(); |
| GLC(gl, gl->BindTexture(resource->target, resource->gl_id)); |
| GLC(gl, |
| @@ -2240,6 +2241,24 @@ void ResourceProvider::CopyResource(ResourceId source_id, ResourceId dest_id) { |
| } |
| } |
| +void ResourceProvider::WaitSyncPointIfNeeded(ResourceId id) { |
| + Resource* resource = GetResource(id); |
| + DCHECK_EQ(resource->exported_count, 0); |
| + DCHECK(resource->allocated); |
| + if (resource->type != GLTexture || resource->gl_id) |
| + return; |
| + if (!resource->mailbox.sync_point()) |
| + return; |
| + DCHECK(resource->mailbox.IsValid()); |
| + |
| + // Insert WaitSyncPointCHROMIUM on gl context, and clear sync_point from |
|
danakj
2014/08/13 23:05:19
this comment says "what", not "why". i think it ca
vmiura
2014/08/15 21:20:39
Done.
|
| + // mailbox. |
| + GLES2Interface* gl = ContextGL(); |
| + DCHECK(gl); |
| + GLC(gl, gl->WaitSyncPointCHROMIUM(resource->mailbox.sync_point())); |
| + resource->mailbox.set_sync_point(0); |
| +} |
| + |
| GLint ResourceProvider::GetActiveTextureUnit(GLES2Interface* gl) { |
| GLint active_unit = 0; |
| gl->GetIntegerv(GL_ACTIVE_TEXTURE, &active_unit); |