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

Side by Side Diff: ui/gfx/gpu_memory_buffer.h

Issue 2970353002: Add GpuMemoryBuffer support for DXGI handles.
Patch Set: add image texture target Created 3 years, 5 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 #ifndef UI_GFX_GPU_MEMORY_BUFFER_H_ 5 #ifndef UI_GFX_GPU_MEMORY_BUFFER_H_
6 #define UI_GFX_GPU_MEMORY_BUFFER_H_ 6 #define UI_GFX_GPU_MEMORY_BUFFER_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
(...skipping 15 matching lines...) Expand all
26 26
27 namespace gfx { 27 namespace gfx {
28 28
29 class ColorSpace; 29 class ColorSpace;
30 30
31 enum GpuMemoryBufferType { 31 enum GpuMemoryBufferType {
32 EMPTY_BUFFER, 32 EMPTY_BUFFER,
33 SHARED_MEMORY_BUFFER, 33 SHARED_MEMORY_BUFFER,
34 IO_SURFACE_BUFFER, 34 IO_SURFACE_BUFFER,
35 NATIVE_PIXMAP, 35 NATIVE_PIXMAP,
36 GPU_MEMORY_BUFFER_TYPE_LAST = NATIVE_PIXMAP 36 DXGI_HANDLE,
reveman 2017/07/12 15:04:14 DXGI_BUFFER? as this should represent the storage
37 GPU_MEMORY_BUFFER_TYPE_LAST = DXGI_HANDLE
37 }; 38 };
38 39
39 using GpuMemoryBufferId = GenericSharedMemoryId; 40 using GpuMemoryBufferId = GenericSharedMemoryId;
40 41
41 struct GFX_EXPORT GpuMemoryBufferHandle { 42 struct GFX_EXPORT GpuMemoryBufferHandle {
42 GpuMemoryBufferHandle(); 43 GpuMemoryBufferHandle();
43 GpuMemoryBufferHandle(const GpuMemoryBufferHandle& other); 44 GpuMemoryBufferHandle(const GpuMemoryBufferHandle& other);
44 ~GpuMemoryBufferHandle(); 45 ~GpuMemoryBufferHandle();
45 bool is_null() const { return type == EMPTY_BUFFER; } 46 bool is_null() const { return type == EMPTY_BUFFER; }
46 GpuMemoryBufferType type; 47 GpuMemoryBufferType type;
47 GpuMemoryBufferId id; 48 GpuMemoryBufferId id;
48 base::SharedMemoryHandle handle; 49 base::SharedMemoryHandle handle;
49 uint32_t offset; 50 uint32_t offset;
50 int32_t stride; 51 int32_t stride;
51 #if defined(OS_LINUX) 52 #if defined(OS_LINUX)
52 NativePixmapHandle native_pixmap_handle; 53 NativePixmapHandle native_pixmap_handle;
53 #elif defined(OS_MACOSX) && !defined(OS_IOS) 54 #elif defined(OS_MACOSX) && !defined(OS_IOS)
54 ScopedRefCountedIOSurfaceMachPort mach_port; 55 ScopedRefCountedIOSurfaceMachPort mach_port;
56 #elif defined(OS_WIN)
57 uint32_t array_level = 0;
55 #endif 58 #endif
56 }; 59 };
57 60
58 // This interface typically correspond to a type of shared memory that is also 61 // This interface typically correspond to a type of shared memory that is also
59 // shared with the GPU. A GPU memory buffer can be written to directly by 62 // shared with the GPU. A GPU memory buffer can be written to directly by
60 // regular CPU code, but can also be read by the GPU. 63 // regular CPU code, but can also be read by the GPU.
61 class GFX_EXPORT GpuMemoryBuffer { 64 class GFX_EXPORT GpuMemoryBuffer {
62 public: 65 public:
63 virtual ~GpuMemoryBuffer() {} 66 virtual ~GpuMemoryBuffer() {}
64 67
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 109
107 // Returns an instance of |handle| which can be sent over IPC. This duplicates 110 // Returns an instance of |handle| which can be sent over IPC. This duplicates
108 // the file-handles as appropriate, so that the IPC code take ownership of them, 111 // the file-handles as appropriate, so that the IPC code take ownership of them,
109 // without invalidating |handle| itself. 112 // without invalidating |handle| itself.
110 GFX_EXPORT GpuMemoryBufferHandle 113 GFX_EXPORT GpuMemoryBufferHandle
111 CloneHandleForIPC(const GpuMemoryBufferHandle& handle); 114 CloneHandleForIPC(const GpuMemoryBufferHandle& handle);
112 115
113 } // namespace gfx 116 } // namespace gfx
114 117
115 #endif // UI_GFX_GPU_MEMORY_BUFFER_H_ 118 #endif // UI_GFX_GPU_MEMORY_BUFFER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698