Beispiel #1
0
        private QueueFamilyIndices FindQueueFamilies(PhysicalDevice device)
        {
            QueueFamilyIndices indices = new QueueFamilyIndices();

            var queueFamilies = device.GetQueueFamilyProperties();

            for (uint index = 0; index < queueFamilies.Length && !indices.IsComplete; index++)
            {
                if (queueFamilies[index].QueueFlags.HasFlag(QueueFlags.Graphics))
                {
                    indices.GraphicsFamily = index;
                }

                if (device.GetSurfaceSupport(index, this.surface))
                {
                    indices.PresentFamily = index;
                }

                if (queueFamilies[index].QueueFlags.HasFlag(QueueFlags.Transfer) && !queueFamilies[index].QueueFlags.HasFlag(QueueFlags.Graphics))
                {
                    indices.TransferFamily = index;
                }
            }

            if (!indices.TransferFamily.HasValue)
            {
                indices.TransferFamily = indices.GraphicsFamily;
            }

            return(indices);
        }
Beispiel #2
0
        private IEnumerable <uint> GetPresentQueues(SharpVk.PhysicalDevice device, VKSurface surface)
        {
            // - Gets GPU command queues
            var queues = device.GetQueueFamilyProperties();

            for (uint i = 0; i < queues.Length; ++i)
            {
                if (device.GetSurfaceSupport(i, surface.Handle))
                {
                    yield return(i);
                }
            }
        }
Beispiel #3
0
        private IEnumerable <uint> GetSuitableQueues(SharpVk.PhysicalDevice device, QueueFlags type)
        {
            // - Gets GPU command queues
            var queues = device.GetQueueFamilyProperties();

            for (uint i = 0; i < queues.Length; ++i)
            {
                var queue = queues[i];

                if (queue.QueueFlags.HasFlag(type))
                {
                    yield return(i);
                }
            }
        }