diff --git a/flake.nix b/flake.nix index 1b38c42..981454a 100644 --- a/flake.nix +++ b/flake.nix @@ -31,7 +31,7 @@ cargo = rust; }); - buildInputs = with pkgs; [ vulkan-headers vulkan-loader vulkan-validation-layers ] + 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.isDarwin (with pkgs; [ darwin.apple_sdk.frameworks.SystemConfiguration ]); @@ -45,6 +45,7 @@ devShells = { default = pkgs.mkShell { nativeBuildInputs = with pkgs; [ + renderdoc (rust.override { extensions = [ "rust-src" "rust-analyzer" ]; }) ] ++ nativeBuildInputs; @@ -52,7 +53,7 @@ ++ [ 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"; + 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"; }; }; diff --git a/src/renderer/app.rs b/src/renderer/app.rs index 0c562fd..3287f7d 100644 --- a/src/renderer/app.rs +++ b/src/renderer/app.rs @@ -41,6 +41,10 @@ impl App { pub fn new(event_loop: &EventLoop<()>) -> Self { let library = VulkanLibrary::new().unwrap(); + for layer in library.layer_properties().unwrap() { + log::debug!("Available layer: {}", layer.name()); + } + let required_extensions = Surface::required_extensions(event_loop).unwrap(); let instance = Instance::new( @@ -52,6 +56,7 @@ impl App { enabled_extensions: required_extensions, enabled_layers: vec![ String::from("VK_LAYER_KHRONOS_validation"), + String::from("VK_LAYER_RENDERDOC_Capture"), ], ..Default::default() }, @@ -90,7 +95,7 @@ impl App { }) .expect("no suitable physical device found"); - println!( + log::debug!( "Using device: {} (type: {:?})", physical_device.properties().device_name, physical_device.properties().device_type, @@ -100,6 +105,8 @@ impl App { device_extensions.khr_dynamic_rendering = true; } + log::debug!("Using device extensions: {:#?}", device_extensions); + let (device, mut queues) = Device::new( physical_device, DeviceCreateInfo {