• Advertisement
Sign in to follow this  

[SlimDX] Cannot make share Texture with directX 10 for using Direct2D and DirectWrite

This topic is 1670 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 want to use Direct2D and DirectWrite with Direct3D11.

So,I referred to this site.But,I'm confused.When I make share Texture DirectX10  with DirectX11,it throws Direct3D10Exception contains "E_INVALIDARG: An invalid parameter was passed to the returning function (-2147024809)" message.

 

First,I made D3D11Device by below code.

using SlimDX.Direct3D10_1;
using SlimDX.Direct3D11;
using SlimDX.DXGI;
using Device1 = SlimDX.Direct3D10_1.Device1;
using Resource = SlimDX.DXGI.Resource;
using Texture2D11 = SlimDX.Direct3D11.Texture2D;
using Texture2D10 = SlimDX.Direct3D10.Texture2D;
using FactoryD2D = SlimDX.Direct2D.Factory;
using FactoryDW = SlimDX.DirectWrite.Factory;
using FeatureLevel11 = SlimDX.Direct3D11.FeatureLevel;
using FeatureLevel10 = SlimDX.Direct3D10.FeatureLevel;
.
.
.
.
//In my class method
Factory1 factory = new Factory1();
adapter1=factory.GetAdapter1(0); //Initializing Swapchain
 Device = new SlimDX.Direct3D11.Device(adapter1,DeviceCreationFlags.Debug, new FeatureLevel[1]{FeatureLevel.Level_11_0}); 

Next,to make Direct2D/DirectWrite available,I made D3D10 Device and DirectX11 Texture,and make instance of SharedResource

          Device10_1 = new Device1(adapter1, SlimDX.Direct3D10.DriverType.Hardware, SlimDX.Direct3D10.DeviceCreationFlags.BgraSupport | SlimDX.Direct3D10.DeviceCreationFlags.Debug,FeatureLevel10.Level_10_0);

TextureD3D_11 = new Texture2D11
(Device,
new Texture2DDescription()
{
Width=form.Width,
Height=form.Height,
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.KeyedMutex
});
//make texture shared
            SharedResource = new Resource(TextureD3D_11);
            TextureD3D_10 = Device10_1.OpenSharedResource<Texture2D10>(SharedResource.SharedHandle);//this line throws the exception
   
In the last line of last code,the exception was thrown.
I could not figure out why this code throws the exception.
If you have anything information helps me,could you advice me?
 
Thanks for reading my terrible English.
Edited by limestreem

Share this post


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

  • Advertisement