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 resource_->image_id = gl->CreateImageCHROMIUM( |
1088 gl->CreateImageCHROMIUM(gpu_memory_buffer_->AsClientBuffer(), | 1088 gpu_memory_buffer_->AsClientBuffer(), size_.width(), size_.height(), |
1089 size_.width(), | 1089 GLInternalFormat(resource_->format)); |
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 1038 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2140 } | 2138 } |
2141 | 2139 |
2142 class GrContext* ResourceProvider::GrContext(bool worker_context) const { | 2140 class GrContext* ResourceProvider::GrContext(bool worker_context) const { |
2143 ContextProvider* context_provider = | 2141 ContextProvider* context_provider = |
2144 worker_context ? output_surface_->worker_context_provider() | 2142 worker_context ? output_surface_->worker_context_provider() |
2145 : output_surface_->context_provider(); | 2143 : output_surface_->context_provider(); |
2146 return context_provider ? context_provider->GrContext() : NULL; | 2144 return context_provider ? context_provider->GrContext() : NULL; |
2147 } | 2145 } |
2148 | 2146 |
2149 } // namespace cc | 2147 } // namespace cc |
OLD | NEW |