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 2072 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2083 // implementations. crbug.com/436314 | 2083 // implementations. crbug.com/436314 |
2084 gl->BeginQueryEXT(GL_COMMANDS_ISSUED_CHROMIUM, | 2084 gl->BeginQueryEXT(GL_COMMANDS_ISSUED_CHROMIUM, |
2085 source_resource->gl_read_lock_query_id); | 2085 source_resource->gl_read_lock_query_id); |
2086 #else | 2086 #else |
2087 gl->BeginQueryEXT(GL_COMMANDS_COMPLETED_CHROMIUM, | 2087 gl->BeginQueryEXT(GL_COMMANDS_COMPLETED_CHROMIUM, |
2088 source_resource->gl_read_lock_query_id); | 2088 source_resource->gl_read_lock_query_id); |
2089 #endif | 2089 #endif |
2090 } | 2090 } |
2091 DCHECK(!dest_resource->image_id); | 2091 DCHECK(!dest_resource->image_id); |
2092 dest_resource->allocated = true; | 2092 dest_resource->allocated = true; |
2093 gl->CopyTextureCHROMIUM(dest_resource->target, | 2093 gl->CopySubTextureCHROMIUM(dest_resource->target, source_resource->gl_id, |
2094 source_resource->gl_id, | 2094 dest_resource->gl_id, 0, 0, 0); |
2095 dest_resource->gl_id, | |
2096 0, | |
2097 GLInternalFormat(dest_resource->format), | |
2098 GLDataType(dest_resource->format)); | |
2099 if (source_resource->gl_read_lock_query_id) { | 2095 if (source_resource->gl_read_lock_query_id) { |
2100 // End query and create a read lock fence that will prevent access to | 2096 // End query and create a read lock fence that will prevent access to |
2101 // source resource until CopyTextureCHROMIUM command has completed. | 2097 // source resource until CopyTextureCHROMIUM command has completed. |
2102 #if defined(OS_CHROMEOS) | 2098 #if defined(OS_CHROMEOS) |
2103 gl->EndQueryEXT(GL_COMMANDS_ISSUED_CHROMIUM); | 2099 gl->EndQueryEXT(GL_COMMANDS_ISSUED_CHROMIUM); |
2104 #else | 2100 #else |
2105 gl->EndQueryEXT(GL_COMMANDS_COMPLETED_CHROMIUM); | 2101 gl->EndQueryEXT(GL_COMMANDS_COMPLETED_CHROMIUM); |
2106 #endif | 2102 #endif |
2107 source_resource->read_lock_fence = make_scoped_refptr( | 2103 source_resource->read_lock_fence = make_scoped_refptr( |
2108 new CopyTextureFence(gl, source_resource->gl_read_lock_query_id)); | 2104 new CopyTextureFence(gl, source_resource->gl_read_lock_query_id)); |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2152 ContextProvider* context_provider = output_surface_->context_provider(); | 2148 ContextProvider* context_provider = output_surface_->context_provider(); |
2153 return context_provider ? context_provider->ContextGL() : NULL; | 2149 return context_provider ? context_provider->ContextGL() : NULL; |
2154 } | 2150 } |
2155 | 2151 |
2156 class GrContext* ResourceProvider::GrContext() const { | 2152 class GrContext* ResourceProvider::GrContext() const { |
2157 ContextProvider* context_provider = output_surface_->context_provider(); | 2153 ContextProvider* context_provider = output_surface_->context_provider(); |
2158 return context_provider ? context_provider->GrContext() : NULL; | 2154 return context_provider ? context_provider->GrContext() : NULL; |
2159 } | 2155 } |
2160 | 2156 |
2161 } // namespace cc | 2157 } // namespace cc |
OLD | NEW |