Exemple #1
0
		public static void UseLayers(ref VkDeviceCreateInfo Inf) {
			if (!EnableDebug)
				return;
			Inf.enabledLayerCount = LayerCount;
			Inf.ppEnabledLayerNames = LayerNames;
		}
Exemple #2
0
		public virtual IntPtr CreateDevice(IntPtr GPU, uint QueueIdx) {
			float[] QueuePriorities = new float[]{ 0 };

			fixed (float* QueuePrioritiesPtr = QueuePriorities) {
				VkDeviceQueueCreateInfo Inf = new VkDeviceQueueCreateInfo();
				Inf.sType = VkStructureType.VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO;
				Inf.queueFamilyIndex = QueueIdx;
				Inf.queueCount = 1;
				Inf.pQueuePriorities = QueuePrioritiesPtr;

				VkDeviceCreateInfo Inf2 = new VkDeviceCreateInfo();
				Inf2.sType = VkStructureType.VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO;
				Inf2.pNext = null;
				Inf2.queueCreateInfoCount = 1;
				Inf2.pQueueCreateInfos = &Inf;
				Inf2.pEnabledFeatures = null;

				byte* EnabledExt = "VK_KHR_swapchain".AllocString();
				Inf2.enabledExtensionCount = 1;
				Inf2.ppEnabledExtensionNames = &EnabledExt;

				VkDebug.UseLayers(ref Inf2);

				IntPtr VirtDev = IntPtr.Zero;
				Vulkan.vkCreateDevice(GPU, &Inf2, IntPtr.Zero, &VirtDev).Throw();
				return VirtDev;
			}

		}