private Direct3DSurface9 GetSharedSurface(Direct3DDevice9Ex device) { return(device.CreateRenderTarget( m_width, m_height, Format, // D3DFMT_A8R8G8B8 0, 0, 0 // UNLOCKABLE )); }
private static Direct3DTexture9 GetSharedSurface(Direct3DDevice9Ex device, Microsoft.WindowsAPICodePack.DirectX.Direct3D10.Texture2D texture) { // First get a shared handle to the D3D10 texture using (var surface = texture.QueryInterface <Microsoft.WindowsAPICodePack.DirectX.Graphics.Resource>()) { IntPtr handle = surface.SharedHandle; // Then create a D3D9 texture using the D3D10 shared handle. // The D3D10 texture must be in the DXGI_FORMAT_B8G8R8A8_UNORM // format (direct 9 version is D3DFMT_A8R8G8B8). return(device.CreateTexture( texture.Description.Width, texture.Description.Height, 1, 1, // D3DUSAGE_RENDERTARGET 21, // D3DFMT_A8R8G8B8 0, // D3DPOOL_DEFAULT ref handle)); } }