This commit is contained in:
Mars 2024-09-30 19:49:44 -04:00
parent 134b43c1d4
commit 658595e0c5
Signed by: pupbrained
GPG key ID: 0FF5B8826803F895
4 changed files with 23 additions and 6 deletions

3
.envrc
View file

@ -1,2 +1 @@
export NIXPKGS_ALLOW_UNSUPPORTED_SYSTEM=1
use_flake . --impure
use_flake

View file

@ -1,6 +1,9 @@
# This file was generated by nvfetcher, please do not modify it manually.
{
fetchgit,
fetchurl,
fetchFromGitHub,
dockerTools,
}: {
fmt = {
pname = "fmt";

View file

@ -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"

View file

@ -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<const char*> deviceExtensions = { "VK_KHR_portability_subset" };
@ -194,6 +195,13 @@ class VulkanApp {
.enabledExtensionCount = static_cast<u32>(deviceExtensions.size()),
.ppEnabledExtensionNames = deviceExtensions.data(),
.pEnabledFeatures = &deviceFeatures };
#else
vk::DeviceCreateInfo createInfo { .queueCreateInfoCount = static_cast<u32>(queueCreateInfos.size()),
.pQueueCreateInfos = queueCreateInfos.data(),
.enabledExtensionCount = 0,
.ppEnabledExtensionNames = nullptr,
.pEnabledFeatures = &deviceFeatures };
#endif
mDevice = mPhysicalDevice.createDeviceUnique(createInfo);