Jump to content
  • Advertisement
Sign in to follow this  
jdub

Issue trying to create a shared resource

This topic is 2024 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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
Advertisement

I'm not too experienced with using the shared resource stuff, but I think that if you want it shared, you need to use the ResourceOptionFlags.Shared flag, not the KeyedMutex flag.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!