Compare commits
41 commits
Author | SHA1 | Date | |
---|---|---|---|
Mars | 9b93436efd | ||
Mars | 7762cb4712 | ||
Mars | 1eade711ba | ||
Mars | 79fdc8c38a | ||
Mars | 61a2e9367b | ||
Mars | f4f4b7898b | ||
Mars | 6711f4b6e0 | ||
Mars | e3cc2bd8f3 | ||
Mars | 0d77992e67 | ||
Mars | df0e12a783 | ||
Mars | ecc11a2751 | ||
Mars | daad4cc907 | ||
Mars | 83631f940e | ||
Mars | 14ca81b3cb | ||
Mars | 23bb6b871f | ||
Mars | 76fa86d622 | ||
Mars | 7fd7beea60 | ||
Mars | 7648a55f8d | ||
Mars | e0b7e93bd8 | ||
Mars | 98bd5f7bc2 | ||
Mars | ba46d3d834 | ||
Mars | 9ae5a4675a | ||
Mars | 623c51d335 | ||
Mars | 87c6018de1 | ||
Mars | aadf46f066 | ||
Mars | 10af83237f | ||
Mars | 6395c6b95c | ||
Mars | 9b221b81b4 | ||
Mars | 658595e0c5 | ||
Mars | 134b43c1d4 | ||
Mars | 2735eb5807 | ||
Mars | ffd3f44464 | ||
Mars | ee96290c80 | ||
Mars | 329eeb76c7 | ||
Mars | a4c78acebf | ||
Mars | d489322ab2 | ||
Mars | df6ec77374 | ||
Mars | 01cdd533c5 | ||
Mars | 651f339537 | ||
Mars | d6c93896d1 | ||
Mars | 12c4d95aff |
|
@ -1,4 +1,3 @@
|
||||||
# noinspection SpellCheckingInspection
|
|
||||||
Checks: >
|
Checks: >
|
||||||
*,
|
*,
|
||||||
-ctad-maybe-unsupported,
|
-ctad-maybe-unsupported,
|
||||||
|
|
4
.clangd
4
.clangd
|
@ -1,4 +0,0 @@
|
||||||
Diagnostics:
|
|
||||||
Suppress: >
|
|
||||||
-Wmissing-template-arg-list-after-template-kw,
|
|
||||||
-Wctad-maybe-unsupported
|
|
4
.envrc
4
.envrc
|
@ -1,2 +1,2 @@
|
||||||
export NIXPKGS_ALLOW_UNSUPPORTED_SYSTEM=1
|
PATH_add ./src/shaders
|
||||||
use_flake . --impure
|
use_flake
|
||||||
|
|
|
@ -1,6 +1,10 @@
|
||||||
# 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";
|
||||||
|
|
18
flake.lock
18
flake.lock
|
@ -2,11 +2,11 @@
|
||||||
"nodes": {
|
"nodes": {
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1727065772,
|
"lastModified": 1728001300,
|
||||||
"narHash": "sha256-U9baiEXL2YsS67QKlBAPIUq+OB+eUPKv8n1vGNdhiec=",
|
"narHash": "sha256-W7PYJ6s+A91V1WZOTef8y3t1BGQKCfcLtHjOKcP5ScA=",
|
||||||
"owner": "NixOS",
|
"owner": "NixOS",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "989dc4cbf6a95f2e5fefc8cd61d2198a8fb6834a",
|
"rev": "e00cc9f2fa7eaac3232e0de9b0b86dfd58b1f43c",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -17,11 +17,11 @@
|
||||||
},
|
},
|
||||||
"nixpkgs_2": {
|
"nixpkgs_2": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1726481836,
|
"lastModified": 1726871744,
|
||||||
"narHash": "sha256-MWTBH4dd5zIz2iatDb8IkqSjIeFum9jAqkFxgHLdzO4=",
|
"narHash": "sha256-V5LpfdHyQkUF7RfOaDPrZDP+oqz88lTJrMT1+stXNwo=",
|
||||||
"owner": "nixos",
|
"owner": "nixos",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "20f9370d5f588fb8c72e844c54511cab054b5f40",
|
"rev": "a1d92660c6b3b7c26fb883500a80ea9d33321be2",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -58,11 +58,11 @@
|
||||||
"nixpkgs": "nixpkgs_2"
|
"nixpkgs": "nixpkgs_2"
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1726734507,
|
"lastModified": 1727984844,
|
||||||
"narHash": "sha256-VUH5O5AcOSxb0uL/m34dDkxFKP6WLQ6y4I1B4+N3L2w=",
|
"narHash": "sha256-xpRqITAoD8rHlXQafYZOLvUXCF6cnZkPfoq67ThN0Hc=",
|
||||||
"owner": "numtide",
|
"owner": "numtide",
|
||||||
"repo": "treefmt-nix",
|
"repo": "treefmt-nix",
|
||||||
"rev": "ee41a466c2255a3abe6bc50fc6be927cdee57a9f",
|
"rev": "4446c7a6fc0775df028c5a3f6727945ba8400e64",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|
100
flake.nix
100
flake.nix
|
@ -16,21 +16,22 @@
|
||||||
}:
|
}:
|
||||||
utils.lib.eachDefaultSystem (
|
utils.lib.eachDefaultSystem (
|
||||||
system: let
|
system: let
|
||||||
pkgs = import nixpkgs {inherit system;};
|
pkgs = import nixpkgs {
|
||||||
|
inherit system;
|
||||||
stdenv =
|
config = {
|
||||||
if pkgs.hostPlatform.isLinux
|
allowUnfree = true;
|
||||||
then pkgs.stdenvAdapters.useMoldLinker pkgs.llvmPackages_18.libcxxStdenv
|
allowUnsupportedSystem = true;
|
||||||
else pkgs.llvmPackages_18.libcxxStdenv;
|
};
|
||||||
|
|
||||||
sources = import ./_sources/generated.nix {
|
|
||||||
inherit (pkgs) fetchFromGitHub fetchgit fetchurl dockerTools;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
mkPkg = name:
|
stdenv = with pkgs;
|
||||||
pkgs.${name}.overrideAttrs {
|
if hostPlatform.isLinux
|
||||||
inherit (sources.${name}) pname version src;
|
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;};
|
||||||
|
|
||||||
fmt = mkPkg "fmt";
|
fmt = mkPkg "fmt";
|
||||||
|
|
||||||
|
@ -38,60 +39,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
|
in rec {
|
||||||
with pkgs; rec {
|
packages = rec {
|
||||||
packages = rec {
|
graphics-test = stdenv.mkDerivation {
|
||||||
graphics-test = stdenv.mkDerivation {
|
name = "graphics-test";
|
||||||
name = "graphics-test";
|
version = "0.1.0";
|
||||||
version = "0.1.0";
|
src = self;
|
||||||
src = self;
|
|
||||||
|
|
||||||
nativeBuildInputs = [
|
nativeBuildInputs = with pkgs; [
|
||||||
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;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
formatter = treefmt-nix.lib.mkWrapper pkgs {
|
default = graphics-test;
|
||||||
|
};
|
||||||
|
|
||||||
|
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 = pkgs.llvmPackages_18.clang-tools;
|
package = llvmPackages_18.clang-tools;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
devShell = mkShell.override {inherit stdenv;} {
|
devShell = with pkgs;
|
||||||
|
mkShell.override {inherit stdenv;} {
|
||||||
packages =
|
packages =
|
||||||
[
|
[
|
||||||
alejandra
|
alejandra
|
||||||
|
@ -99,6 +100,7 @@
|
||||||
(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
|
||||||
|
@ -113,6 +115,14 @@
|
||||||
|
|
||||||
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"
|
||||||
|
@ -120,6 +130,6 @@
|
||||||
|
|
||||||
name = "C++";
|
name = "C++";
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
5015
include/vkfw.hpp
Normal file
5015
include/vkfw.hpp
Normal file
File diff suppressed because it is too large
Load diff
11
meson.build
11
meson.build
|
@ -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=debugoptimized'],
|
default_options: ['cpp_std=c++20', 'warning_level=everything', 'buildtype=debug'],
|
||||||
)
|
)
|
||||||
|
|
||||||
cpp = meson.get_compiler('cpp')
|
cpp = meson.get_compiler('cpp')
|
||||||
|
@ -35,14 +35,15 @@ foreach file : source_file_names
|
||||||
endforeach
|
endforeach
|
||||||
|
|
||||||
deps = [
|
deps = [
|
||||||
dependency('fmt', static: true),
|
dependency('fmt', include_type: 'system'),
|
||||||
dependency('glfw3'),
|
dependency('glfw3', include_type: 'system'),
|
||||||
dependency('glm'),
|
dependency('glm', include_type: 'system'),
|
||||||
dependency('vulkan'),
|
dependency('vulkan', include_type: 'system'),
|
||||||
]
|
]
|
||||||
|
|
||||||
executable(
|
executable(
|
||||||
'graphics-test',
|
'graphics-test',
|
||||||
sources,
|
sources,
|
||||||
|
include_directories: include_directories('include', is_system: true),
|
||||||
dependencies: deps,
|
dependencies: deps,
|
||||||
)
|
)
|
973
src/main.cpp
973
src/main.cpp
File diff suppressed because it is too large
Load diff
BIN
src/shaders/frag.spv
Normal file
BIN
src/shaders/frag.spv
Normal file
Binary file not shown.
9
src/shaders/shader.frag
Normal file
9
src/shaders/shader.frag
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
#version 450
|
||||||
|
|
||||||
|
layout(location = 0) in vec3 fragColor;
|
||||||
|
|
||||||
|
layout(location = 0) out vec4 outColor;
|
||||||
|
|
||||||
|
void main() {
|
||||||
|
outColor = vec4(fragColor, 1.0);
|
||||||
|
}
|
20
src/shaders/shader.vert
Normal file
20
src/shaders/shader.vert
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
#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];
|
||||||
|
}
|
7
src/shaders/shaderc
Executable file
7
src/shaders/shaderc
Executable file
|
@ -0,0 +1,7 @@
|
||||||
|
#!/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
|
BIN
src/shaders/vert.spv
Normal file
BIN
src/shaders/vert.spv
Normal file
Binary file not shown.
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue