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 1066 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1077 GLES2Interface* gl = resource_provider_->ContextGL(); | 1077 GLES2Interface* gl = resource_provider_->ContextGL(); |
1078 DCHECK(gl); | 1078 DCHECK(gl); |
1079 | 1079 |
1080 #if defined(OS_CHROMEOS) | 1080 #if defined(OS_CHROMEOS) |
1081 // TODO(reveman): GL_COMMANDS_ISSUED_CHROMIUM is used for synchronization | 1081 // TODO(reveman): GL_COMMANDS_ISSUED_CHROMIUM is used for synchronization |
1082 // on ChromeOS to avoid some performance issues. This only works with | 1082 // on ChromeOS to avoid some performance issues. This only works with |
1083 // shared memory backed buffers. crbug.com/436314 | 1083 // shared memory backed buffers. crbug.com/436314 |
1084 DCHECK_EQ(gpu_memory_buffer_->GetHandle().type, gfx::SHARED_MEMORY_BUFFER); | 1084 DCHECK_EQ(gpu_memory_buffer_->GetHandle().type, gfx::SHARED_MEMORY_BUFFER); |
1085 #endif | 1085 #endif |
1086 | 1086 |
1087 resource_->image_id = | 1087 ClientBuffer buffers[] = {gpu_memory_buffer_->AsClientBuffer()}; |
1088 gl->CreateImageCHROMIUM(gpu_memory_buffer_->AsClientBuffer(), | 1088 resource_->image_id = gl->CreateImageCHROMIUM(buffers, size_.width(), |
1089 size_.width(), | 1089 size_.height(), GL_RGBA); |
1090 size_.height(), | |
1091 GL_RGBA); | |
1092 } | 1090 } |
1093 | 1091 |
1094 std::swap(resource_->gpu_memory_buffer, gpu_memory_buffer_); | 1092 std::swap(resource_->gpu_memory_buffer, gpu_memory_buffer_); |
1095 resource_->allocated = true; | 1093 resource_->allocated = true; |
1096 resource_->dirty_image = true; | 1094 resource_->dirty_image = true; |
1097 | 1095 |
1098 // GpuMemoryBuffer provides direct access to the memory used by the GPU. | 1096 // GpuMemoryBuffer provides direct access to the memory used by the GPU. |
1099 // Read lock fences are required to ensure that we're not trying to map a | 1097 // Read lock fences are required to ensure that we're not trying to map a |
1100 // buffer that is currently in-use by the GPU. | 1098 // buffer that is currently in-use by the GPU. |
1101 resource_->read_lock_fences_enabled = true; | 1099 resource_->read_lock_fences_enabled = true; |
(...skipping 1061 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2163 } | 2161 } |
2164 | 2162 |
2165 class GrContext* ResourceProvider::GrContext(bool worker_context) const { | 2163 class GrContext* ResourceProvider::GrContext(bool worker_context) const { |
2166 ContextProvider* context_provider = | 2164 ContextProvider* context_provider = |
2167 worker_context ? output_surface_->worker_context_provider() | 2165 worker_context ? output_surface_->worker_context_provider() |
2168 : output_surface_->context_provider(); | 2166 : output_surface_->context_provider(); |
2169 return context_provider ? context_provider->GrContext() : NULL; | 2167 return context_provider ? context_provider->GrContext() : NULL; |
2170 } | 2168 } |
2171 | 2169 |
2172 } // namespace cc | 2170 } // namespace cc |
OLD | NEW |