summaryrefslogtreecommitdiffstats
path: root/unityplugin/GhostCubePlugin/PluginSource
diff options
context:
space:
mode:
authorEgor Yusov <egor.yusov@gmail.com>2018-11-21 18:01:10 +0000
committerEgor Yusov <egor.yusov@gmail.com>2018-11-21 18:01:10 +0000
commit41e5a5404dd18c748a8355c0796d5e53f793c3b9 (patch)
tree58af8fabc3132d1edce8248ae5f5eaf53bbd6f42 /unityplugin/GhostCubePlugin/PluginSource
parentFixed release history (diff)
downloadDiligentEngine-41e5a5404dd18c748a8355c0796d5e53f793c3b9.tar.gz
DiligentEngine-41e5a5404dd18c748a8355c0796d5e53f793c3b9.zip
Implemented explicit resource state transitions
Diffstat (limited to 'unityplugin/GhostCubePlugin/PluginSource')
-rw-r--r--unityplugin/GhostCubePlugin/PluginSource/src/RenderAPI_D3D11.cpp4
-rw-r--r--unityplugin/GhostCubePlugin/PluginSource/src/RenderAPI_D3D12.cpp4
-rw-r--r--unityplugin/GhostCubePlugin/PluginSource/src/RenderAPI_OpenGLCoreES.cpp4
-rw-r--r--unityplugin/GhostCubePlugin/PluginSource/src/SamplePlugin.cpp1
4 files changed, 7 insertions, 6 deletions
diff --git a/unityplugin/GhostCubePlugin/PluginSource/src/RenderAPI_D3D11.cpp b/unityplugin/GhostCubePlugin/PluginSource/src/RenderAPI_D3D11.cpp
index 85c81ba..46d3ac8 100644
--- a/unityplugin/GhostCubePlugin/PluginSource/src/RenderAPI_D3D11.cpp
+++ b/unityplugin/GhostCubePlugin/PluginSource/src/RenderAPI_D3D11.cpp
@@ -80,11 +80,11 @@ void RenderAPI_D3D11::AttachToNativeRenderTexture(void *nativeRenderTargetHandle
auto *pd3d11RenderTarget = reinterpret_cast<ID3D11Texture2D *>(nativeRenderTargetHandle);
RefCntAutoPtr<ITexture> pRenderTarget;
- pDeviceD3D11->CreateTextureFromD3DResource(pd3d11RenderTarget, &pRenderTarget);
+ pDeviceD3D11->CreateTextureFromD3DResource(pd3d11RenderTarget, RESOURCE_STATE_UNDEFINED, &pRenderTarget);
auto *pd3d11DepthBuffer = reinterpret_cast<ID3D11Texture2D *>(nativeDepthTextureHandle);
RefCntAutoPtr<ITexture> pDepthBuffer;
- pDeviceD3D11->CreateTextureFromD3DResource(pd3d11DepthBuffer, &pDepthBuffer);
+ pDeviceD3D11->CreateTextureFromD3DResource(pd3d11DepthBuffer, RESOURCE_STATE_UNDEFINED, &pDepthBuffer);
CreateTextureViews(pRenderTarget, pDepthBuffer);
}
diff --git a/unityplugin/GhostCubePlugin/PluginSource/src/RenderAPI_D3D12.cpp b/unityplugin/GhostCubePlugin/PluginSource/src/RenderAPI_D3D12.cpp
index 8befeb0..3f4f9ea 100644
--- a/unityplugin/GhostCubePlugin/PluginSource/src/RenderAPI_D3D12.cpp
+++ b/unityplugin/GhostCubePlugin/PluginSource/src/RenderAPI_D3D12.cpp
@@ -189,14 +189,14 @@ void RenderAPI_D3D12::AttachToNativeRenderTexture(void *nativeRenderTargetHandle
{
auto *pd3d12RenderTarget = reinterpret_cast<ID3D12Resource*>(nativeRenderTargetHandle);
RefCntAutoPtr<ITexture> pRenderTarget;
- pDeviceD3D12->CreateTextureFromD3DResource(pd3d12RenderTarget, &pRenderTarget);
+ pDeviceD3D12->CreateTextureFromD3DResource(pd3d12RenderTarget, RESOURCE_STATE_UNDEFINED, &pRenderTarget);
pRenderTarget->QueryInterface(IID_TextureD3D12, reinterpret_cast<IObject**>(static_cast<ITextureD3D12**>(&m_RenderTarget)));
}
{
auto *pd3d12DepthBuffer = reinterpret_cast<ID3D12Resource *>(nativeDepthTextureHandle);
RefCntAutoPtr<ITexture> pDepthBuffer;
- pDeviceD3D12->CreateTextureFromD3DResource(pd3d12DepthBuffer, &pDepthBuffer);
+ pDeviceD3D12->CreateTextureFromD3DResource(pd3d12DepthBuffer, RESOURCE_STATE_UNDEFINED, &pDepthBuffer);
pDepthBuffer->QueryInterface(IID_TextureD3D12, reinterpret_cast<IObject**>(static_cast<ITextureD3D12**>(&m_DepthBuffer)));
}
CreateTextureViews(m_RenderTarget, m_DepthBuffer);
diff --git a/unityplugin/GhostCubePlugin/PluginSource/src/RenderAPI_OpenGLCoreES.cpp b/unityplugin/GhostCubePlugin/PluginSource/src/RenderAPI_OpenGLCoreES.cpp
index 4e9b345..cac774d 100644
--- a/unityplugin/GhostCubePlugin/PluginSource/src/RenderAPI_OpenGLCoreES.cpp
+++ b/unityplugin/GhostCubePlugin/PluginSource/src/RenderAPI_OpenGLCoreES.cpp
@@ -83,7 +83,7 @@ void RenderAPI_OpenGLCoreES::CreateRenderTargetAndDepthBuffer()
RenderTargetDesc.Height = 1024;
RenderTargetDesc.Format = TEX_FORMAT_RGBA8_UNORM_SRGB;
#endif
- pDeviceGL->CreateTextureFromGLHandle(m_GLRenderTargetHandle, RenderTargetDesc, &pRenderTarget);
+ pDeviceGL->CreateTextureFromGLHandle(m_GLRenderTargetHandle, RenderTargetDesc, RESOURCE_STATE_UNKNOWN, &pRenderTarget);
RefCntAutoPtr<ITexture> pDepthBuffer;
TextureDesc DepthBufferDesc;
@@ -98,7 +98,7 @@ void RenderAPI_OpenGLCoreES::CreateRenderTargetAndDepthBuffer()
DepthBufferDesc.Height = 1024;
DepthBufferDesc.Format = TEX_FORMAT_D32_FLOAT;
#endif
- pDeviceGL->CreateTextureFromGLHandle(m_GLDepthTextureHandle, DepthBufferDesc, &pDepthBuffer);
+ pDeviceGL->CreateTextureFromGLHandle(m_GLDepthTextureHandle, DepthBufferDesc, RESOURCE_STATE_UNKNOWN, &pDepthBuffer);
CreateTextureViews(pRenderTarget, pDepthBuffer);
}
diff --git a/unityplugin/GhostCubePlugin/PluginSource/src/SamplePlugin.cpp b/unityplugin/GhostCubePlugin/PluginSource/src/SamplePlugin.cpp
index b54e84a..aee52b2 100644
--- a/unityplugin/GhostCubePlugin/PluginSource/src/SamplePlugin.cpp
+++ b/unityplugin/GhostCubePlugin/PluginSource/src/SamplePlugin.cpp
@@ -169,5 +169,6 @@ void SamplePlugin::Render(Diligent::IDeviceContext *pContext, const float4x4 &Vi
DrawAttrs.IsIndexed = true;
DrawAttrs.IndexType = VT_UINT32;
DrawAttrs.NumIndices = 36;
+ DrawAttrs.Flags = DRAW_FLAG_TRANSITION_INDEX_BUFFER | DRAW_FLAG_TRANSITION_VERTEX_BUFFERS;
pContext->Draw(DrawAttrs);
}