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

View File

@@ -31,7 +31,6 @@ let
deps = {
crane = lib.call ./deps/crane.nix;
cef = lib.call ./deps/cef.nix;
rustGPU = lib.call ./deps/rust-gpu.nix;
};
@@ -62,13 +61,13 @@ in
graphite-bundle = (lib.call ./pkgs/graphite-bundle.nix) { };
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-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;
tools = {
third-party-licenses = lib.call ./pkgs/tools/third-party-licenses.nix;
};
graphite-cef = lib.call ./pkgs/graphite-cef/package.nix;
}
);

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;
}

View File

@@ -1,4 +1,10 @@
{ pkgs, deps, ... }:
{
pkgs,
deps,
self,
system,
...
}:
let
libs = [
@@ -51,13 +57,13 @@ pkgs.mkShell (
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";
# shellHook = ''
# alias cargo='mold --run cargo'
# '';
# shellHook = ''
# alias cargo='mold --run cargo'
# '';
}
// deps.cef.env
// deps.rustGPU.env
)

View File

@@ -1,5 +1,6 @@
{
pkgs,
deps,
self,
system,
...
@@ -33,7 +34,7 @@ let
cp -r ${graphite}/share out/share
mkdir -p out/lib/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/Resources/* out/lib/cef/
find "out/lib/cef/locales" -type f ! -name 'en-US*' -delete

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
'';
})

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="
}
}

View File

@@ -50,7 +50,7 @@ let
pkgs.pkg-config
pkgs.lld
];
env = deps.cef.env;
env.CEF_PATH = self.packages.${system}.graphite-cef;
buildPhase =
let
profile = if dev then "dev" else "release";
@@ -97,10 +97,11 @@ deps.crane.lib.buildPackage (
npmConfigScript = "setup";
makeCacheWritable = true;
env = deps.cef.env // {
env = {
RASTER_NODES_SHADER_PATH = self.packages.${system}.graphite-raster-nodes-shaders;
GRAPHITE_GIT_COMMIT_HASH = self.rev or "unknown";
GRAPHITE_GIT_COMMIT_DATE = self.lastModified or "unknown";
CEF_PATH = self.packages.${system}.graphite-cef;
};
postPatch = ''
@@ -149,7 +150,7 @@ deps.crane.lib.buildPackage (
remove-references-to -t "${common.cargoVendorDir}" $out/bin/graphite
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 \
$out/bin/graphite
'';

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";
}
)

254
Cargo.lock generated
View File

@@ -451,7 +451,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "82bad075de69e455c338955b4a7d58c0ced253185ef7703a3c6a3846e2d5ee66"
dependencies = [
"anyhow",
"cargo_metadata",
"cargo_metadata 0.21.0",
"directories",
"log",
"serde",
@@ -467,6 +467,16 @@ dependencies = [
"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]]
name = "cargo-run"
version = "0.0.0"
@@ -497,7 +507,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5cfca2aaa699835ba88faf58a06342a314a950d2b9686165e038286c30316868"
dependencies = [
"camino",
"cargo-platform",
"cargo-platform 0.2.0",
"cargo-util-schemas",
"semver",
"serde",
@@ -505,6 +515,20 @@ dependencies = [
"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]]
name = "cast"
version = "0.3.0"
@@ -524,30 +548,37 @@ dependencies = [
[[package]]
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"
checksum = "32eab60854609591d365051497b1fb78b77b129d9e39ba69b1f71ee3f4ae9345"
checksum = "d09c05112b644e85d58f9e1bf7d62bc5a21a806a92129d4ed750d8cc9479abff"
dependencies = [
"anyhow",
"ash",
"cargo_metadata 0.23.1",
"cef-dll-sys",
"clap",
"libc",
"libloading 0.9.0",
"metal",
"objc",
"objc2 0.6.3",
"objc2-io-surface",
"plist",
"semver",
"serde",
"serde_json",
"thiserror 2.0.18",
"tracing",
"wgpu",
"windows",
"windows 0.62.2",
"windows-sys 0.61.2",
]
[[package]]
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"
checksum = "5a8c418c8eb6abff55f52668dbb8cba3cd5fcf057cf3eed46c04013a08ad9004"
checksum = "693e287c4fe19ba5ed6f478bed66b1d367b06fbce904eeffafb8359a40dab24b"
dependencies = [
"anyhow",
"cmake",
@@ -1194,8 +1225,9 @@ checksum = "75b325c5dbd37f80359721ad39aca5a29fb04c89279657cffdda8736d0c0b9d2"
[[package]]
name = "download-cef"
version = "2.2.0"
source = "git+https://github.com/timon-schelling/cef-rs.git?branch=graphite#8efeb241d1837447eccaee5d713a7c1ce331cd52"
version = "2.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d7471a7d5d3bd8df1b3b75871f0317d8a6dd73270ab861cc97ae7907ee63e554"
dependencies = [
"bzip2",
"clap",
@@ -1349,9 +1381,9 @@ checksum = "dea2df4cf52843e0452895c455a1a2cfbb842a1e7329671acf418fdc53ed4c59"
[[package]]
name = "euclid"
version = "0.22.11"
version = "0.22.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ad9cdb4b747e485a12abb0e6566612956c7a1bafa3bdb8d682c5b6d403589e48"
checksum = "f1a05365e3b1c6d1650318537c7460c6923f1abdd272ad6842baa2b509957a06"
dependencies = [
"num-traits",
]
@@ -1512,7 +1544,7 @@ dependencies = [
"read-fonts 0.35.0",
"roxmltree 0.20.0",
"smallvec",
"windows",
"windows 0.58.0",
"windows-core 0.58.0",
"yeslogic-fontconfig-sys",
]
@@ -1790,35 +1822,18 @@ dependencies = [
"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]]
name = "gpu-allocator"
version = "0.27.0"
version = "0.28.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c151a2a5ef800297b4e79efa4f4bec035c5f51d5ae587287c9b952bdf734cacd"
checksum = "51255ea7cfaadb6c5f1528d43e92a82acb2b96c43365989a28b2d44ee38f8795"
dependencies = [
"ash",
"hashbrown 0.16.0",
"log",
"presser",
"thiserror 1.0.69",
"windows",
"thiserror 2.0.18",
"windows 0.62.2",
]
[[package]]
@@ -2044,7 +2059,7 @@ dependencies = [
"vello",
"wgpu",
"window_clipboard",
"windows",
"windows 0.58.0",
"winit",
]
@@ -2178,9 +2193,9 @@ dependencies = [
[[package]]
name = "guillotiere"
version = "0.6.2"
version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b62d5865c036cb1393e23c50693df631d3f5d7bcca4c04fe4cc0fd592e74a782"
checksum = "6b17e70c989c36bad147b27a58d148c0741c51448aa5653436547323e524d0ab"
dependencies = [
"euclid",
"svg_fmt",
@@ -2248,6 +2263,8 @@ version = "0.16.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5419bdc4f6a9207fbeba6d11b604d481addf78ecd10c11ad51e76c2f6482748d"
dependencies = [
"allocator-api2",
"equivalent",
"foldhash 0.2.0",
]
@@ -2561,7 +2578,7 @@ dependencies = [
"color_quant",
"gif",
"num-traits",
"png",
"png 0.17.16",
"zune-core",
"zune-jpeg",
]
@@ -3036,9 +3053,9 @@ dependencies = [
[[package]]
name = "metal"
version = "0.32.0"
version = "0.33.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "00c15a6f673ff72ddcc22394663290f870fb224c1bfce55734a75c414150e605"
checksum = "c7047791b5bc903b8cd963014b355f71dc9864a9a0b727057676c1dcae5cbc15"
dependencies = [
"bitflags 2.11.0",
"block",
@@ -3089,16 +3106,16 @@ dependencies = [
"objc2-core-foundation",
"objc2-foundation 0.3.2",
"once_cell",
"png",
"png 0.17.16",
"thiserror 2.0.18",
"windows-sys 0.60.2",
]
[[package]]
name = "naga"
version = "27.0.3"
version = "28.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "066cf25f0e8b11ee0df221219010f213ad429855f57c494f995590c861a9a7d8"
checksum = "618f667225063219ddfc61251087db8a9aec3c3f0950c916b614e403486f1135"
dependencies = [
"arrayvec",
"bit-set",
@@ -3902,6 +3919,19 @@ dependencies = [
"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]]
name = "polling"
version = "3.10.0"
@@ -5088,7 +5118,7 @@ version = "0.10.0-alpha.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b721e6d7d7bc999126e838d16b070c8beada89ff8251c3f8a9e5292102827d86"
dependencies = [
"cargo_metadata",
"cargo_metadata 0.21.0",
"log",
"memchr",
"raw-string",
@@ -6010,14 +6040,15 @@ dependencies = [
[[package]]
name = "vello"
version = "0.7.0"
source = "git+https://github.com/Keavon/vello.git?branch=0.7.0-fix-images-rendering-blurry#9a2591c80470789eb82681203c21b7d9002bedcb"
version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7484a935acbced16ca6b2a7e6c8d6aa2b32ca0aff269c1b95f62be9b8f672c41"
dependencies = [
"bytemuck",
"futures-intrusive",
"log",
"peniko",
"png",
"png 0.18.1",
"skrifa 0.40.0",
"static_assertions",
"thiserror 2.0.18",
@@ -6028,8 +6059,9 @@ dependencies = [
[[package]]
name = "vello_encoding"
version = "0.7.0"
source = "git+https://github.com/Keavon/vello.git?branch=0.7.0-fix-images-rendering-blurry#9a2591c80470789eb82681203c21b7d9002bedcb"
version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d53d864987821f40431e62608bf0f58342db57f2f2860628c8cfc28e16a1cc39"
dependencies = [
"bytemuck",
"guillotiere",
@@ -6040,8 +6072,9 @@ dependencies = [
[[package]]
name = "vello_shaders"
version = "0.7.0"
source = "git+https://github.com/Keavon/vello.git?branch=0.7.0-fix-images-rendering-blurry#9a2591c80470789eb82681203c21b7d9002bedcb"
version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c455e04d570129212ecc4c0fdaa051ad66e5be15781a75b38c519d08120db374"
dependencies = [
"bytemuck",
"log",
@@ -6354,12 +6387,13 @@ checksum = "a751b3277700db47d3e574514de2eced5e54dc8a5436a3bf7a0b248b2cee16f3"
[[package]]
name = "wgpu"
version = "27.0.1"
version = "28.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bfe68bac7cde125de7a731c3400723cadaaf1703795ad3f4805f187459cd7a77"
checksum = "f9cb534d5ffd109c7d1135f34cdae29e60eab94855a625dcfe1705f8bc7ad79f"
dependencies = [
"arrayvec",
"bitflags 2.11.0",
"bytemuck",
"cfg-if",
"cfg_aliases",
"document-features",
@@ -6383,9 +6417,9 @@ dependencies = [
[[package]]
name = "wgpu-core"
version = "27.0.3"
version = "28.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "27a75de515543b1897b26119f93731b385a19aea165a1ec5f0e3acecc229cae7"
checksum = "d23f4642f53f666adcfd2d3218ab174d1e6681101aef18696b90cbe64d1c10f9"
dependencies = [
"arrayvec",
"bit-set",
@@ -6415,27 +6449,27 @@ dependencies = [
[[package]]
name = "wgpu-core-deps-apple"
version = "27.0.0"
version = "28.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0772ae958e9be0c729561d5e3fd9a19679bcdfb945b8b1a1969d9bfe8056d233"
checksum = "87b7b696b918f337c486bf93142454080a32a37832ba8a31e4f48221890047da"
dependencies = [
"wgpu-hal",
]
[[package]]
name = "wgpu-core-deps-emscripten"
version = "27.0.0"
version = "28.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b06ac3444a95b0813ecfd81ddb2774b66220b264b3e2031152a4a29fda4da6b5"
checksum = "34b251c331f84feac147de3c4aa3aa45112622a95dd7ee1b74384fa0458dbd79"
dependencies = [
"wgpu-hal",
]
[[package]]
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"
checksum = "71197027d61a71748e4120f05a9242b2ad142e3c01f8c1b47707945a879a03c3"
checksum = "68ca976e72b2c9964eb243e281f6ce7f14a514e409920920dcda12ae40febaae"
dependencies = [
"wgpu-hal",
]
@@ -6461,9 +6495,9 @@ dependencies = [
[[package]]
name = "wgpu-hal"
version = "27.0.4"
version = "28.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5b21cb61c57ee198bc4aff71aeadff4cbb80b927beb912506af9c780d64313ce"
checksum = "44d6cb474beb218824dcc9e1ce679d973f719262789bfb27407da560cac20eeb"
dependencies = [
"android_system_properties",
"arrayvec",
@@ -6477,7 +6511,6 @@ dependencies = [
"core-graphics-types",
"glow",
"glutin_wgl_sys",
"gpu-alloc",
"gpu-allocator",
"gpu-descriptor",
"hashbrown 0.16.0",
@@ -6504,21 +6537,20 @@ dependencies = [
"wasm-bindgen",
"web-sys",
"wgpu-types",
"windows",
"windows-core 0.58.0",
"windows 0.62.2",
"windows-core 0.62.2",
]
[[package]]
name = "wgpu-types"
version = "27.0.1"
version = "28.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "afdcf84c395990db737f2dd91628706cb31e86d72e53482320d368e52b5da5eb"
checksum = "e18308757e594ed2cd27dddbb16a139c42a683819d32a2e0b1b0167552f5840c"
dependencies = [
"bitflags 2.11.0",
"bytemuck",
"js-sys",
"log",
"thiserror 2.0.18",
"web-sys",
]
@@ -6577,6 +6609,27 @@ dependencies = [
"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]]
name = "windows-core"
version = "0.58.0"
@@ -6603,6 +6656,30 @@ dependencies = [
"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]]
name = "windows-implement"
version = "0.58.0"
@@ -6659,6 +6736,16 @@ version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
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]]
name = "windows-registry"
version = "0.5.3"
@@ -6688,6 +6775,15 @@ dependencies = [
"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]]
name = "windows-strings"
version = "0.1.0"
@@ -6707,6 +6803,15 @@ dependencies = [
"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]]
name = "windows-sys"
version = "0.45.0"
@@ -6800,6 +6905,15 @@ dependencies = [
"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]]
name = "windows_aarch64_gnullvm"
version = "0.42.2"

View File

@@ -115,7 +115,7 @@ quote = "1.0"
chrono = "0.4"
ron = "0.12"
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
"fragile-send-sync-non-atomic-wasm",
"spirv",
@@ -149,8 +149,8 @@ url = "2.5"
tokio = { version = "1.29", features = ["fs", "macros", "io-std", "rt", "rt-multi-thread"] }
# Linebender ecosystem (BEGIN)
kurbo = { version = "0.13", features = ["serde"] }
vello = "0.7"
vello_encoding = "0.7"
vello = "0.8"
vello_encoding = "0.8"
resvg = "0.47"
usvg = "0.47"
parley = "0.6"
@@ -197,8 +197,8 @@ iai-callgrind = { version = "0.16" }
ndarray = "0.16"
strum = { version = "0.27", features = ["derive"] }
dirs = "6.0"
cef = "142"
cef-dll-sys = "142"
cef = "146"
cef-dll-sys = "146"
include_dir = "0.7"
tracing-subscriber = { version = "0.3", features = ["env-filter"] }
tracing = "0.1"
@@ -238,7 +238,4 @@ debug = true
[patch.crates-io]
# Force cargo to use only one version of the dpi crate (vendoring breaks without this)
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
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" }

View File

@@ -1,7 +1,7 @@
use crate::wrapper::{WgpuContext, WgpuContextBuilder, WgpuFeatures};
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
println!("\nAvailable WGPU adapters:\n{}", wgpu_context_builder.available_adapters_fmt().await);

View File

@@ -26,14 +26,14 @@ fn vs_main(@builtin(vertex_index) vertex_index: u32) -> VertexOutput {
// FRAGMENT SHADER
// ===============
struct Constants {
struct Immediates {
viewport_scale: vec2<f32>,
viewport_offset: vec2<f32>,
ui_scale: vec2<f32>,
background_color: vec4<f32>,
};
var<push_constant> constants: Constants;
var<immediate> immediates: Immediates;
@group(0) @binding(0)
var t_viewport: texture_2d<f32>;
@@ -46,10 +46,10 @@ var s_diffuse: sampler;
@fragment
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 ||
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));
@@ -60,19 +60,19 @@ fn fs_main(in: VertexOutput) -> @location(0) vec4<f32> {
// UI texture is premultiplied, we need to unpremultiply before blending
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 ||
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);
var viewport_srgb = textureSample(t_viewport, s_diffuse, viewport_coordinate);
if (viewport_srgb.a < 0.001) {
viewport_srgb = constants.background_color;
viewport_srgb = immediates.background_color;
} 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) {

View File

@@ -73,7 +73,7 @@ impl RenderState {
address_mode_w: wgpu::AddressMode::ClampToEdge,
mag_filter: wgpu::FilterMode::Linear,
min_filter: wgpu::FilterMode::Nearest,
mipmap_filter: wgpu::FilterMode::Nearest,
mipmap_filter: wgpu::MipmapFilterMode::Nearest,
..Default::default()
});
@@ -122,10 +122,7 @@ impl RenderState {
let render_pipeline_layout = context.device.create_pipeline_layout(&wgpu::PipelineLayoutDescriptor {
label: Some("Render Pipeline Layout"),
bind_group_layouts: &[&texture_bind_group_layout],
push_constant_ranges: &[wgpu::PushConstantRange {
stages: wgpu::ShaderStages::FRAGMENT,
range: 0..size_of::<Constants>() as u32,
}],
immediate_size: size_of::<Immediates>() as u32,
});
let render_pipeline = context.device.create_render_pipeline(&wgpu::RenderPipelineDescriptor {
@@ -162,7 +159,7 @@ impl RenderState {
mask: !0,
alpha_to_coverage_enabled: false,
},
multiview: None,
multiview_mask: None,
cache: None,
});
@@ -281,13 +278,13 @@ impl RenderState {
depth_stencil_attachment: None,
occlusion_query_set: None,
timestamp_writes: None,
multiview_mask: None,
});
render_pass.set_pipeline(&self.render_pipeline);
render_pass.set_push_constants(
wgpu::ShaderStages::FRAGMENT,
render_pass.set_immediates(
0,
bytemuck::bytes_of(&Constants {
bytemuck::bytes_of(&Immediates {
viewport_scale: self.viewport_scale,
viewport_offset: self.viewport_offset,
ui_scale: ui_scale.unwrap_or([1., 1.]),
@@ -358,7 +355,7 @@ pub(crate) enum RenderError {
#[repr(C)]
#[derive(Copy, Clone, bytemuck::Pod, bytemuck::Zeroable)]
struct Constants {
struct Immediates {
viewport_scale: [f32; 2],
viewport_offset: [f32; 2],
ui_scale: [f32; 2],

View File

@@ -49,7 +49,7 @@ impl ContextBuilder {
}
pub async fn available_adapters_fmt(&self) -> impl std::fmt::Display {
let instance = self.build_instance();
fmt::AvailableAdaptersFormatter(instance.enumerate_adapters(self.backends))
fmt::AvailableAdaptersFormatter(instance.enumerate_adapters(self.backends).await)
}
}
#[cfg(target_family = "wasm")]
@@ -102,9 +102,9 @@ impl ContextBuilder {
let instance = self.build_instance();
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") {
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 {
None
};
@@ -119,11 +119,11 @@ impl ContextBuilder {
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
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)?;
if selected_index >= adapters.len() {
return None;

View File

@@ -39,7 +39,7 @@ impl Resampler {
let pipeline_layout = device.create_pipeline_layout(&wgpu::PipelineLayoutDescriptor {
label: Some("resample_pipeline_layout"),
bind_group_layouts: &[&bind_group_layout],
push_constant_ranges: &[],
..Default::default()
});
let pipeline = device.create_render_pipeline(&wgpu::RenderPipelineDescriptor {
@@ -67,7 +67,7 @@ impl Resampler {
},
depth_stencil: None,
multisample: wgpu::MultisampleState::default(),
multiview: None,
multiview_mask: None,
cache: None,
});
@@ -135,9 +135,7 @@ impl Resampler {
},
depth_slice: None,
})],
depth_stencil_attachment: None,
timestamp_writes: None,
occlusion_query_set: None,
..Default::default()
});
render_pass.set_pipeline(&self.pipeline);

View File

@@ -117,7 +117,7 @@ impl PerPixelAdjustGraphicsPipeline {
label: Some(&format!("PerPixelAdjust {name} BindGroupLayout 0")),
entries,
})],
push_constant_ranges: &[],
..Default::default()
});
let pipeline = device.create_render_pipeline(&RenderPipelineDescriptor {
@@ -140,6 +140,7 @@ impl PerPixelAdjustGraphicsPipeline {
},
depth_stencil: None,
multisample: Default::default(),
multiview_mask: None,
fragment: Some(FragmentState {
module: &shader_module,
entry_point: Some(&fragment_name),
@@ -150,7 +151,6 @@ impl PerPixelAdjustGraphicsPipeline {
write_mask: Default::default(),
})],
}),
multiview: None,
cache: None,
});
Self {
@@ -227,9 +227,7 @@ impl PerPixelAdjustGraphicsPipeline {
},
depth_slice: None,
})],
depth_stencil_attachment: None,
timestamp_writes: None,
occlusion_query_set: None,
..Default::default()
});
rp.set_pipeline(&self.pipeline);
rp.set_bind_group(0, Some(&bind_group), &[]);