Sign in to follow this  

Issue trying to create a shared resource

Recommended Posts

I am trying to interop between DirectX11 and DirectWrite so that I can render font in my window.  However, for some reason my code to create a shared throws an Invalid Argument exception:


            //create a shared texture where text will be 
            //rendered to before being blended with the main backbuffer
            textureD3D11 = new Texture2D(renderer.GraphicsPipeline.Device, new Texture2DDescription
                Width = form.Width,
                Height = form.Height,
                MipLevels = 1,
                ArraySize = 1,
                Format = Format.B8G8R8A8_UNorm,
                SampleDescription = new SampleDescription(1, 0),
                Usage = ResourceUsage.Default,
                BindFlags = BindFlags.RenderTarget | BindFlags.ShaderResource,
                CpuAccessFlags = CpuAccessFlags.None,
                OptionFlags = ResourceOptionFlags.KeyedMutex

            // A DirectX10 Texture2D sharing the DirectX11 Texture2D
            SlimDX.DXGI.Resource sharedResource = new SlimDX.DXGI.Resource(textureD3D11);
            SlimDX.Direct3D10.Texture2D textureD3D10 = device_10_1.OpenSharedResource<SlimDX.Direct3D10.Texture2D>(sharedResource.SharedHandle);


The exception is thrown on the line where I call OpenSharedResource().  Any ideas as to what's going on here?



Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this