feat(wezterm): properly detect and handle vulkan support
This commit is contained in:
parent
88e6a93abd
commit
ead312f29a
24
dots/.config/wezterm/config/gpu.lua
Normal file
24
dots/.config/wezterm/config/gpu.lua
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
-- We have to provide a good gpu for wezterm to use gpu acceleration. We ideally want to use a vullkan front end, but if
|
||||||
|
-- we are unable to locate a card that supports Vulkan we fall back to OpenGL
|
||||||
|
local config = {}
|
||||||
|
local wezterm = require("wezterm")
|
||||||
|
local wlib = require("wlib")
|
||||||
|
|
||||||
|
local found_valid_gpu = false
|
||||||
|
wezterm.log_info(wlib.Table.dump(wezterm.gui.enumerate_gpus()))
|
||||||
|
for _, gpu in ipairs(wezterm.gui.enumerate_gpus()) do
|
||||||
|
if gpu.backend == "Vulkan" then
|
||||||
|
wezterm.log_info("Found Usable Vulkan GPU\n Device Name -> " .. gpu.name .."\n Device Type -> " .. gpu.device_type)
|
||||||
|
config.webgpu_preferred_adapter = gpu
|
||||||
|
config.front_end = "WebGpu"
|
||||||
|
found_valid_gpu = true
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if not found_valid_gpu then
|
||||||
|
wezterm.log_warn("Unable to locate a Vulkan-supported GPU, falling back to OpenGL")
|
||||||
|
config.front_end = "OpenGL"
|
||||||
|
end
|
||||||
|
|
||||||
|
return config
|
@ -10,6 +10,7 @@ local tabbar = require("config.tabbar")
|
|||||||
local rendering = require("config.rendering")
|
local rendering = require("config.rendering")
|
||||||
local keybinds = require("config.keybinds")
|
local keybinds = require("config.keybinds")
|
||||||
local misc = require("config.misc")
|
local misc = require("config.misc")
|
||||||
|
local gpu = require("config.gpu")
|
||||||
|
|
||||||
-- NOTE: Pull in the OS specific config, this is passed last to the mergeable
|
-- NOTE: Pull in the OS specific config, this is passed last to the mergeable
|
||||||
-- NOTE: as the last item to be merged (last item passed) overrides all others
|
-- NOTE: as the last item to be merged (last item passed) overrides all others
|
||||||
@ -23,5 +24,8 @@ if not found then
|
|||||||
os_config = {}
|
os_config = {}
|
||||||
end
|
end
|
||||||
|
|
||||||
local config = wlib.Table.merge(events, fonts, theme, tabbar, misc, rendering, keybinds, os_config)
|
|
||||||
|
local config = wlib.Table.merge(gpu, events, fonts, theme, tabbar, misc, rendering, keybinds, os_config)
|
||||||
|
|
||||||
|
|
||||||
return config
|
return config
|
||||||
|
Loading…
Reference in New Issue
Block a user