Compare commits

..

No commits in common. "no-unique" and "main" have entirely different histories.

15 changed files with 2097 additions and 5774 deletions

View file

@ -1,3 +1,4 @@
# noinspection SpellCheckingInspection
Checks: >
*,
-ctad-maybe-unsupported,

4
.clangd Normal file
View file

@ -0,0 +1,4 @@
Diagnostics:
Suppress: >
-Wmissing-template-arg-list-after-template-kw,
-Wctad-maybe-unsupported

4
.envrc
View file

@ -1,2 +1,2 @@
PATH_add ./src/shaders
use_flake
export NIXPKGS_ALLOW_UNSUPPORTED_SYSTEM=1
use_flake . --impure

View file

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

View file

@ -2,11 +2,11 @@
"nodes": {
"nixpkgs": {
"locked": {
"lastModified": 1728001300,
"narHash": "sha256-W7PYJ6s+A91V1WZOTef8y3t1BGQKCfcLtHjOKcP5ScA=",
"lastModified": 1727065772,
"narHash": "sha256-U9baiEXL2YsS67QKlBAPIUq+OB+eUPKv8n1vGNdhiec=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "e00cc9f2fa7eaac3232e0de9b0b86dfd58b1f43c",
"rev": "989dc4cbf6a95f2e5fefc8cd61d2198a8fb6834a",
"type": "github"
},
"original": {
@ -17,11 +17,11 @@
},
"nixpkgs_2": {
"locked": {
"lastModified": 1726871744,
"narHash": "sha256-V5LpfdHyQkUF7RfOaDPrZDP+oqz88lTJrMT1+stXNwo=",
"lastModified": 1726481836,
"narHash": "sha256-MWTBH4dd5zIz2iatDb8IkqSjIeFum9jAqkFxgHLdzO4=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "a1d92660c6b3b7c26fb883500a80ea9d33321be2",
"rev": "20f9370d5f588fb8c72e844c54511cab054b5f40",
"type": "github"
},
"original": {
@ -58,11 +58,11 @@
"nixpkgs": "nixpkgs_2"
},
"locked": {
"lastModified": 1727984844,
"narHash": "sha256-xpRqITAoD8rHlXQafYZOLvUXCF6cnZkPfoq67ThN0Hc=",
"lastModified": 1726734507,
"narHash": "sha256-VUH5O5AcOSxb0uL/m34dDkxFKP6WLQ6y4I1B4+N3L2w=",
"owner": "numtide",
"repo": "treefmt-nix",
"rev": "4446c7a6fc0775df028c5a3f6727945ba8400e64",
"rev": "ee41a466c2255a3abe6bc50fc6be927cdee57a9f",
"type": "github"
},
"original": {

100
flake.nix
View file

@ -16,22 +16,21 @@
}:
utils.lib.eachDefaultSystem (
system: let
pkgs = import nixpkgs {
inherit system;
config = {
allowUnfree = true;
allowUnsupportedSystem = true;
};
pkgs = import nixpkgs {inherit system;};
stdenv =
if pkgs.hostPlatform.isLinux
then pkgs.stdenvAdapters.useMoldLinker pkgs.llvmPackages_18.libcxxStdenv
else pkgs.llvmPackages_18.libcxxStdenv;
sources = import ./_sources/generated.nix {
inherit (pkgs) fetchFromGitHub fetchgit fetchurl dockerTools;
};
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;};
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";
@ -39,60 +38,60 @@
fmt
glfw
glm
shaderc
vulkan-extension-layer
vulkan-memory-allocator
vulkan-utility-libraries
vulkan-headers
vulkan-loader
vulkan-tools
];
in rec {
packages = rec {
graphics-test = stdenv.mkDerivation {
name = "graphics-test";
version = "0.1.0";
src = self;
in
with pkgs; rec {
packages = rec {
graphics-test = stdenv.mkDerivation {
name = "graphics-test";
version = "0.1.0";
src = self;
nativeBuildInputs = with pkgs; [
meson
ninja
pkg-config
];
nativeBuildInputs = [
meson
ninja
pkg-config
];
buildInputs = deps;
buildInputs = deps;
configurePhase = ''
meson setup build
'';
configurePhase = ''
meson setup build
'';
buildPhase = ''
meson compile -C build
'';
buildPhase = ''
meson compile -C build
'';
installPhase = ''
mkdir -p $out/bin
mv build/graphics-test $out/bin/graphics-test
'';
installPhase = ''
mkdir -p $out/bin
mv build/graphics-test $out/bin/graphics-test
'';
};
default = graphics-test;
};
default = graphics-test;
};
formatter = with pkgs;
treefmt-nix.lib.mkWrapper pkgs {
formatter = treefmt-nix.lib.mkWrapper pkgs {
projectRootFile = "flake.nix";
programs = {
alejandra.enable = true;
deadnix.enable = true;
clang-format = {
enable = true;
package = llvmPackages_18.clang-tools;
package = pkgs.llvmPackages_18.clang-tools;
};
};
};
devShell = with pkgs;
mkShell.override {inherit stdenv;} {
devShell = mkShell.override {inherit stdenv;} {
packages =
[
alejandra
@ -100,7 +99,6 @@
(llvmPackages_18.clang-tools.override {enableLibcxx = true;})
lldb
meson
nil
ninja
nvfetcher
pkg-config
@ -115,14 +113,6 @@
VULKAN_SDK = "${vulkan-headers}";
VK_LAYER_PATH = "${vulkan-validation-layers}/share/vulkan/explicit_layer.d";
VK_ICD_FILENAMES =
if stdenv.isDarwin
then "${darwin.moltenvk}/share/vulkan/icd.d/MoltenVK_icd.json"
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_vulkan_beta}/share/vulkan/icd.d/nvidia_icd.x86_64.json:${vulkanPaths}";
shellHook = ''
export PATH="${llvmPackages_18.clang-tools.override {enableLibcxx = true;}}/bin:$PATH"
@ -130,6 +120,6 @@
name = "C++";
};
}
}
);
}

File diff suppressed because it is too large Load diff

View file

@ -2,7 +2,7 @@ project(
'graphics-test',
'cpp',
version: '0.1.0',
default_options: ['cpp_std=c++20', 'warning_level=everything', 'buildtype=debug'],
default_options: ['cpp_std=c++20', 'warning_level=everything', 'buildtype=debugoptimized'],
)
cpp = meson.get_compiler('cpp')
@ -35,15 +35,14 @@ foreach file : source_file_names
endforeach
deps = [
dependency('fmt', include_type: 'system'),
dependency('glfw3', include_type: 'system'),
dependency('glm', include_type: 'system'),
dependency('vulkan', include_type: 'system'),
dependency('fmt', static: true),
dependency('glfw3'),
dependency('glm'),
dependency('vulkan'),
]
executable(
'graphics-test',
sources,
include_directories: include_directories('include', is_system: true),
dependencies: deps,
)
)

File diff suppressed because it is too large Load diff

Binary file not shown.

View file

@ -1,9 +0,0 @@
#version 450
layout(location = 0) in vec3 fragColor;
layout(location = 0) out vec4 outColor;
void main() {
outColor = vec4(fragColor, 1.0);
}

View file

@ -1,20 +0,0 @@
#version 450
layout(location = 0) out vec3 fragColor;
vec2 positions[3] = vec2[](
vec2(0.0, -0.5),
vec2(0.5, 0.5),
vec2(-0.5, 0.5)
);
vec3 colors[3] = vec3[](
vec3(1.0, 0.0, 0.0),
vec3(0.0, 1.0, 0.0),
vec3(0.0, 0.0, 1.0)
);
void main() {
gl_Position = vec4(positions[gl_VertexIndex], 0.0, 1.0);
fragColor = colors[gl_VertexIndex];
}

View file

@ -1,7 +0,0 @@
#!/usr/bin/env sh
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
cd "$SCRIPT_DIR" || exit
glslc -c ./shader.vert -o ./vert.spv
glslc -c ./shader.frag -o ./frag.spv

Binary file not shown.

1709
src/util/magic_enum.hpp Normal file

File diff suppressed because it is too large Load diff