Jump to content
  • Advertisement
Sign in to follow this  
arbitus

[SlimDX] Creating a shared resource for D3D11 and D2D/DirectWrite interop

This topic is 2679 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

So I have been researching this topic based on information found here and here and here.

I am trying to create a shared texture, using SlimDX instead of the C++ API. I get an exception when attempting to call OpenSharedResource on the Direct3D 10 device. The code is as follows:

The texture description

private static readonly Texture2DDescription SharedTextureDesc = new Texture2DDescription
{
Width = 1024,
Height = 768,
MipLevels = 1,
ArraySize = 1,
Format = Format.R8G8B8A8_UNorm,
SampleDescription = new SampleDescription(1, 0),
Usage = ResourceUsage.Default,
BindFlags = BindFlags.RenderTarget | BindFlags.ShaderResource,
CpuAccessFlags = CpuAccessFlags.None,
OptionFlags = ResourceOptionFlags.Shared
};


Attempting to open shared resource:

GraphicsDevice10 = new DX10.Device(DX10.DriverType.Hardware, DX10.DeviceCreationFlags.None);
SharedTexture = new Texture2D(GraphicsDevice11, SharedTextureDesc);
SharedResource = new SlimDX.DXGI.Resource(SharedTexture);

var shared = GraphicsDevice10.OpenSharedResource<Texture2D>(SharedResource.SharedHandle);

[font="Arial"]GraphicsDevice11 is created previously. Both devices are successfully created, checked in the debugger. However, when I call OpenSharedResource, I get the following unmanaged exception:
An unhandled exception of type 'SlimDX.Direct3D10.Direct3D10Exception' occurred in SlimDX.dll

Additional information: E_NOINTERFACE: The requested COM interface is not available (-2147467262)

On a side note, I am new to DXGI and DirectX10+, having just now transitioned from DirectX 9.0c and XNA 3.0. What other debugging measures can I take, since I can no longer just enable the debug runtimes? I only have unmanged code debugging enabled, and I feel that there should be more.
[/font]

Share this post


Link to post
Share on other sites
Advertisement

Try using creation flags for BGRA support when creating the device.


Thanks for the reply, but it would make me feel better if that were my problem. I discovered the issue last night and tested it this morning. My problem was that I was using the Direct3d11 version of the Texture2D class as my generic parameter to the OpenSharedResource() rather than the Direct3d10 version of the Texture2D class. That is what I get for liberal use of unqualified using statements.

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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!