private static Interop.Direct3DTexture9 GetSharedSurface(Interop.Direct3DDevice9Ex device, D3D10.Texture2D texture) { // First get a shared handle to the D3D10 texture using (var surface = texture.QueryInterface<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); } }