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

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: rebase + fix test expectations. Created 5 years, 11 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
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 850 matching lines...) Expand 10 before | Expand all | Expand 10 after
861 if (resource->type == GLTexture && !resource->gl_id) { 861 if (resource->type == GLTexture && !resource->gl_id) {
862 DCHECK(resource->origin != Resource::Internal); 862 DCHECK(resource->origin != Resource::Internal);
863 DCHECK(resource->mailbox.IsTexture()); 863 DCHECK(resource->mailbox.IsTexture());
864 864
865 // Mailbox sync_points must be processed by a call to 865 // Mailbox sync_points must be processed by a call to
866 // WaitSyncPointIfNeeded() prior to calling LockForRead(). 866 // WaitSyncPointIfNeeded() prior to calling LockForRead().
867 DCHECK(!resource->mailbox.sync_point()); 867 DCHECK(!resource->mailbox.sync_point());
868 868
869 GLES2Interface* gl = ContextGL(); 869 GLES2Interface* gl = ContextGL();
870 DCHECK(gl); 870 DCHECK(gl);
871 resource->gl_id = texture_id_allocator_->NextId(); 871 resource->gl_id =
872 GLC(gl, gl->BindTexture(resource->target, resource->gl_id)); 872 GLC(gl, gl->CreateAndConsumeTextureCHROMIUM(resource->mailbox.target(),
873 GLC(gl, 873 resource->mailbox.name()));
874 gl->ConsumeTextureCHROMIUM(resource->mailbox.target(),
875 resource->mailbox.name()));
876 } 874 }
877 875
878 if (!resource->pixels && resource->has_shared_bitmap_id && 876 if (!resource->pixels && resource->has_shared_bitmap_id &&
879 shared_bitmap_manager_) { 877 shared_bitmap_manager_) {
880 scoped_ptr<SharedBitmap> bitmap = 878 scoped_ptr<SharedBitmap> bitmap =
881 shared_bitmap_manager_->GetSharedBitmapFromId( 879 shared_bitmap_manager_->GetSharedBitmapFromId(
882 resource->size, resource->shared_bitmap_id); 880 resource->size, resource->shared_bitmap_id);
883 if (bitmap) { 881 if (bitmap) {
884 resource->shared_bitmap = bitmap.release(); 882 resource->shared_bitmap = bitmap.release();
885 resource->pixels = resource->shared_bitmap->pixels(); 883 resource->pixels = resource->shared_bitmap->pixels();
(...skipping 680 matching lines...) Expand 10 before | Expand all | Expand 10 after
1566 resource->is_repeated = (source->wrap_mode == GL_REPEAT); 1564 resource->is_repeated = (source->wrap_mode == GL_REPEAT);
1567 resource->allow_overlay = source->allow_overlay; 1565 resource->allow_overlay = source->allow_overlay;
1568 1566
1569 if (source->type == Bitmap) { 1567 if (source->type == Bitmap) {
1570 resource->mailbox_holder.mailbox = source->shared_bitmap_id; 1568 resource->mailbox_holder.mailbox = source->shared_bitmap_id;
1571 resource->is_software = true; 1569 resource->is_software = true;
1572 } else if (!source->mailbox.IsValid()) { 1570 } else if (!source->mailbox.IsValid()) {
1573 LazyCreate(source); 1571 LazyCreate(source);
1574 DCHECK(source->gl_id); 1572 DCHECK(source->gl_id);
1575 DCHECK(source->origin == Resource::Internal); 1573 DCHECK(source->origin == Resource::Internal);
1576 GLC(gl, 1574
1577 gl->BindTexture(resource->mailbox_holder.texture_target,
1578 source->gl_id));
1579 if (source->image_id) { 1575 if (source->image_id) {
1580 DCHECK(source->dirty_image); 1576 DCHECK(source->dirty_image);
1581 BindImageForSampling(source); 1577 BindImageForSampling(source);
1582 } 1578 }
1583 // This is a resource allocated by the compositor, we need to produce it. 1579 // This is a resource allocated by the compositor, we need to produce it.
1584 // Don't set a sync point, the caller will do it. 1580 // Don't set a sync point, the caller will do it.
1585 GLC(gl, gl->GenMailboxCHROMIUM(resource->mailbox_holder.mailbox.name)); 1581 GLC(gl, gl->GenMailboxCHROMIUM(resource->mailbox_holder.mailbox.name));
1586 GLC(gl, 1582 GLC(gl, gl->ProduceTextureDirectCHROMIUM(
1587 gl->ProduceTextureCHROMIUM(resource->mailbox_holder.texture_target, 1583 source->gl_id, resource->mailbox_holder.texture_target,
1588 resource->mailbox_holder.mailbox.name)); 1584 resource->mailbox_holder.mailbox.name));
1585
1589 source->mailbox = TextureMailbox(resource->mailbox_holder); 1586 source->mailbox = TextureMailbox(resource->mailbox_holder);
1590 } else { 1587 } else {
1591 DCHECK(source->mailbox.IsTexture()); 1588 DCHECK(source->mailbox.IsTexture());
1592 if (source->image_id && source->dirty_image) { 1589 if (source->image_id && source->dirty_image) {
1593 DCHECK(source->gl_id); 1590 DCHECK(source->gl_id);
1594 DCHECK(source->origin == Resource::Internal); 1591 DCHECK(source->origin == Resource::Internal);
1595 GLC(gl, 1592 GLC(gl,
1596 gl->BindTexture(resource->mailbox_holder.texture_target, 1593 gl->BindTexture(resource->mailbox_holder.texture_target,
1597 source->gl_id)); 1594 source->gl_id));
1598 BindImageForSampling(source); 1595 BindImageForSampling(source);
(...skipping 534 matching lines...) Expand 10 before | Expand all | Expand 10 after
2133 ContextProvider* context_provider = output_surface_->context_provider(); 2130 ContextProvider* context_provider = output_surface_->context_provider();
2134 return context_provider ? context_provider->ContextGL() : NULL; 2131 return context_provider ? context_provider->ContextGL() : NULL;
2135 } 2132 }
2136 2133
2137 class GrContext* ResourceProvider::GrContext() const { 2134 class GrContext* ResourceProvider::GrContext() const {
2138 ContextProvider* context_provider = output_surface_->context_provider(); 2135 ContextProvider* context_provider = output_surface_->context_provider();
2139 return context_provider ? context_provider->GrContext() : NULL; 2136 return context_provider ? context_provider->GrContext() : NULL;
2140 } 2137 }
2141 2138
2142 } // namespace cc 2139 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | cc/resources/resource_provider_unittest.cc » ('j') | cc/resources/resource_provider_unittest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698