Jump to content

  • Log In with Google      Sign In   
  • Create Account

Issue trying to create a shared resource


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
2 replies to this topic

#1 jdub   Members   -  Reputation: 419

Like
0Likes
Like

Posted 30 March 2013 - 06:34 PM

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?

 

 


J.W.

Sponsor:

#2 jdub   Members   -  Reputation: 419

Like
0Likes
Like

Posted 01 April 2013 - 01:42 AM

*bump* any ideas?


J.W.

#3 Mike.Popoloski   Crossbones+   -  Reputation: 2931

Like
0Likes
Like

Posted 01 April 2013 - 10:15 AM

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.


Mike Popoloski | Journal | SlimDX




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS