예제 #1
0
        public Result CreateWin32SurfaceKHR(MgWin32SurfaceCreateInfoKHR pCreateInfo, IMgAllocationCallbacks allocator, out IMgSurfaceKHR pSurface)
        {
            if (pCreateInfo == null)
            {
                throw new ArgumentNullException(nameof(pCreateInfo));
            }

            Debug.Assert(!mIsDisposed);

            var allocatorHandle = GetAllocatorHandle(allocator);

            var createInfo = new VkWin32SurfaceCreateInfoKHR
            {
                sType     = VkStructureType.StructureTypeWin32SurfaceCreateInfoKhr,
                pNext     = IntPtr.Zero,
                flags     = pCreateInfo.Flags,
                hinstance = pCreateInfo.Hinstance,
                hwnd      = pCreateInfo.Hwnd,
            };

            // TODO : MIGHT NEED GetInstanceProcAddr INSTEAD

            var surfaceHandle = 0UL;
            var result        = Interops.vkCreateWin32SurfaceKHR(Handle, ref createInfo, allocatorHandle, ref surfaceHandle);

            pSurface = new VkSurfaceKHR(surfaceHandle);

            return(result);
        }