BattleFrogue
✅ Debugging exceptions not caught by try-catch
True, true. But like I said, I'd rather learn this myself so I can apply it to other libraries. My main ulterior motive right now are some internal libraries at work. We're forced to use C/C++ because they are C libraries. But I personally have fallen out of favour with C++ and want to move to .NET now it has AOT support. I picked Vulkan as a practice library because it's a library I have native familiarity with and because it had the added complexity of needing to load function pointers manually to skip trampolining. I figured if I can get some semi-complex demo running using Vulkan I can map our internal libraries to .NET and use a more palletable language (in my opinion)
50 replies
✅ Debugging exceptions not caught by try-catch
I see, that does complicate things. In my own research I find that there's either a lot of research on a topic, usually pre-2012. Or 1 page on MS's docs site that doesn't really give me enough information for me to understand how it works
50 replies
✅ Debugging exceptions not caught by try-catch
Right, because
vkGetInstanceProcAddr/vkGetDeviceProcAddr
require a valid Instance or Device. C get's away with it because it does the trampolining, but if I wanted to do that in C# every function would have to be LibraryLoad
ed which would be a performance nightmare. Okay maybe I don't do that then 😂50 replies
✅ Debugging exceptions not caught by try-catch
I do also plan to have a
Raw
namepsace which will be just the C api with a C# front cover. So in the event that I want to use the raw API I can, and internall the managed API will use the Raw
function calls50 replies
✅ Debugging exceptions not caught by try-catch
I will admit I am more familiar with the raw C api and prefer it to say the C++ api. But I think in the context of C/C++ it makes sense to use the raw API. C# is a managed lanugage and I feel like having a more managed approach to it, even when AOT'd, makes sense
50 replies
✅ Debugging exceptions not caught by try-catch
I see, thanks for the advice. And just so I'm understanding this correctly. I would be able to use a C# 9 function pointer for a native function pointer returned to me by using
vkGetInstanceProcAddr
? I would like to follow Khronos' guidelines for reducing driver overhead50 replies
✅ Debugging exceptions not caught by try-catch
I do, I have
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
and I have also tried [UnmanagedFunctionPointer(CallingConvention.Cdecl]
. I have seen Silk.NET, and as nice as it looks part of this exercise is me wanting to learn how to do performant native interops. Even as wide spread as the .NET community is I'm not always going to be lucky enough that there is a ready made library that does it for me. It's interesting that you mention that delegates are slow and clunky because I actually asked here in a different thread what the most performance way to do native function calls are and the LibraryLoad
attribute was what was suggested to me. Does Silk use C#9 function pointers?50 replies
✅ Debugging exceptions not caught by try-catch
I have tried catching both
Exception
s and EngineExecutionException
s. In fact when I tried catching an EngineExecutionException
specifically Rider warned me that those exceptions aren't even raised by the runtime anymore.50 replies