Ejemplo n.º 1
0
        public VkObjectResult <IVkDisplayModeKHR> CreateDisplayMode(IVkDisplayKHR display, VkDisplayModeCreateInfoKHR createInfo, IVkAllocationCallbacks allocator)
        {
            var unmanagedSize =
                createInfo.SizeOfMarshalIndirect() +
                allocator.SizeOfMarshalIndirect();
            var unmanagedArray = new byte[unmanagedSize];

            fixed(byte *unmanagedStart = unmanagedArray)
            {
                var unmanaged     = unmanagedStart;
                var displayHandle = display?.Handle ?? VkDisplayKHR.HandleType.Null;
                var pCreateInfo   = createInfo.MarshalIndirect(ref unmanaged);
                var pAllocator    = allocator.MarshalIndirect(ref unmanaged);

                VkDisplayModeKHR.HandleType displayModeHandle;
                var result   = Direct.CreateDisplayModeKHR(Handle, displayHandle, pCreateInfo, pAllocator, &displayModeHandle);
                var instance = result == VkResult.Success ? new VkDisplayModeKHR(Instance, displayModeHandle) : null;

                return(new VkObjectResult <IVkDisplayModeKHR>(result, instance));
            }
        }