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 2054 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2065 // implementations. crbug.com/436314 | 2065 // implementations. crbug.com/436314 |
2066 gl->BeginQueryEXT(GL_COMMANDS_ISSUED_CHROMIUM, | 2066 gl->BeginQueryEXT(GL_COMMANDS_ISSUED_CHROMIUM, |
2067 source_resource->gl_read_lock_query_id); | 2067 source_resource->gl_read_lock_query_id); |
2068 #else | 2068 #else |
2069 gl->BeginQueryEXT(GL_COMMANDS_COMPLETED_CHROMIUM, | 2069 gl->BeginQueryEXT(GL_COMMANDS_COMPLETED_CHROMIUM, |
2070 source_resource->gl_read_lock_query_id); | 2070 source_resource->gl_read_lock_query_id); |
2071 #endif | 2071 #endif |
2072 } | 2072 } |
2073 DCHECK(!dest_resource->image_id); | 2073 DCHECK(!dest_resource->image_id); |
2074 dest_resource->allocated = true; | 2074 dest_resource->allocated = true; |
2075 gl->CopyTextureCHROMIUM(dest_resource->target, | 2075 gl->CopySubTextureCHROMIUM(dest_resource->target, source_resource->gl_id, |
2076 source_resource->gl_id, | 2076 dest_resource->gl_id, 0, 0, 0); |
2077 dest_resource->gl_id, | |
2078 0, | |
2079 GLInternalFormat(dest_resource->format), | |
2080 GLDataType(dest_resource->format)); | |
2081 if (source_resource->gl_read_lock_query_id) { | 2077 if (source_resource->gl_read_lock_query_id) { |
2082 // End query and create a read lock fence that will prevent access to | 2078 // End query and create a read lock fence that will prevent access to |
2083 // source resource until CopyTextureCHROMIUM command has completed. | 2079 // source resource until CopyTextureCHROMIUM command has completed. |
2084 #if defined(OS_CHROMEOS) | 2080 #if defined(OS_CHROMEOS) |
2085 gl->EndQueryEXT(GL_COMMANDS_ISSUED_CHROMIUM); | 2081 gl->EndQueryEXT(GL_COMMANDS_ISSUED_CHROMIUM); |
2086 #else | 2082 #else |
2087 gl->EndQueryEXT(GL_COMMANDS_COMPLETED_CHROMIUM); | 2083 gl->EndQueryEXT(GL_COMMANDS_COMPLETED_CHROMIUM); |
2088 #endif | 2084 #endif |
2089 source_resource->read_lock_fence = make_scoped_refptr( | 2085 source_resource->read_lock_fence = make_scoped_refptr( |
2090 new CopyTextureFence(gl, source_resource->gl_read_lock_query_id)); | 2086 new CopyTextureFence(gl, source_resource->gl_read_lock_query_id)); |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2134 ContextProvider* context_provider = output_surface_->context_provider(); | 2130 ContextProvider* context_provider = output_surface_->context_provider(); |
2135 return context_provider ? context_provider->ContextGL() : NULL; | 2131 return context_provider ? context_provider->ContextGL() : NULL; |
2136 } | 2132 } |
2137 | 2133 |
2138 class GrContext* ResourceProvider::GrContext() const { | 2134 class GrContext* ResourceProvider::GrContext() const { |
2139 ContextProvider* context_provider = output_surface_->context_provider(); | 2135 ContextProvider* context_provider = output_surface_->context_provider(); |
2140 return context_provider ? context_provider->GrContext() : NULL; | 2136 return context_provider ? context_provider->GrContext() : NULL; |
2141 } | 2137 } |
2142 | 2138 |
2143 } // namespace cc | 2139 } // namespace cc |
OLD | NEW |