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

Side by Side Diff: cc/resources/video_resource_updater.cc

Issue 1406013007: cc: Remove GL_TEXTURE_2D hard-coding (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Set upstream right 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
« no previous file with comments | « cc/resources/resource_provider.cc ('k') | cc/test/fake_delegated_renderer_layer_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/resources/video_resource_updater.h" 5 #include "cc/resources/video_resource_updater.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/trace_event/trace_event.h" 10 #include "base/trace_event/trace_event.h"
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 return all_resources_.end(); 161 return all_resources_.end();
162 162
163 gpu::Mailbox mailbox; 163 gpu::Mailbox mailbox;
164 if (has_mailbox) { 164 if (has_mailbox) {
165 DCHECK(context_provider_); 165 DCHECK(context_provider_);
166 166
167 gpu::gles2::GLES2Interface* gl = context_provider_->ContextGL(); 167 gpu::gles2::GLES2Interface* gl = context_provider_->ContextGL();
168 168
169 gl->GenMailboxCHROMIUM(mailbox.name); 169 gl->GenMailboxCHROMIUM(mailbox.name);
170 ResourceProvider::ScopedWriteLockGL lock(resource_provider_, resource_id); 170 ResourceProvider::ScopedWriteLockGL lock(resource_provider_, resource_id);
171 gl->ProduceTextureDirectCHROMIUM(lock.texture_id(), GL_TEXTURE_2D, 171 gl->ProduceTextureDirectCHROMIUM(
172 mailbox.name); 172 lock.texture_id(),
173 resource_provider_->GetResourceTextureTarget(resource_id),
174 mailbox.name);
173 } 175 }
174 all_resources_.push_front( 176 all_resources_.push_front(
175 PlaneResource(resource_id, plane_size, format, mailbox)); 177 PlaneResource(resource_id, plane_size, format, mailbox));
176 return all_resources_.begin(); 178 return all_resources_.begin();
177 } 179 }
178 180
179 void VideoResourceUpdater::DeleteResource(ResourceList::iterator resource_it) { 181 void VideoResourceUpdater::DeleteResource(ResourceList::iterator resource_it) {
180 DCHECK_EQ(resource_it->ref_count, 0); 182 DCHECK_EQ(resource_it->ref_count, 0);
181 resource_provider_->DeleteResource(resource_it->resource_id); 183 resource_provider_->DeleteResource(resource_it->resource_id);
182 all_resources_.erase(resource_it); 184 all_resources_.erase(resource_it);
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
377 memcpy(dst, src, bytes_per_row); 379 memcpy(dst, src, bytes_per_row);
378 } 380 }
379 pixels = &upload_pixels_[0]; 381 pixels = &upload_pixels_[0];
380 } 382 }
381 383
382 resource_provider_->CopyToResource(plane_resource.resource_id, pixels, 384 resource_provider_->CopyToResource(plane_resource.resource_id, pixels,
383 resource_size_pixels); 385 resource_size_pixels);
384 SetPlaneResourceUniqueId(video_frame.get(), i, &plane_resource); 386 SetPlaneResourceUniqueId(video_frame.get(), i, &plane_resource);
385 } 387 }
386 388
387 external_resources.mailboxes.push_back(TextureMailbox( 389 external_resources.mailboxes.push_back(
388 plane_resource.mailbox, gpu::SyncToken(), GL_TEXTURE_2D)); 390 TextureMailbox(plane_resource.mailbox, gpu::SyncToken(),
391 resource_provider_->GetResourceTextureTarget(
392 plane_resource.resource_id)));
389 external_resources.release_callbacks.push_back( 393 external_resources.release_callbacks.push_back(
390 base::Bind(&RecycleResource, AsWeakPtr(), plane_resource.resource_id)); 394 base::Bind(&RecycleResource, AsWeakPtr(), plane_resource.resource_id));
391 } 395 }
392 396
393 external_resources.type = VideoFrameExternalResources::YUV_RESOURCE; 397 external_resources.type = VideoFrameExternalResources::YUV_RESOURCE;
394 return external_resources; 398 return external_resources;
395 } 399 }
396 400
397 // static 401 // static
398 void VideoResourceUpdater::ReturnTexture( 402 void VideoResourceUpdater::ReturnTexture(
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
476 resource_it->ref_count = 0; 480 resource_it->ref_count = 0;
477 updater->DeleteResource(resource_it); 481 updater->DeleteResource(resource_it);
478 return; 482 return;
479 } 483 }
480 484
481 --resource_it->ref_count; 485 --resource_it->ref_count;
482 DCHECK_GE(resource_it->ref_count, 0); 486 DCHECK_GE(resource_it->ref_count, 0);
483 } 487 }
484 488
485 } // namespace cc 489 } // namespace cc
OLDNEW
« no previous file with comments | « cc/resources/resource_provider.cc ('k') | cc/test/fake_delegated_renderer_layer_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698