Diligent Engine  v.2.4.g
EngineFactoryD3D11.h
Go to the documentation of this file.
1 /*
2  * Copyright 2019-2021 Diligent Graphics LLC
3  * Copyright 2015-2019 Egor Yusov
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  * In no event and under no legal theory, whether in tort (including negligence),
18  * contract, or otherwise, unless required by applicable law (such as deliberate
19  * and grossly negligent acts) or agreed to in writing, shall any Contributor be
20  * liable for any damages, including any direct, indirect, special, incidental,
21  * or consequential damages of any character arising as a result of this License or
22  * out of the use or inability to use the software (including but not limited to damages
23  * for loss of goodwill, work stoppage, computer failure or malfunction, or any and
24  * all other commercial damages or losses), even if such Contributor has been advised
25  * of the possibility of such damages.
26  */
27 
28 #pragma once
29 
32 
33 #include "../../GraphicsEngine/interface/EngineFactory.h"
34 #include "../../GraphicsEngine/interface/RenderDevice.h"
35 #include "../../GraphicsEngine/interface/DeviceContext.h"
36 #include "../../GraphicsEngine/interface/SwapChain.h"
37 
38 #if ENGINE_DLL
39 # include "../../GraphicsEngine/interface/LoadEngineDll.h"
40 #endif
41 
43 
44 // {62663A30-AAF0-4A9A-9729-9EAC6BF789F2}
45 static const struct INTERFACE_ID IID_EngineFactoryD3D11 =
46  {0x62663a30, 0xaaf0, 0x4a9a, {0x97, 0x29, 0x9e, 0xac, 0x6b, 0xf7, 0x89, 0xf2}};
47 
48 #define DILIGENT_INTERFACE_NAME IEngineFactoryD3D11
49 #include "../../../Primitives/interface/DefineInterfaceHelperMacros.h"
50 
51 #define IEngineFactoryD3D11InclusiveMethods \
52  IEngineFactoryInclusiveMethods; \
53  IEngineFactoryD3D11Methods EngineFactoryD3D11
54 
55 // clang-format off
56 
59 {
61 
69  VIRTUAL void METHOD(CreateDeviceAndContextsD3D11)(THIS_
70  const EngineD3D11CreateInfo REF EngineCI,
71  IRenderDevice** ppDevice,
72  IDeviceContext** ppContexts) PURE;
73 
74 
76 
89  VIRTUAL void METHOD(CreateSwapChainD3D11)(THIS_
90  IRenderDevice* pDevice,
91  IDeviceContext* pImmediateContext,
92  const SwapChainDesc REF SCDesc,
93  const FullScreenModeDesc REF FSDesc,
94  const NativeWindow REF Window,
95  ISwapChain** ppSwapChain) PURE;
96 
97 
99 
109  VIRTUAL void METHOD(AttachToD3D11Device)(THIS_
110  void* pd3d11NativeDevice,
111  void* pd3d11ImmediateContext,
112  const EngineD3D11CreateInfo REF EngineCI,
113  IRenderDevice** ppDevice,
114  IDeviceContext** ppContexts) PURE;
115 
116 
118 
130  VIRTUAL void METHOD(EnumerateAdapters)(THIS_
131  DIRECT3D_FEATURE_LEVEL MinFeatureLevel,
132  Uint32 REF NumAdapters,
133  GraphicsAdapterInfo* Adapters) PURE;
134 
135 
137 
148  VIRTUAL void METHOD(EnumerateDisplayModes)(THIS_
149  DIRECT3D_FEATURE_LEVEL MinFeatureLevel,
150  Uint32 AdapterId,
151  Uint32 OutputId,
152  TEXTURE_FORMAT Format,
153  Uint32 REF NumDisplayModes,
154  DisplayModeAttribs* DisplayModes) PURE;
155 };
157 
158 #include "../../../Primitives/interface/UndefInterfaceHelperMacros.h"
159 
160 #if DILIGENT_C_INTERFACE
161 
162 // clang-format off
163 
164 # define IEngineFactoryD3D11_CreateDeviceAndContextsD3D11(This, ...) CALL_IFACE_METHOD(EngineFactoryD3D11, CreateDeviceAndContextsD3D11, This, __VA_ARGS__)
165 # define IEngineFactoryD3D11_CreateSwapChainD3D11(This, ...) CALL_IFACE_METHOD(EngineFactoryD3D11, CreateSwapChainD3D11, This, __VA_ARGS__)
166 # define IEngineFactoryD3D11_AttachToD3D11Device(This, ...) CALL_IFACE_METHOD(EngineFactoryD3D11, AttachToD3D11Device, This, __VA_ARGS__)
167 # define IEngineFactoryD3D11_EnumerateAdapters(This, ...) CALL_IFACE_METHOD(EngineFactoryD3D11, EnumerateAdapters, This, __VA_ARGS__)
168 # define IEngineFactoryD3D11_EnumerateDisplayModes(This, ...) CALL_IFACE_METHOD(EngineFactoryD3D11, EnumerateDisplayModes, This, __VA_ARGS__)
169 
170 // clang-format on
171 
172 #endif
173 
174 
175 #if ENGINE_DLL
176 
177 typedef struct IEngineFactoryD3D11* (*GetEngineFactoryD3D11Type)();
178 
179 inline GetEngineFactoryD3D11Type DILIGENT_GLOBAL_FUNCTION(LoadGraphicsEngineD3D11)()
180 {
181  return (GetEngineFactoryD3D11Type)LoadEngineDll("GraphicsEngineD3D11", "GetEngineFactoryD3D11");
182 }
183 
184 #else
185 
186 struct IEngineFactoryD3D11* DILIGENT_GLOBAL_FUNCTION(GetEngineFactoryD3D11)();
187 
188 #endif
189 
190 DILIGENT_END_NAMESPACE // namespace Diligent
DILIGENT_END_INTERFACE
#define DILIGENT_END_INTERFACE
Definition: DefineInterfaceHelperMacros.h:88
Diligent::INTERFACE_ID
struct INTERFACE_ID INTERFACE_ID
Definition: InterfaceID.h:54
VIRTUAL
#define VIRTUAL
Definition: DefineInterfaceHelperMacros.h:83
DILIGENT_BEGIN_INTERFACE
#define DILIGENT_BEGIN_INTERFACE(Name, Base)
Definition: CommonDefinitions.h:97
Diligent::GetEngineFactoryD3D11
struct IEngineFactoryD3D11 * GetEngineFactoryD3D11()
Definition: EngineFactoryD3D11.cpp:340
DILIGENT_GLOBAL_FUNCTION
#define DILIGENT_GLOBAL_FUNCTION(FuncName)
Definition: CommonDefinitions.h:95
Diligent::ISwapChain
Swap chain interface.
Definition: SwapChain.h:56
Diligent::EngineD3D11CreateInfo
Attributes specific to D3D11 engine.
Definition: GraphicsTypes.h:2082
PURE
#define PURE
Definition: DefineInterfaceHelperMacros.h:85
Diligent::IRenderDevice
Render device interface.
Definition: RenderDevice.h:75
Diligent::DIRECT3D_FEATURE_LEVEL
DIRECT3D_FEATURE_LEVEL
Direct3D11/12 feature level.
Definition: GraphicsTypes.h:2058
DILIGENT_END_NAMESPACE
#define DILIGENT_END_NAMESPACE
Definition: CommonDefinitions.h:86
Diligent::DisplayModeAttribs
Display mode attributes.
Definition: GraphicsTypes.h:1269
Diligent::SwapChainDesc
Swap chain description.
Definition: GraphicsTypes.h:1347
Diligent::Uint32
uint32_t Uint32
32-bit unsigned integer
Definition: BasicTypes.h:51
Diligent::TEXTURE_FORMAT
TEXTURE_FORMAT
Texture formats.
Definition: GraphicsTypes.h:328
Diligent::LoadEngineDll
FARPROC LoadEngineDll(const char *EngineName, const char *GetFactoryFuncName)
Definition: LoadEngineDll.h:49
REF
#define REF
Definition: DefineGlobalFuncHelperMacros.h:39
Diligent::GraphicsAdapterInfo
Graphics adapter properties.
Definition: GraphicsTypes.h:1782
METHOD
#define METHOD(Name)
Definition: DefineInterfaceHelperMacros.h:87
Diligent::IEngineFactoryD3D11
Engine factory for Direct3D11 rendering backend.
Definition: EngineFactoryD3D11.h:58
Diligent::IDeviceContext
Device context interface.
Definition: DeviceContext.h:1460
DILIGENT_BEGIN_NAMESPACE
#define DILIGENT_BEGIN_NAMESPACE(Name)
Definition: CommonDefinitions.h:82
Diligent::IEngineFactory
Engine factory base interface.
Definition: EngineFactory.h:60
Diligent
The library uses Direct3D-style math:
Definition: AdvancedMath.hpp:37
THIS_
#define THIS_
Definition: DefineInterfaceHelperMacros.h:82
Diligent::FullScreenModeDesc
Full screen mode description.
Definition: GraphicsTypes.h:1425