tgoop.com/madcsharp/33
Last Update:
Interseting discovery about Unity when using Vulkan.
See, Vulkan have two entry points to resolve functions: vkGetInstanceProcAddr
and vkGetDeviceProcAddr
. vkGetInstanceProcAddr
returns functions for a given VkInstance.vkGetDeviceProcAddr
on the other hand returns functions for a given VkDevice OR device child, e.g. VkQueue and VkCommandBuffer.
According to the docs, vkGetDeviceProcAddr
is preferred when resolving device/-child functions, because returned address induce less overhead (probably because it doesn't need to resolve the child from VkInstance).
So, Unity requests vkGetDeviceProcAddr
from Vulkan (or native plugin if hooked with InterceptVulkanInitialization
). But actually never using it.
That means that all of the device/-child functions have an overhead to them. E.g. vkCmd* functions, vkQueue* functions etc. Those functions are actually used with insane frequency, in draw calls, uploading constants, binding buffer ranges etc.
The good thing is that we can reroute vkGetInstanceProcAddr
to return pointers as vkGetDeviceProcAddr
via native plugin. Which can give potential performance increase when events count is high.
How much performance? Well, you never know before you try. I think for 10K calls, say, on Android it could be measurable, like 0.5ms or something, but that's just my speculation.
BY MadSharp: Unsafe
Share with your friend now:
tgoop.com/madcsharp/33