- Home /
Access DXGI Swapchain with DX11?
Hi, I'm the author of AVPro Movie Capture plugin for Unity, a plugin that captures Unity into AVI videos.
With OpenGL and DX9 we access the frame buffer directly to do this capturing, however with DX11 it seems we need access to the DXGI pointer to to get the current render target / swap chain. Does anyone know if it's possible to acquire this?
Hi Andrew, Can you please let me know how you did this? I have added my code at http://forum.unity3d.com/threads/capture-unity-screen-in-native-code-using-directx-capture.347627/.
But I am getting empty frames while if I use it on a standalone application, I can capture the data correctly.
I know the issue. I should use D3D11_RTV_DI$$anonymous$$ENSION_TEXTURE2D for copyresource.
Answer by ncallaway · Oct 31, 2013 at 05:29 PM
Just from looking at the API, it appears you can do this by going through the DeviceContext. Given the ID3D11Device given to you by Unity you can use:
ID3D11Device::GetImmediateContext to get the active DeviceContext. (http://msdn.microsoft.com/en-us/library/windows/desktop/ff476529(v=vs.85).aspx)
ID3D11DeviceContext::OMGetRenderTargets to get RenderTarget(s). (http://msdn.microsoft.com/en-us/library/windows/desktop/ff476460(v=vs.85).aspx).
I haven't yet written any code to do this, but I suspect something along this line could get you to a solution.
Interesting! I'll investigate that :) It'll be nice to add proper fast DX11 support to the plugin. I'll report back if it works.
Hey this worked :) Thanks! Adding this to our video capture plugin now..
Your answer
Follow this Question
Related Questions
how to use Geometry shader in unity 4 ? 1 Answer
Billboard trees have white outline in dx11? 0 Answers
How to verify if the player can use DX 11 shader ? 1 Answer
Unity 5 tesselation problem 1 Answer
New Logical Blend Operations?! 0 Answers