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

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

Issue 2999923002: Revert of 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,
96 unsigned internalformat) { 95 unsigned internalformat) {
97 // Note that the GpuMemoryBufferId and child id don't matter since the texture 96 // Note that the GpuMemoryBufferId and child id don't matter since the texture
98 // will never be directly exposed to other processes, only via a mailbox. 97 // will never be directly exposed to other processes, only via a mailbox.
99 int gmb_id = 0; 98 int gmb_id = 0;
100 int client_id = 0; 99 int client_id = 0;
101 gfx::GpuMemoryBufferHandle handle = 100 gfx::GpuMemoryBufferHandle handle = CreateGpuMemoryBuffer(
102 CreateGpuMemoryBuffer(gfx::GpuMemoryBufferId(gmb_id), size, format, usage, 101 gfx::GpuMemoryBufferId(gmb_id), size, format, gfx::BufferUsage::SCANOUT,
103 client_id, gpu::kNullSurfaceHandle); 102 client_id, gpu::kNullSurfaceHandle);
104 103
105 base::ScopedCFTypeRef<IOSurfaceRef> io_surface; 104 base::ScopedCFTypeRef<IOSurfaceRef> io_surface;
106 io_surface.reset(IOSurfaceLookupFromMachPort(handle.mach_port.get())); 105 io_surface.reset(IOSurfaceLookupFromMachPort(handle.mach_port.get()));
107 DCHECK_NE(nullptr, io_surface.get()); 106 DCHECK_NE(nullptr, io_surface.get());
108 scoped_refptr<gl::GLImageIOSurface> image( 107 scoped_refptr<gl::GLImageIOSurface> image(
109 new gl::GLImageIOSurface(size, internalformat)); 108 new gl::GLImageIOSurface(size, internalformat));
110 if (!image->Initialize(io_surface.get(), handle.id, format)) 109 if (!image->Initialize(io_surface.get(), handle.id, format))
111 return scoped_refptr<gl::GLImage>(); 110 return scoped_refptr<gl::GLImage>();
112 return image; 111 return image;
113 } 112 }
114 113
115 unsigned GpuMemoryBufferFactoryIOSurface::RequiredTextureType() { 114 unsigned GpuMemoryBufferFactoryIOSurface::RequiredTextureType() {
116 return GL_TEXTURE_RECTANGLE_ARB; 115 return GL_TEXTURE_RECTANGLE_ARB;
117 } 116 }
118 117
119 bool GpuMemoryBufferFactoryIOSurface::SupportsFormatRGB() { 118 bool GpuMemoryBufferFactoryIOSurface::SupportsFormatRGB() {
120 return false; 119 return false;
121 } 120 }
122 121
123 } // namespace gpu 122 } // 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