wez / wezterm

A GPU-accelerated cross-platform terminal emulator and multiplexer written by @wez and implemented in Rust
https://wezfurlong.org/wezterm/
Other
16.72k stars 749 forks source link

`GLD_TEXTURE_INDEX_2D is unloadable` warning and pixellated/unusable output on Nix aarch64-darwin #6005

Closed siriobalmelli closed 1 day ago

siriobalmelli commented 3 weeks ago

What Operating System(s) are you seeing this problem on?

macOS

Which Wayland compositor or X11 Window manager(s) are you using?

Default macOS window manager.

WezTerm version

20240203-110809-5046fc22

Did you try the latest nightly build to see if the issue is better (or worse!) than your current version?

No, and I'll explain why below

Describe the bug

Wezterm gives this warning when starting:

UNSUPPORTED (log once): POSSIBLE ISSUE: unit 0 GLD_TEXTURE_INDEX_2D is unloadable and bound to sampler type (Float) - using zero texture because texture unloadable

The graphics output is pixellated and unusable:

Screenshot 2024-08-21 at 1 36 57 PM

This was broken in nixpkgs by the following commit introduced to fix the build under rust 1.80.1:

commit e57228512561add2e46812f3e61a7304b46a7958
Author: Sandro Jäckel <sandro.jaeckel@gmail.com>
Date:   Thu Aug 15 11:47:14 2024 +0200

    wezterm: fix compilation with rust 1.80

diff --git a/pkgs/applications/terminal-emulators/wezterm/Cargo.lock b/pkgs/applications/terminal-emulators/wezterm/Cargo.lock
index 58f7820be40e..4d31d10c502f 100644
--- a/pkgs/applications/terminal-emulators/wezterm/Cargo.lock
+++ b/pkgs/applications/terminal-emulators/wezterm/Cargo.lock
@@ -3648,6 +3648,12 @@ dependencies = [
  "num-traits",
 ]

+[[package]]
+name = "num-conv"
+version = "0.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9"
+
 [[package]]
 name = "num-derive"
 version = "0.3.3"
@@ -5554,12 +5560,13 @@ dependencies = [

 [[package]]
 name = "time"
-version = "0.3.31"
+version = "0.3.36"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f657ba42c3f86e7680e53c8cd3af8abbe56b5491790b46e22e19c0d57463583e"
+checksum = "5dfd88e563464686c916c7e46e623e520ddc6d79fa6641390f2e3fa86e83e885"
 dependencies = [
  "deranged",
  "itoa",
+ "num-conv",
  "powerfmt",
  "serde",
  "time-core",
@@ -5589,10 +5596,11 @@ dependencies = [

 [[package]]
 name = "time-macros"
-version = "0.2.16"
+version = "0.2.18"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "26197e33420244aeb70c3e8c78376ca46571bc4e701e4791c2cd9f57dcb3a43f"
+checksum = "3f252a68540fde3a3877aeea552b832b40ab9a69e318efd078774a01ddee1ccf"
 dependencies = [
+ "num-conv",
  "time-core",
 ]

diff --git a/pkgs/applications/terminal-emulators/wezterm/default.nix b/pkgs/applications/terminal-emulators/wezterm/default.nix
index ea9e45c292e1..4f710d61c20a 100644
--- a/pkgs/applications/terminal-emulators/wezterm/default.nix
+++ b/pkgs/applications/terminal-emulators/wezterm/default.nix
@@ -43,6 +43,8 @@ rustPlatform.buildRustPackage rec {
   };

   postPatch = ''
+    cp ${./Cargo.lock} Cargo.lock
+
     echo ${version} > .tag

     # tests are failing with: Unable to exchange encryption keys

I do not think nixpkgs will approve a PR that points wezterm to the currently nightly, but will accept either of:

To Reproduce

git clone https://github.com/NixOS/nixpkgs.git
cd nixpkgs
nix run .#wezterm

Configuration

-- Generated by Home Manager.
-- See https://wezfurlong.org/wezterm/

local wezterm = require 'wezterm';

-- Pull in the wezterm API
local wezterm = require 'wezterm'

-- This table will hold the configuration.
local config = {}

-- In newer versions of wezterm, use the config_builder which will
-- help provide clearer error messages
if wezterm.config_builder then
   config = wezterm.config_builder()
end

-- This is where you actually apply your config choices

-- For example, changing the color scheme:
-- config.color_scheme = 'Dark Ocean (terminal.sexy)'
config.color_scheme = 'Builtin Tango Dark'
config.font = wezterm.font 'JetBrains Mono'
config.font_size = 22.0
config.initial_cols = 256 -- will maximise
config.initial_rows = 256
config.switch_to_last_active_tab_when_closing_tab = true
config.window_background_opacity = 0.9

local act = wezterm.action

-- https://github.com/wez/wezterm/discussions/2691#discussioncomment-4032144
config.keys = {
   {
      key = 'y',
      mods = 'CMD',
      action = wezterm.action_callback(function(window, pane)
         local mux_window = window:mux_window()

         -- determine the index of the current tab
         -- https://wezfurlong.org/wezterm/config/lua/mux-window/tabs_with_info.html
         local tabs = mux_window:tabs_with_info()
         local current_index = 0
         for _, tab_info in ipairs(tabs) do
            if tab_info.is_active then
               current_index = tab_info.index
               break
            end
         end

         -- spawn a new tab; it will be made active
         -- https://wezfurlong.org/wezterm/config/lua/mux-window/spawn_tab.html
         mux_window:spawn_tab {}

         -- Move the new active tab to the right of the previously active tab
         window:perform_action(act.MoveTab(current_index + 1), pane)
      end)
   }
}

-- and finally, return the configuration to wezterm
return config

Expected Behavior

The release build works fine on the nixos-24.05 branch:

git checkout nixos-24.05
nix run .#wezterm
Screenshot 2024-08-21 at 1 54 47 PM

Logs

Debug Overlay is unreadable:

Screenshot 2024-08-21 at 1 56 29 PM

Anything else?

No response

RVxLab commented 3 weeks ago

Also reported in #5990 for Linux

DavSanchez commented 2 days ago

Setting front_end = "WebGpu" has fixed it on my install (Had opened #6134, installed it via Nixpkgs/Home Manager):

Debug Overlay
wezterm version: 20240203-110809-5046fc22 aarch64-apple-darwin
Window Environment: macOS 14.6.1 (23G93)
Lua Version: Lua 5.4
WebGPU: name=Apple M1 Max, device_type=IntegratedGpu, backend=Metal, vendor=0, device=0

Let me know if I can provide additional info via debug overlay, etc.

siriobalmelli commented 1 day ago

That works, thank you 🙏