This commit is contained in:
Mars 2024-10-08 23:56:24 -04:00
parent 7762cb4712
commit 9b93436efd
Signed by: pupbrained
GPG key ID: 874E22DF2F9DFCB5
2 changed files with 40 additions and 41 deletions

View file

@ -24,19 +24,14 @@
};
};
stdenv =
if pkgs.hostPlatform.isLinux
then pkgs.stdenvAdapters.useMoldLinker pkgs.llvmPackages_18.libcxxStdenv
else pkgs.llvmPackages_18.libcxxStdenv;
stdenv = with pkgs;
if hostPlatform.isLinux
then stdenvAdapters.useMoldLinker llvmPackages_18.libcxxStdenv
else llvmPackages_18.libcxxStdenv;
sources = import ./_sources/generated.nix {
inherit (pkgs) fetchFromGitHub fetchgit fetchurl dockerTools;
};
sources = import ./_sources/generated.nix {inherit (pkgs) fetchFromGitHub fetchgit fetchurl dockerTools;};
mkPkg = name:
pkgs.${name}.overrideAttrs {
inherit (sources.${name}) pname version src;
};
mkPkg = name: pkgs.${name}.overrideAttrs {inherit (sources.${name}) pname version src;};
fmt = mkPkg "fmt";
@ -51,15 +46,14 @@
vulkan-loader
vulkan-tools
];
in
with pkgs; rec {
in rec {
packages = rec {
graphics-test = stdenv.mkDerivation {
name = "graphics-test";
version = "0.1.0";
src = self;
nativeBuildInputs = [
nativeBuildInputs = with pkgs; [
meson
ninja
pkg-config
@ -84,19 +78,21 @@
default = graphics-test;
};
formatter = treefmt-nix.lib.mkWrapper pkgs {
formatter = with pkgs;
treefmt-nix.lib.mkWrapper pkgs {
projectRootFile = "flake.nix";
programs = {
alejandra.enable = true;
clang-format = {
enable = true;
package = pkgs.llvmPackages_18.clang-tools;
package = llvmPackages_18.clang-tools;
};
};
};
devShell = mkShell.override {inherit stdenv;} {
devShell = with pkgs;
mkShell.override {inherit stdenv;} {
packages =
[
alejandra

View file

@ -38,6 +38,7 @@ constexpr bool enableValidationLayers = true;
class VulkanApp {
public:
fn run() -> void {
// Create a window
initWindow();
initVulkan();
mainLoop();
@ -854,11 +855,13 @@ class VulkanApp {
};
fn main() -> i32 {
// Allows for loading functions dynamically at runtime
vk::DynamicLoader dynamicLoader;
auto vkGetInstanceProcAddr =
dynamicLoader.getProcAddress<PFN_vkGetInstanceProcAddr>("vkGetInstanceProcAddr");
VULKAN_HPP_DEFAULT_DISPATCHER.init(vkGetInstanceProcAddr);
// Create app object
VulkanApp app;
try {