Update CEF

This commit is contained in:
Timon
2026-04-24 17:23:31 +00:00
parent 96b18d2552
commit e0d3c21429
16 changed files with 290 additions and 185 deletions
+4 -5
View File
@@ -31,7 +31,6 @@ let
deps = { deps = {
crane = lib.call ./deps/crane.nix; crane = lib.call ./deps/crane.nix;
cef = lib.call ./deps/cef.nix;
rustGPU = lib.call ./deps/rust-gpu.nix; rustGPU = lib.call ./deps/rust-gpu.nix;
}; };
@@ -62,13 +61,13 @@ in
graphite-bundle = (lib.call ./pkgs/graphite-bundle.nix) { }; graphite-bundle = (lib.call ./pkgs/graphite-bundle.nix) { };
graphite-bundle-dev = (lib.call ./pkgs/graphite-bundle.nix) { graphite = graphite-dev; }; graphite-bundle-dev = (lib.call ./pkgs/graphite-bundle.nix) { graphite = graphite-dev; };
graphite-flatpak-manifest = (lib.call ./pkgs/graphite-flatpak-manifest.nix) { }; graphite-flatpak-manifest = (lib.call ./pkgs/graphite-flatpak-manifest.nix) { };
graphite-flatpak-manifest-dev = (lib.call ./pkgs/graphite-flatpak-manifest.nix) { graphite-bundle = graphite-bundle-dev; }; graphite-flatpak-manifest-dev = (lib.call ./pkgs/graphite-flatpak-manifest.nix) {
graphite-bundle = graphite-bundle-dev;
};
# TODO: graphene-cli = lib.call ./pkgs/graphene-cli.nix; # TODO: graphene-cli = lib.call ./pkgs/graphene-cli.nix;
tools = { graphite-cef = lib.call ./pkgs/graphite-cef/package.nix;
third-party-licenses = lib.call ./pkgs/tools/third-party-licenses.nix;
};
} }
); );
-27
View File
@@ -1,27 +0,0 @@
{ pkgs, ... }:
let
cefPath = pkgs.cef-binary.overrideAttrs (finalAttrs: {
postInstall = ''
rm -r $out/* $out/.* || true
strip ./Release/*.so*
mv ./Release/* $out/
find "./Resources/locales" -maxdepth 1 -type f ! -name 'en-US.pak' -delete
mv ./Resources/* $out/
mv ./include $out/
cat ./CREDITS.html | ${pkgs.xz}/bin/xz -9 -e -c > $out/CREDITS.html.xz
echo '${
builtins.toJSON {
type = "minimal";
name = builtins.baseNameOf finalAttrs.src.url;
sha1 = "";
}
}' > $out/archive.json
'';
});
in
{
env.CEF_PATH = cefPath;
}
+12 -6
View File
@@ -1,4 +1,10 @@
{ pkgs, deps, ... }: {
pkgs,
deps,
self,
system,
...
}:
let let
libs = [ libs = [
@@ -51,13 +57,13 @@ pkgs.mkShell (
pkgs.graphviz pkgs.graphviz
]; ];
LD_LIBRARY_PATH = "${pkgs.lib.makeLibraryPath libs}:${deps.cef.env.CEF_PATH}"; CEF_PATH = self.packages.${system}.graphite-cef;
LD_LIBRARY_PATH = "${pkgs.lib.makeLibraryPath libs}:${self.packages.${system}.graphite-cef}";
XDG_DATA_DIRS = "${pkgs.gsettings-desktop-schemas}/share/gsettings-schemas/${pkgs.gsettings-desktop-schemas.name}:${pkgs.gtk3}/share/gsettings-schemas/${pkgs.gtk3.name}:$XDG_DATA_DIRS"; XDG_DATA_DIRS = "${pkgs.gsettings-desktop-schemas}/share/gsettings-schemas/${pkgs.gsettings-desktop-schemas.name}:${pkgs.gtk3}/share/gsettings-schemas/${pkgs.gtk3.name}:$XDG_DATA_DIRS";
# shellHook = '' # shellHook = ''
# alias cargo='mold --run cargo' # alias cargo='mold --run cargo'
# ''; # '';
} }
// deps.cef.env
// deps.rustGPU.env // deps.rustGPU.env
) )
+2 -1
View File
@@ -1,5 +1,6 @@
{ {
pkgs, pkgs,
deps,
self, self,
system, system,
... ...
@@ -33,7 +34,7 @@ let
cp -r ${graphite}/share out/share cp -r ${graphite}/share out/share
mkdir -p out/lib/cef mkdir -p out/lib/cef
mkdir -p ./cef mkdir -p ./cef
tar -xvf ${pkgs.cef-binary.src} -C ./cef --strip-components=1 tar -xvf ${self.packages.${system}.graphite-cef.src} -C ./cef --strip-components=1
cp -r ./cef/Release/* out/lib/cef/ cp -r ./cef/Release/* out/lib/cef/
cp -r ./cef/Resources/* out/lib/cef/ cp -r ./cef/Resources/* out/lib/cef/
find "out/lib/cef/locales" -type f ! -name 'en-US*' -delete find "out/lib/cef/locales" -type f ! -name 'en-US*' -delete
+45
View File
@@ -0,0 +1,45 @@
{ pkgs, ... }:
let
versionFile = builtins.fromJSON (builtins.readFile ./version.json);
version = versionFile.version;
hash = selectSystem versionFile.hashes;
selectSystem =
attrs:
attrs.${pkgs.stdenv.hostPlatform.system}
or (throw "Unsupported system ${pkgs.stdenv.hostPlatform.system}");
src = pkgs.fetchurl {
url = "https://cef-builds.spotifycdn.com/cef_binary_${version}_${
selectSystem {
aarch64-linux = "linuxarm64";
x86_64-linux = "linux64";
}
}_minimal.tar.bz2";
hash = hash;
};
in
pkgs.cef-binary.overrideAttrs (finalAttrs: {
version = builtins.head (builtins.split "\\+" version);
inherit src;
postInstall = ''
rm -r $out/* $out/.* || true
strip ./Release/*.so*
mv ./Release/* $out/
find "./Resources/locales" -maxdepth 1 -type f ! -name 'en-US.pak' -delete
mv ./Resources/* $out/
mv ./include $out/
cat ./CREDITS.html | ${pkgs.xz}/bin/xz -9 -e -c > $out/CREDITS.html.xz
echo '${
builtins.toJSON {
type = "minimal";
name = builtins.baseNameOf finalAttrs.src.url;
sha1 = "";
}
}' > $out/archive.json
'';
})
+7
View File
@@ -0,0 +1,7 @@
{
"version": "146.0.12+g6214c8e+chromium-146.0.7680.179",
"hashes": {
"aarch64-linux": "sha256-pi3fV3O31YMHcOh+/lnk2gWI6/MaSNAiUgFhD09d7u0=",
"x86_64-linux": "sha256-b2HKaSEEXkZsnsBw9bL2JGmKWwRN5l2wu/O1DxfhAgE="
}
}
+4 -3
View File
@@ -50,7 +50,7 @@ let
pkgs.pkg-config pkgs.pkg-config
pkgs.lld pkgs.lld
]; ];
env = deps.cef.env; env.CEF_PATH = self.packages.${system}.graphite-cef;
buildPhase = buildPhase =
let let
profile = if dev then "dev" else "release"; profile = if dev then "dev" else "release";
@@ -97,10 +97,11 @@ deps.crane.lib.buildPackage (
npmConfigScript = "setup"; npmConfigScript = "setup";
makeCacheWritable = true; makeCacheWritable = true;
env = deps.cef.env // { env = {
RASTER_NODES_SHADER_PATH = self.packages.${system}.graphite-raster-nodes-shaders; RASTER_NODES_SHADER_PATH = self.packages.${system}.graphite-raster-nodes-shaders;
GRAPHITE_GIT_COMMIT_HASH = self.rev or "unknown"; GRAPHITE_GIT_COMMIT_HASH = self.rev or "unknown";
GRAPHITE_GIT_COMMIT_DATE = self.lastModified or "unknown"; GRAPHITE_GIT_COMMIT_DATE = self.lastModified or "unknown";
CEF_PATH = self.packages.${system}.graphite-cef;
}; };
postPatch = '' postPatch = ''
@@ -149,7 +150,7 @@ deps.crane.lib.buildPackage (
remove-references-to -t "${common.cargoVendorDir}" $out/bin/graphite remove-references-to -t "${common.cargoVendorDir}" $out/bin/graphite
patchelf \ patchelf \
--set-rpath "${pkgs.lib.makeLibraryPath libs}:${deps.cef.env.CEF_PATH}" \ --set-rpath "${pkgs.lib.makeLibraryPath libs}:${self.packages.${system}.graphite-cef}" \
--add-needed libGL.so \ --add-needed libGL.so \
$out/bin/graphite $out/bin/graphite
''; '';
-31
View File
@@ -1,31 +0,0 @@
{
info,
deps,
pkgs,
...
}:
let
cargoVendorDir = deps.crane.lib.vendorCargoDeps { inherit (info) src; };
common = {
pname = "third-party-licenses";
inherit (info) version src;
inherit cargoVendorDir;
nativeBuildInputs = [ pkgs.pkg-config ];
buildInputs = [ pkgs.openssl ];
strictDeps = true;
env = deps.cef.env // {
CARGO_PROFILE = "dev";
};
cargoExtraArgs = "-p third-party-licenses --features desktop";
doCheck = false;
};
in
deps.crane.lib.buildPackage (
common
// {
inherit cargoVendorDir;
cargoArtifacts = deps.crane.lib.buildDepsOnly common;
meta.mainProgram = "third-party-licenses";
}
)
Generated
+184 -70
View File
@@ -451,7 +451,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "82bad075de69e455c338955b4a7d58c0ced253185ef7703a3c6a3846e2d5ee66" checksum = "82bad075de69e455c338955b4a7d58c0ced253185ef7703a3c6a3846e2d5ee66"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"cargo_metadata", "cargo_metadata 0.21.0",
"directories", "directories",
"log", "log",
"serde", "serde",
@@ -467,6 +467,16 @@ dependencies = [
"serde", "serde",
] ]
[[package]]
name = "cargo-platform"
version = "0.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dd0061da739915fae12ea00e16397555ed4371a6bb285431aab930f61b0aa4ba"
dependencies = [
"serde",
"serde_core",
]
[[package]] [[package]]
name = "cargo-run" name = "cargo-run"
version = "0.0.0" version = "0.0.0"
@@ -497,7 +507,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5cfca2aaa699835ba88faf58a06342a314a950d2b9686165e038286c30316868" checksum = "5cfca2aaa699835ba88faf58a06342a314a950d2b9686165e038286c30316868"
dependencies = [ dependencies = [
"camino", "camino",
"cargo-platform", "cargo-platform 0.2.0",
"cargo-util-schemas", "cargo-util-schemas",
"semver", "semver",
"serde", "serde",
@@ -505,6 +515,20 @@ dependencies = [
"thiserror 2.0.18", "thiserror 2.0.18",
] ]
[[package]]
name = "cargo_metadata"
version = "0.23.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ef987d17b0a113becdd19d3d0022d04d7ef41f9efe4f3fb63ac44ba61df3ade9"
dependencies = [
"camino",
"cargo-platform 0.3.3",
"semver",
"serde",
"serde_json",
"thiserror 2.0.18",
]
[[package]] [[package]]
name = "cast" name = "cast"
version = "0.3.0" version = "0.3.0"
@@ -524,30 +548,37 @@ dependencies = [
[[package]] [[package]]
name = "cef" name = "cef"
version = "142.5.0+142.0.17" version = "146.7.0+146.0.12"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "32eab60854609591d365051497b1fb78b77b129d9e39ba69b1f71ee3f4ae9345" checksum = "d09c05112b644e85d58f9e1bf7d62bc5a21a806a92129d4ed750d8cc9479abff"
dependencies = [ dependencies = [
"anyhow",
"ash", "ash",
"cargo_metadata 0.23.1",
"cef-dll-sys", "cef-dll-sys",
"clap",
"libc", "libc",
"libloading 0.9.0", "libloading 0.9.0",
"metal", "metal",
"objc", "objc",
"objc2 0.6.3", "objc2 0.6.3",
"objc2-io-surface", "objc2-io-surface",
"plist",
"semver",
"serde",
"serde_json",
"thiserror 2.0.18", "thiserror 2.0.18",
"tracing", "tracing",
"wgpu", "wgpu",
"windows", "windows 0.62.2",
"windows-sys 0.61.2", "windows-sys 0.61.2",
] ]
[[package]] [[package]]
name = "cef-dll-sys" name = "cef-dll-sys"
version = "142.5.0+142.0.17" version = "146.7.0+146.0.12"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5a8c418c8eb6abff55f52668dbb8cba3cd5fcf057cf3eed46c04013a08ad9004" checksum = "693e287c4fe19ba5ed6f478bed66b1d367b06fbce904eeffafb8359a40dab24b"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"cmake", "cmake",
@@ -1194,8 +1225,9 @@ checksum = "75b325c5dbd37f80359721ad39aca5a29fb04c89279657cffdda8736d0c0b9d2"
[[package]] [[package]]
name = "download-cef" name = "download-cef"
version = "2.2.0" version = "2.3.1"
source = "git+https://github.com/timon-schelling/cef-rs.git?branch=graphite#8efeb241d1837447eccaee5d713a7c1ce331cd52" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d7471a7d5d3bd8df1b3b75871f0317d8a6dd73270ab861cc97ae7907ee63e554"
dependencies = [ dependencies = [
"bzip2", "bzip2",
"clap", "clap",
@@ -1349,9 +1381,9 @@ checksum = "dea2df4cf52843e0452895c455a1a2cfbb842a1e7329671acf418fdc53ed4c59"
[[package]] [[package]]
name = "euclid" name = "euclid"
version = "0.22.11" version = "0.22.14"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ad9cdb4b747e485a12abb0e6566612956c7a1bafa3bdb8d682c5b6d403589e48" checksum = "f1a05365e3b1c6d1650318537c7460c6923f1abdd272ad6842baa2b509957a06"
dependencies = [ dependencies = [
"num-traits", "num-traits",
] ]
@@ -1512,7 +1544,7 @@ dependencies = [
"read-fonts 0.35.0", "read-fonts 0.35.0",
"roxmltree 0.20.0", "roxmltree 0.20.0",
"smallvec", "smallvec",
"windows", "windows 0.58.0",
"windows-core 0.58.0", "windows-core 0.58.0",
"yeslogic-fontconfig-sys", "yeslogic-fontconfig-sys",
] ]
@@ -1790,35 +1822,18 @@ dependencies = [
"gl_generator", "gl_generator",
] ]
[[package]]
name = "gpu-alloc"
version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fbcd2dba93594b227a1f57ee09b8b9da8892c34d55aa332e034a228d0fe6a171"
dependencies = [
"bitflags 2.11.0",
"gpu-alloc-types",
]
[[package]]
name = "gpu-alloc-types"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "98ff03b468aa837d70984d55f5d3f846f6ec31fe34bbb97c4f85219caeee1ca4"
dependencies = [
"bitflags 2.11.0",
]
[[package]] [[package]]
name = "gpu-allocator" name = "gpu-allocator"
version = "0.27.0" version = "0.28.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c151a2a5ef800297b4e79efa4f4bec035c5f51d5ae587287c9b952bdf734cacd" checksum = "51255ea7cfaadb6c5f1528d43e92a82acb2b96c43365989a28b2d44ee38f8795"
dependencies = [ dependencies = [
"ash",
"hashbrown 0.16.0",
"log", "log",
"presser", "presser",
"thiserror 1.0.69", "thiserror 2.0.18",
"windows", "windows 0.62.2",
] ]
[[package]] [[package]]
@@ -2044,7 +2059,7 @@ dependencies = [
"vello", "vello",
"wgpu", "wgpu",
"window_clipboard", "window_clipboard",
"windows", "windows 0.58.0",
"winit", "winit",
] ]
@@ -2178,9 +2193,9 @@ dependencies = [
[[package]] [[package]]
name = "guillotiere" name = "guillotiere"
version = "0.6.2" version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b62d5865c036cb1393e23c50693df631d3f5d7bcca4c04fe4cc0fd592e74a782" checksum = "6b17e70c989c36bad147b27a58d148c0741c51448aa5653436547323e524d0ab"
dependencies = [ dependencies = [
"euclid", "euclid",
"svg_fmt", "svg_fmt",
@@ -2248,6 +2263,8 @@ version = "0.16.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5419bdc4f6a9207fbeba6d11b604d481addf78ecd10c11ad51e76c2f6482748d" checksum = "5419bdc4f6a9207fbeba6d11b604d481addf78ecd10c11ad51e76c2f6482748d"
dependencies = [ dependencies = [
"allocator-api2",
"equivalent",
"foldhash 0.2.0", "foldhash 0.2.0",
] ]
@@ -2561,7 +2578,7 @@ dependencies = [
"color_quant", "color_quant",
"gif", "gif",
"num-traits", "num-traits",
"png", "png 0.17.16",
"zune-core", "zune-core",
"zune-jpeg", "zune-jpeg",
] ]
@@ -3036,9 +3053,9 @@ dependencies = [
[[package]] [[package]]
name = "metal" name = "metal"
version = "0.32.0" version = "0.33.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "00c15a6f673ff72ddcc22394663290f870fb224c1bfce55734a75c414150e605" checksum = "c7047791b5bc903b8cd963014b355f71dc9864a9a0b727057676c1dcae5cbc15"
dependencies = [ dependencies = [
"bitflags 2.11.0", "bitflags 2.11.0",
"block", "block",
@@ -3089,16 +3106,16 @@ dependencies = [
"objc2-core-foundation", "objc2-core-foundation",
"objc2-foundation 0.3.2", "objc2-foundation 0.3.2",
"once_cell", "once_cell",
"png", "png 0.17.16",
"thiserror 2.0.18", "thiserror 2.0.18",
"windows-sys 0.60.2", "windows-sys 0.60.2",
] ]
[[package]] [[package]]
name = "naga" name = "naga"
version = "27.0.3" version = "28.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "066cf25f0e8b11ee0df221219010f213ad429855f57c494f995590c861a9a7d8" checksum = "618f667225063219ddfc61251087db8a9aec3c3f0950c916b614e403486f1135"
dependencies = [ dependencies = [
"arrayvec", "arrayvec",
"bit-set", "bit-set",
@@ -3902,6 +3919,19 @@ dependencies = [
"miniz_oxide", "miniz_oxide",
] ]
[[package]]
name = "png"
version = "0.18.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "60769b8b31b2a9f263dae2776c37b1b28ae246943cf719eb6946a1db05128a61"
dependencies = [
"bitflags 2.11.0",
"crc32fast",
"fdeflate",
"flate2",
"miniz_oxide",
]
[[package]] [[package]]
name = "polling" name = "polling"
version = "3.10.0" version = "3.10.0"
@@ -5088,7 +5118,7 @@ version = "0.10.0-alpha.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b721e6d7d7bc999126e838d16b070c8beada89ff8251c3f8a9e5292102827d86" checksum = "b721e6d7d7bc999126e838d16b070c8beada89ff8251c3f8a9e5292102827d86"
dependencies = [ dependencies = [
"cargo_metadata", "cargo_metadata 0.21.0",
"log", "log",
"memchr", "memchr",
"raw-string", "raw-string",
@@ -6010,14 +6040,15 @@ dependencies = [
[[package]] [[package]]
name = "vello" name = "vello"
version = "0.7.0" version = "0.8.0"
source = "git+https://github.com/Keavon/vello.git?branch=0.7.0-fix-images-rendering-blurry#9a2591c80470789eb82681203c21b7d9002bedcb" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7484a935acbced16ca6b2a7e6c8d6aa2b32ca0aff269c1b95f62be9b8f672c41"
dependencies = [ dependencies = [
"bytemuck", "bytemuck",
"futures-intrusive", "futures-intrusive",
"log", "log",
"peniko", "peniko",
"png", "png 0.18.1",
"skrifa 0.40.0", "skrifa 0.40.0",
"static_assertions", "static_assertions",
"thiserror 2.0.18", "thiserror 2.0.18",
@@ -6028,8 +6059,9 @@ dependencies = [
[[package]] [[package]]
name = "vello_encoding" name = "vello_encoding"
version = "0.7.0" version = "0.8.0"
source = "git+https://github.com/Keavon/vello.git?branch=0.7.0-fix-images-rendering-blurry#9a2591c80470789eb82681203c21b7d9002bedcb" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d53d864987821f40431e62608bf0f58342db57f2f2860628c8cfc28e16a1cc39"
dependencies = [ dependencies = [
"bytemuck", "bytemuck",
"guillotiere", "guillotiere",
@@ -6040,8 +6072,9 @@ dependencies = [
[[package]] [[package]]
name = "vello_shaders" name = "vello_shaders"
version = "0.7.0" version = "0.8.0"
source = "git+https://github.com/Keavon/vello.git?branch=0.7.0-fix-images-rendering-blurry#9a2591c80470789eb82681203c21b7d9002bedcb" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c455e04d570129212ecc4c0fdaa051ad66e5be15781a75b38c519d08120db374"
dependencies = [ dependencies = [
"bytemuck", "bytemuck",
"log", "log",
@@ -6354,12 +6387,13 @@ checksum = "a751b3277700db47d3e574514de2eced5e54dc8a5436a3bf7a0b248b2cee16f3"
[[package]] [[package]]
name = "wgpu" name = "wgpu"
version = "27.0.1" version = "28.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bfe68bac7cde125de7a731c3400723cadaaf1703795ad3f4805f187459cd7a77" checksum = "f9cb534d5ffd109c7d1135f34cdae29e60eab94855a625dcfe1705f8bc7ad79f"
dependencies = [ dependencies = [
"arrayvec", "arrayvec",
"bitflags 2.11.0", "bitflags 2.11.0",
"bytemuck",
"cfg-if", "cfg-if",
"cfg_aliases", "cfg_aliases",
"document-features", "document-features",
@@ -6383,9 +6417,9 @@ dependencies = [
[[package]] [[package]]
name = "wgpu-core" name = "wgpu-core"
version = "27.0.3" version = "28.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "27a75de515543b1897b26119f93731b385a19aea165a1ec5f0e3acecc229cae7" checksum = "d23f4642f53f666adcfd2d3218ab174d1e6681101aef18696b90cbe64d1c10f9"
dependencies = [ dependencies = [
"arrayvec", "arrayvec",
"bit-set", "bit-set",
@@ -6415,27 +6449,27 @@ dependencies = [
[[package]] [[package]]
name = "wgpu-core-deps-apple" name = "wgpu-core-deps-apple"
version = "27.0.0" version = "28.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0772ae958e9be0c729561d5e3fd9a19679bcdfb945b8b1a1969d9bfe8056d233" checksum = "87b7b696b918f337c486bf93142454080a32a37832ba8a31e4f48221890047da"
dependencies = [ dependencies = [
"wgpu-hal", "wgpu-hal",
] ]
[[package]] [[package]]
name = "wgpu-core-deps-emscripten" name = "wgpu-core-deps-emscripten"
version = "27.0.0" version = "28.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b06ac3444a95b0813ecfd81ddb2774b66220b264b3e2031152a4a29fda4da6b5" checksum = "34b251c331f84feac147de3c4aa3aa45112622a95dd7ee1b74384fa0458dbd79"
dependencies = [ dependencies = [
"wgpu-hal", "wgpu-hal",
] ]
[[package]] [[package]]
name = "wgpu-core-deps-windows-linux-android" name = "wgpu-core-deps-windows-linux-android"
version = "27.0.0" version = "28.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "71197027d61a71748e4120f05a9242b2ad142e3c01f8c1b47707945a879a03c3" checksum = "68ca976e72b2c9964eb243e281f6ce7f14a514e409920920dcda12ae40febaae"
dependencies = [ dependencies = [
"wgpu-hal", "wgpu-hal",
] ]
@@ -6461,9 +6495,9 @@ dependencies = [
[[package]] [[package]]
name = "wgpu-hal" name = "wgpu-hal"
version = "27.0.4" version = "28.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5b21cb61c57ee198bc4aff71aeadff4cbb80b927beb912506af9c780d64313ce" checksum = "44d6cb474beb218824dcc9e1ce679d973f719262789bfb27407da560cac20eeb"
dependencies = [ dependencies = [
"android_system_properties", "android_system_properties",
"arrayvec", "arrayvec",
@@ -6477,7 +6511,6 @@ dependencies = [
"core-graphics-types", "core-graphics-types",
"glow", "glow",
"glutin_wgl_sys", "glutin_wgl_sys",
"gpu-alloc",
"gpu-allocator", "gpu-allocator",
"gpu-descriptor", "gpu-descriptor",
"hashbrown 0.16.0", "hashbrown 0.16.0",
@@ -6504,21 +6537,20 @@ dependencies = [
"wasm-bindgen", "wasm-bindgen",
"web-sys", "web-sys",
"wgpu-types", "wgpu-types",
"windows", "windows 0.62.2",
"windows-core 0.58.0", "windows-core 0.62.2",
] ]
[[package]] [[package]]
name = "wgpu-types" name = "wgpu-types"
version = "27.0.1" version = "28.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "afdcf84c395990db737f2dd91628706cb31e86d72e53482320d368e52b5da5eb" checksum = "e18308757e594ed2cd27dddbb16a139c42a683819d32a2e0b1b0167552f5840c"
dependencies = [ dependencies = [
"bitflags 2.11.0", "bitflags 2.11.0",
"bytemuck", "bytemuck",
"js-sys", "js-sys",
"log", "log",
"thiserror 2.0.18",
"web-sys", "web-sys",
] ]
@@ -6577,6 +6609,27 @@ dependencies = [
"windows-targets 0.52.6", "windows-targets 0.52.6",
] ]
[[package]]
name = "windows"
version = "0.62.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "527fadee13e0c05939a6a05d5bd6eec6cd2e3dbd648b9f8e447c6518133d8580"
dependencies = [
"windows-collections",
"windows-core 0.62.2",
"windows-future",
"windows-numerics",
]
[[package]]
name = "windows-collections"
version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "23b2d95af1a8a14a3c7367e1ed4fc9c20e0a26e79551b1454d72583c97cc6610"
dependencies = [
"windows-core 0.62.2",
]
[[package]] [[package]]
name = "windows-core" name = "windows-core"
version = "0.58.0" version = "0.58.0"
@@ -6603,6 +6656,30 @@ dependencies = [
"windows-strings 0.4.2", "windows-strings 0.4.2",
] ]
[[package]]
name = "windows-core"
version = "0.62.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b8e83a14d34d0623b51dce9581199302a221863196a1dde71a7663a4c2be9deb"
dependencies = [
"windows-implement 0.60.2",
"windows-interface 0.59.3",
"windows-link 0.2.1",
"windows-result 0.4.1",
"windows-strings 0.5.1",
]
[[package]]
name = "windows-future"
version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e1d6f90251fe18a279739e78025bd6ddc52a7e22f921070ccdc67dde84c605cb"
dependencies = [
"windows-core 0.62.2",
"windows-link 0.2.1",
"windows-threading",
]
[[package]] [[package]]
name = "windows-implement" name = "windows-implement"
version = "0.58.0" version = "0.58.0"
@@ -6659,6 +6736,16 @@ version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5" checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5"
[[package]]
name = "windows-numerics"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6e2e40844ac143cdb44aead537bbf727de9b044e107a0f1220392177d15b0f26"
dependencies = [
"windows-core 0.62.2",
"windows-link 0.2.1",
]
[[package]] [[package]]
name = "windows-registry" name = "windows-registry"
version = "0.5.3" version = "0.5.3"
@@ -6688,6 +6775,15 @@ dependencies = [
"windows-link 0.1.3", "windows-link 0.1.3",
] ]
[[package]]
name = "windows-result"
version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7781fa89eaf60850ac3d2da7af8e5242a5ea78d1a11c49bf2910bb5a73853eb5"
dependencies = [
"windows-link 0.2.1",
]
[[package]] [[package]]
name = "windows-strings" name = "windows-strings"
version = "0.1.0" version = "0.1.0"
@@ -6707,6 +6803,15 @@ dependencies = [
"windows-link 0.1.3", "windows-link 0.1.3",
] ]
[[package]]
name = "windows-strings"
version = "0.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7837d08f69c77cf6b07689544538e017c1bfcf57e34b4c0ff58e6c2cd3b37091"
dependencies = [
"windows-link 0.2.1",
]
[[package]] [[package]]
name = "windows-sys" name = "windows-sys"
version = "0.45.0" version = "0.45.0"
@@ -6800,6 +6905,15 @@ dependencies = [
"windows_x86_64_msvc 0.53.0", "windows_x86_64_msvc 0.53.0",
] ]
[[package]]
name = "windows-threading"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3949bd5b99cafdf1c7ca86b43ca564028dfe27d66958f2470940f73d86d75b37"
dependencies = [
"windows-link 0.2.1",
]
[[package]] [[package]]
name = "windows_aarch64_gnullvm" name = "windows_aarch64_gnullvm"
version = "0.42.2" version = "0.42.2"
+5 -8
View File
@@ -115,7 +115,7 @@ quote = "1.0"
chrono = "0.4" chrono = "0.4"
ron = "0.12" ron = "0.12"
fastnoise-lite = "1.1" fastnoise-lite = "1.1"
wgpu = { version = "27.0", features = [ wgpu = { version = "28.0", features = [
# We don't have wgpu on multiple threads (yet) https://github.com/gfx-rs/wgpu/blob/trunk/CHANGELOG.md#wgpu-types-now-send-sync-on-wasm # We don't have wgpu on multiple threads (yet) https://github.com/gfx-rs/wgpu/blob/trunk/CHANGELOG.md#wgpu-types-now-send-sync-on-wasm
"fragile-send-sync-non-atomic-wasm", "fragile-send-sync-non-atomic-wasm",
"spirv", "spirv",
@@ -149,8 +149,8 @@ url = "2.5"
tokio = { version = "1.29", features = ["fs", "macros", "io-std", "rt", "rt-multi-thread"] } tokio = { version = "1.29", features = ["fs", "macros", "io-std", "rt", "rt-multi-thread"] }
# Linebender ecosystem (BEGIN) # Linebender ecosystem (BEGIN)
kurbo = { version = "0.13", features = ["serde"] } kurbo = { version = "0.13", features = ["serde"] }
vello = "0.7" vello = "0.8"
vello_encoding = "0.7" vello_encoding = "0.8"
resvg = "0.47" resvg = "0.47"
usvg = "0.47" usvg = "0.47"
parley = "0.6" parley = "0.6"
@@ -197,8 +197,8 @@ iai-callgrind = { version = "0.16" }
ndarray = "0.16" ndarray = "0.16"
strum = { version = "0.27", features = ["derive"] } strum = { version = "0.27", features = ["derive"] }
dirs = "6.0" dirs = "6.0"
cef = "142" cef = "146"
cef-dll-sys = "142" cef-dll-sys = "146"
include_dir = "0.7" include_dir = "0.7"
tracing-subscriber = { version = "0.3", features = ["env-filter"] } tracing-subscriber = { version = "0.3", features = ["env-filter"] }
tracing = "0.1" tracing = "0.1"
@@ -238,7 +238,4 @@ debug = true
[patch.crates-io] [patch.crates-io]
# Force cargo to use only one version of the dpi crate (vendoring breaks without this) # Force cargo to use only one version of the dpi crate (vendoring breaks without this)
dpi = { git = "https://github.com/rust-windowing/winit.git" } dpi = { git = "https://github.com/rust-windowing/winit.git" }
download-cef = { git = "https://github.com/timon-schelling/cef-rs.git", branch = "graphite" }
rfd = { git = "https://github.com/timon-schelling/rfd.git", branch = "graphite" } # TODO: Remove this once https://github.com/PolyMeilex/rfd/pull/317 is merged and released rfd = { git = "https://github.com/timon-schelling/rfd.git", branch = "graphite" } # TODO: Remove this once https://github.com/PolyMeilex/rfd/pull/317 is merged and released
vello = { git = "https://github.com/Keavon/vello.git", branch = "0.7.0-fix-images-rendering-blurry" }
vello_encoding = { git = "https://github.com/Keavon/vello.git", branch = "0.7.0-fix-images-rendering-blurry" }
+1 -1
View File
@@ -1,7 +1,7 @@
use crate::wrapper::{WgpuContext, WgpuContextBuilder, WgpuFeatures}; use crate::wrapper::{WgpuContext, WgpuContextBuilder, WgpuFeatures};
pub(super) async fn create_wgpu_context() -> WgpuContext { pub(super) async fn create_wgpu_context() -> WgpuContext {
let wgpu_context_builder = WgpuContextBuilder::new().with_features(WgpuFeatures::PUSH_CONSTANTS); let wgpu_context_builder = WgpuContextBuilder::new().with_features(WgpuFeatures::IMMEDIATES);
// TODO: add a cli flag to list adapters and exit instead of always printing // TODO: add a cli flag to list adapters and exit instead of always printing
println!("\nAvailable WGPU adapters:\n{}", wgpu_context_builder.available_adapters_fmt().await); println!("\nAvailable WGPU adapters:\n{}", wgpu_context_builder.available_adapters_fmt().await);
+8 -8
View File
@@ -26,14 +26,14 @@ fn vs_main(@builtin(vertex_index) vertex_index: u32) -> VertexOutput {
// FRAGMENT SHADER // FRAGMENT SHADER
// =============== // ===============
struct Constants { struct Immediates {
viewport_scale: vec2<f32>, viewport_scale: vec2<f32>,
viewport_offset: vec2<f32>, viewport_offset: vec2<f32>,
ui_scale: vec2<f32>, ui_scale: vec2<f32>,
background_color: vec4<f32>, background_color: vec4<f32>,
}; };
var<push_constant> constants: Constants; var<immediate> immediates: Immediates;
@group(0) @binding(0) @group(0) @binding(0)
var t_viewport: texture_2d<f32>; var t_viewport: texture_2d<f32>;
@@ -46,10 +46,10 @@ var s_diffuse: sampler;
@fragment @fragment
fn fs_main(in: VertexOutput) -> @location(0) vec4<f32> { fn fs_main(in: VertexOutput) -> @location(0) vec4<f32> {
let ui_coordinate = in.tex_coords * constants.ui_scale; let ui_coordinate = in.tex_coords * immediates.ui_scale;
if (ui_coordinate.x < 0.0 || ui_coordinate.x > 1.0 || if (ui_coordinate.x < 0.0 || ui_coordinate.x > 1.0 ||
ui_coordinate.y < 0.0 || ui_coordinate.y > 1.0) { ui_coordinate.y < 0.0 || ui_coordinate.y > 1.0) {
return srgb_to_linear(constants.background_color); return srgb_to_linear(immediates.background_color);
} }
let ui_linear = srgb_to_linear(textureSample(t_ui, s_diffuse, ui_coordinate)); let ui_linear = srgb_to_linear(textureSample(t_ui, s_diffuse, ui_coordinate));
@@ -60,19 +60,19 @@ fn fs_main(in: VertexOutput) -> @location(0) vec4<f32> {
// UI texture is premultiplied, we need to unpremultiply before blending // UI texture is premultiplied, we need to unpremultiply before blending
let ui_srgb = linear_to_srgb(unpremultiply(ui_linear)); let ui_srgb = linear_to_srgb(unpremultiply(ui_linear));
let viewport_coordinate = (in.tex_coords - constants.viewport_offset) * constants.viewport_scale; let viewport_coordinate = (in.tex_coords - immediates.viewport_offset) * immediates.viewport_scale;
if (viewport_coordinate.x < 0.0 || viewport_coordinate.x > 1.0 || if (viewport_coordinate.x < 0.0 || viewport_coordinate.x > 1.0 ||
viewport_coordinate.y < 0.0 || viewport_coordinate.y > 1.0) { viewport_coordinate.y < 0.0 || viewport_coordinate.y > 1.0) {
return srgb_to_linear(constants.background_color); return srgb_to_linear(immediates.background_color);
} }
let overlay_srgb = textureSample(t_overlays, s_diffuse, viewport_coordinate); let overlay_srgb = textureSample(t_overlays, s_diffuse, viewport_coordinate);
var viewport_srgb = textureSample(t_viewport, s_diffuse, viewport_coordinate); var viewport_srgb = textureSample(t_viewport, s_diffuse, viewport_coordinate);
if (viewport_srgb.a < 0.001) { if (viewport_srgb.a < 0.001) {
viewport_srgb = constants.background_color; viewport_srgb = immediates.background_color;
} else if (viewport_srgb.a < 0.999) { } else if (viewport_srgb.a < 0.999) {
viewport_srgb = blend(viewport_srgb, constants.background_color); viewport_srgb = blend(viewport_srgb, immediates.background_color);
} }
if (overlay_srgb.a < 0.001) { if (overlay_srgb.a < 0.001) {
+7 -10
View File
@@ -73,7 +73,7 @@ impl RenderState {
address_mode_w: wgpu::AddressMode::ClampToEdge, address_mode_w: wgpu::AddressMode::ClampToEdge,
mag_filter: wgpu::FilterMode::Linear, mag_filter: wgpu::FilterMode::Linear,
min_filter: wgpu::FilterMode::Nearest, min_filter: wgpu::FilterMode::Nearest,
mipmap_filter: wgpu::FilterMode::Nearest, mipmap_filter: wgpu::MipmapFilterMode::Nearest,
..Default::default() ..Default::default()
}); });
@@ -122,10 +122,7 @@ impl RenderState {
let render_pipeline_layout = context.device.create_pipeline_layout(&wgpu::PipelineLayoutDescriptor { let render_pipeline_layout = context.device.create_pipeline_layout(&wgpu::PipelineLayoutDescriptor {
label: Some("Render Pipeline Layout"), label: Some("Render Pipeline Layout"),
bind_group_layouts: &[&texture_bind_group_layout], bind_group_layouts: &[&texture_bind_group_layout],
push_constant_ranges: &[wgpu::PushConstantRange { immediate_size: size_of::<Immediates>() as u32,
stages: wgpu::ShaderStages::FRAGMENT,
range: 0..size_of::<Constants>() as u32,
}],
}); });
let render_pipeline = context.device.create_render_pipeline(&wgpu::RenderPipelineDescriptor { let render_pipeline = context.device.create_render_pipeline(&wgpu::RenderPipelineDescriptor {
@@ -162,7 +159,7 @@ impl RenderState {
mask: !0, mask: !0,
alpha_to_coverage_enabled: false, alpha_to_coverage_enabled: false,
}, },
multiview: None, multiview_mask: None,
cache: None, cache: None,
}); });
@@ -281,13 +278,13 @@ impl RenderState {
depth_stencil_attachment: None, depth_stencil_attachment: None,
occlusion_query_set: None, occlusion_query_set: None,
timestamp_writes: None, timestamp_writes: None,
multiview_mask: None,
}); });
render_pass.set_pipeline(&self.render_pipeline); render_pass.set_pipeline(&self.render_pipeline);
render_pass.set_push_constants( render_pass.set_immediates(
wgpu::ShaderStages::FRAGMENT,
0, 0,
bytemuck::bytes_of(&Constants { bytemuck::bytes_of(&Immediates {
viewport_scale: self.viewport_scale, viewport_scale: self.viewport_scale,
viewport_offset: self.viewport_offset, viewport_offset: self.viewport_offset,
ui_scale: ui_scale.unwrap_or([1., 1.]), ui_scale: ui_scale.unwrap_or([1., 1.]),
@@ -358,7 +355,7 @@ pub(crate) enum RenderError {
#[repr(C)] #[repr(C)]
#[derive(Copy, Clone, bytemuck::Pod, bytemuck::Zeroable)] #[derive(Copy, Clone, bytemuck::Pod, bytemuck::Zeroable)]
struct Constants { struct Immediates {
viewport_scale: [f32; 2], viewport_scale: [f32; 2],
viewport_offset: [f32; 2], viewport_offset: [f32; 2],
ui_scale: [f32; 2], ui_scale: [f32; 2],
@@ -49,7 +49,7 @@ impl ContextBuilder {
} }
pub async fn available_adapters_fmt(&self) -> impl std::fmt::Display { pub async fn available_adapters_fmt(&self) -> impl std::fmt::Display {
let instance = self.build_instance(); let instance = self.build_instance();
fmt::AvailableAdaptersFormatter(instance.enumerate_adapters(self.backends)) fmt::AvailableAdaptersFormatter(instance.enumerate_adapters(self.backends).await)
} }
} }
#[cfg(target_family = "wasm")] #[cfg(target_family = "wasm")]
@@ -102,9 +102,9 @@ impl ContextBuilder {
let instance = self.build_instance(); let instance = self.build_instance();
let selected_adapter = if let Some(select) = select { let selected_adapter = if let Some(select) = select {
self.select_adapter(&instance, select) self.select_adapter(&instance, select).await
} else if cfg!(target_os = "windows") { } else if cfg!(target_os = "windows") {
self.select_adapter(&instance, |adapters: &[Adapter]| adapters.iter().position(|a| a.get_info().backend == wgpu::Backend::Dx12)) self.select_adapter(&instance, |adapters: &[Adapter]| adapters.iter().position(|a| a.get_info().backend == wgpu::Backend::Dx12)).await
} else { } else {
None None
}; };
@@ -119,11 +119,11 @@ impl ContextBuilder {
instance: Arc::new(instance), instance: Arc::new(instance),
}) })
} }
fn select_adapter<S>(&self, instance: &Instance, select: S) -> Option<Adapter> async fn select_adapter<S>(&self, instance: &Instance, select: S) -> Option<Adapter>
where where
S: Fn(&[Adapter]) -> Option<usize>, S: Fn(&[Adapter]) -> Option<usize>,
{ {
let mut adapters = instance.enumerate_adapters(self.backends); let mut adapters = instance.enumerate_adapters(self.backends).await;
let selected_index = select(&adapters)?; let selected_index = select(&adapters)?;
if selected_index >= adapters.len() { if selected_index >= adapters.len() {
return None; return None;
@@ -39,7 +39,7 @@ impl Resampler {
let pipeline_layout = device.create_pipeline_layout(&wgpu::PipelineLayoutDescriptor { let pipeline_layout = device.create_pipeline_layout(&wgpu::PipelineLayoutDescriptor {
label: Some("resample_pipeline_layout"), label: Some("resample_pipeline_layout"),
bind_group_layouts: &[&bind_group_layout], bind_group_layouts: &[&bind_group_layout],
push_constant_ranges: &[], ..Default::default()
}); });
let pipeline = device.create_render_pipeline(&wgpu::RenderPipelineDescriptor { let pipeline = device.create_render_pipeline(&wgpu::RenderPipelineDescriptor {
@@ -67,7 +67,7 @@ impl Resampler {
}, },
depth_stencil: None, depth_stencil: None,
multisample: wgpu::MultisampleState::default(), multisample: wgpu::MultisampleState::default(),
multiview: None, multiview_mask: None,
cache: None, cache: None,
}); });
@@ -135,9 +135,7 @@ impl Resampler {
}, },
depth_slice: None, depth_slice: None,
})], })],
depth_stencil_attachment: None, ..Default::default()
timestamp_writes: None,
occlusion_query_set: None,
}); });
render_pass.set_pipeline(&self.pipeline); render_pass.set_pipeline(&self.pipeline);
@@ -117,7 +117,7 @@ impl PerPixelAdjustGraphicsPipeline {
label: Some(&format!("PerPixelAdjust {name} BindGroupLayout 0")), label: Some(&format!("PerPixelAdjust {name} BindGroupLayout 0")),
entries, entries,
})], })],
push_constant_ranges: &[], ..Default::default()
}); });
let pipeline = device.create_render_pipeline(&RenderPipelineDescriptor { let pipeline = device.create_render_pipeline(&RenderPipelineDescriptor {
@@ -140,6 +140,7 @@ impl PerPixelAdjustGraphicsPipeline {
}, },
depth_stencil: None, depth_stencil: None,
multisample: Default::default(), multisample: Default::default(),
multiview_mask: None,
fragment: Some(FragmentState { fragment: Some(FragmentState {
module: &shader_module, module: &shader_module,
entry_point: Some(&fragment_name), entry_point: Some(&fragment_name),
@@ -150,7 +151,6 @@ impl PerPixelAdjustGraphicsPipeline {
write_mask: Default::default(), write_mask: Default::default(),
})], })],
}), }),
multiview: None,
cache: None, cache: None,
}); });
Self { Self {
@@ -227,9 +227,7 @@ impl PerPixelAdjustGraphicsPipeline {
}, },
depth_slice: None, depth_slice: None,
})], })],
depth_stencil_attachment: None, ..Default::default()
timestamp_writes: None,
occlusion_query_set: None,
}); });
rp.set_pipeline(&self.pipeline); rp.set_pipeline(&self.pipeline);
rp.set_bind_group(0, Some(&bind_group), &[]); rp.set_bind_group(0, Some(&bind_group), &[]);