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

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

Issue 635543002: cc: Make ResourceProvider use bindless Produce/ConsumeTextureCHROMIUM (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 months 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 | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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/resource_provider.h" 5 #include "cc/resources/resource_provider.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <limits> 8 #include <limits>
9 9
10 #include "base/containers/hash_tables.h" 10 #include "base/containers/hash_tables.h"
(...skipping 825 matching lines...) Expand 10 before | Expand all | Expand 10 after
836 if (resource->type == GLTexture && !resource->gl_id) { 836 if (resource->type == GLTexture && !resource->gl_id) {
837 DCHECK(resource->origin != Resource::Internal); 837 DCHECK(resource->origin != Resource::Internal);
838 DCHECK(resource->mailbox.IsTexture()); 838 DCHECK(resource->mailbox.IsTexture());
839 839
840 // Mailbox sync_points must be processed by a call to 840 // Mailbox sync_points must be processed by a call to
841 // WaitSyncPointIfNeeded() prior to calling LockForRead(). 841 // WaitSyncPointIfNeeded() prior to calling LockForRead().
842 DCHECK(!resource->mailbox.sync_point()); 842 DCHECK(!resource->mailbox.sync_point());
843 843
844 GLES2Interface* gl = ContextGL(); 844 GLES2Interface* gl = ContextGL();
845 DCHECK(gl); 845 DCHECK(gl);
846 resource->gl_id = texture_id_allocator_->NextId(); 846 resource->gl_id = 0;
847 GLC(gl, gl->BindTexture(resource->target, resource->gl_id));
848 GLC(gl, 847 GLC(gl,
849 gl->ConsumeTextureCHROMIUM(resource->mailbox.target(), 848 gl->CreateAndConsumeTextureCHROMIUM(resource->mailbox.target(),
danakj 2014/10/06 15:25:28 This returns the texture id, you're just setting i
sohanjg 2014/10/07 11:23:47 Done.
850 resource->mailbox.name())); 849 resource->mailbox.name()));
851 } 850 }
852 851
853 if (!resource->pixels && resource->has_shared_bitmap_id && 852 if (!resource->pixels && resource->has_shared_bitmap_id &&
854 shared_bitmap_manager_) { 853 shared_bitmap_manager_) {
855 scoped_ptr<SharedBitmap> bitmap = 854 scoped_ptr<SharedBitmap> bitmap =
856 shared_bitmap_manager_->GetSharedBitmapFromId( 855 shared_bitmap_manager_->GetSharedBitmapFromId(
857 resource->size, resource->shared_bitmap_id); 856 resource->size, resource->shared_bitmap_id);
858 if (bitmap) { 857 if (bitmap) {
859 resource->shared_bitmap = bitmap.release(); 858 resource->shared_bitmap = bitmap.release();
860 resource->pixels = resource->shared_bitmap->pixels(); 859 resource->pixels = resource->shared_bitmap->pixels();
(...skipping 539 matching lines...) Expand 10 before | Expand all | Expand 10 after
1400 resource->is_repeated = (source->wrap_mode == GL_REPEAT); 1399 resource->is_repeated = (source->wrap_mode == GL_REPEAT);
1401 resource->allow_overlay = source->allow_overlay; 1400 resource->allow_overlay = source->allow_overlay;
1402 1401
1403 if (source->type == Bitmap) { 1402 if (source->type == Bitmap) {
1404 resource->mailbox_holder.mailbox = source->shared_bitmap_id; 1403 resource->mailbox_holder.mailbox = source->shared_bitmap_id;
1405 resource->is_software = true; 1404 resource->is_software = true;
1406 } else if (!source->mailbox.IsValid()) { 1405 } else if (!source->mailbox.IsValid()) {
1407 LazyCreate(source); 1406 LazyCreate(source);
1408 DCHECK(source->gl_id); 1407 DCHECK(source->gl_id);
1409 DCHECK(source->origin == Resource::Internal); 1408 DCHECK(source->origin == Resource::Internal);
1410 GLC(gl, 1409
1411 gl->BindTexture(resource->mailbox_holder.texture_target,
1412 source->gl_id));
1413 if (source->image_id) { 1410 if (source->image_id) {
1414 DCHECK(source->dirty_image); 1411 DCHECK(source->dirty_image);
1415 BindImageForSampling(source); 1412 BindImageForSampling(source);
1416 } 1413 }
1417 // This is a resource allocated by the compositor, we need to produce it. 1414 // This is a resource allocated by the compositor, we need to produce it.
1418 // Don't set a sync point, the caller will do it. 1415 // Don't set a sync point, the caller will do it.
1419 GLC(gl, gl->GenMailboxCHROMIUM(resource->mailbox_holder.mailbox.name)); 1416 GLC(gl, gl->GenMailboxCHROMIUM(resource->mailbox_holder.mailbox.name));
1420 GLC(gl, 1417 GLC(gl,
1421 gl->ProduceTextureCHROMIUM(resource->mailbox_holder.texture_target, 1418 gl->ProduceTextureDirectCHROMIUM(
1422 resource->mailbox_holder.mailbox.name)); 1419 source->gl_id,
1420 resource->mailbox_holder.texture_target,
1421 resource->mailbox_holder.mailbox.name));
1422
1423 source->mailbox = TextureMailbox(resource->mailbox_holder); 1423 source->mailbox = TextureMailbox(resource->mailbox_holder);
1424 } else { 1424 } else {
1425 DCHECK(source->mailbox.IsTexture()); 1425 DCHECK(source->mailbox.IsTexture());
1426 if (source->image_id && source->dirty_image) { 1426 if (source->image_id && source->dirty_image) {
1427 DCHECK(source->gl_id); 1427 DCHECK(source->gl_id);
1428 DCHECK(source->origin == Resource::Internal); 1428 DCHECK(source->origin == Resource::Internal);
1429 GLC(gl, 1429 GLC(gl,
1430 gl->BindTexture(resource->mailbox_holder.texture_target, 1430 gl->BindTexture(resource->mailbox_holder.texture_target,
1431 source->gl_id)); 1431 source->gl_id));
1432 BindImageForSampling(source); 1432 BindImageForSampling(source);
(...skipping 640 matching lines...) Expand 10 before | Expand all | Expand 10 after
2073 ContextProvider* context_provider = output_surface_->context_provider(); 2073 ContextProvider* context_provider = output_surface_->context_provider();
2074 return context_provider ? context_provider->ContextGL() : NULL; 2074 return context_provider ? context_provider->ContextGL() : NULL;
2075 } 2075 }
2076 2076
2077 class GrContext* ResourceProvider::GrContext() const { 2077 class GrContext* ResourceProvider::GrContext() const {
2078 ContextProvider* context_provider = output_surface_->context_provider(); 2078 ContextProvider* context_provider = output_surface_->context_provider();
2079 return context_provider ? context_provider->GrContext() : NULL; 2079 return context_provider ? context_provider->GrContext() : NULL;
2080 } 2080 }
2081 2081
2082 } // namespace cc 2082 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698