   Mono/C# with native renderer
  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!   