• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2019 The Dawn Authors
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 //     http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
15 #ifndef DAWNNATIVE_D3D12_ADAPTERD3D12_H_
16 #define DAWNNATIVE_D3D12_ADAPTERD3D12_H_
17 
18 #include "dawn_native/Adapter.h"
19 
20 #include "common/GPUInfo.h"
21 #include "dawn_native/d3d12/D3D12Info.h"
22 #include "dawn_native/d3d12/d3d12_platform.h"
23 
24 namespace dawn_native { namespace d3d12 {
25 
26     class Backend;
27 
28     class Adapter : public AdapterBase {
29       public:
30         Adapter(Backend* backend, ComPtr<IDXGIAdapter3> hardwareAdapter);
31         ~Adapter() override;
32 
33         // AdapterBase Implementation
34         bool SupportsExternalImages() const override;
35 
36         const D3D12DeviceInfo& GetDeviceInfo() const;
37         IDXGIAdapter3* GetHardwareAdapter() const;
38         Backend* GetBackend() const;
39         ComPtr<ID3D12Device> GetDevice() const;
40         const gpu_info::D3DDriverVersion& GetDriverVersion() const;
41 
42       private:
43         ResultOrError<DeviceBase*> CreateDeviceImpl(
44             const DawnDeviceDescriptor* descriptor) override;
45         MaybeError ResetInternalDeviceForTestingImpl() override;
46 
47         bool AreTimestampQueriesSupported() const;
48 
49         MaybeError InitializeImpl() override;
50         MaybeError InitializeSupportedFeaturesImpl() override;
51         MaybeError InitializeSupportedLimitsImpl(CombinedLimits* limits) override;
52 
53         MaybeError InitializeDebugLayerFilters();
54         void CleanUpDebugLayerFilters();
55 
56         ComPtr<IDXGIAdapter3> mHardwareAdapter;
57         ComPtr<ID3D12Device> mD3d12Device;
58         gpu_info::D3DDriverVersion mDriverVersion;
59 
60         Backend* mBackend;
61         D3D12DeviceInfo mDeviceInfo = {};
62     };
63 
64 }}  // namespace dawn_native::d3d12
65 
66 #endif  // DAWNNATIVE_D3D12_ADAPTERD3D12_H_
67