Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(64)

Side by Side Diff: content/browser/gpu/browser_gpu_memory_buffer_manager.cc

Issue 2585653003: gpu: Move buffer format to target texture map into gpu host. (Closed)
Patch Set: . Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 91
92 BrowserGpuMemoryBufferManager::~BrowserGpuMemoryBufferManager() { 92 BrowserGpuMemoryBufferManager::~BrowserGpuMemoryBufferManager() {
93 g_gpu_memory_buffer_manager = nullptr; 93 g_gpu_memory_buffer_manager = nullptr;
94 } 94 }
95 95
96 // static 96 // static
97 BrowserGpuMemoryBufferManager* BrowserGpuMemoryBufferManager::current() { 97 BrowserGpuMemoryBufferManager* BrowserGpuMemoryBufferManager::current() {
98 return g_gpu_memory_buffer_manager; 98 return g_gpu_memory_buffer_manager;
99 } 99 }
100 100
101 // static
102 uint32_t BrowserGpuMemoryBufferManager::GetImageTextureTarget(
103 gfx::BufferFormat format,
104 gfx::BufferUsage usage) {
105 gpu::GpuMemoryBufferConfigurationSet native_configurations =
106 gpu::GetNativeGpuMemoryBufferConfigurations();
107 if (native_configurations.find(std::make_pair(format, usage)) ==
108 native_configurations.end()) {
109 return GL_TEXTURE_2D;
110 }
111
112 switch (gpu::GetNativeGpuMemoryBufferType()) {
113 case gfx::OZONE_NATIVE_PIXMAP:
114 // GPU memory buffers that are shared with the GL using EGLImages
115 // require TEXTURE_EXTERNAL_OES.
116 return GL_TEXTURE_EXTERNAL_OES;
117 case gfx::IO_SURFACE_BUFFER:
118 // IOSurface backed images require GL_TEXTURE_RECTANGLE_ARB.
119 return GL_TEXTURE_RECTANGLE_ARB;
120 case gfx::SHARED_MEMORY_BUFFER:
121 return GL_TEXTURE_2D;
122 case gfx::EMPTY_BUFFER:
123 NOTREACHED();
124 return GL_TEXTURE_2D;
125 }
126
127 NOTREACHED();
128 return GL_TEXTURE_2D;
129 }
130
131 std::unique_ptr<gfx::GpuMemoryBuffer> 101 std::unique_ptr<gfx::GpuMemoryBuffer>
132 BrowserGpuMemoryBufferManager::CreateGpuMemoryBuffer( 102 BrowserGpuMemoryBufferManager::CreateGpuMemoryBuffer(
133 const gfx::Size& size, 103 const gfx::Size& size,
134 gfx::BufferFormat format, 104 gfx::BufferFormat format,
135 gfx::BufferUsage usage, 105 gfx::BufferUsage usage,
136 gpu::SurfaceHandle surface_handle) { 106 gpu::SurfaceHandle surface_handle) {
137 return AllocateGpuMemoryBufferForSurface(size, format, usage, surface_handle); 107 return AllocateGpuMemoryBufferForSurface(size, format, usage, surface_handle);
138 } 108 }
139 109
140 void BrowserGpuMemoryBufferManager::AllocateGpuMemoryBufferForChildProcess( 110 void BrowserGpuMemoryBufferManager::AllocateGpuMemoryBufferForChildProcess(
(...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after
537 format(format), 507 format(format),
538 usage(usage), 508 usage(usage),
539 gpu_host_id(gpu_host_id) {} 509 gpu_host_id(gpu_host_id) {}
540 510
541 BrowserGpuMemoryBufferManager::BufferInfo::BufferInfo(const BufferInfo& other) = 511 BrowserGpuMemoryBufferManager::BufferInfo::BufferInfo(const BufferInfo& other) =
542 default; 512 default;
543 513
544 BrowserGpuMemoryBufferManager::BufferInfo::~BufferInfo() {} 514 BrowserGpuMemoryBufferManager::BufferInfo::~BufferInfo() {}
545 515
546 } // namespace content 516 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/gpu/browser_gpu_memory_buffer_manager.h ('k') | content/browser/renderer_host/render_process_host_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698