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

Side by Side Diff: gpu/ipc/service/gpu_memory_buffer_factory_io_surface.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
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_io_surface.h" 5 #include "gpu/ipc/service/gpu_memory_buffer_factory_io_surface.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "gpu/GLES2/gl2extchromium.h" 10 #include "gpu/GLES2/gl2extchromium.h"
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 new gl::GLImageIOSurface(size, internalformat)); 85 new gl::GLImageIOSurface(size, internalformat));
86 if (!image->Initialize(it->second.get(), handle.id, format)) 86 if (!image->Initialize(it->second.get(), handle.id, format))
87 return scoped_refptr<gl::GLImage>(); 87 return scoped_refptr<gl::GLImage>();
88 88
89 return image; 89 return image;
90 } 90 }
91 91
92 scoped_refptr<gl::GLImage> 92 scoped_refptr<gl::GLImage>
93 GpuMemoryBufferFactoryIOSurface::CreateAnonymousImage(const gfx::Size& size, 93 GpuMemoryBufferFactoryIOSurface::CreateAnonymousImage(const gfx::Size& size,
94 gfx::BufferFormat format, 94 gfx::BufferFormat format,
95 gfx::BufferUsage usage,
95 unsigned internalformat) { 96 unsigned internalformat) {
96 // Note that the GpuMemoryBufferId and child id don't matter since the texture 97 // Note that the GpuMemoryBufferId and child id don't matter since the texture
97 // will never be directly exposed to other processes, only via a mailbox. 98 // will never be directly exposed to other processes, only via a mailbox.
98 int gmb_id = 0; 99 int gmb_id = 0;
99 int client_id = 0; 100 int client_id = 0;
100 gfx::GpuMemoryBufferHandle handle = CreateGpuMemoryBuffer( 101 gfx::GpuMemoryBufferHandle handle =
101 gfx::GpuMemoryBufferId(gmb_id), size, format, gfx::BufferUsage::SCANOUT, 102 CreateGpuMemoryBuffer(gfx::GpuMemoryBufferId(gmb_id), size, format, usage,
102 client_id, gpu::kNullSurfaceHandle); 103 client_id, gpu::kNullSurfaceHandle);
103 104
104 base::ScopedCFTypeRef<IOSurfaceRef> io_surface; 105 base::ScopedCFTypeRef<IOSurfaceRef> io_surface;
105 io_surface.reset(IOSurfaceLookupFromMachPort(handle.mach_port.get())); 106 io_surface.reset(IOSurfaceLookupFromMachPort(handle.mach_port.get()));
106 DCHECK_NE(nullptr, io_surface.get()); 107 DCHECK_NE(nullptr, io_surface.get());
107 scoped_refptr<gl::GLImageIOSurface> image( 108 scoped_refptr<gl::GLImageIOSurface> image(
108 new gl::GLImageIOSurface(size, internalformat)); 109 new gl::GLImageIOSurface(size, internalformat));
109 if (!image->Initialize(io_surface.get(), handle.id, format)) 110 if (!image->Initialize(io_surface.get(), handle.id, format))
110 return scoped_refptr<gl::GLImage>(); 111 return scoped_refptr<gl::GLImage>();
111 return image; 112 return image;
112 } 113 }
113 114
114 unsigned GpuMemoryBufferFactoryIOSurface::RequiredTextureType() { 115 unsigned GpuMemoryBufferFactoryIOSurface::RequiredTextureType() {
115 return GL_TEXTURE_RECTANGLE_ARB; 116 return GL_TEXTURE_RECTANGLE_ARB;
116 } 117 }
117 118
118 bool GpuMemoryBufferFactoryIOSurface::SupportsFormatRGB() { 119 bool GpuMemoryBufferFactoryIOSurface::SupportsFormatRGB() {
119 return false; 120 return false;
120 } 121 }
121 122
122 } // namespace gpu 123 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/ipc/service/gpu_memory_buffer_factory_io_surface.h ('k') | gpu/ipc/service/gpu_memory_buffer_factory_native_pixmap.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698