Jump to content
  • Advertisement
Sign in to follow this  
Plerion

[PIX] Unable to create D2D rendertarget

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

Hello everybody

Im using interop with D3D10 to render text in D3D11. Thus i create a shared resource and from this resource i open a rendertarget for D2D. While all works perfectly when i run my application on its own but if i start it with PIX there is an exception:

The code im talking about is the following:
[source lang="csharp"] var device10 = new SlimDX.Direct3D10_1.Device1(GXLink.Instance.OutputAdapter, DriverType.Hardware, DeviceCreationFlags.BgraSupport | DeviceCreationFlags.Debug, SlimDX.Direct3D10_1.FeatureLevel.Level_10_0);

mSharedDescription = new SlimDX.Direct3D11.Texture2DDescription()
{
ArraySize = 1,
BindFlags = SlimDX.Direct3D11.BindFlags.ShaderResource | SlimDX.Direct3D11.BindFlags.RenderTarget,
CpuAccessFlags = SlimDX.Direct3D11.CpuAccessFlags.None,
Format = SlimDX.DXGI.Format.B8G8R8A8_UNorm,
Height = GXLink.Instance.RenderWindow.ClientSize.Height,
Width = GXLink.Instance.RenderWindow.ClientSize.Width,
MipLevels = 1,
OptionFlags = SlimDX.Direct3D11.ResourceOptionFlags.KeyedMutex,
SampleDescription = new SlimDX.DXGI.SampleDescription(1, 0),
Usage = SlimDX.Direct3D11.ResourceUsage.Default
};

mSharedTexture = new SlimDX.Direct3D11.Texture2D(GXLink.Instance.Device, mSharedDescription);

var dxgiResource = new SlimDX.DXGI.Resource(mSharedTexture);

SlimDX.Direct3D10.Texture2D tex = device10.OpenSharedResource<SlimDX.Direct3D10.Texture2D>(dxgiResource.SharedHandle);
device10.Dispose();
dxgiResource.Dispose();

var surf = tex.AsSurface();

mKeyedMutex10 = new SlimDX.DXGI.KeyedMutex(surf);
mKeyedMutex11 = new SlimDX.DXGI.KeyedMutex(mSharedTexture);

var props = new RenderTargetProperties()
{
Type = RenderTargetType.Hardware,
HorizontalDpi = 96,
MinimumFeatureLevel = SlimDX.Direct2D.FeatureLevel.Direct3D10,
PixelFormat = new PixelFormat(SlimDX.DXGI.Format.Unknown, AlphaMode.Premultiplied),
Usage = RenderTargetUsage.None,
VerticalDpi = 96,
};

SlimDX.Direct2D.Factory fac2D = new SlimDX.Direct2D.Factory(SlimDX.Direct2D.FactoryType.SingleThreaded);
mRenderTarget2D = RenderTarget.FromDXGI(fac2D, surf, props);[/source]

The line that causes the exception with PIX is the following:

mRenderTarget2D = RenderTarget.FromDXGI(fac2D, surf, props);


Here i get a System.AccessViolation exception.

Once again, without PIX no problems, the text is renderer and all is fine. With PIX -> System.AccessViolation on this line.

Is this a common error or could i change some settings in PIX or what can i do?

Greetings
Plerion

Share this post


Link to post
Share on other sites
Advertisement
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!