Jump to content

  • Log In with Google      Sign In   
  • Create Account


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


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
1 reply to this topic

#1 limestreem   Members   -  Reputation: 108

Like
0Likes
Like

Posted 20 June 2013 - 08:01 PM

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, 20 June 2013 - 09:43 PM.


Sponsor:

#2 hossainiir   Members   -  Reputation: 951

Like
0Likes
Like

Posted 25 June 2013 - 03:35 AM

hi, i'm using the code as your 's , and there is no problem.

 



 


خلیج تا ابد فارس

Persian Gulf





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