简体   繁体   中英

C# gpgpu in winrt

Basically the question is how do I run gpgpu code in a Metro app. The library doesn't need to be dedicated to computing, for example, using XNA's hlsl (originally intended to render things) for general computing (XNA is not included in Metro, hence my problem). A default Metro library is preferred over a reference to a external one.

I realize that one may call core DirectX functions in C++, however, I am asking if it is possible to use the gpu in C# in a metro app.

DirectCompute is perfectly usable with SharpDX in a Metro application (as it is from a desktop application, this is the same API). Although, if you are targeting some tablets, this will require at least a DirectX10 graphics card. If the tablet is a 10.0 or 10.1, you will have some restrictions with Compute Shaders on Downlevel hardware .

I didn't think it was possible, actually, but when looking for a link to prove its impossibility, I came up with references to SharpDX , which purports to being a managed DirectX wrapper that will also support Win8 Metro applications. See this SharpDX sample project , which includes a .hlsl file, to learn more.

This isn't my area of expertise, so I have no idea whether this will even work; also, I have to wonder how they can do this and still allow the app to be certified for sale in the Store. But depending on your requirements, this might be something to check out.

(Note: the first link does claim that the "[n]ext version of SharpDX will provide assemblies that will be fully compatible and certified-ready for Win8 Metro style application," so their intention is clear. My remark above about certification is just that it sounds like this would need to do interop I wasn't aware is allowed in such apps, so they might be optimistic about it. I could be totally wrong, though.)

GPU.NET will JIT compile specially marked and written C# code to GPU code.

www.tidepowerd.com

I have not tried it yet, but the concept is promising and the code looks relatively clean. All of it within C#.....

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM