Move the check for missing Vulkan per-architecture libraries to the options.

Like libvulkan problems, these result in DXVK and VKD3D being disabled in the config UI, and they won't be used. Maybe this is excessive - some games might have worked perhaps- but something is clearly broken.

The checks for non-VULKAN libraries are still done at startup, but result in log entries only.
This commit is contained in:
Daniel Johnson 2023-06-18 05:31:41 -04:00
parent 41ee2ded3a
commit d118ae5603
5 changed files with 38 additions and 27 deletions

View file

@ -14,6 +14,7 @@ from lutris.runners.runner import Runner
from lutris.util import system
from lutris.util.display import DISPLAY_MANAGER, get_default_dpi
from lutris.util.graphics import vkquery
from lutris.util.linux import LINUX_SYSTEM
from lutris.util.log import logger
from lutris.util.steam.config import get_steam_dir
from lutris.util.strings import split_arguments
@ -44,6 +45,18 @@ def _get_prefix_warning(config, _option_key):
def _get_dxvk_error(config, option_key):
"""Checks that required libraries are installed on the system"""
missing_arch = LINUX_SYSTEM.get_missing_lib_arch("VULKAN")
if missing_arch:
arches = ", ".join(missing_arch)
return _("<b>Error</b> Missing Vulkan libraries\n"
"Lutris was unable to detect Vulkan support for "
"the %s architecture.\n"
"This will prevent many games and programs from working.\n"
"To install it, please use the following guide: "
"<a href='%s'>Installing Graphics Drivers</a>"
) % (arches, settings.DRIVER_HOWTO_URL)
if not vkquery.is_vulkan_supported():
return _("<b>Error</b> Vulkan is not installed or is not supported by your system, so DXVK is not available.\n"
"If you have compatible hardware, please follow "
@ -56,7 +69,7 @@ def _get_dxvk_error(config, option_key):
def _get_vkd3d_error(config, option_key):
if not vkquery.is_vulkan_supported():
if LINUX_SYSTEM.get_missing_lib_arch("VULKAN") or not vkquery.is_vulkan_supported():
return _("<b>Error</b> Vulkan is not installed or is not supported by your system, so VKD3D is not available.")
return None

View file

@ -108,29 +108,12 @@ def check_libs(all_components=False):
components = LINUX_SYSTEM.requirements
else:
components = LINUX_SYSTEM.critical_requirements
missing_vulkan_libs = []
for req in components:
for index, arch in enumerate(LINUX_SYSTEM.runtime_architectures):
for lib in missing_libs[req][index]:
if req == "VULKAN":
missing_vulkan_libs.append(arch)
logger.error("%s %s missing (needed by %s)", arch, lib, req.lower())
if missing_vulkan_libs:
WarningMessageDialog(
_("Missing Vulkan libraries"),
secondary_message=_(
"Lutris was unable to detect Vulkan support for "
"the %s architecture.\n"
"This will prevent many games and programs from working.\n"
"To install it, please use the following guide: "
"<a href='%s'>Installing Graphics Drivers</a>"
) % (
_(" and ").join(missing_vulkan_libs),
settings.DRIVER_HOWTO_URL,
)
)
def check_vulkan():
"""Reports if Vulkan is enabled on the system"""

View file

@ -121,7 +121,7 @@ class LinuxSystem: # pylint: disable=too-many-public-methods
logger.warning("Command '%s' not found on your system", command)
# Detect if system is 64bit capable
self.is_64_bit = sys.maxsize > 2**32
self.is_64_bit = sys.maxsize > 2 ** 32
self.arch = self.get_arch()
self.shared_libraries = self.get_shared_libraries()
self.populate_libraries()
@ -226,11 +226,15 @@ class LinuxSystem: # pylint: disable=too-many-public-methods
# 515.43.04 was the first driver to support
# VK_EXT_image_drm_format_modifier, required by gamescope.
minimum_nvidia_version_supported = 515
driver_info = drivers.get_nvidia_driver_info()
driver_version = driver_info["nvrm"]["version"]
major_version = int(driver_version.split(".")[0])
return major_version >= minimum_nvidia_version_supported
try:
minimum_nvidia_version_supported = 515
driver_info = drivers.get_nvidia_driver_info()
driver_version = driver_info["nvrm"]["version"]
major_version = int(driver_version.split(".")[0])
return major_version >= minimum_nvidia_version_supported
except Exception as ex:
logger.exception("Unable to determine NVidia version: %s", ex)
return False
@property
def has_steam(self):
@ -388,6 +392,15 @@ class LinuxSystem: # pylint: disable=too-many-public-methods
"""Return a dictionary of missing libraries"""
return {req: self.get_missing_requirement_libs(req) for req in self.requirements}
def get_missing_lib_arch(self, requirement):
"""Returns a list of architectures that are missing a library for a specific
requirement."""
missing_arch = []
for index, arch in enumerate(self.runtime_architectures):
if self.get_missing_requirement_libs(requirement)[index]:
missing_arch.append(arch)
return missing_arch
def is_feature_supported(self, feature):
"""Return whether the system has the necessary libs to support a feature"""
if feature == "ACO":

View file

@ -7,6 +7,7 @@ from lutris.settings import RUNTIME_DIR
from lutris.util.extract import extract_archive
from lutris.util.graphics import vkquery
from lutris.util.http import download_file
from lutris.util.linux import LINUX_SYSTEM
from lutris.util.log import logger
from lutris.util.system import create_folder, execute, remove_folder
from lutris.util.wine.dll_manager import DLLManager
@ -23,7 +24,7 @@ class DXVKManager(DLLManager):
vulkan_api_version = vkquery.get_expected_api_version()
def can_enable(self):
return vkquery.is_vulkan_supported()
return not LINUX_SYSTEM.get_missing_lib_arch("VULKAN") or vkquery.is_vulkan_supported()
def is_recommended_version(self, version):
# DXVK 2.x and later require Vulkan 1.3, so if that iss lacking

View file

@ -3,6 +3,7 @@ import os
from lutris.util.graphics import vkquery
from lutris.settings import RUNTIME_DIR
from lutris.util.linux import LINUX_SYSTEM
from lutris.util.wine.dll_manager import DLLManager
@ -14,4 +15,4 @@ class VKD3DManager(DLLManager):
releases_url = "https://api.github.com/repos/lutris/vkd3d/releases"
def can_enable(self):
return vkquery.is_vulkan_supported()
return not LINUX_SYSTEM.get_missing_lib_arch("VULKAN") or vkquery.is_vulkan_supported()