Kept you waiting, huh? It’s been a long time, S… since my last post, mostly due to an enormous amount of work I made during this period. Ever wondered that you can utilize some Vulkan features for your good, but Unity seemingly doesn’t support them in HLSL? Right, that’s what I stumbled across too. So, […]
Author: meetem
Managed primitives Part I
In the Part 1 the layouts of:
1. System.Object
2. T[] array
3. string
This article also reveals how to access those types in unsafe or unmanaged environment. How we can change the object type or get array/string length pointer to change it later.
Is .NET 8 performant enough?
While I’m experementing on making my execution environment for C++/C# interop I became curious about the performance of .NET 8 (under CoreCLR, not Mono). Maybe I can use it without Burst and transition via P/Invoke at all? Test suite Thankfully there’s already a test bench for Burst: https://github.com/nxrighthere/BurstBenchmarks As we can see there, .NET Core 3.1’s […]
Detecting .NET runtime at compile time
When you want to have single DLL which works in all .NET runtimes (Mono/IL2CPP/NETFX/NETCore), it’s crucial to detect which runtime you are currently in. While there are some dynamic methods, like query runtime name and check it for “Mono” string, it’s not the best approach, and definitely not the performant one.
.NET(s) Fields and their offsets
Field offsets can help you in numerous ways, first what comes in mind is that you can set fields of the struct or class instance without using TypedReference (doesn’t work in IL2CPP) and without GC allocs which comes with boxing when either instance or a value is a struct. Second, it could help you with unmanaged access to the class/struct for custom binary serialization, etc.
Saddling up IL to our benefit
When you come from C++ to C# it’s such a relief. C# is a greatly designed language, you can do almost anything you want with it, apart from some design choises like macroses and C++ template<>. But sometimes we can find ourselves near the wall which you can’t pass with C# itself. IL Comes To […]
C# Bool To Int Conversion
Overview and performance comparasion for bool -> int/uint/byte conversion in C#
And simple solution for fast platform-independent conversion.
The cost of Unity’s forgiveness
Short overview of the costs you are paying by using extremely safe single-threaded Unity API (which is basically every call to the engine, including properties like Transform.localPosition) and how to avoid paying them.
Spoiler: these costs are huge.
How to get a pointer to managed object in C#
Not really quick overview of methods for taking a pointer of managed C# object.
With a great forbidden solution inside.
Jump in!