Example #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);
        }
Example #2
0
        public Result CreateDisplayPlaneSurfaceKHR(MgDisplaySurfaceCreateInfoKHR createInfo, IMgAllocationCallbacks allocator, out IMgSurfaceKHR pSurface)
        {
            if (createInfo == null)
            {
                throw new ArgumentNullException(nameof(createInfo));
            }

            Debug.Assert(!mIsDisposed);

            var bDisplayMode = (VkDisplayModeKHR)createInfo.DisplayMode;

            Debug.Assert(bDisplayMode != null);

            var pCreateInfo = new VkDisplaySurfaceCreateInfoKHR
            {
                sType           = VkStructureType.StructureTypeDisplaySurfaceCreateInfoKhr,
                pNext           = IntPtr.Zero,
                flags           = createInfo.Flags,
                displayMode     = bDisplayMode.Handle,
                planeIndex      = createInfo.PlaneIndex,
                planeStackIndex = createInfo.PlaneStackIndex,
                transform       = (VkSurfaceTransformFlagsKhr)createInfo.Transform,
                globalAlpha     = createInfo.GlobalAlpha,
                alphaMode       = (VkDisplayPlaneAlphaFlagsKhr)createInfo.AlphaMode,
                imageExtent     = createInfo.ImageExtent,
            };

            // MIGHT NEED GetInstanceProcAddr INSTEAD

            var allocatorHandle = GetAllocatorHandle(allocator);

            UInt64 handle = 0UL;
            var    result = Interops.vkCreateDisplayPlaneSurfaceKHR(Handle, ref pCreateInfo, allocatorHandle, ref handle);

            pSurface = new VkSurfaceKHR(handle);

            return(result);
        }