diff --git a/.envrc b/.envrc index ae39e78..c4b17d7 100644 --- a/.envrc +++ b/.envrc @@ -1,2 +1 @@ -export NIXPKGS_ALLOW_UNSUPPORTED_SYSTEM=1 -use_flake . --impure +use_flake diff --git a/_sources/generated.nix b/_sources/generated.nix index f5030fa..af0fe60 100644 --- a/_sources/generated.nix +++ b/_sources/generated.nix @@ -1,6 +1,9 @@ # This file was generated by nvfetcher, please do not modify it manually. { + fetchgit, + fetchurl, fetchFromGitHub, + dockerTools, }: { fmt = { pname = "fmt"; diff --git a/flake.nix b/flake.nix index a27d398..913b99a 100644 --- a/flake.nix +++ b/flake.nix @@ -16,7 +16,11 @@ }: utils.lib.eachDefaultSystem ( system: let - pkgs = import nixpkgs {inherit system;}; + pkgs = import nixpkgs { + inherit system; + config.allowUnfree = true; + config.allowUnsupportedSystem = true; + }; stdenv = if pkgs.hostPlatform.isLinux @@ -81,7 +85,6 @@ projectRootFile = "flake.nix"; programs = { alejandra.enable = true; - deadnix.enable = true; clang-format = { enable = true; @@ -115,7 +118,11 @@ VK_ICD_FILENAMES = if stdenv.isDarwin then "${darwin.moltenvk}/share/vulkan/icd.d/MoltenVK_icd.json" - else ""; + else let + vulkanDir = "${mesa.drivers}/share/vulkan/icd.d"; + vulkanFiles = builtins.filter (file: builtins.match ".*\\.json$" file != null) (builtins.attrNames (builtins.readDir vulkanDir)); + vulkanPaths = lib.concatStringsSep ":" (map (file: "${vulkanDir}/${file}") vulkanFiles); + in "${linuxPackages_latest.nvidia_x11}/share/vulkan/icd.d/nvidia_icd.x86_64.json:${vulkanPaths}"; shellHook = '' export PATH="${llvmPackages_18.clang-tools.override {enableLibcxx = true;}}/bin:$PATH" diff --git a/src/main.cpp b/src/main.cpp index 192071a..22d44f7 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -155,7 +155,7 @@ class VulkanApp { for (const auto& device : devices) { #ifndef NDEBUG vk::PhysicalDeviceProperties properties = device.getProperties(); - fmt::println("Device: {}", properties.deviceName.data()); + fmt::println("\t{}", properties.deviceName.data()); #endif if (isDeviceSuitable(device)) { @@ -186,6 +186,7 @@ class VulkanApp { vk::PhysicalDeviceFeatures deviceFeatures; +#ifdef __APPLE__ // Add the portability subset extension std::vector deviceExtensions = { "VK_KHR_portability_subset" }; @@ -194,6 +195,13 @@ class VulkanApp { .enabledExtensionCount = static_cast(deviceExtensions.size()), .ppEnabledExtensionNames = deviceExtensions.data(), .pEnabledFeatures = &deviceFeatures }; +#else + vk::DeviceCreateInfo createInfo { .queueCreateInfoCount = static_cast(queueCreateInfos.size()), + .pQueueCreateInfos = queueCreateInfos.data(), + .enabledExtensionCount = 0, + .ppEnabledExtensionNames = nullptr, + .pEnabledFeatures = &deviceFeatures }; +#endif mDevice = mPhysicalDevice.createDeviceUnique(createInfo);