OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "content/browser/gpu/browser_gpu_memory_buffer_manager.h" | 5 #include "content/browser/gpu/browser_gpu_memory_buffer_manager.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
10 #include "base/synchronization/waitable_event.h" | 10 #include "base/synchronization/waitable_event.h" |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
222 } | 222 } |
223 | 223 |
224 // static | 224 // static |
225 uint32 BrowserGpuMemoryBufferManager::GetImageTextureTarget( | 225 uint32 BrowserGpuMemoryBufferManager::GetImageTextureTarget( |
226 gfx::BufferFormat format, | 226 gfx::BufferFormat format, |
227 gfx::BufferUsage usage) { | 227 gfx::BufferUsage usage) { |
228 GpuMemoryBufferConfigurationSet native_configurations = | 228 GpuMemoryBufferConfigurationSet native_configurations = |
229 GetNativeGpuMemoryBufferConfigurations(); | 229 GetNativeGpuMemoryBufferConfigurations(); |
230 if (native_configurations.find(std::make_pair(format, usage)) == | 230 if (native_configurations.find(std::make_pair(format, usage)) == |
231 native_configurations.end()) { | 231 native_configurations.end()) { |
232 return GL_TEXTURE_2D; | 232 return 0; |
reveman
2015/10/29 14:11:39
I don't think this is correct. This is supposed to
ccameron
2015/10/29 19:08:29
Yeah, this was a bad idea and I should have left i
| |
233 } | 233 } |
234 | 234 |
235 switch (GpuMemoryBufferFactory::GetNativeType()) { | 235 switch (GpuMemoryBufferFactory::GetNativeType()) { |
236 case gfx::SURFACE_TEXTURE_BUFFER: | 236 case gfx::SURFACE_TEXTURE_BUFFER: |
237 case gfx::OZONE_NATIVE_PIXMAP: | 237 case gfx::OZONE_NATIVE_PIXMAP: |
238 // GPU memory buffers that are shared with the GL using EGLImages | 238 // GPU memory buffers that are shared with the GL using EGLImages |
239 // require TEXTURE_EXTERNAL_OES. | 239 // require TEXTURE_EXTERNAL_OES. |
240 return GL_TEXTURE_EXTERNAL_OES; | 240 return GL_TEXTURE_EXTERNAL_OES; |
241 case gfx::IO_SURFACE_BUFFER: | 241 case gfx::IO_SURFACE_BUFFER: |
242 // IOSurface backed images require GL_TEXTURE_RECTANGLE_ARB. | 242 // IOSurface backed images require GL_TEXTURE_RECTANGLE_ARB. |
243 return GL_TEXTURE_RECTANGLE_ARB; | 243 return GL_TEXTURE_RECTANGLE_ARB; |
244 case gfx::SHARED_MEMORY_BUFFER: | 244 case gfx::SHARED_MEMORY_BUFFER: |
245 return GL_TEXTURE_2D; | 245 return 0; |
reveman
2015/10/29 14:11:39
This could be a NOTREACHED case now that the shm f
| |
246 case gfx::EMPTY_BUFFER: | 246 case gfx::EMPTY_BUFFER: |
247 NOTREACHED(); | 247 NOTREACHED(); |
248 return GL_TEXTURE_2D; | 248 return 0; |
249 } | 249 } |
250 | 250 |
251 NOTREACHED(); | 251 NOTREACHED(); |
252 return GL_TEXTURE_2D; | 252 return 0; |
253 } | 253 } |
254 | 254 |
255 scoped_ptr<gfx::GpuMemoryBuffer> | 255 scoped_ptr<gfx::GpuMemoryBuffer> |
256 BrowserGpuMemoryBufferManager::AllocateGpuMemoryBuffer(const gfx::Size& size, | 256 BrowserGpuMemoryBufferManager::AllocateGpuMemoryBuffer(const gfx::Size& size, |
257 gfx::BufferFormat format, | 257 gfx::BufferFormat format, |
258 gfx::BufferUsage usage) { | 258 gfx::BufferUsage usage) { |
259 return AllocateGpuMemoryBufferForSurface(size, format, usage, 0); | 259 return AllocateGpuMemoryBufferForSurface(size, format, usage, 0); |
260 } | 260 } |
261 | 261 |
262 scoped_ptr<gfx::GpuMemoryBuffer> | 262 scoped_ptr<gfx::GpuMemoryBuffer> |
(...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
738 return gpu_client_tracing_id_; | 738 return gpu_client_tracing_id_; |
739 } | 739 } |
740 | 740 |
741 // In normal cases, |client_id| is a child process id, so we can perform | 741 // In normal cases, |client_id| is a child process id, so we can perform |
742 // the standard conversion. | 742 // the standard conversion. |
743 return ChildProcessHostImpl::ChildProcessUniqueIdToTracingProcessId( | 743 return ChildProcessHostImpl::ChildProcessUniqueIdToTracingProcessId( |
744 client_id); | 744 client_id); |
745 } | 745 } |
746 | 746 |
747 } // namespace content | 747 } // namespace content |
OLD | NEW |