Exemple #1
0
        private void createLogicalDevice()
        {
            LogicalDeviceBuilder builder = new LogicalDeviceBuilder();

            HashSet <uint> queueTypes = new HashSet <uint>(new uint[] {
                this.vkQueueFamilies.GraphicsFamily.Value,
                this.vkQueueFamilies.PresentFamily.Value
            });

            foreach (uint queueType in queueTypes)
            {
                Vk.DeviceQueueCreateInfo queueInfo = new Vk.DeviceQueueCreateInfo();
                queueInfo.QueueFamilyIndex = queueType;
                queueInfo.QueueCount       = 1;
                queueInfo.QueuePriorities  = new float[] { 1.0F };

                builder.EnableQueue(queueInfo);
            }

            builder.EnableExtensions(this.DeviceExtensions);

            if (this.validationLayersEnabled)
            {
                builder.EnableValidationLayers(this.ValidationLayers);
            }

            try {
                this.Device = builder.Create(this.PhysicalDevice);
            } catch (Vk.ResultException result) {
                throw new VkException("An error occurred while creating the logical device.", result);
            }
        }
        internal Interop.DeviceQueueCreateInfo[] GetDeviceQueueCreateArray()
        {
            Interop.DeviceQueueCreateInfo[] myInformation;
            HashSet <SharedQueueItem>       myQueuedItems = new HashSet <SharedQueueItem>();

            foreach (var A in myQueueLookup)
            {
                foreach (var B in A.Value.myList)
                {
                    if (myQueuedItems.Contains(B))
                    {
                        continue;
                    }
                    myQueuedItems.Add(B);
                }
            }
            myInformation = new Interop.DeviceQueueCreateInfo[myQueuedItems.Count];
            float Priority  = 1f;
            int   DQCIIndex = 0;

            foreach (SharedQueueItem A in myQueuedItems)
            {
                myInformation[DQCIIndex]                  = new Interop.DeviceQueueCreateInfo();
                myInformation[DQCIIndex].QueueCount       = (uint)A.QueueCountRemaining.Length;
                myInformation[DQCIIndex].QueueFamilyIndex = A.QueueFamilyIndex;
                myInformation[DQCIIndex].QueuePriorities  = new float[A.QueueCountRemaining.Length];
                for (int i = 0; i < A.QueueCountRemaining.Length; i++)
                {
                    myInformation[DQCIIndex].QueuePriorities[i] = Priority;
                }
                Priority -= 0.1f;
                DQCIIndex++;
            }


            return(myInformation);
        }
Exemple #3
0
 public void EnableQueue(Vk.DeviceQueueCreateInfo queueInfo)
 {
     this.queueInfos.Add(queueInfo);
 }