Ejemplo n.º 1
0
    def __createLogicalDevice(self):
        indices = self.__findQueueFamilies(self.__physicalDevice)

        queueCreateInfo = _vk.DeviceQueueCreateInfo()
        queueCreateInfo.queueFamilyIndex = indices.graphicsFamily
        queueCreateInfo.queuePriorities = [
            1.0,
        ]

        deviceFeatures = _vk.PhysicalDeviceFeatures()
        createInfo = _vk.DeviceCreateInfo()
        createInfo.queueCreateInfos = [
            queueCreateInfo,
        ]
        createInfo.enabledFeatures = deviceFeatures
        if enableValidationLayers:
            createInfo.enabledLayerNames = validationLayers

        self.__device = self.__physicalDevice.createDevice(createInfo)
        #self.__device = _vk.Device(self.__physicalDevice, createInfo)
        print(self.__device.isValid)

        self.__graphicQueue = self.__device.getQueue(indices.graphicsFamily, 0)
        print(self.__graphicQueue.isValid)
        self.__presentQueue = self.__device.getQueue(indices.presentFamily, 0)
        print(self.__presentQueue.isValid)
Ejemplo n.º 2
0
    def __createLogicalDevice(self):
        self.__indices = self.__findQueueFamilies(self.__physicalDevice)

        uniqueQueueFamilies = {}.fromkeys(
            [self.__indices.graphicsFamily, self.__indices.presentFamily])
        queueCreateInfos = []
        for i in uniqueQueueFamilies:
            queueCreateInfo = _vk.DeviceQueueCreateInfo()
            queueCreateInfo.queueFamilyIndex = self.__indices.graphicsFamily
            queueCreateInfo.queuePriorities = [
                1.0,
            ]
            queueCreateInfos.append(queueCreateInfo)

        deviceFeatures = _vk.PhysicalDeviceFeatures()
        createInfo = _vk.DeviceCreateInfo()
        createInfo.queueCreateInfos = [
            queueCreateInfo,
        ]
        createInfo.enabledFeatures = deviceFeatures
        createInfo.enabledExtensionNames = deviceExtensions
        if enableValidationLayers:
            createInfo.enabledLayerNames = validationLayers

        self.__device = self.__physicalDevice.createDevice(createInfo)
        #self.__device = _vk.Device(self.__physicalDevice, createInfo)

        self.__graphicQueue = self.__device.getQueue(
            self.__indices.graphicsFamily, 0)
        self.__presentQueue = self.__device.getQueue(
            self.__indices.presentFamily, 0)
Ejemplo n.º 3
0
    def createDevice(self):
        # We create the logical device in this function.
        self.__queueFamilyIndex = self.getComputeQueueFamilyIndex()
        # When creating the device, we also specify what queues it has.
        queueCreateInfo = _vk.DeviceQueueCreateInfo(self.__queueFamilyIndex, [1.0,])

        deviceFeatures = _vk.PhysicalDeviceFeatures()
        deviceCreateInfo = _vk.DeviceCreateInfo()
        deviceCreateInfo.enabledLayerNames = self.__enabledLayers
        deviceCreateInfo.queueCreateInfos = [queueCreateInfo, ]
        deviceCreateInfo.enabledFeatures = deviceFeatures

        self.__device = self.__physicalDevice.createDevice(deviceCreateInfo)
        self.__queue = self.__device.getQueue(self.__queueFamilyIndex, 0)