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

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

Issue 2930143004: Add DIRECT_COMPOSITION GpuMemoryBuffer type.
Patch Set: fix build Created 3 years, 6 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
(Empty)
1
2 // Copyright 2017 The Chromium Authors. All rights reserved.
3 // Use of this source code is governed by a BSD-style license that can be
4 // found in the LICENSE file.
5
6 #include "gpu/ipc/service/gpu_memory_buffer_factory_win.h"
7
8 #include "gpu/ipc/service/gl_image_direct_composition.h"
9
10 namespace gpu {
11
12 GpuMemoryBufferFactoryWin::GpuMemoryBufferFactoryWin() {}
13
14 GpuMemoryBufferFactoryWin::~GpuMemoryBufferFactoryWin() {}
15
16 gfx::GpuMemoryBufferHandle GpuMemoryBufferFactoryWin::CreateGpuMemoryBuffer(
17 gfx::GpuMemoryBufferId id,
18 const gfx::Size& size,
19 gfx::BufferFormat format,
20 gfx::BufferUsage usage,
21 int client_id,
22 SurfaceHandle surface_handle) {
23 base::AutoLock lock(lock_);
24 gfx::GpuMemoryBufferHandle handle;
25 handle.type = gfx::DIRECT_COMPOSITION;
26 handle.id = id;
27 UsageMapKey key(id, client_id);
28 usage_map_[key] = usage;
29
30 return handle;
31 }
32
33 void GpuMemoryBufferFactoryWin::DestroyGpuMemoryBuffer(
34 gfx::GpuMemoryBufferId id,
35 int client_id) {
36 base::AutoLock lock(lock_);
37 UsageMapKey key(id, client_id);
38 usage_map_.erase(key);
39 }
40
41 ImageFactory* GpuMemoryBufferFactoryWin::AsImageFactory() {
42 return this;
43 }
44
45 // Overridden from ImageFactory:
46 scoped_refptr<gl::GLImage>
47 GpuMemoryBufferFactoryWin::CreateImageForGpuMemoryBuffer(
48 const gfx::GpuMemoryBufferHandle& handle,
49 const gfx::Size& size,
50 gfx::BufferFormat format,
51 unsigned internalformat,
52 int client_id,
53 SurfaceHandle surface_handle) {
54 base::AutoLock lock(lock_);
55 UsageMapKey key(handle.id, client_id);
56 auto it = usage_map_.find(key);
57 if (it == usage_map_.end())
58 return nullptr;
59
60 gfx::BufferUsage usage = it->second;
61 return make_scoped_refptr(new GLImageDirectComposition(size, format, usage));
62 }
63
64 scoped_refptr<gl::GLImage> GpuMemoryBufferFactoryWin::CreateAnonymousImage(
65 const gfx::Size& size,
66 gfx::BufferFormat format,
67 unsigned internalformat) {
68 NOTIMPLEMENTED();
69 return nullptr;
70 }
71
72 unsigned GpuMemoryBufferFactoryWin::RequiredTextureType() {
73 return GL_TEXTURE_2D;
74 }
75
76 bool GpuMemoryBufferFactoryWin::SupportsFormatRGB() {
77 return false;
78 }
79
80 } // namespace gpu
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698