示例#1
0
文件: Utils.cs 项目: Svengali/vk.net
        public static IntPtr GetDelegate(VkInstance inst, string name)
        {
            byte[]   n   = System.Text.Encoding.UTF8.GetBytes(name + '\0');
            GCHandle hnd = GCHandle.Alloc(n, GCHandleType.Pinned);
            IntPtr   del = Vk.vkGetInstanceProcAddr(inst, hnd.AddrOfPinnedObject());

            if (del == IntPtr.Zero)
            {
                Console.WriteLine("instance function pointer not found for " + name);
            }
            hnd.Free();
            return(del);
        }
示例#2
0
文件: Utils.cs 项目: Svengali/vk.net
        /// <summary>
        /// try to get device function handle if available
        /// </summary>
        public static void GetDelegate(VkDevice dev, string name, ref IntPtr ptr)
        {
            byte[]   n   = System.Text.Encoding.UTF8.GetBytes(name + '\0');
            GCHandle hnd = GCHandle.Alloc(n, GCHandleType.Pinned);
            IntPtr   del = Vk.vkGetDeviceProcAddr(dev, hnd.AddrOfPinnedObject());

            if (del == IntPtr.Zero)
            {
                Console.WriteLine("device function pointer not found for " + name);
            }
            else
            {
                ptr = del;
            }
            hnd.Free();
        }
示例#3
0
 static Vk()
 {
     s_nativeLib = LoadNativeLibrary();
     Vk.LoadFunctionPointers();
 }