diff options
| author | Egor Yusov <egor.yusov@gmail.com> | 2019-03-18 15:00:25 +0000 |
|---|---|---|
| committer | Egor Yusov <egor.yusov@gmail.com> | 2019-03-18 15:00:25 +0000 |
| commit | 86af8a7c8c1f4598efa6effcec3fb85d12161e98 (patch) | |
| tree | 3ba96a6e3f12376e432e0ed5aad142857d23555b /Graphics | |
| parent | Moved NumDeferredContexts parameter from factory functions to EngineCreateInf... (diff) | |
| parent | Few more readme updates (diff) | |
| download | DiligentCore-86af8a7c8c1f4598efa6effcec3fb85d12161e98.tar.gz DiligentCore-86af8a7c8c1f4598efa6effcec3fb85d12161e98.zip | |
Merge from master
Diffstat (limited to 'Graphics')
| -rw-r--r-- | Graphics/GraphicsEngineD3D11/readme.md | 58 | ||||
| -rw-r--r-- | Graphics/GraphicsEngineD3D12/readme.md | 52 | ||||
| -rw-r--r-- | Graphics/GraphicsEngineOpenGL/readme.md | 20 |
3 files changed, 65 insertions, 65 deletions
diff --git a/Graphics/GraphicsEngineD3D11/readme.md b/Graphics/GraphicsEngineD3D11/readme.md index 5e475597..f0af4126 100644 --- a/Graphics/GraphicsEngineD3D11/readme.md +++ b/Graphics/GraphicsEngineD3D11/readme.md @@ -5,7 +5,7 @@ Implementation of Direct3D11 back-end # Initialization -The following code snippet shows how to initialize Diligent Engine in D3D11 mode. +The following code snippet shows how to initialize Diligent Engine in Direct3D11 mode. ```cpp #include "EngineFactoryD3D11.h" @@ -13,8 +13,8 @@ using namespace Diligent; // ... -EngineD3D11Attribs DeviceAttribs; -DeviceAttribs.DebugFlags = +EngineD3D11CreateInfo EngineCI; +EngineCI.DebugFlags = (Uint32)EngineD3D11DebugFlags::VerifyCommittedShaderResources | (Uint32)EngineD3D11DebugFlags::VerifyCommittedResourceRelevance; @@ -24,14 +24,14 @@ DeviceAttribs.DebugFlags = // Load the dll and import GetEngineFactoryD3D11() function LoadGraphicsEngineD3D11(GetEngineFactoryD3D11); #endif -auto *pFactoryD3D11 = GetEngineFactoryD3D11(); +auto* pFactoryD3D11 = GetEngineFactoryD3D11(); RefCntAutoPtr<IRenderDevice> pRenderDevice; RefCntAutoPtr<IDeviceContext> pImmediateContext; SwapChainDesc SwapChainDesc; RefCntAutoPtr<ISwapChain> pSwapChain; -pFactoryD3D11->CreateDeviceAndContextsD3D11( DeviceAttribs, &pRenderDevice, &pImmediateContext ); -pFactoryD3D11->CreateSwapChainD3D11( pRenderDevice, pImmediateContext, SwapChainDesc, hWnd, &pSwapChain ); +pFactoryD3D11->CreateDeviceAndContextsD3D11(EngineCI, &pRenderDevice, &pImmediateContext); +pFactoryD3D11->CreateSwapChainD3D11(pRenderDevice, pImmediateContext, SwapChainDesc, hWnd, &pSwapChain); ``` Alternatively, the engine can be initialized by attaching to existing D3D11 device and immediate context (see below). @@ -42,45 +42,45 @@ Diligent Engine exposes methods to access internal D3D11 objects, is able to cre and textures from existing Direct3D11 buffers and textures, and can be initialized by attaching to existing D3D11 device and immediate context. -## Accessing Native D3D11 objects +## Accessing Native Direct3D11 objects Below are some of the methods that provide access to internal D3D11 objects: | Function | Description | |-----------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------| -| `ID3D11Buffer *IBufferD3D11::GetD3D11Buffer()` | returns a pointer to the ID3D11Buffer interface of the internal Direct3D11 buffer object | -| `ID3D11Resource* ITextureD3D11::GetD3D11Texture()` | returns a pointer to the ID3D11Resource interface of the internal Direct3D11 texture object | -| `ID3D11View* IBufferViewD3D11()::GetD3D11View()` | returns a pointer to the ID3D11View interface of the internal d3d11 object representing the buffer view | -| `ID3D11View* ITextureViewD3D11::GetD3D11View()` | returns a pointer to the ID3D11View interface of the internal d3d11 object representing the texture view | -| `ID3D11Device* IRenderDeviceD3D11::GetD3D11Device()` | returns a pointer to the native D3D11 device object | -| `ID3D11DeviceContext* IDeviceContextD3D11::GetD3D11DeviceContext()` | returns a pointer to the native ID3D11DeviceContext object | +| `ID3D11Buffer* IBufferD3D11::GetD3D11Buffer()` | returns a pointer to the `ID3D11Buffer` interface of the internal Direct3D11 buffer object | +| `ID3D11Resource* ITextureD3D11::GetD3D11Texture()` | returns a pointer to the `ID3D11Resource` interface of the internal Direct3D11 texture object | +| `ID3D11View* IBufferViewD3D11()::GetD3D11View()` | returns a pointer to the `ID3D11View` interface of the internal Direct3D11 object representing the buffer view | +| `ID3D11View* ITextureViewD3D11::GetD3D11View()` | returns a pointer to the `ID3D11View` interface of the internal Direct3D11 object representing the texture view | +| `ID3D11Device* IRenderDeviceD3D11::GetD3D11Device()` | returns a pointer to the native Direct3D11 device object | +| `ID3D11DeviceContext* IDeviceContextD3D11::GetD3D11DeviceContext()` | returns a pointer to the native `ID3D11DeviceContext` object | -## Creating Diligent Engine Objects from D3D11 Resources +## Creating Diligent Engine Objects from Direct3D11 Resources -* `void IRenderDeviceD3D11::CreateBufferFromD3DResource(ID3D11Buffer *pd3d11Buffer, const BufferDesc& BuffDesc, RESOURCE_STATE InitialState, IBuffer **ppBuffer)` - - creates a diligent engine buffer object from the native d3d11 buffer -* `void IRenderDeviceD3D11::CreateTextureFromD3DResource(ID3D11Texture1D *pd3d11Texture, RESOURCE_STATE InitialState, ITexture **ppTexture)` - - create a diligent engine texture object from the native D3D11 1D texture -* `void IRenderDeviceD3D11::CreateTextureFromD3DResource(ID3D11Texture2D *pd3d11Texture, RESOURCE_STATE InitialState, ITexture **ppTexture)` - - create a diligent engine texture object from the native D3D11 2D texture -* `void IRenderDeviceD3D11::CreateTextureFromD3DResource(ID3D11Texture3D *pd3d11Texture, RESOURCE_STATE InitialState, ITexture **ppTexture)` - - create a diligent engine texture object from the native D3D11 3D texture +* `void IRenderDeviceD3D11::CreateBufferFromD3DResource(ID3D11Buffer* pd3d11Buffer, const BufferDesc& BuffDesc, RESOURCE_STATE InitialState, IBuffer** ppBuffer)` - + creates a Diligent Engine buffer object from the native Direct3D11 buffer +* `void IRenderDeviceD3D11::CreateTextureFromD3DResource(ID3D11Texture1D* pd3d11Texture, RESOURCE_STATE InitialState, ITexture** ppTexture)` - + create a Diligent Engine texture object from the native Direct3D11 1D texture +* `void IRenderDeviceD3D11::CreateTextureFromD3DResource(ID3D11Texture2D* pd3d11Texture, RESOURCE_STATE InitialState, ITexture** ppTexture)` - + create a Diligent Engine texture object from the native Direct3D11 2D texture +* `void IRenderDeviceD3D11::CreateTextureFromD3DResource(ID3D11Texture3D* pd3d11Texture, RESOURCE_STATE InitialState, ITexture** ppTexture)` - + create a Diligent Engine texture object from the native Direct3D11 3D texture -## Initializing the Engine by Attaching to Existing D3D11 Device and Immediate Context +## Initializing the Engine by Attaching to Existing Direct3D11 Device and Immediate Context -The code snippet below shows how diligent engine can be attached to D3D11 device returned by Unity +The code snippet below shows how diligent engine can be attached to Direct3D11 device returned by Unity ```cpp IUnityGraphicsD3D11* d3d = interfaces->Get<IUnityGraphicsD3D11>(); ID3D11Device* d3d11NativeDevice = d3d->GetDevice(); CComPtr<ID3D11DeviceContext> d3d11ImmediateContext; d3d11NativeDevice->GetImmediateContext(&d3d11ImmediateContext); -auto *pFactoryD3d11 = GetEngineFactoryD3D11(); -EngineD3D11Attribs Attribs; -pFactoryD3d11->AttachToD3D11Device(d3d11NativeDevice, d3d11ImmediateContext, Attribs, &m_Device, &m_Context, 0); +auto* pFactoryD3d11 = GetEngineFactoryD3D11(); +EngineD3D11CreateInfo EngineCI; +pFactoryD3d11->AttachToD3D11Device(d3d11NativeDevice, d3d11ImmediateContext, EngineCI, &m_Device, &m_Context, 0); ``` -For more information about interoperability with D3D11, please visit [Diligent Engine web site](http://diligentgraphics.com/diligent-engine/native-api-interoperability/direct3d11-interoperability/) +For more information about interoperability with Direct3D11, please visit [Diligent Engine web site](http://diligentgraphics.com/diligent-engine/native-api-interoperability/direct3d11-interoperability/) # References @@ -93,4 +93,4 @@ For more information about interoperability with D3D11, please visit [Diligent E [diligentgraphics.com](http://diligentgraphics.com) [](https://twitter.com/diligentengine) -[](https://www.facebook.com/DiligentGraphics/)
\ No newline at end of file +[](https://www.facebook.com/DiligentGraphics/) diff --git a/Graphics/GraphicsEngineD3D12/readme.md b/Graphics/GraphicsEngineD3D12/readme.md index 7d209e5a..42ec0005 100644 --- a/Graphics/GraphicsEngineD3D12/readme.md +++ b/Graphics/GraphicsEngineD3D12/readme.md @@ -5,7 +5,7 @@ Implementation of Direct3D12 back-end # Initialization -The following code snippet shows how to initialize Diligent Engine in D3D12 mode. +The following code snippet shows how to initialize Diligent Engine in Direct3D12 mode. ```cpp #include "EngineFactoryD3D12.h" @@ -17,46 +17,46 @@ using namespace Diligent; // Load the dll and import GetEngineFactoryD3D12() function LoadGraphicsEngineD3D12(GetEngineFactoryD3D12); #endif -auto* pFactoryD3D11 = GetEngineFactoryD3D12(); +auto* pFactoryD3D12 = GetEngineFactoryD3D12(); EngineD3D12CreateInfo EngineCI; EngineCI.CPUDescriptorHeapAllocationSize[0] = 1024; EngineCI.CPUDescriptorHeapAllocationSize[1] = 32; EngineCI.CPUDescriptorHeapAllocationSize[2] = 16; EngineCI.CPUDescriptorHeapAllocationSize[3] = 16; EngineCI.NumCommandsToFlushCmdList = 64; -RefCntAutoPtr<IRenderDevice> pRenderDevice; +RefCntAutoPtr<IRenderDevice> pRenderDevice; RefCntAutoPtr<IDeviceContext> pImmediateContext; SwapChainDesc SwapChainDesc; RefCntAutoPtr<ISwapChain> pSwapChain; -pFactoryD3D11->CreateDeviceAndContextsD3D12( EngineCI, &pRenderDevice, &pImmediateContext ); -pFactoryD3D11->CreateSwapChainD3D12( pRenderDevice, pImmediateContext, SwapChainDesc, hWnd, &pSwapChain ); +pFactoryD3D12->CreateDeviceAndContextsD3D12(EngineCI, &pRenderDevice, &pImmediateContext); +pFactoryD3D12->CreateSwapChainD3D12(pRenderDevice, pImmediateContext, SwapChainDesc, hWnd, &pSwapChain); ``` -Alternatively, the engine can be initialized by attaching to existing D3D12 device (see below). +Alternatively, the engine can be initialized by attaching to existing Direct3D12 device (see below). # Interoperability with Direct3D12 -Diligent Engine exposes methods to access internal D3D12 objects, is able to create diligent engine buffers -and textures from existing Direct3D12 resources, and can be initialized by attaching to existing D3D12 +Diligent Engine exposes methods to access internal Direct3D12 objects, is able to create diligent engine buffers +and textures from existing Direct3D12 resources, and can be initialized by attaching to existing Direct3D12 device and provide synchronization tools. -## Accessing Native D3D12 Resources +## Accessing Native Direct3D12 Resources -Below are some of the methods that provide access to internal D3D12 objects: +Below are some of the methods that provide access to internal Direct3D12 objects: | Function | Description | |-----------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------| -| `ID3D12Resource* IBufferD3D12::GetD3D12Buffer(size_t &DataStartByteOffset, Uint32 ContextId)` | returns a pointer to the ID3D12Resource interface of the internal Direct3D12 buffer object. Note that dynamic buffers are suballocated from dynamic heap, and every context has its own dynamic heap. Offset from the beginning of the dynamic heap for a context identified by ContextId is returned in DataStartByteOffset parameter | +| `ID3D12Resource* IBufferD3D12::GetD3D12Buffer(size_t& DataStartByteOffset, Uint32 ContextId)` | returns a pointer to the `ID3D12Resource` interface of the internal Direct3D12 buffer object. Note that dynamic buffers are suballocated from dynamic heap, and every context has its own dynamic heap. Offset from the beginning of the dynamic heap for a context identified by `ContextId` is returned in `DataStartByteOffset` parameter | | `void IBufferD3D12::SetD3D12ResourceState(D3D12_RESOURCE_STATES state)` | sets the buffer usage state. This method should be used when an application transitions the buffer to inform diligent engine about the current usage state | | `D3D12_CPU_DESCRIPTOR_HANDLE IBufferViewD3D12::GetCPUDescriptorHandle()` | returns CPU descriptor handle of the buffer view | -| `ID3D12Resource* ITextureD3D12::GetD3D12Texture()` | returns a pointer to the ID3D12Resource interface of the internal Direct3D12 texture object | +| `ID3D12Resource* ITextureD3D12::GetD3D12Texture()` | returns a pointer to the `ID3D12Resource` interface of the internal Direct3D12 texture object | | `void ITextureD3D12::SetD3D12ResourceState(D3D12_RESOURCE_STATES state)` | sets the texture usage state. This method should be used when an application transitions the texture to inform diligent engine about the current usage state | | `D3D12_CPU_DESCRIPTOR_HANDLE ITextureViewD3D12::GetCPUDescriptorHandle()` | returns CPU descriptor handle of the texture view | -| `void IDeviceContextD3D12::TransitionTextureState(ITexture *pTexture, D3D12_RESOURCE_STATES State)` | transitions internal D3D12 texture object to a specified state | -| `void IDeviceContextD3D12::TransitionBufferState(IBuffer *pBuffer, D3D12_RESOURCE_STATES State)` | transitions internal D3D12 buffer object to a specified state | -| `ID3D12PipelineState* IPipelineStateD3D12::GetD3D12PipelineState()` | returns ID3D12PipelineState interface of the internal D3D12 pipeline state object object | +| `void IDeviceContextD3D12::TransitionTextureState(ITexture* pTexture, D3D12_RESOURCE_STATES State)` | transitions internal Direct3D12 texture object to a specified state | +| `void IDeviceContextD3D12::TransitionBufferState(IBuffer* pBuffer, D3D12_RESOURCE_STATES State)` | transitions internal Direct3D12 buffer object to a specified state | +| `ID3D12PipelineState* IPipelineStateD3D12::GetD3D12PipelineState()` | returns ID3D12PipelineState interface of the internal Direct3D12 pipeline state object object | | `ID3D12RootSignature* IPipelineStateD3D12::GetD3D12RootSignature()` | returns a pointer to the root signature object associated with this pipeline state | -| `D3D12_CPU_DESCRIPTOR_HANDLE ISamplerD3D12::GetCPUDescriptorHandle()` | returns a CPU descriptor handle of the D3D12 sampler object | +| `D3D12_CPU_DESCRIPTOR_HANDLE ISamplerD3D12::GetCPUDescriptorHandle()` | returns a CPU descriptor handle of the Direct3D12 sampler object | | `ID3D12Device* IRenderDeviceD3D12::GetD3D12Device()` | returns ID3D12Device interface of the internal Direct3D12 device object | ## Synchronization Tools @@ -65,17 +65,17 @@ Below are some of the methods that provide access to internal D3D12 objects: |---------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------| | `Uint64 IRenderDeviceD3D12::GetNextFenceValue()` | returns the fence value that will be signaled by the GPU command queue when the next command list is submitted for execution | | `Bool IRenderDeviceD3D12::IsFenceSignaled(Uint64 FenceValue)` | checks if the fence value has been signaled by the GPU. True means that all associated work has been finished | -| `void IRenderDeviceD3D12::FinishFrame()` | this method should be called at the end of the frame when attached to existing D3D12 device. Otherwise the method is automatically called before present | +| `void IRenderDeviceD3D12::FinishFrame()` | this method should be called at the end of the frame when attached to existing Direct3D12 device. Otherwise the method is automatically called before present | ## Creating Diligent Engine Objects from D3D12 Resources -* `void IRenderDeviceD3D12::CreateTextureFromD3DResource(ID3D12Resource *pd3d12Texture, RESOURCE_STATE InitialState, ITexture **ppTexture)` - - creates a diligent engine texture object from native D3D12 resource. -* `void IRenderDeviceD3D12::CreateBufferFromD3DResource(ID3D12Resource *pd3d12Buffer, const BufferDesc& BuffDesc, RESOURCE_STATE InitialState, IBuffer **ppBuffer)` - - creates a diligent engine buffer object from native D3D12 resource. - The method takes a pointer to the native d3d12 resiyrce pd3d12Buffer, buffer description BuffDesc and writes a pointer to the IBuffer - interface at the memory location pointed to by ppBuffer. The system can recover buffer size, but the rest of the fields of - BuffDesc structure need to be populated by the client as they cannot be recovered from d3d12 resource description. +* `void IRenderDeviceD3D12::CreateTextureFromD3DResource(ID3D12Resource* pd3d12Texture, RESOURCE_STATE InitialState, ITexture** ppTexture)` - + creates a Diligent Engine texture object from native Direct3D12 resource. +* `void IRenderDeviceD3D12::CreateBufferFromD3DResource(ID3D12Resource* pd3d12Buffer, const BufferDesc& BuffDesc, RESOURCE_STATE InitialState, IBuffer** ppBuffer)` - + creates a Diligent Engine buffer object from native Direct3D12 resource. + The method takes a pointer to the native Direct3D12 resiyrce `pd3d12Buffer`, buffer description `BuffDesc` and writes a pointer to the `IBuffer` + interface at the memory location pointed to by `ppBuffer`. The system can recover buffer size, but the rest of the fields of + BuffDesc structure need to be populated by the client as they cannot be recovered from Direct3D12 resource description. ## Initializing the Engine by Attaching to Existing D3D12 Device @@ -96,7 +96,7 @@ immediate goes at position 0. If `EngineCI.NumDeferredContexts` > 0, pointers to The function also takes a pointer to the command queue object `pCommandQueue`, which needs to implement `ICommandQueueD3D12` interface. -For more information about interoperability with D3D12, please visit [Diligent Engine web site](http://diligentgraphics.com/diligent-engine/native-api-interoperability/direct3d12-interoperability/) +For more information about interoperability with Direct3D12, please visit [Diligent Engine web site](http://diligentgraphics.com/diligent-engine/native-api-interoperability/direct3d12-interoperability/) # References @@ -109,4 +109,4 @@ For more information about interoperability with D3D12, please visit [Diligent E [diligentgraphics.com](http://diligentgraphics.com) [](https://twitter.com/diligentengine) -[](https://www.facebook.com/DiligentGraphics/)
\ No newline at end of file +[](https://www.facebook.com/DiligentGraphics/) diff --git a/Graphics/GraphicsEngineOpenGL/readme.md b/Graphics/GraphicsEngineOpenGL/readme.md index ab987dad..0c3c204b 100644 --- a/Graphics/GraphicsEngineOpenGL/readme.md +++ b/Graphics/GraphicsEngineOpenGL/readme.md @@ -8,25 +8,25 @@ Implementation of OpenGL/GLES back-end The following code snippet shows how to initialize Diligent Engine in OpenGL/GLES mode. ```cpp -#include "RenderDeviceFactoryOpenGL.h" +#include "EngineFactoryOpenGL.h" using namespace Diligent; // ... #if ENGINE_DLL GetEngineFactoryOpenGLType GetEngineFactoryOpenGL; - if( !LoadGraphicsEngineOpenGL(GetEngineFactoryOpenGL) ) + if(!LoadGraphicsEngineOpenGL(GetEngineFactoryOpenGL)) return FALSE; #endif RefCntAutoPtr<IRenderDevice> pRenderDevice; RefCntAutoPtr<IDeviceContext> pImmediateContext; SwapChainDesc SCDesc; RefCntAutoPtr<ISwapChain> pSwapChain; -auto *pFactoryOpenGL = GetEngineFactoryOpenGL(); -EngineGLCreateInfo CreationAttribs; -CreationAttribs.pNativeWndHandle = NativeWindowHandle; +auto* pFactoryOpenGL = GetEngineFactoryOpenGL(); +EngineGLCreateInfo EngineCI; +EngineCI = NativeWindowHandle; pFactoryOpenGL->CreateDeviceAndSwapChainGL( - CreationAttribs, &pRenderDevice, &pImmediateContext, SCDesc, &pSwapChain); + EngineCI, &pRenderDevice, &pImmediateContext, SCDesc, &pSwapChain); ``` Alternatively, the engine can be initialized by attaching to existing OpenGL context (see [below](#initializing-the-engine-by-attaching-to-existing-gl-context)). @@ -50,13 +50,13 @@ Below are some of the methods that provide access to internal D3D11 objects: ## Creating Diligent Engine Objects from OpenGL Handles -* `void IRenderDeviceGL::CreateTextureFromGLHandle(Uint32 GLHandle, const TextureDesc &TexDesc, RESOURCE_STATE InitialState, ITexture **ppTexture)` - +* `void IRenderDeviceGL::CreateTextureFromGLHandle(Uint32 GLHandle, const TextureDesc& TexDesc, RESOURCE_STATE InitialState, ITexture** ppTexture)` - creates a diligent engine texture from OpenGL handle. The method takes OpenGL handle GLHandle, texture description TexDesc, and writes the pointer to the created texture object at the memory address pointed to by ppTexture. The engine can automatically set texture width, height, depth, mip levels count, and format, but the remaining field of TexDesc structure must be populated by the application. Note that diligent engine texture object does not take ownership of the GL resource, and the application must not destroy it while it is in use by the engine. -* `void IRenderDeviceGL::CreateBufferFromGLHandle(Uint32 GLHandle, const BufferDesc &BuffDesc, RESOURCE_STATE InitialState, IBuffer **ppBuffer)` - +* `void IRenderDeviceGL::CreateBufferFromGLHandle(Uint32 GLHandle, const BufferDesc& BuffDesc, RESOURCE_STATE InitialState, IBuffer** ppBuffer)` - creates a diligent engine buffer from OpenGL handle. The method takes OpenGL handle GLHandle, buffer description BuffDesc, and writes the pointer to the created buffer object at the memory address pointed to by ppBuffer. The engine can automatically set the buffer size, but the rest of the fields need to be set by the client. Note that diligent engine buffer object does not @@ -67,7 +67,7 @@ Below are some of the methods that provide access to internal D3D11 objects: The code snippet below shows how diligent engine can be attached to existing GL context ```cpp -auto *pFactoryGL = GetEngineFactoryOpenGL(); +auto* pFactoryGL = GetEngineFactoryOpenGL(); EngineCreationAttribs Attribs; pFactoryGL->AttachToActiveGLContext(Attribs, &m_Device, &m_Context); ``` @@ -83,4 +83,4 @@ For more information about interoperability with OpenGL, please visit [Diligent [diligentgraphics.com](http://diligentgraphics.com) [](https://twitter.com/diligentengine) -[](https://www.facebook.com/DiligentGraphics/)
\ No newline at end of file +[](https://www.facebook.com/DiligentGraphics/) |
