Diligent Engine  v.2.4.g
EngineFactoryVk.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 PLATFORM_ANDROID || PLATFORM_LINUX || PLATFORM_MACOS || PLATFORM_IOS || (PLATFORM_WIN32 && !defined(_MSC_VER))
39 // https://gcc.gnu.org/wiki/Visibility
40 # define API_QUALIFIER __attribute__((visibility("default")))
41 #elif PLATFORM_WIN32
42 # define API_QUALIFIER
43 #else
44 # error Unsupported platform
45 #endif
46 
47 #if ENGINE_DLL && PLATFORM_WIN32 && defined(_MSC_VER)
48 # include "../../GraphicsEngine/interface/LoadEngineDll.h"
49 # define EXPLICITLY_LOAD_ENGINE_VK_DLL 1
50 #endif
51 
53 
54 // {F554EEE4-57C2-4637-A508-85BE80DC657C}
55 static const INTERFACE_ID IID_EngineFactoryVk =
56  {0xf554eee4, 0x57c2, 0x4637, {0xa5, 0x8, 0x85, 0xbe, 0x80, 0xdc, 0x65, 0x7c}};
57 
58 #define DILIGENT_INTERFACE_NAME IEngineFactoryVk
59 #include "../../../Primitives/interface/DefineInterfaceHelperMacros.h"
60 
61 #define IEngineFactoryVkInclusiveMethods \
62  IEngineFactoryInclusiveMethods; \
63  IEngineFactoryVkMethods EngineFactoryVk
64 
65 // clang-format off
66 
68 {
70 
78  VIRTUAL void METHOD(CreateDeviceAndContextsVk)(THIS_
79  const EngineVkCreateInfo REF EngineCI,
80  IRenderDevice** ppDevice,
81  IDeviceContext** ppContexts) PURE;
82 
83 
85 
94  VIRTUAL void METHOD(CreateSwapChainVk)(THIS_
95  IRenderDevice* pDevice,
96  IDeviceContext* pImmediateContext,
98  const NativeWindow REF Window,
99  ISwapChain** ppSwapChain) PURE;
100 };
102 
103 #include "../../../Primitives/interface/UndefInterfaceHelperMacros.h"
104 
105 #if DILIGENT_C_INTERFACE
106 
107 // clang-format off
108 
109 # define IEngineFactoryVk_CreateDeviceAndContextsVk(This, ...) CALL_IFACE_METHOD(EngineFactoryVk, CreateDeviceAndContextsVk, This, __VA_ARGS__)
110 # define IEngineFactoryVk_CreateSwapChainVk(This, ...) CALL_IFACE_METHOD(EngineFactoryVk, CreateSwapChainVk, This, __VA_ARGS__)
111 
112 // clang-format on
113 
114 #endif
115 
116 #if EXPLICITLY_LOAD_ENGINE_VK_DLL
117 
118 typedef struct IEngineFactoryVk* (*GetEngineFactoryVkType)();
119 
120 inline GetEngineFactoryVkType DILIGENT_GLOBAL_FUNCTION(LoadGraphicsEngineVk)()
121 {
122  return (GetEngineFactoryVkType)LoadEngineDll("GraphicsEngineVk", "GetEngineFactoryVk");
123 }
124 
125 #else
126 
128 struct IEngineFactoryVk* DILIGENT_GLOBAL_FUNCTION(GetEngineFactoryVk)();
129 
130 #endif
131 
132 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
API_QUALIFIER
#define API_QUALIFIER
Definition: EngineFactoryMtl.h:39
DILIGENT_GLOBAL_FUNCTION
#define DILIGENT_GLOBAL_FUNCTION(FuncName)
Definition: CommonDefinitions.h:95
Diligent::ISwapChain
Swap chain interface.
Definition: SwapChain.h:56
PURE
#define PURE
Definition: DefineInterfaceHelperMacros.h:85
Diligent::IRenderDevice
Render device interface.
Definition: RenderDevice.h:75
DILIGENT_END_NAMESPACE
#define DILIGENT_END_NAMESPACE
Definition: CommonDefinitions.h:86
Diligent::GetEngineFactoryVk
API_QUALIFIER struct IEngineFactoryVk * GetEngineFactoryVk()
Definition: EngineFactoryVk.cpp:713
Diligent::SwapChainDesc
Swap chain description.
Definition: GraphicsTypes.h:1347
Diligent::SwapChainDesc
struct SwapChainDesc SwapChainDesc
Definition: GraphicsTypes.h:1421
Diligent::IEngineFactoryVk
Definition: EngineFactoryVk.h:67
Diligent::LoadEngineDll
FARPROC LoadEngineDll(const char *EngineName, const char *GetFactoryFuncName)
Definition: LoadEngineDll.h:49
REF
#define REF
Definition: DefineGlobalFuncHelperMacros.h:39
METHOD
#define METHOD(Name)
Definition: DefineInterfaceHelperMacros.h:87
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::EngineVkCreateInfo
Attributes specific to Vulkan engine.
Definition: GraphicsTypes.h:2282
Diligent
The library uses Direct3D-style math:
Definition: AdvancedMath.hpp:37
THIS_
#define THIS_
Definition: DefineInterfaceHelperMacros.h:82