OLD | NEW |
---|---|
(Empty) | |
1 /* | |
2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. | |
3 * | |
4 * Use of this source code is governed by a BSD-style license | |
5 * that can be found in the LICENSE file in the root of the source | |
6 * tree. An additional intellectual property rights grant can be found | |
7 * in the file PATENTS. All contributing project authors may | |
8 * be found in the AUTHORS file in the root of the source tree. | |
9 */ | |
10 | |
11 #ifndef MODULES_DESKTOP_CAPTURE_WIN_D3D_DEVICE_H_ | |
12 #define MODULES_DESKTOP_CAPTURE_WIN_D3D_DEVICE_H_ | |
13 | |
14 #include <comdef.h> | |
15 #include <wrl/client.h> | |
16 #include <D3D11.h> | |
17 #include <DXGI.h> | |
18 | |
19 #include <vector> | |
20 | |
21 namespace webrtc { | |
22 | |
23 // A wrapper of ID3D11Device and its corresponding context and IDXGIAdapter. | |
24 // This class represents one video card in the system. | |
25 class D3dDevice { | |
Sergey Ulanov
2016/07/08 22:36:53
Do you really need this as a class and not a struc
Hzj_jie
2016/07/11 00:54:59
I would still prefer to let this as a class. Movin
| |
26 public: | |
27 // Initialize the D3dDevice from an IDXGIAdapter. | |
28 bool Initialize(const Microsoft::WRL::ComPtr<IDXGIAdapter>& adapter); | |
Sergey Ulanov
2016/07/08 22:36:53
Do you need this as a separate method? Can initial
Hzj_jie
2016/07/11 00:54:59
Same reason as above.
| |
29 | |
30 ID3D11Device* d3d_device() const { | |
31 return d3d_device_.Get(); | |
32 } | |
33 | |
34 ID3D11DeviceContext* context() const { | |
35 return context_.Get(); | |
36 } | |
37 | |
38 IDXGIDevice* dxgi_device() const { | |
39 return dxgi_device_.Get(); | |
40 } | |
41 | |
42 IDXGIAdapter* dxgi_adapter() const { | |
43 return dxgi_adapter_.Get(); | |
44 } | |
45 | |
46 // Returns all D3dDevices on the system. Returns an empty vector if anything | |
47 // wrong. | |
48 static std::vector<D3dDevice> EnumDevices(); | |
49 | |
50 private: | |
51 Microsoft::WRL::ComPtr<ID3D11Device> d3d_device_; | |
52 Microsoft::WRL::ComPtr<ID3D11DeviceContext> context_; | |
53 Microsoft::WRL::ComPtr<IDXGIDevice> dxgi_device_; | |
54 Microsoft::WRL::ComPtr<IDXGIAdapter> dxgi_adapter_; | |
55 }; | |
56 | |
57 } // namespace webrtc | |
58 | |
59 #endif // MODULES_DESKTOP_CAPTURE_WIN_D3D_DEVICE_H_ | |
OLD | NEW |