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: > Checks: >
*, *,
-ctad-maybe-unsupported, -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 export NIXPKGS_ALLOW_UNSUPPORTED_SYSTEM=1
use_flake use_flake . --impure

View file

@ -1,10 +1,6 @@
# 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, dockerTools }:
{ {
fetchgit,
fetchurl,
fetchFromGitHub,
dockerTools,
}: {
fmt = { fmt = {
pname = "fmt"; pname = "fmt";
version = "11.0.2"; version = "11.0.2";

View file

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

100
flake.nix
View file

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

File diff suppressed because it is too large Load diff

View file

@ -2,7 +2,7 @@ project(
'graphics-test', 'graphics-test',
'cpp', 'cpp',
version: '0.1.0', 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') cpp = meson.get_compiler('cpp')
@ -35,15 +35,14 @@ foreach file : source_file_names
endforeach endforeach
deps = [ deps = [
dependency('fmt', include_type: 'system'), dependency('fmt', static: true),
dependency('glfw3', include_type: 'system'), dependency('glfw3'),
dependency('glm', include_type: 'system'), dependency('glm'),
dependency('vulkan', include_type: 'system'), dependency('vulkan'),
] ]
executable( executable(
'graphics-test', 'graphics-test',
sources, sources,
include_directories: include_directories('include', is_system: true),
dependencies: deps, 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