Jump to content
  • Advertisement
Sign in to follow this  
geolycosa

Mono/C# with native renderer

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

I have had some excellent results embedding the Mono JIT compiler into my cross-platform C++ code base using SWIG to generate the glue code. Because Mono does not support mixed-mode assemblies (mixing managed and unmanaged code), SWIG creates a bridge between managed C# and unmanaged C++ using P/Invoke, which has some inherent overhead caused by the data marshaling that has to occur, as well as a security check that mono performs which involves a stack walk. I have eliminated the stack walk with the SecurityPermission assembly attribute, but the call is still relatively slow. I would like to minimize the number of P/Invoke calls inside my game loop. The most obvious trouble spot is getting render state data to the native rendering system. On the managed side, the render state is encapsulated in a few objects (Drawable, Texture, Light, Material) which will all need to make calls to the native C rendering API each frame. I was wondering if anyone has a suggestion for batching or optimizing this work. An alternative to the SWIG P/Invoke approach might be to directly expose the native rendering API to the Mono runtime using their mono_add_internal_call function. Has anyone tried this? Thanks for your advice!

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!