Exemplo n.º 1
0
        public Vk.Device Create(Vk.PhysicalDevice physicalDevice)
        {
            Vk.DeviceCreateInfo deviceInfo = new Vk.DeviceCreateInfo();

            deviceInfo.QueueCreateInfos     = this.queueInfos.ToArray();
            deviceInfo.QueueCreateInfoCount = (uint)this.queueInfos.Count;

            deviceInfo.EnabledFeatures = this.deviceFeatures;

            if (this.extensions.Count != 0)
            {
                deviceInfo.EnabledExtensionNames = this.extensions.ToArray();
            }

            deviceInfo.EnabledExtensionCount = (uint)this.extensions.Count;

            if (this.validationLayers.Count != 0)
            {
                deviceInfo.EnabledLayerNames = this.validationLayers.ToArray();
            }

            deviceInfo.EnabledLayerCount = (uint)this.validationLayers.Count;

            return(physicalDevice.CreateDevice(deviceInfo));
        }
        public VulkanLogicalDevice(VulkanPhysicalDevice selectedPhysicalDevice)
        {
            myAssociatedDevice = selectedPhysicalDevice;
            selectedPhysicalDevice.LogicalDevice = this;
            QueueManager = new DeviceQueueManager(selectedPhysicalDevice, this);

            var DeviceCreateInfo = new Interop.DeviceCreateInfo
            {
                EnabledExtensionNames = new string[] { "VK_KHR_swapchain", },
                QueueCreateInfos      = QueueManager.GetDeviceQueueCreateArray()// new Interop.DeviceQueueCreateInfo[] { GraphicsQueueInfo, ComputeQueueInfo }
            };

            unsafe
            {
                Interop.Result result;
                fixed(IntPtr *ptrpDevice = &this.m)
                {
                    result = Interop.Interop.NativeMethods.vkCreateDevice(selectedPhysicalDevice.m, DeviceCreateInfo.m, null, ptrpDevice);
                }

                if (result != Interop.Result.Success)
                {
                    throw new Interop.ResultException(result);
                }
            }
            DeviceCreateInfo.Dispose();
        }