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

Side by Side Diff: gpu/ipc/host/gpu_memory_buffer_support.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
« no previous file with comments | « gpu/ipc/host/gpu_memory_buffer_support.h ('k') | ui/aura/mus/mus_context_factory.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "gpu/ipc/host/gpu_memory_buffer_support.h" 5 #include "gpu/ipc/host/gpu_memory_buffer_support.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "build/build_config.h" 9 #include "build/build_config.h"
10 #include "gpu/ipc/common/gpu_memory_buffer_support.h" 10 #include "gpu/ipc/common/gpu_memory_buffer_support.h"
11 #include "gpu/ipc/host/gpu_switches.h" 11 #include "gpu/ipc/host/gpu_switches.h"
12 #include "ui/gl/gl_bindings.h"
12 #include "ui/gl/gl_switches.h" 13 #include "ui/gl/gl_switches.h"
13 14
14 namespace gpu { 15 namespace gpu {
15 16
16 bool AreNativeGpuMemoryBuffersEnabled() { 17 bool AreNativeGpuMemoryBuffersEnabled() {
17 // Disable native buffers when using Mesa. 18 // Disable native buffers when using Mesa.
18 if (base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( 19 if (base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
19 switches::kUseGL) == gl::kGLImplementationOSMesaName) { 20 switches::kUseGL) == gl::kGLImplementationOSMesaName) {
20 return false; 21 return false;
21 } 22 }
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 for (auto& usage : kGPUReadWriteUsages) { 76 for (auto& usage : kGPUReadWriteUsages) {
76 if (IsNativeGpuMemoryBufferConfigurationSupported(format, usage)) 77 if (IsNativeGpuMemoryBufferConfigurationSupported(format, usage))
77 configurations.insert(std::make_pair(format, usage)); 78 configurations.insert(std::make_pair(format, usage));
78 } 79 }
79 } 80 }
80 } 81 }
81 82
82 return configurations; 83 return configurations;
83 } 84 }
84 85
86 uint32_t GetImageTextureTarget(gfx::BufferFormat format,
87 gfx::BufferUsage usage) {
88 GpuMemoryBufferConfigurationSet native_configurations =
89 GetNativeGpuMemoryBufferConfigurations();
90 if (native_configurations.find(std::make_pair(format, usage)) ==
91 native_configurations.end()) {
92 return GL_TEXTURE_2D;
93 }
94
95 switch (GetNativeGpuMemoryBufferType()) {
96 case gfx::OZONE_NATIVE_PIXMAP:
97 // GPU memory buffers that are shared with the GL using EGLImages
98 // require TEXTURE_EXTERNAL_OES.
99 return GL_TEXTURE_EXTERNAL_OES;
100 case gfx::IO_SURFACE_BUFFER:
101 // IOSurface backed images require GL_TEXTURE_RECTANGLE_ARB.
102 return GL_TEXTURE_RECTANGLE_ARB;
103 case gfx::SHARED_MEMORY_BUFFER:
104 return GL_TEXTURE_2D;
105 case gfx::EMPTY_BUFFER:
106 NOTREACHED();
107 return GL_TEXTURE_2D;
108 }
109
110 NOTREACHED();
111 return GL_TEXTURE_2D;
112 }
113
85 } // namespace gpu 114 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/ipc/host/gpu_memory_buffer_support.h ('k') | ui/aura/mus/mus_context_factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698