Skip to content

Commit

Permalink
Merge branch 'main' into bottlesdevs-pr
Browse files Browse the repository at this point in the history
  • Loading branch information
koplo199 authored Apr 27, 2024
2 parents 2e9e4f2 + 536cb8c commit 39e67e1
Showing 1 changed file with 17 additions and 21 deletions.
38 changes: 17 additions & 21 deletions bottles/backend/utils/vulkan.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class VulkanUtils:
"/usr/share/vulkan",
"/etc/vulkan",
"/usr/local/share/vulkan",
"/usr/local/etc/vulkan"
"/usr/local/etc/vulkan",
]
if "FLATPAK_ID" in os.environ:
__vk_icd_dirs += [
Expand All @@ -39,23 +39,22 @@ def __init__(self):
self.loaders = self.__get_vk_icd_loaders()

def __get_vk_icd_loaders(self):
loaders = {
"nvidia": [],
"amd": [],
"intel": []
}
loaders = {"nvidia": [], "amd": [], "intel": []}

for _dir in self.__vk_icd_dirs:
_files = glob(f"{_dir}/icd.d/*.json", recursive=True)

for file in _files:
if "nvidia" in file.lower():
# Workaround for nvidia flatpak bug: https://github.com/flathub/org.freedesktop.Platform.GL.nvidia/issues/112
should_skip=False
should_skip = False
for nvidia_loader in loaders["nvidia"]:
if filecmp.cmp(nvidia_loader, file):
should_skip=True
continue
try:
if filecmp.cmp(nvidia_loader, file):
should_skip = True
continue
except:
pass
if not should_skip:
loaders["nvidia"] += [file]
elif "amd" in file.lower() or "radeon" in file.lower():
Expand All @@ -66,11 +65,7 @@ def __get_vk_icd_loaders(self):
return loaders

def get_vk_icd(self, vendor: str, as_string=False):
vendors = [
"nvidia",
"amd",
"intel"
]
vendors = ["nvidia", "amd", "intel"]
icd = []

if vendor in vendors:
Expand All @@ -90,11 +85,12 @@ def test_vulkan():
if shutil.which("vulkaninfo") is None:
return "vulkaninfo tool not found"

res = subprocess.Popen(
"vulkaninfo",
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
shell=True
).communicate()[0].decode("utf-8")
res = (
subprocess.Popen(
"vulkaninfo", stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True
)
.communicate()[0]
.decode("utf-8")
)

return res

0 comments on commit 39e67e1

Please sign in to comment.