1 /* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2  * This Source Code Form is subject to the terms of the Mozilla Public
3  * License, v. 2.0. If a copy of the MPL was not distributed with this
4  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5 
6 #ifndef mozilla_gfx_thebes_D3D11Checks_h
7 #define mozilla_gfx_thebes_D3D11Checks_h
8 
9 #include "mozilla/EnumSet.h"
10 #include "mozilla/EnumTypeTraits.h"
11 
12 struct ID3D11Device;
13 struct IDXGIAdapter;
14 struct DXGI_ADAPTER_DESC;
15 
16 namespace mozilla {
17 namespace gfx {
18 
19 struct D3D11Checks {
20   enum class VideoFormatOption {
21     NV12,
22     P010,
23     P016,
24   };
25   using VideoFormatOptionSet = EnumSet<VideoFormatOption>;
26 
27   static bool DoesRenderTargetViewNeedRecreating(ID3D11Device* aDevice);
28   static bool DoesDeviceWork();
29   static bool DoesTextureSharingWork(ID3D11Device* device);
30   static bool DoesAlphaTextureSharingWork(ID3D11Device* device);
31   static void WarnOnAdapterMismatch(ID3D11Device* device);
32   static bool GetDxgiDesc(ID3D11Device* device, DXGI_ADAPTER_DESC* out);
33   static bool DoesRemotePresentWork(IDXGIAdapter* adapter);
34   static VideoFormatOptionSet FormatOptions(ID3D11Device* device);
35 };
36 
37 }  // namespace gfx
38 
39 // Used for IPDL serialization.
40 // The 'value' have to be the biggest enum from D3D11Checks::Option.
41 template <>
42 struct MaxEnumValue<::mozilla::gfx::D3D11Checks::VideoFormatOption> {
43   static constexpr unsigned int value =
44       static_cast<unsigned int>(gfx::D3D11Checks::VideoFormatOption::P016);
45 };
46 
47 }  // namespace mozilla
48 
49 #endif  // mozilla_gfx_thebes_D3D11Checks_h
50