Ejemplo n.º 1
0
    def __cretaeInstance(self):
        #appInfo = _vk.ApplicationInfo()
        #appInfo.applicationName = 'pyvkApp'
        #appInfo.engineName = 'pyvkEngine'
        #appInfo.applicationVersion = _vk.makeVersion()
        #appInfo.engineVersion = _vk.makeVersion()
        #appInfo.apiVersion = _vk.Instance.version()
        #v = _vk.makeVersion()
        #appInfo = _vk.ApplicationInfo('pyvkApp', 'pyvkEngine', v, v, _vk.Instance.version())
        
        #createInfo = _vk.InstanceCreateInfo()
        #createInfo.applicationInfo = appInfo
        #createInfo = _vk.InstanceCreateInfo(appInfo, [], [])

        createInfo = _vk.InstanceCreateInfo()
        createInfo.applicationInfo.applicationName = 'pyvkApp'
        createInfo.applicationInfo.engineName = 'pyvkEngine'
        createInfo.applicationInfo.engineVersion = _vk.makeVersion()
        createInfo.applicationInfo.applicationVersion = _vk.makeVersion()
        createInfo.applicationInfo.apiVersion = _vk.makeVersion()

        extensionNames = [e.extensionName for e in _vk.Instance.getExtensionProperties()]
        extensionNames = ['VK_KHR_get_physical_device_properties2', 'VK_KHR_get_surface_capabilities2', 'VK_KHR_surface', 'VK_KHR_win32_surface']
        createInfo.enabledExtensionNames = extensionNames
        #print(createInfo.enabledExtensionNames)

        #layerNames = [l.layerName for l in _vk.Instance.getLayerProperties()]
        layerNames = ['VK_LAYER_KHRONOS_validation', ]
        createInfo.enabledLayerNames = layerNames

        self.__instance = _vk.Instance(createInfo)
        print(self.__instance.isValid)
Ejemplo n.º 2
0
    def __cretaeInstance(self):
        createInfo = _vk.InstanceCreateInfo()
        createInfo.applicationInfo.applicationName = 'pyvkApp'
        createInfo.applicationInfo.engineName = 'pyvkEngine'
        createInfo.applicationInfo.engineVersion = _vk.makeVersion()
        createInfo.applicationInfo.applicationVersion = _vk.makeVersion()
        createInfo.applicationInfo.apiVersion = _vk.makeVersion()

        debugInfo = _vk.DebugUtilsMessengerCreateInfoEXT()
        messageSeverity = _vk.VK_DEBUG_UTILS_MESSAGE_SEVERITY_VERBOSE_BIT_EXT | _vk.VK_DEBUG_UTILS_MESSAGE_SEVERITY_WARNING_BIT_EXT | _vk.VK_DEBUG_UTILS_MESSAGE_SEVERITY_ERROR_BIT_EXT  #| _vk.VK_DEBUG_UTILS_MESSAGE_SEVERITY_INFO_BIT_EXT
        print(messageSeverity, type(messageSeverity),
              type(_vk.VK_DEBUG_UTILS_MESSAGE_SEVERITY_VERBOSE_BIT_EXT))
        debugInfo.messageSeverity = messageSeverity
        debugInfo.messageType = _vk.VK_DEBUG_UTILS_MESSAGE_TYPE_GENERAL_BIT_EXT | _vk.VK_DEBUG_UTILS_MESSAGE_TYPE_VALIDATION_BIT_EXT | _vk.VK_DEBUG_UTILS_MESSAGE_TYPE_PERFORMANCE_BIT_EXT
        debugInfo.userCallback = debugCallback

        createInfo.pNext = debugInfo

        if enableValidationLayers:
            extensionNames = self.__getRequiredExtensions()
            #extensionNames = ['VK_LAYER_KHRONOS_validation', 'VK_KHR_get_surface_capabilities2', 'VK_KHR_surface', 'VK_KHR_win32_surface']
            createInfo.enabledExtensionNames = extensionNames
            createInfo.enabledLayerNames = validationLayers

        self.__instance = _vk.Instance(createInfo)
        print(self.__instance.isValid)
Ejemplo n.º 3
0
    def createInstance(self):
        enabledExtensions = []
        if enableValidationLayers:
            supportLayerNames = [prop.layerName for prop in _vk.Instance.getLayerProperties()]
            if 'VK_LAYER_KHRONOS_validation' not in supportLayerNames:
                raise Exception('Layer VK_LAYER_KHRONOS_validation not supported')
            self.__enabledLayers.append('VK_LAYER_KHRONOS_validation')

            supportExtensions = [prop.extensionName for prop in _vk.Instance.getExtensionProperties()]
            if _vk.VK_EXT_DEBUG_UTILS_EXTENSION_NAME not in supportExtensions:
                raise Exception('Extension {} not supported'.format(_vk.VK_EXT_DEBUG_UTILS_EXTENSION_NAME))
            enabledExtensions.append(_vk.VK_EXT_DEBUG_UTILS_EXTENSION_NAME)
        
        appInfo = _vk.ApplicationInfo()
        appInfo.applicationName = 'Hello world app'
        appInfo.applicationVersion = 0
        appInfo.engineName = 'awesomeengine'
        appInfo.engineVersion = 0
        appInfo.apiVersion = _vk.makeVersion()

        createInfo = _vk.InstanceCreateInfo()
        createInfo.applicationInfo = appInfo
        createInfo.enabledLayerNames = self.__enabledLayers
        createInfo.enabledExtensionNames = enabledExtensions

        self.__instance = _vk.Instance(createInfo)

        if enableValidationLayers:
            messageSeverity = _vk.VK_DEBUG_UTILS_MESSAGE_SEVERITY_VERBOSE_BIT_EXT | _vk.VK_DEBUG_UTILS_MESSAGE_SEVERITY_WARNING_BIT_EXT | _vk.VK_DEBUG_UTILS_MESSAGE_SEVERITY_ERROR_BIT_EXT
            messageType = _vk.VK_DEBUG_UTILS_MESSAGE_TYPE_GENERAL_BIT_EXT | _vk.VK_DEBUG_UTILS_MESSAGE_TYPE_VALIDATION_BIT_EXT | _vk.VK_DEBUG_UTILS_MESSAGE_TYPE_PERFORMANCE_BIT_EXT

            createInfo = _vk.DebugUtilsMessengerCreateInfoEXT()
            createInfo.messageSeverity = messageSeverity
            createInfo.messageType = messageType
            createInfo.userCallback = self.debugCallback

            self.__debugMessenger = self.__instance.createDebugUtilsMessengerEXT(createInfo)