OLD | NEW |
---|---|
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 2059 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2070 DCHECK_EQ(GLTexture, source_resource->type); | 2070 DCHECK_EQ(GLTexture, source_resource->type); |
2071 DCHECK(source_resource->allocated); | 2071 DCHECK(source_resource->allocated); |
2072 LazyCreate(source_resource); | 2072 LazyCreate(source_resource); |
2073 | 2073 |
2074 Resource* dest_resource = GetResource(dest_id); | 2074 Resource* dest_resource = GetResource(dest_id); |
2075 DCHECK(!dest_resource->locked_for_write); | 2075 DCHECK(!dest_resource->locked_for_write); |
2076 DCHECK(!dest_resource->lock_for_read_count); | 2076 DCHECK(!dest_resource->lock_for_read_count); |
2077 DCHECK(dest_resource->origin == Resource::Internal); | 2077 DCHECK(dest_resource->origin == Resource::Internal); |
2078 DCHECK_EQ(dest_resource->exported_count, 0); | 2078 DCHECK_EQ(dest_resource->exported_count, 0); |
2079 DCHECK_EQ(GLTexture, dest_resource->type); | 2079 DCHECK_EQ(GLTexture, dest_resource->type); |
2080 LazyCreate(dest_resource); | 2080 LazyAllocate(dest_resource); |
dshwang
2014/11/20 16:58:39
It doesn't regress perf because CopyTextureChromiu
| |
2081 | 2081 |
2082 DCHECK_EQ(source_resource->type, dest_resource->type); | 2082 DCHECK_EQ(source_resource->type, dest_resource->type); |
2083 DCHECK_EQ(source_resource->format, dest_resource->format); | 2083 DCHECK_EQ(source_resource->format, dest_resource->format); |
2084 DCHECK(source_resource->size == dest_resource->size); | 2084 DCHECK(source_resource->size == dest_resource->size); |
2085 | 2085 |
2086 GLES2Interface* gl = ContextGL(); | 2086 GLES2Interface* gl = ContextGL(); |
2087 DCHECK(gl); | 2087 DCHECK(gl); |
2088 if (source_resource->image_id && source_resource->dirty_image) { | 2088 if (source_resource->image_id && source_resource->dirty_image) { |
2089 gl->BindTexture(source_resource->target, source_resource->gl_id); | 2089 gl->BindTexture(source_resource->target, source_resource->gl_id); |
2090 BindImageForSampling(source_resource); | 2090 BindImageForSampling(source_resource); |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2155 ContextProvider* context_provider = output_surface_->context_provider(); | 2155 ContextProvider* context_provider = output_surface_->context_provider(); |
2156 return context_provider ? context_provider->ContextGL() : NULL; | 2156 return context_provider ? context_provider->ContextGL() : NULL; |
2157 } | 2157 } |
2158 | 2158 |
2159 class GrContext* ResourceProvider::GrContext() const { | 2159 class GrContext* ResourceProvider::GrContext() const { |
2160 ContextProvider* context_provider = output_surface_->context_provider(); | 2160 ContextProvider* context_provider = output_surface_->context_provider(); |
2161 return context_provider ? context_provider->GrContext() : NULL; | 2161 return context_provider ? context_provider->GrContext() : NULL; |
2162 } | 2162 } |
2163 | 2163 |
2164 } // namespace cc | 2164 } // namespace cc |
OLD | NEW |