Skip to content

Commit d34392b

Browse files
author
DiligentGraphics
authored
Updated readme with iOS build info
1 parent ad3ae37 commit d34392b

File tree

1 file changed

+39
-17
lines changed

1 file changed

+39
-17
lines changed

README.md

Lines changed: 39 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,18 @@
11
# DiligentCore
22

3-
This module implements key engine functionality. It provides API implementations with Direct3D11, Direct3D12,
4-
OpenGL and OpenGLES as well as basic platform-specific utilities.
3+
This module implements [Diligent Engine](https://github.com/DiligentGraphics/DiligentEngine)'s core functionality: Direct3D11, Direct3D12,
4+
OpenGL, and OpenGLES rendering backends as well as basic platform-specific utilities. It is self-contained and can be built by its own.
5+
The module's cmake script defines a number of variables that are required to generate build files for other modules,
6+
so it must always be handled first.
7+
8+
To build the module, see [build instrcutions](https://github.com/DiligentGraphics/DiligentEngine/blob/master/README.md) in the master repository.
59

610
# Build Status
711

812
| Platform | Status |
913
| -------------------------- | ------------- |
1014
| Win32/Universal Windows | [![Build Status](https://ci.appveyor.com/api/projects/status/github/DiligentGraphics/DiligentCore?svg=true)](https://ci.appveyor.com/project/DiligentGraphics/diligentcore) |
11-
| Linux/MacOS | [![Build Status](https://travis-ci.org/DiligentGraphics/DiligentCore.svg?branch=master)](https://travis-ci.org/DiligentGraphics/DiligentCore) |
15+
| Linux/MacOS/iOS | [![Build Status](https://travis-ci.org/DiligentGraphics/DiligentCore.svg?branch=master)](https://travis-ci.org/DiligentGraphics/DiligentCore) |
1216

1317

1418
# Repository structure
@@ -22,13 +26,14 @@ OpenGL and OpenGLES as well as basic platform-specific utilities.
2226
| [Graphics/GraphicsAccessories](https://github.com/DiligentGraphics/DiligentCore/tree/master/Graphics/GraphicsAccessories) | Basic graphics accessories used by all implementations |
2327
| [Graphics/GraphicsEngine](https://github.com/DiligentGraphics/DiligentCore/tree/master/Graphics/GraphicsEngine) | Platform-independent base functionality |
2428
| [Graphics/GraphicsEngineD3DBase](https://github.com/DiligentGraphics/DiligentCore/tree/master/Graphics/GraphicsEngineD3DBase)| Base functionality for D3D11/D3D12 implementations |
25-
| [Graphics/GraphicsEngineD3D11](https://github.com/DiligentGraphics/DiligentCore/tree/master/Graphics/GraphicsEngineD3D11) | Engine implementation with Direct3D11 |
26-
| [Graphics/GraphicsEngineD3D12](https://github.com/DiligentGraphics/DiligentCore/tree/master/Graphics/GraphicsEngineD3D12) | Engine implementation with Direct3D12 |
27-
| [Graphics/GraphicsEngineOpenGL](https://github.com/DiligentGraphics/DiligentCore/tree/master/Graphics/GraphicsEngineOpenGL) | Engine implementation with OpenGL/GLES |
29+
| [Graphics/GraphicsEngineD3D11](https://github.com/DiligentGraphics/DiligentCore/tree/master/Graphics/GraphicsEngineD3D11) | Implementation of Direct3D11 rendering backend |
30+
| [Graphics/GraphicsEngineD3D12](https://github.com/DiligentGraphics/DiligentCore/tree/master/Graphics/GraphicsEngineD3D12) | Implementation of Direct3D12 rendering backend |
31+
| [Graphics/GraphicsEngineOpenGL](https://github.com/DiligentGraphics/DiligentCore/tree/master/Graphics/GraphicsEngineOpenGL) | Implementation of OpenGL/GLES rendering backend |
2832
| [Graphics/GraphicsTools](https://github.com/DiligentGraphics/DiligentCore/tree/master/Graphics/GraphicsTools) | Graphics utilities build on top of core interfaces (definitions of commonly used states, texture uploaders, etc.) |
2933
| [Graphics/HLSL2GLSLConverterLib](https://github.com/DiligentGraphics/DiligentCore/tree/master/Graphics/HLSL2GLSLConverterLib) | HLSL to GLSL source code converter library |
3034
| [Platforms/Basic](https://github.com/DiligentGraphics/DiligentCore/tree/master/Platforms/Basic) | Interface for platform-specific routines and implementation of some common functionality |
3135
| [Platforms/Android](https://github.com/DiligentGraphics/DiligentCore/tree/master/Platforms/Android) | Implementation of platform-specific routines on Android |
36+
| [Platforms/Apple](https://github.com/DiligentGraphics/DiligentCore/tree/master/Platforms/Apple) | Implementation of platform-specific routines on Apple platforms (MacOS, iOS)|
3237
| [Platforms/UWP](https://github.com/DiligentGraphics/DiligentCore/tree/master/Platforms/UWP) | Implementation of platform-specific routines on Universal Windows platform |
3338
| [Platforms/Win32](https://github.com/DiligentGraphics/DiligentCore/tree/master/Platforms/Win32) | Implementation of platform-specific routines on Win32 platform |
3439
| [Platforms/Linux](https://github.com/DiligentGraphics/DiligentCore/tree/master/Platforms/Linux) | Implementation of platform-specific routines on Linux platform |
@@ -47,28 +52,29 @@ On Win32 platform, you can create OpenGL, Direct3D11 or Direct3D12 device as sho
4752
```cpp
4853
void InitDevice(HWND hWnd,
4954
IRenderDevice **ppRenderDevice,
50-
IDeviceContext **ppImmediateContext,
55+
std::vector<IDeviceContext*> &ppContexts,
5156
ISwapChain **ppSwapChain,
5257
DeviceType DevType)
5358
{
5459
SwapChainDesc SCDesc;
5560
SCDesc.SamplesCount = 1;
61+
Uint32 NumDeferredCtx = 0;
5662
switch (DevType)
5763
{
5864
case DeviceType::D3D11:
5965
{
6066
EngineD3D11Attribs DeviceAttribs;
61-
DeviceAttribs.DebugFlags = (Uint32)EngineD3D11DebugFlags::VerifyCommittedShaderResources |
62-
(Uint32)EngineD3D11DebugFlags::VerifyCommittedResourceRelevance;
67+
g_pSample->GetEngineInitializationAttribs(DevType, DeviceAttribs, NumDeferredCtx);
6368

6469
#ifdef ENGINE_DLL
6570
GetEngineFactoryD3D11Type GetEngineFactoryD3D11 = nullptr;
6671
// Load the dll and import GetEngineFactoryD3D11() function
6772
LoadGraphicsEngineD3D11(GetEngineFactoryD3D11);
6873
#endif
6974
auto *pFactoryD3D11 = GetEngineFactoryD3D11();
70-
pFactoryD3D11->CreateDeviceAndContextsD3D11( DeviceAttribs, ppRenderDevice, ppImmediateContext, 0 );
71-
pFactoryD3D11->CreateSwapChainD3D11( *ppRenderDevice, *ppImmediateContext, SCDesc, hWnd, ppSwapChain );
75+
ppContexts.resize(1 + NumDeferredCtx);
76+
pFactoryD3D11->CreateDeviceAndContextsD3D11( DeviceAttribs, ppRenderDevice, ppContexts.data(), NumDeferredCtx );
77+
pFactoryD3D11->CreateSwapChainD3D11( *ppRenderDevice, ppContexts[0], SCDesc, hWnd, ppSwapChain );
7278
}
7379
break;
7480

@@ -82,13 +88,15 @@ void InitDevice(HWND hWnd,
8288

8389
auto *pFactoryD3D12 = GetEngineFactoryD3D12();
8490
EngineD3D12Attribs EngD3D12Attribs;
91+
g_pSample->GetEngineInitializationAttribs(DevType, EngD3D12Attribs, NumDeferredCtx);
8592
EngineD3D12Attribs.GPUDescriptorHeapDynamicSize[0] = 32768;
8693
EngineD3D12Attribs.GPUDescriptorHeapSize[1] = 128;
8794
EngineD3D12Attribs.GPUDescriptorHeapDynamicSize[1] = 2048-128;
8895
EngineD3D12Attribs.DynamicDescriptorAllocationChunkSize[0] = 32;
89-
EngineD3D12Attribs.DynamicDescriptorAllocationChunkSize[1] = 8; // D3D12_DESCRIPTOR_HEAP_TYPE_SAMPLER
90-
pFactoryD3D12->CreateDeviceAndContextsD3D12( EngD3D12Attribs, ppRenderDevice, ppImmediateContext, 0);
91-
pFactoryD3D12->CreateSwapChainD3D12( *ppRenderDevice, *ppImmediateContext, SCDesc, hWnd, ppSwapChain );
96+
EngineD3D12Attribs.DynamicDescriptorAllocationChunkSize[1] = 8; // D3D12_DESCRIPTOR_HEAP_TYPE_SAMPLER
97+
ppContexts.resize(1 + NumDeferredCtx);
98+
pFactoryD3D12->CreateDeviceAndContextsD3D12( EngD3D12Attribs, ppRenderDevice, ppContexts.data(), NumDeferredCtx);
99+
pFactoryD3D12->CreateSwapChainD3D12( *ppRenderDevice, ppContexts[0], SCDesc, hWnd, ppSwapChain );
92100
}
93101
break;
94102

@@ -100,9 +108,17 @@ void InitDevice(HWND hWnd,
100108
// Load the dll and import GetEngineFactoryOpenGL() function
101109
LoadGraphicsEngineOpenGL(GetEngineFactoryOpenGL);
102110
#endif
103-
EngineCreationAttribs EngineCreationAttribs;
111+
EngineGLAttribs CreationAttribs;
112+
CreationAttribs.pNativeWndHandle = hWnd;
113+
g_pSample->GetEngineInitializationAttribs(DevType, CreationAttribs, NumDeferredCtx);
114+
if(NumDeferredCtx != 0)
115+
{
116+
LOG_ERROR_MESSAGE("Deferred contexts are not supported in OpenGL mode");
117+
NumDeferredCtx = 0;
118+
}
119+
ppContexts.resize(1 + NumDeferredCtx);
104120
GetEngineFactoryOpenGL()->CreateDeviceAndSwapChainGL(
105-
EngineCreationAttribs, ppRenderDevice, ppImmediateContext, SCDesc, hWnd, ppSwapChain );
121+
CreationAttribs, ppRenderDevice, ppContexts.data(), SCDesc, ppSwapChain );
106122
}
107123
break;
108124

@@ -195,6 +211,12 @@ static
195211
}
196212
```
197213

214+
### iOS
215+
216+
iOS implementation only supports OpenGLES backend. Initialization of GL context on iOS is
217+
performed by the application, and the engine attaches to the context initialized by the app; see
218+
[EAGLView.m](https://github.com/DiligentGraphics/DiligentSamples/blob/master/Samples/SampleBase/Apple/Source/Classes/iOS/EAGLView.m) for details.
219+
198220
### Attaching to Already Initialized Graphics API
199221

200222
An alternative way to initialize the engine is to attach to existing D3D11/D3D12 device or OpenGL/GLES context.
@@ -582,7 +604,7 @@ objects. Refer to the following pages for more information:
582604
583605
## Current Progress
584606
585-
* Added MacOS support
607+
* Added MacOS and iOS support
586608
587609
## v2.1.b
588610

0 commit comments

Comments
 (0)