   [SlimDX] Direct2D RenderTarget Exception
  Hi all,I am trying since several hours to use Direct2D with Direct3D 11 by passing by a Direct3D 10 device.It seem that is the only way to use Direct2D with Direct3D 11 and I found this post here with a code sample to do this :http://www.gamedev.net/community/forums/topic.asp?topic_id=552795My problem is that this sample is written in C++ and I can't seem to reproduce it under SlimDX, it look like there is no KeyedMutex under the DXGI namespace of SlimDX. Without KeyedMutex I am a bit lost on how to share surface between the two device (I am quite new to DirectX).I would really appreciate if someone could point me out how to use Direct2D with Direct3D 11 UNDER SLIMDX.[Edited by - karnalta on May 12, 2010 8:24:16 AM]
  In the same post I mentioned above there is a second solution to do it (once again in C++). But I have another problem with it, when I try to retrieve the Surface from a Texture2D.In C++ it look like this :IDXGISurface1 *pSurface;pTexture->QueryInterface(__uuidof(IDXGISurface1), (void**)&pSurface);In C#/SlimDX I try like this but I get a null pointer :IntPtr surfaceIntPtr;Guid surfaceGuid = typeof(Surface).GUID;Marshal.QueryInterface(sharedTexture.ComPointer, ref surfaceGuid, out surfaceIntPtr);Surface surface = Surface.FromPointer(surfaceIntPtr);Anyone can help me please ?;  I reached to reproduce the C++ solution I found on this forum, but it doesn't work... It throw me a exception when trying to create the Direct2D RenderTarger saying "E_NOINTERFACE: The requested COM interface is not available".Here is my code :_swapchain11 = Direct3D 11 device swapchain._device11 = Direct3D 11 device._originalBackBuffer and _tempTexture are both not ID3D11Texture2D.// Get the Direct3D 11 back buffer  _originalBackBuffer = Texture2D.FromSwapChain<Texture2D>(_swapChain11, 0);  // Initialize a new Texture2D to draw in  Texture2DDescription textureDesc = new Texture2DDescription();  textureDesc.Width = _originalBackBuffer.Description.Width;  textureDesc.Height = _originalBackBuffer.Description.Height;  textureDesc.MipLevels = 1;  textureDesc.ArraySize = 1;  textureDesc.Format = Format.B8G8R8A8_UNorm;  textureDesc.SampleDescription = new SampleDescription(1, 0);  textureDesc.Usage = ResourceUsage.Default;  textureDesc.BindFlags = BindFlags.ShaderResource | BindFlags.RenderTarget;  textureDesc.OptionFlags = ResourceOptionFlags.GdiCompatible;  _tempTexture = new Texture2D(_device11, textureDesc);  // Get the Surface from the texture  IntPtr pSurface = IntPtr.Zero;  Guid gSurface = Surface.NativeInterface;  Marshal.QueryInterface(_tempTexture.ComPointer, ref gSurface, out pSurface);  Surface surface = Surface.FromPointer(pSurface);  // Create Direct2D factory  SlimDX.Direct2D.Factory d2dFactory = new SlimDX.Direct2D.Factory(SlimDX.Direct2D.FactoryType.SingleThreaded);  // Create RenderTarget  RenderTargetProperties rtProperties = new RenderTargetProperties();  rtProperties.Type = RenderTargetType.Hardware;  rtProperties.PixelFormat = new PixelFormat(Format.B8G8R8A8_UNorm, AlphaMode.Premultiplied);  _renderTarget = RenderTarget.FromDXGI(d2dFactory, surface, rtProperties); // EXCEPTION