Esempio n. 1
0
    def _setup_instance(self):
        layers = []
        extensions = ["VK_KHR_surface", hvk.SYSTEM_SURFACE_EXTENSION]

        available_layers = [l[0] for l in hvk.enumerate_layers()]

        if DEBUG and "VK_LAYER_LUNARG_standard_validation" in available_layers:
            self.debug = True
            extensions.append("VK_EXT_debug_utils")
            layers.append("VK_LAYER_LUNARG_standard_validation")

        self.api, self.instance = hvk.create_instance(extensions, layers)
Esempio n. 2
0
def create_instance():
    global api, instance

    # Layers
    # Check if debugging layers are present
    layer_names = [l[0] for l in hvk.enumerate_layers()]
    if "VK_LAYER_LUNARG_core_validation" in layer_names and "VK_LAYER_LUNARG_standard_validation" in layer_names:
        layers = ("VK_LAYER_LUNARG_core_validation",
                  "VK_LAYER_LUNARG_standard_validation")
    else:
        layers = ()

    # Extensions
    extensions = ["VK_KHR_surface", "VK_EXT_debug_report"]

    system_name = platform.system()
    if system_name == 'Windows':
        extensions.append('VK_KHR_win32_surface')
    elif system_name == 'Linux':
        extensions.append('VK_KHR_xcb_surface')

    # Api & Instance creation
    api, instance = hvk.create_instance(extensions, layers)