Пример #1
0
        private VkObjectResult <IVkDevice> CreateDevice(IntPtr data, VkDeviceCreateInfo createInfo, IVkAllocationCallbacks allocator)
        {
            var unmanaged     = (byte *)data;
            var createInfoRaw = createInfo.MarshalDirect(ref unmanaged);
            var pAllocator    = allocator.MarshalIndirect(ref unmanaged);

            VkDevice.HandleType handle;
            var result = Direct.CreateDevice(Handle, &createInfoRaw, pAllocator, &handle);
            var device = result == VkResult.Success ? new VkDevice(this, handle, allocator) : null;

            return(new VkObjectResult <IVkDevice>(result, device));
        }
Пример #2
0
        public VkObjectResult <IVkDebugReportCallbackEXT> CreateDebugReportCallbackEXT(VkDebugReportCallbackCreateInfoEXT createInfo, IVkAllocationCallbacks allocator)
        {
            var unmanagedSize =
                createInfo.SizeOfMarshalIndirect() +
                allocator.SizeOfMarshalIndirect();
            var unmanagedArray = new byte[unmanagedSize];

            fixed(byte *unmanagedStart = unmanagedArray)
            {
                var unmanaged   = unmanagedStart;
                var pCreateInfo = createInfo.MarshalIndirect(ref unmanaged);
                var pAllocator  = allocator.MarshalIndirect(ref unmanaged);

                VkDebugReportCallbackEXT.HandleType callbackHandle;
                var result   = Direct.CreateDebugReportCallbackEXT(Handle, pCreateInfo, pAllocator, &callbackHandle);
                var instance = result == VkResult.Success ? new VkDebugReportCallbackEXT(this, callbackHandle, allocator) : null;

                return(new VkObjectResult <IVkDebugReportCallbackEXT>(result, instance));
            }
        }
Пример #3
0
        public VkObjectResult <IVkSurfaceKHR> CreateDisplayPlaneSurfaceKHR(VkDisplaySurfaceCreateInfoKHR createInfo, IVkAllocationCallbacks allocator)
        {
            var unmanagedSize =
                createInfo.SizeOfMarshalIndirect() +
                allocator.SizeOfMarshalIndirect();
            var unmanagedArray = new byte[unmanagedSize];

            fixed(byte *unmanagedStart = unmanagedArray)
            {
                var unmanaged   = unmanagedStart;
                var pCreateInfo = createInfo.MarshalIndirect(ref unmanaged);
                var pAllocator  = allocator.MarshalIndirect(ref unmanaged);

                VkSurfaceKHR.HandleType surfaceHandle;
                var result   = Direct.CreateDisplayPlaneSurfaceKHR(Handle, pCreateInfo, pAllocator, &surfaceHandle);
                var instance = result == VkResult.Success ? new VkSurfaceKHR(this, surfaceHandle, allocator) : null;

                return(new VkObjectResult <IVkSurfaceKHR>(result, instance));
            }
        }
Пример #4
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));
            }
        }
Пример #5
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);
     }
 }
Пример #6
0
 private VkObjectResult<IVkDevice> CreateDevice(IntPtr data, VkDeviceCreateInfo createInfo, IVkAllocationCallbacks allocator)
 {
     var unmanaged = (byte*)data;
     var createInfoRaw = createInfo.MarshalDirect(ref unmanaged);
     var pAllocator = allocator.MarshalIndirect(ref unmanaged);
     VkDevice.HandleType handle;
     var result = Direct.CreateDevice(Handle, &createInfoRaw, pAllocator, &handle);
     var device = result == VkResult.Success ? new VkDevice(this, handle, allocator) : null;
     return new VkObjectResult<IVkDevice>(result, device);
 }
Пример #7
0
 public VkObjectResult<IVkSurfaceKHR> CreateDisplayPlaneSurfaceKHR(VkDisplaySurfaceCreateInfoKHR createInfo, IVkAllocationCallbacks allocator)
 {
     var unmanagedSize =
         createInfo.SizeOfMarshalIndirect() +
         allocator.SizeOfMarshalIndirect();
     var unmanagedArray = new byte[unmanagedSize];
     fixed (byte* unmanagedStart = unmanagedArray)
     {
         var unmanaged = unmanagedStart;
         var pCreateInfo = createInfo.MarshalIndirect(ref unmanaged);
         var pAllocator = allocator.MarshalIndirect(ref unmanaged);
         VkSurfaceKHR.HandleType surfaceHandle;
         var result = Direct.CreateDisplayPlaneSurfaceKHR(Handle, pCreateInfo, pAllocator, &surfaceHandle);
         var instance = result == VkResult.Success ? new VkSurfaceKHR(this, surfaceHandle, allocator) : null;
         return new VkObjectResult<IVkSurfaceKHR>(result, instance);
     }
 }