Jump to content

  • Log In with Google      Sign In   
  • Create Account


Two very strange SlimDX DX11 errors


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
4 replies to this topic

#1 CdrTomalak   Members   -  Reputation: 272

Like
0Likes
Like

Posted 08 September 2012 - 09:37 AM

I am in the final stages of porting some code into my framework.

The latest problem is very similar to this one I posted recently (http://stackoverflow...-from-the-usage), whereby text enclosed in '<' and '>' in the listing I am porting code is missing.

The latest offending line is:
[source lang="csharp"] using (var resource = SlimDX.Direct3D11.Resource.FromSwapChain(swapChain, 0)) renderTarget = new SlimDX.Direct3D11.RenderTargetView(graphics, resource);[/source]

I get the following error from the compiler:

The type arguments for method 'SlimDX.Direct3D10.Device.OpenSharedResource(System.IntPtr)' cannot be inferred from the usage. Try specifying the type arguments explicitly.

I tried to fix this myself by changing my code to:

using (var resource = SlimDX.Direct3D11.Resource.FromSwapChain<SlimDX.Direct3D11.Resource>(swapChain, 0))
renderTarget = new SlimDX.Direct3D11.RenderTargetView(graphics, resource);

... but now I get an even stranger run-time error:

"Error: Method 'SlimDX.Direct3D11.Resource.FromPointerReflectionThunk' not found."

Initial research indicates I might have stumbled into something which is way above my head: http://www.gamedev.n...interop-expert/Posted Image

All I am trying to do is port this code into my framework: http://www.aaronblog.us/?p=36 ... which is all about drawing text in SlimDX with DX11.
At some point I hope to have figured out how to genericise this code into my framework. It is heavy going though.

I'm using SlimDX SDK (January 2012).

Edited by CdrTomalak, 08 September 2012 - 09:48 AM.


Sponsor:

#2 Hyunkel   Members   -  Reputation: 368

Like
1Likes
Like

Posted 08 September 2012 - 10:31 AM

I'm a bit confused.
You say the error is related to 'SlimDX.Direct3D10.Device.OpenSharedResource(System.IntPtr)'
yet you change 'SlimDX.Direct3D11.Resource.FromSwapChain(swapChain, 0)'

Can you show a little more code?
Specifically the part where you obtain and access the shared resource.

#3 akhanubis   Members   -  Reputation: 291

Like
2Likes
Like

Posted 08 September 2012 - 10:51 AM

Resource is an abstract class, try using Texture2D

[source lang="csharp"]using (var resource = Resource.FromSwapChain&lt;Texture2D&gt;(swapChain, 0)){ renderTargetBackBuffer = new RenderTargetView(device, resource);}[/source]
http://akhanubis.tumblr.com (Blog in spanish, mostly about SlimDX)

#4 Mike.Popoloski   Crossbones+   -  Reputation: 2900

Like
1Likes
Like

Posted 08 September 2012 - 10:53 AM

Resource is an abstract class, so you can't directly create an instance of it. The method wants you to give it the derived type, in this case probably Texture2D.

EDIT: Ninja-ed!

Edited by Mike.Popoloski, 08 September 2012 - 10:53 AM.

Mike Popoloski | Journal | SlimDX

#5 CdrTomalak   Members   -  Reputation: 272

Like
0Likes
Like

Posted 08 September 2012 - 11:42 AM

I changeed to

resource = SlimDX.Direct3D11.Resource.FromSwapChain<SlimDX.Direct3D11.Texture2D>(swapChain, 0);

This works fine. Well, I say that, but nothings appearing at the moment so maybe not, but this could be because of some other problem.

Hyunkel - this is more code ported from Aarons shared surface method to draw text. Everything is in place now in exactly the same order but nothing is appearing. I'm currently trying to figure it out. Thanks for the help tho.




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