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

Side by Side Diff: gpu/ipc/service/gpu_memory_buffer_factory_native_pixmap.cc

Issue 2945673002: Allow creating GLImage-backed textures with glTexStorage2D. (Closed)
Patch Set: rebase Created 3 years, 4 months 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/service/gpu_memory_buffer_factory_native_pixmap.h ('k') | ui/gl/gl_bindings.h » ('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 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 "gpu/ipc/service/gpu_memory_buffer_factory_native_pixmap.h" 5 #include "gpu/ipc/service/gpu_memory_buffer_factory_native_pixmap.h"
6 6
7 #include "ui/gfx/client_native_pixmap.h" 7 #include "ui/gfx/client_native_pixmap.h"
8 #include "ui/gfx/native_pixmap.h" 8 #include "ui/gfx/native_pixmap.h"
9 #include "ui/gl/gl_image_native_pixmap.h" 9 #include "ui/gl/gl_image_native_pixmap.h"
10 10
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 << static_cast<int>(format); 124 << static_cast<int>(format);
125 return nullptr; 125 return nullptr;
126 } 126 }
127 return image; 127 return image;
128 } 128 }
129 129
130 scoped_refptr<gl::GLImage> 130 scoped_refptr<gl::GLImage>
131 GpuMemoryBufferFactoryNativePixmap::CreateAnonymousImage( 131 GpuMemoryBufferFactoryNativePixmap::CreateAnonymousImage(
132 const gfx::Size& size, 132 const gfx::Size& size,
133 gfx::BufferFormat format, 133 gfx::BufferFormat format,
134 gfx::BufferUsage usage,
134 unsigned internalformat) { 135 unsigned internalformat) {
135 scoped_refptr<gfx::NativePixmap> pixmap; 136 scoped_refptr<gfx::NativePixmap> pixmap;
136 #if defined(USE_OZONE) 137 #if defined(USE_OZONE)
137 pixmap = ui::OzonePlatform::GetInstance() 138 pixmap =
138 ->GetSurfaceFactoryOzone() 139 ui::OzonePlatform::GetInstance()
139 ->CreateNativePixmap(gpu::kNullSurfaceHandle, size, format, 140 ->GetSurfaceFactoryOzone()
140 gfx::BufferUsage::SCANOUT); 141 ->CreateNativePixmap(gpu::kNullSurfaceHandle, size, format, usage);
141 #else 142 #else
142 NOTIMPLEMENTED(); 143 NOTIMPLEMENTED();
143 #endif 144 #endif
144 if (!pixmap.get()) { 145 if (!pixmap.get()) {
145 LOG(ERROR) << "Failed to create pixmap " << size.ToString() << " format " 146 LOG(ERROR) << "Failed to create pixmap " << size.ToString() << " format "
146 << static_cast<int>(format); 147 << static_cast<int>(format);
147 return nullptr; 148 return nullptr;
148 } 149 }
149 scoped_refptr<gl::GLImageNativePixmap> image( 150 scoped_refptr<gl::GLImageNativePixmap> image(
150 new gl::GLImageNativePixmap(size, internalformat)); 151 new gl::GLImageNativePixmap(size, internalformat));
151 if (!image->Initialize(pixmap.get(), format)) { 152 if (!image->Initialize(pixmap.get(), format)) {
152 LOG(ERROR) << "Failed to create GLImage " << size.ToString() << " format " 153 LOG(ERROR) << "Failed to create GLImage " << size.ToString() << " format "
153 << static_cast<int>(format); 154 << static_cast<int>(format);
154 return nullptr; 155 return nullptr;
155 } 156 }
156 return image; 157 return image;
157 } 158 }
158 159
159 unsigned GpuMemoryBufferFactoryNativePixmap::RequiredTextureType() { 160 unsigned GpuMemoryBufferFactoryNativePixmap::RequiredTextureType() {
160 return GL_TEXTURE_2D; 161 return GL_TEXTURE_2D;
161 } 162 }
162 163
163 } // namespace gpu 164 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/ipc/service/gpu_memory_buffer_factory_native_pixmap.h ('k') | ui/gl/gl_bindings.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698