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 2089 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2100 // implementations. crbug.com/436314 | 2100 // implementations. crbug.com/436314 |
2101 gl->BeginQueryEXT(GL_COMMANDS_ISSUED_CHROMIUM, | 2101 gl->BeginQueryEXT(GL_COMMANDS_ISSUED_CHROMIUM, |
2102 source_resource->gl_read_lock_query_id); | 2102 source_resource->gl_read_lock_query_id); |
2103 #else | 2103 #else |
2104 gl->BeginQueryEXT(GL_COMMANDS_COMPLETED_CHROMIUM, | 2104 gl->BeginQueryEXT(GL_COMMANDS_COMPLETED_CHROMIUM, |
2105 source_resource->gl_read_lock_query_id); | 2105 source_resource->gl_read_lock_query_id); |
2106 #endif | 2106 #endif |
2107 } | 2107 } |
2108 DCHECK(!dest_resource->image_id); | 2108 DCHECK(!dest_resource->image_id); |
2109 dest_resource->allocated = true; | 2109 dest_resource->allocated = true; |
2110 gl->CopyTextureCHROMIUM(dest_resource->target, | 2110 gl->CopySubTextureCHROMIUM(dest_resource->target, source_resource->gl_id, |
2111 source_resource->gl_id, | 2111 dest_resource->gl_id, 0, 0); |
2112 dest_resource->gl_id, | |
2113 0, | |
2114 GLInternalFormat(dest_resource->format), | |
2115 GLDataType(dest_resource->format)); | |
2116 if (source_resource->gl_read_lock_query_id) { | 2112 if (source_resource->gl_read_lock_query_id) { |
2117 // End query and create a read lock fence that will prevent access to | 2113 // End query and create a read lock fence that will prevent access to |
2118 // source resource until CopyTextureCHROMIUM command has completed. | 2114 // source resource until CopySubTextureCHROMIUM command has completed. |
2119 #if defined(OS_CHROMEOS) | 2115 #if defined(OS_CHROMEOS) |
2120 gl->EndQueryEXT(GL_COMMANDS_ISSUED_CHROMIUM); | 2116 gl->EndQueryEXT(GL_COMMANDS_ISSUED_CHROMIUM); |
2121 #else | 2117 #else |
2122 gl->EndQueryEXT(GL_COMMANDS_COMPLETED_CHROMIUM); | 2118 gl->EndQueryEXT(GL_COMMANDS_COMPLETED_CHROMIUM); |
2123 #endif | 2119 #endif |
2124 source_resource->read_lock_fence = make_scoped_refptr( | 2120 source_resource->read_lock_fence = make_scoped_refptr( |
2125 new CopyTextureFence(gl, source_resource->gl_read_lock_query_id)); | 2121 new CopyTextureFence(gl, source_resource->gl_read_lock_query_id)); |
2126 } else { | 2122 } else { |
2127 // Create a SynchronousFence when CHROMIUM_sync_query extension is missing. | 2123 // Create a SynchronousFence when CHROMIUM_sync_query extension is missing. |
2128 // Try to use one synchronous fence for as many CopyResource operations as | 2124 // Try to use one synchronous fence for as many CopyResource operations as |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2171 } | 2167 } |
2172 | 2168 |
2173 class GrContext* ResourceProvider::GrContext(bool worker_context) const { | 2169 class GrContext* ResourceProvider::GrContext(bool worker_context) const { |
2174 ContextProvider* context_provider = | 2170 ContextProvider* context_provider = |
2175 worker_context ? output_surface_->worker_context_provider() | 2171 worker_context ? output_surface_->worker_context_provider() |
2176 : output_surface_->context_provider(); | 2172 : output_surface_->context_provider(); |
2177 return context_provider ? context_provider->GrContext() : NULL; | 2173 return context_provider ? context_provider->GrContext() : NULL; |
2178 } | 2174 } |
2179 | 2175 |
2180 } // namespace cc | 2176 } // namespace cc |
OLD | NEW |