Beispiel #1
0
 public VkInstance(HandleType handle, VkAllocationCallbacks allocator)
 {
     Handle = handle;
     Allocator = allocator;
     Direct = new DirectFunctions(this);
     PhysicalDevices = EnumeratePhysicalDevices();
 }
Beispiel #2
0
 private VkObjectResult<IVkInstance> CreateInstanceInternal(IntPtr data, VkInstanceCreateInfo createInfo, VkAllocationCallbacks allocator)
 {
     var unmanaged = (byte*)data;
     var pCreateInfo = createInfo.MarshalIndirect(ref unmanaged);
     var pAllocator = allocator.MarshalIndirect(ref unmanaged);
     VkInstance.HandleType handle;
     var result = Direct.CreateInstance(pCreateInfo, pAllocator, &handle);
     var instance = result == VkResult.Success ? new VkInstance(handle, allocator) : null;
     return new VkObjectResult<IVkInstance>(result, instance);
 }
Beispiel #3
0
 public VkObjectResult<IVkInstance> CreateInstance(VkInstanceCreateInfo createInfo, VkAllocationCallbacks allocator)
 {
     var size =
         createInfo.SizeOfMarshalIndirect() +
         allocator.SizeOfMarshalIndirect();
     return VkHelpers.RunWithUnamangedData(size, u => CreateInstanceInternal(u, createInfo, allocator));
 }
Beispiel #4
0
        private VkObjectResult <IVkInstance> CreateInstanceInternal(IntPtr data, VkInstanceCreateInfo createInfo, VkAllocationCallbacks allocator)
        {
            var unmanaged   = (byte *)data;
            var pCreateInfo = createInfo.MarshalIndirect(ref unmanaged);
            var pAllocator  = allocator.MarshalIndirect(ref unmanaged);

            VkInstance.HandleType handle;
            var result   = Direct.CreateInstance(pCreateInfo, pAllocator, &handle);
            var instance = result == VkResult.Success ? new VkInstance(handle, allocator) : null;

            return(new VkObjectResult <IVkInstance>(result, instance));
        }
Beispiel #5
0
        public VkObjectResult <IVkInstance> CreateInstance(VkInstanceCreateInfo createInfo, VkAllocationCallbacks allocator)
        {
            var size =
                createInfo.SizeOfMarshalIndirect() +
                allocator.SizeOfMarshalIndirect();

            return(VkHelpers.RunWithUnamangedData(size, u => CreateInstanceInternal(u, createInfo, allocator)));
        }