Jump to content

  • Log In with Google      Sign In   
  • Create Account


Wrapper for Direct X on WinRT


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 Gavin Williams   Members   -  Reputation: 649

Like
0Likes
Like

Posted 19 November 2012 - 06:54 PM

Hi,
Just to set the scene, I've been using SlimDX for accessing Direct X 11 in C#. But I'm very much interested in how Direct X 11.1 will be made available to C# and how I can work with C#/DX11.1 on the Windows Store platform specifically. Obviously there is SharpDX. But at the moment I'm just trying to understand how interop might best work on Win RT to connect Direct X with C#. And how I might implement such interop, or at least understand it better.

So I've read or heard via the build videos that Direct X has been integrated with WinRT, at least, that's what some of the diagram's portray. But when I inspect the WinMetadata folder, Direct X is not part of the WinRT object model (it seems to me).

So is it that Direct X is in WinRT by name only ? And has it not been functionally integrated ? I would imagine that if it were integrated, then the CLR could generate a Runtime Callable Wrapper as needed, but I would say performance might not be as good as say SharpDX. I'm not sure if SharpDX uses C++/CLI or C++/CX, but I think the Runtime Callable Wrappers would incur an additional cost.

And if interop between Direct X and C# were implemented for RT, what then would be the best way. I would say use class libraries rather than Windows RT Components as I am only interested in C#.

Also, I would say use C++/CX rather than C++/CLI as I believe that CX provides better interop performance. In fact CX might be the only way to write RT wrappers (not Runtime Callable Wrappers). But this is confusing because as I've said, Direct X might not be actually a part of RT even though it is shown to be. I haven't quite worked out how CX fits into the picture other than to say it's next gen C++/CLI and is CLI for RT. So I would use CX to provide Direct X with a managed programming surface ? Or C++/CLI otherwise.Am I starting to understand this properly ? Or what can be said about how to approach this problem ?

Edited by Gavin Williams, 19 November 2012 - 06:57 PM.


Sponsor:

#2 Martins Mozeiko   Crossbones+   -  Reputation: 1422

Like
0Likes
Like

Posted 19 November 2012 - 07:20 PM

I think word "integrated" in this context means that WinRT supports D3D11 for applications and nothing else. Like GDI is not integrated with WinRT.

#3 Gavin Williams   Members   -  Reputation: 649

Like
0Likes
Like

Posted 19 November 2012 - 08:24 PM

Right ok... I have found this to confirm what you've said and what I suspected (from DirectX and XAML interop (Windows Store apps using C++ and DirectX) )

Note DirectX APIs are not defined as Windows Runtime types, so you typically use C++/Cx to develop XAML app components that interop with DirectX. That said, you can create a Windows Store app with C# and XAML app that uses DirectX if you wrap the DirectX calls in a separate Windows Runtime type library.



#4 Gavin Williams   Members   -  Reputation: 649

Like
0Likes
Like

Posted 20 November 2012 - 08:35 AM

Alexandre Mutel went some way to lay out my options for me on msdn where I 'double posted' this question, as rough as it is. http://social.msdn.m...42-484223559ef3 Certainly there's enough insight there to keep me busy. Also this link http://devhawk.net/tag/c-plus-plus-cx/ provides a great demo by DevHawk on using WinRT to wrap C++ code. Which isn't hard at all but as a C++ noob, at first this all seems very daunting.

#5 Vexal   Members   -  Reputation: 416

Like
1Likes
Like

Posted 22 November 2012 - 04:05 AM

You use C++ / CX to interface with the operating system. All code you would write in a C++ Direct3D program for Win32 (xp, vista, 7) will be identical in a C++ Direct3D Windows RT application. Almost all of the Direct3D code will be the same. The only difference is the code used to create the window and bind it to the device context, and to get the user input (event handlers instead of directinput).

None of the code in C++ / CX is managed. The WinRT components use reference counting, but you do not have to use the components except to create a Window. There is no overhead of the XAML layer.




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