forked from pupbrained/vulkan-test
weh
This commit is contained in:
parent
134b43c1d4
commit
658595e0c5
3
.envrc
3
.envrc
|
@ -1,2 +1 @@
|
||||||
export NIXPKGS_ALLOW_UNSUPPORTED_SYSTEM=1
|
use_flake
|
||||||
use_flake . --impure
|
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
# This file was generated by nvfetcher, please do not modify it manually.
|
# This file was generated by nvfetcher, please do not modify it manually.
|
||||||
{
|
{
|
||||||
|
fetchgit,
|
||||||
|
fetchurl,
|
||||||
fetchFromGitHub,
|
fetchFromGitHub,
|
||||||
|
dockerTools,
|
||||||
}: {
|
}: {
|
||||||
fmt = {
|
fmt = {
|
||||||
pname = "fmt";
|
pname = "fmt";
|
||||||
|
|
13
flake.nix
13
flake.nix
|
@ -16,7 +16,11 @@
|
||||||
}:
|
}:
|
||||||
utils.lib.eachDefaultSystem (
|
utils.lib.eachDefaultSystem (
|
||||||
system: let
|
system: let
|
||||||
pkgs = import nixpkgs {inherit system;};
|
pkgs = import nixpkgs {
|
||||||
|
inherit system;
|
||||||
|
config.allowUnfree = true;
|
||||||
|
config.allowUnsupportedSystem = true;
|
||||||
|
};
|
||||||
|
|
||||||
stdenv =
|
stdenv =
|
||||||
if pkgs.hostPlatform.isLinux
|
if pkgs.hostPlatform.isLinux
|
||||||
|
@ -81,7 +85,6 @@
|
||||||
projectRootFile = "flake.nix";
|
projectRootFile = "flake.nix";
|
||||||
programs = {
|
programs = {
|
||||||
alejandra.enable = true;
|
alejandra.enable = true;
|
||||||
deadnix.enable = true;
|
|
||||||
|
|
||||||
clang-format = {
|
clang-format = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
@ -115,7 +118,11 @@
|
||||||
VK_ICD_FILENAMES =
|
VK_ICD_FILENAMES =
|
||||||
if stdenv.isDarwin
|
if stdenv.isDarwin
|
||||||
then "${darwin.moltenvk}/share/vulkan/icd.d/MoltenVK_icd.json"
|
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 = ''
|
shellHook = ''
|
||||||
export PATH="${llvmPackages_18.clang-tools.override {enableLibcxx = true;}}/bin:$PATH"
|
export PATH="${llvmPackages_18.clang-tools.override {enableLibcxx = true;}}/bin:$PATH"
|
||||||
|
|
10
src/main.cpp
10
src/main.cpp
|
@ -155,7 +155,7 @@ class VulkanApp {
|
||||||
for (const auto& device : devices) {
|
for (const auto& device : devices) {
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
vk::PhysicalDeviceProperties properties = device.getProperties();
|
vk::PhysicalDeviceProperties properties = device.getProperties();
|
||||||
fmt::println("Device: {}", properties.deviceName.data());
|
fmt::println("\t{}", properties.deviceName.data());
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (isDeviceSuitable(device)) {
|
if (isDeviceSuitable(device)) {
|
||||||
|
@ -186,6 +186,7 @@ class VulkanApp {
|
||||||
|
|
||||||
vk::PhysicalDeviceFeatures deviceFeatures;
|
vk::PhysicalDeviceFeatures deviceFeatures;
|
||||||
|
|
||||||
|
#ifdef __APPLE__
|
||||||
// Add the portability subset extension
|
// Add the portability subset extension
|
||||||
std::vector<const char*> deviceExtensions = { "VK_KHR_portability_subset" };
|
std::vector<const char*> deviceExtensions = { "VK_KHR_portability_subset" };
|
||||||
|
|
||||||
|
@ -194,6 +195,13 @@ class VulkanApp {
|
||||||
.enabledExtensionCount = static_cast<u32>(deviceExtensions.size()),
|
.enabledExtensionCount = static_cast<u32>(deviceExtensions.size()),
|
||||||
.ppEnabledExtensionNames = deviceExtensions.data(),
|
.ppEnabledExtensionNames = deviceExtensions.data(),
|
||||||
.pEnabledFeatures = &deviceFeatures };
|
.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);
|
mDevice = mPhysicalDevice.createDeviceUnique(createInfo);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue