I\'m writing a ebook reader app for Windows Store. I\'m using Direct2D + DXGI swap chains to render book pages on screen.
My book content sometimes is quite complex (ge
Ok, I've found a solution.
Basically, all I needed is to modify approach 2 to use DXGI resource sharing between two DirectX factory sets. I'll skip all the gory details (they can be found here: http://xboxforums.create.msdn.com/forums/t/66208.aspx), but basic steps are:
ID3D11Device2
from main resource set, create D3D 2D texture by CreateTexture2D
D3D11_BIND_RENDER_TARGET
, D3D11_BIND_SHADER_RESOURCE
, D3D11_RESOURCE_MISC_SHARED_NTHANDLE
and D3D11_RESOURCE_MISC_SHARED_KEYEDMUTEX
flags.IDXGIResource1
and calling CreateSharedHandle
from it with XGI_SHARED_RESOURCE_READ
and DXGI_SHARED_RESOURCE_WRITE
.ID3D11Device2::OpenSharedResource1
.IDXGIKeyedMutex::AcquireSync
), create render target from it (ID2D1Factory2::CreateDxgiSurfaceRenderTarget
), draw on it and release mutex (IDXGIKeyedMutex::ReleaseSync
).Note that mutex locking stuff is necessary. Not doing it results in some cryptic DirectX debug error messages, and erroneous operation or even crashing.