Unity have implemented fully generic shared function generation, when generic params could be both reference types or struct types to generate less code, but when
And by "fully" I mean FULLY. Yes, with returning value too. Then it referencing
calli opcode is encountered with an unmanaged call it will generate exception. Though it's ok because we don't need fully generic sharing, we always know argument types upfront. This exception throw will fully replace the call.And by "fully" I mean FULLY. Yes, with returning value too. Then it referencing
intptr_t L_11 which should be a return value, and since it's now non-existent, well, the variable became non-existent too leading to compile errors. This is only the case when TReturn is a reference type, of there's no TReturn at all (returning a void* for instance)https://github.com/Meetem/ILCall
ILCall is now released at version 1.0.0 🎉🎉
You can make your IL additions by using provided sln to generate new ILCall.dll.
Binaries could be found in "Releases" section on GitHub.
ILCall is now released at version 1.0.0 🎉🎉
You can make your IL additions by using provided sln to generate new ILCall.dll.
Binaries could be found in "Releases" section on GitHub.
GitHub
GitHub - Meetem/ILCall
Contribute to Meetem/ILCall development by creating an account on GitHub.
👍6
A little example on how to use IL to our profit and how to overcome C# limitations.
In this case I'll show you how to call an arbitrary function by a pointer.
https://meetemq.com/2023/09/06/saddling-up-il-to-our-benefit/
In this case I'll show you how to call an arbitrary function by a pointer.
https://meetemq.com/2023/09/06/saddling-up-il-to-our-benefit/
Meetemq
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…
🔥3
An article on getting field offset of struct or class object, and how to make it cross-runtime, so it works in Unity (Mono/IL2CPP) and real dotnets.
Field offsets are good stuff to read/write fields without incurring into reflection, so we can avoid TypedReferences (not supported in IL2CPP) and also we avoid GC allocations for fieldInfo.SetValue(object target, object value), if both target and value are structs that's two boxing operations!
Let's dive in!
https://meetemq.com/2023/09/10/nets-fields-and-their-offsets/
Field offsets are good stuff to read/write fields without incurring into reflection, so we can avoid TypedReferences (not supported in IL2CPP) and also we avoid GC allocations for fieldInfo.SetValue(object target, object value), if both target and value are structs that's two boxing operations!
Let's dive in!
https://meetemq.com/2023/09/10/nets-fields-and-their-offsets/
Meetemq
.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…
🔥5
How do I know if I'm running under Mono or .NETFX, or may be Burst, should I say .NET Core?
Here's how you can tell it at JIT/Compile-time!
https://meetemq.com/2023/09/12/detecting-net-runtime-at-compile-time/
Here's how you can tell it at JIT/Compile-time!
https://meetemq.com/2023/09/12/detecting-net-runtime-at-compile-time/
Meetemq
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…
👍4
Запустил стрим, подпиливаем и пересобираем dotnet-runtime, буду юзать его для кастомного движка в поддержкой шарпа
https://www.youtube.com/live/U57DD1g6_nA?feature=shared
https://www.youtube.com/live/U57DD1g6_nA?feature=shared
❤9👍1
MadSharp: Unsafe
Запустил стрим, подпиливаем и пересобираем dotnet-runtime, буду юзать его для кастомного движка в поддержкой шарпа https://www.youtube.com/live/U57DD1g6_nA?feature=shared
Тестовый стрим имхо прошел не плохо. Правда задачу решить не получилось, буду дальше думать))
👍6
Раз уж сегодня пятница, вечером в 19:00 МСК проведу стрим с ответами на вопросы. Буду рад ответить всем. Вопросы можно задать в комменты под постом, или прямо на стриме.
👍6
Наверняка у вас накопилось много вопросов.
И вот вам стрим где все можно спросит. Вопросы в чат на ютубе или в под этот пост. Начинаем через 5 минут.
https://www.youtube.com/live/Oy2LpjdmjFg?feature=shared
И вот вам стрим где все можно спросит. Вопросы в чат на ютубе или в под этот пост. Начинаем через 5 минут.
https://www.youtube.com/live/Oy2LpjdmjFg?feature=shared
YouTube
Вопросы и ответы про C# Unsafe
https://news.1rj.ru/str/madcsharp
👍3
What we will get when Unity finally implement .NET Core?
Short comparison of the new .NET 8.0 with Burst in terms of runtime performance.
Spoiler: .NET IS AWESOME!
https://meetemq.com/2023/09/18/is-net-8-performant-enough/
Short comparison of the new .NET 8.0 with Burst in terms of runtime performance.
Spoiler: .NET IS AWESOME!
https://meetemq.com/2023/09/18/is-net-8-performant-enough/
Meetemq
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…
🔥7👍2
Forwarded from viruseg
Написал статью как работать с классом Gradient из под burst. И в процессе малость охренел, от того что моя реализация метода Evaluate оказалось в разы быстрее c++ реализации.
https://habr.com/ru/articles/761572/
https://habr.com/ru/articles/761572/
Хабр
Работа с Gradient через jobs + burst
В Unity есть класс Gradient, который предоставляет удобные средства для управления градиентом в рантайме и редакторе. Но т.к. это класс, а не структура использовать его через Job system и burst...
👍14😐3
Finally!
There's a new article on .NET object layouts.
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.
https://meetemq.com/2023/09/27/managed-primitives-part-i/
There's a new article on .NET object layouts.
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.
https://meetemq.com/2023/09/27/managed-primitives-part-i/
Meetemq
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.
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.
🔥6👍1
Всем привет, давно тут не было новостей. А все потому что я очень много работал, и реализовывал очень интересные вещи.
Работать я более менее закончил, поэтому запускаю стрим с вопросами и ответами про ансейф и все такое, можете заранее писать вопросы в комменты под этой новостью.
Когда? 16.01.2024
18:00 CET (20:00 MSK, 19:00 Kyiv)
Ссылочку выложу ближе к началу
Please open Telegram to view this post
VIEW IN TELEGRAM
🔥12
Через полтора часа начинаем.
Пишите вопросы в комменты под этим или предыдущим постом.
18:00 CET
20:00 Msk
19:00 Kyiv
https://www.youtube.com/watch?v=vTXDPntqs6Y
Пишите вопросы в комменты под этим или предыдущим постом.
18:00 CET
20:00 Msk
19:00 Kyiv
https://www.youtube.com/watch?v=vTXDPntqs6Y
YouTube
Q&A Про ансейф и перформанс в Unity и C#
🔥9👍2
Все знают что произошло.
Тем кто сочувствует — мои соболезнования. Сам только отхожу.
Тем кто сочувствует — мои соболезнования. Сам только отхожу.
😢19
Ok, so I've managed to call MDI render on DX12 and Vulkan.
Previously I've been working on MDI for DX11 via NvAPI and it worked, tho NVIDIA doesn't have an API for passing an indirect count, but at least CPU count worked fine.
Unity mentioned that they may support MDI in BRG, but they actually don't and they don't even have plans to support it in Unity 6, so I made my little takeover.
There's a working proof of concept.
All material, shader, and render targets (basically a PSO) is set by Unity, so we don't need to go fully native.
Writing native rendering plugins for Unity is hard, mostly due to lack of documentation and even if it exists, there's a big chance it will not work.
😁 You are welcome to ask any questions in the comments, I will answer them in upcoming stream.
Previously I've been working on MDI for DX11 via NvAPI and it worked, tho NVIDIA doesn't have an API for passing an indirect count, but at least CPU count worked fine.
Unity mentioned that they may support MDI in BRG, but they actually don't and they don't even have plans to support it in Unity 6, so I made my little takeover.
There's a working proof of concept.
All material, shader, and render targets (basically a PSO) is set by Unity, so we don't need to go fully native.
Writing native rendering plugins for Unity is hard, mostly due to lack of documentation and even if it exists, there's a big chance it will not work.
Please open Telegram to view this post
VIEW IN TELEGRAM
👍10🔥3
Сегодня сделаю стрим по обзору Unity Native Rendering Plugin
и ответами на вопросы.
Подключайтесь)
19:00 MSK
19:00 Kyiv
18:00 CEST
https://www.youtube.com/watch?v=XcjNVTHRxqI
и ответами на вопросы.
Подключайтесь)
19:00 MSK
19:00 Kyiv
18:00 CEST
https://www.youtube.com/watch?v=XcjNVTHRxqI
YouTube
Ковыряем Unity Native Rendering Plugin
Длинный обзор того что внутри и что за что отвечает.
👍7🔥3❤2
How to build Unity Native Rendering Plugin for Windows, Linux, WebGL and Android.
https://gist.github.com/Meetem/b8538de3e7800de3242b6e4f830b87c6
https://gist.github.com/Meetem/b8538de3e7800de3242b6e4f830b87c6
Gist
Unity Render Plugin Compilation Example
Unity Render Plugin Compilation Example. GitHub Gist: instantly share code, notes, and snippets.
🔥6
Quick overview on using Vulkan-native features in Unity's HLSL:
(bonus point: adding Unsupported functionality in Unity's DXC)
https://meetemq.com/2024/06/14/using-vulkan-in-unity-shaders/
(bonus point: adding Unsupported functionality in Unity's DXC)
https://meetemq.com/2024/06/14/using-vulkan-in-unity-shaders/
Meetemq
Using Vulkan in Unity shaders
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?…
🔥5👍2