From 30721773c890f58fe65095a437ff12d9fa53585b Mon Sep 17 00:00:00 2001 From: Florian RICHER Date: Sat, 22 Mar 2025 21:51:21 +0100 Subject: [PATCH] First renderdoc run without wayland --- Cargo.toml | 2 +- flake.lock | 12 ++++++------ flake.nix | 40 ++++++++++++++++++++++++++-------------- rust-toolchain.toml | 2 +- src/renderer/app.rs | 5 +---- 5 files changed, 35 insertions(+), 26 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 11b5243..ba7eb9d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "rust_vulkan_test" version = "0.1.0" -edition = "2021" +edition = "2024" authors = ["Florian RICHER "] publish = false diff --git a/flake.lock b/flake.lock index 6b2b086..2853bb7 100644 --- a/flake.lock +++ b/flake.lock @@ -44,11 +44,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1741865919, - "narHash": "sha256-4thdbnP6dlbdq+qZWTsm4ffAwoS8Tiq1YResB+RP6WE=", + "lastModified": 1742546557, + "narHash": "sha256-QyhimDBaDBtMfRc7kyL28vo+HTwXRPq3hz+BgSJDotw=", "owner": "nixos", "repo": "nixpkgs", - "rev": "573c650e8a14b2faa0041645ab18aed7e60f0c9a", + "rev": "bfa9810ff7104a17555ab68ebdeafb6705f129b1", "type": "github" }, "original": { @@ -73,11 +73,11 @@ ] }, "locked": { - "lastModified": 1741919466, - "narHash": "sha256-xto0Oq+WItjDZvafo6ZVI4TZa6/2oxJHb0tkcSGVUJI=", + "lastModified": 1742524367, + "narHash": "sha256-KzTwk/5ETJavJZYV1DEWdCx05M4duFCxCpRbQSKWpng=", "owner": "oxalica", "repo": "rust-overlay", - "rev": "8b137260b776525542d47d3a4dbac753df478a42", + "rev": "70bf752d176b2ce07417e346d85486acea9040ef", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index 981454a..e1a71d6 100644 --- a/flake.nix +++ b/flake.nix @@ -31,8 +31,17 @@ cargo = rust; }); + renderdoc = pkgs.renderdoc.overrideAttrs(oldAttrs: { + cmakeFlags = oldAttrs.cmakeFlags ++ [ + (pkgs.lib.cmakeBool "ENABLE_UNSUPPORTED_EXPERIMENTAL_POSSIBLY_BROKEN_WAYLAND" true) + ]; + }); + buildInputs = with pkgs; [ vulkan-headers vulkan-loader vulkan-validation-layers renderdoc ] - ++ pkgs.lib.optionals pkgs.stdenv.hostPlatform.isLinux (with pkgs; [ libxkbcommon wayland libGL ]) + ++ pkgs.lib.optionals pkgs.stdenv.hostPlatform.isLinux (with pkgs; [ + libxkbcommon wayland libGL # Wayland + xorg.libX11 xorg.libXcursor xorg.libXi xorg.libxcb xorg.libxshmfence # Xorg + ]) ++ pkgs.lib.optionals pkgs.stdenv.hostPlatform.isDarwin (with pkgs; [ darwin.apple_sdk.frameworks.SystemConfiguration ]); nativeBuildInputs = with pkgs; [ @@ -40,22 +49,25 @@ cmake python312 ]; + + mkCustomShell = { packages ? [] }: pkgs.mkShell { + nativeBuildInputs = with pkgs; [ + renderdoc + (rust.override { extensions = [ "rust-src" "rust-analyzer" ]; }) + ] ++ nativeBuildInputs; + + buildInputs = buildInputs + ++ packages; + + LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath buildInputs; + VK_LAYER_PATH = "${pkgs.vulkan-validation-layers}/share/vulkan/explicit_layer.d:${renderdoc}/share/vulkan/implicit_layer.d"; + RUST_LOG = "info,rust_vulkan_test=trace"; + }; in { devShells = { - default = pkgs.mkShell { - nativeBuildInputs = with pkgs; [ - renderdoc - (rust.override { extensions = [ "rust-src" "rust-analyzer" ]; }) - ] ++ nativeBuildInputs; - - buildInputs = buildInputs - ++ [ pkgs.nixgl.auto.nixVulkanNvidia pkgs.nixgl.nixVulkanMesa ]; - - LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath buildInputs; - VK_LAYER_PATH = "${pkgs.vulkan-validation-layers}/share/vulkan/explicit_layer.d:${pkgs.renderdoc}/share/vulkan/implicit_layer.d"; - RUST_LOG = "info,rust_vulkan_test=trace"; - }; + default = mkCustomShell { packages = [ pkgs.nixgl.auto.nixVulkanNvidia pkgs.nixgl.nixVulkanMesa ]; }; + nixos = mkCustomShell { }; }; packages = { diff --git a/rust-toolchain.toml b/rust-toolchain.toml index c1bc0a6..00822fd 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,2 +1,2 @@ [toolchain] -channel = "1.85.0" +channel = "1.85.1" diff --git a/src/renderer/app.rs b/src/renderer/app.rs index 3287f7d..f791616 100644 --- a/src/renderer/app.rs +++ b/src/renderer/app.rs @@ -54,10 +54,7 @@ impl App { // (e.g. MoltenVK) flags: InstanceCreateFlags::ENUMERATE_PORTABILITY, enabled_extensions: required_extensions, - enabled_layers: vec![ - String::from("VK_LAYER_KHRONOS_validation"), - String::from("VK_LAYER_RENDERDOC_Capture"), - ], + enabled_layers: vec![String::from("VK_LAYER_KHRONOS_validation")], ..Default::default() }, )