Index: webrtc/modules/desktop_capture/win/d3d_device.h |
diff --git a/webrtc/modules/desktop_capture/win/d3d_device.h b/webrtc/modules/desktop_capture/win/d3d_device.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..5c1a4c02c1fe75bc702cd4789512b4472a4992fc |
--- /dev/null |
+++ b/webrtc/modules/desktop_capture/win/d3d_device.h |
@@ -0,0 +1,59 @@ |
+/* |
+ * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. |
+ * |
+ * Use of this source code is governed by a BSD-style license |
+ * that can be found in the LICENSE file in the root of the source |
+ * tree. An additional intellectual property rights grant can be found |
+ * in the file PATENTS. All contributing project authors may |
+ * be found in the AUTHORS file in the root of the source tree. |
+ */ |
+ |
+#ifndef MODULES_DESKTOP_CAPTURE_WIN_D3D_DEVICE_H_ |
+#define MODULES_DESKTOP_CAPTURE_WIN_D3D_DEVICE_H_ |
+ |
+#include <comdef.h> |
+#include <wrl/client.h> |
+#include <D3D11.h> |
+#include <DXGI.h> |
+ |
+#include <vector> |
+ |
+namespace webrtc { |
+ |
+// A wrapper of ID3D11Device and its corresponding context and IDXGIAdapter. |
+// This class represents one video card in the system. |
+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
|
+ public: |
+ // Initialize the D3dDevice from an IDXGIAdapter. |
+ 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.
|
+ |
+ ID3D11Device* d3d_device() const { |
+ return d3d_device_.Get(); |
+ } |
+ |
+ ID3D11DeviceContext* context() const { |
+ return context_.Get(); |
+ } |
+ |
+ IDXGIDevice* dxgi_device() const { |
+ return dxgi_device_.Get(); |
+ } |
+ |
+ IDXGIAdapter* dxgi_adapter() const { |
+ return dxgi_adapter_.Get(); |
+ } |
+ |
+ // Returns all D3dDevices on the system. Returns an empty vector if anything |
+ // wrong. |
+ static std::vector<D3dDevice> EnumDevices(); |
+ |
+ private: |
+ Microsoft::WRL::ComPtr<ID3D11Device> d3d_device_; |
+ Microsoft::WRL::ComPtr<ID3D11DeviceContext> context_; |
+ Microsoft::WRL::ComPtr<IDXGIDevice> dxgi_device_; |
+ Microsoft::WRL::ComPtr<IDXGIAdapter> dxgi_adapter_; |
+}; |
+ |
+} // namespace webrtc |
+ |
+#endif // MODULES_DESKTOP_CAPTURE_WIN_D3D_DEVICE_H_ |