Compare commits

..

41 commits

Author SHA1 Message Date
Mars 9b93436efd
weh 2024-10-08 23:56:24 -04:00
Mars 7762cb4712
testing stuff 2024-10-07 18:08:15 -04:00
Mars 1eade711ba
scujkel; 2024-10-07 16:04:49 -04:00
Mars 79fdc8c38a
weh 2024-10-06 18:34:42 -04:00
Mars 61a2e9367b ok i guess we do need exceptions 2024-10-06 18:14:15 -04:00
Mars f4f4b7898b uirgghghghg 2024-10-06 17:34:25 -04:00
Mars 6711f4b6e0
oops 2024-10-06 16:19:29 -04:00
Mars e3cc2bd8f3
oh this doesnt even need that anymore ok 2024-10-06 12:36:12 -04:00
Mars 0d77992e67
what 2024-10-06 12:26:44 -04:00
Mars df0e12a783
some more things 2024-10-06 01:26:41 -04:00
Mars ecc11a2751
shit 2024-10-06 00:37:51 -04:00
Mars daad4cc907
yes i will change those value calls to something else later 2024-10-06 00:37:42 -04:00
Mars 83631f940e
resizing works now yay 2024-10-05 23:08:12 -04:00
Mars 14ca81b3cb
clang 19 is giving me issues 2024-10-05 23:08:04 -04:00
Mars 23bb6b871f
are you serious. the issue was yabai. 2024-10-05 15:57:25 -04:00
Mars 76fa86d622
few little things 2024-10-01 19:00:31 -04:00
Mars 7fd7beea60
HOLY FUCKING SHIT I GOT A TRIANGLE 2024-10-01 18:54:41 -04:00
Mars 7648a55f8d
Framebuffers 2024-10-01 18:33:05 -04:00
Mars e0b7e93bd8
FInished graphics pipeline basics 2024-10-01 18:30:31 -04:00
Mars 98bd5f7bc2
Ok cool we're back to where we were 2024-10-01 17:06:14 -04:00
Mars ba46d3d834
Finished swap chain 2024-10-01 16:57:40 -04:00
Mars 9ae5a4675a
up to right before choosing the right settings for the swap chain 2024-10-01 16:10:20 -04:00
Mars 623c51d335
i dont think i need this 2024-10-01 14:29:05 -04:00
Mars 87c6018de1
fix es 2024-10-01 14:15:39 -04:00
Mars aadf46f066
more things 2024-09-30 21:34:25 -04:00
Mars 10af83237f
forgot this 2024-09-30 21:23:11 -04:00
Mars 6395c6b95c
more vk stuff 2024-09-30 21:21:38 -04:00
Mars 9b221b81b4
remove unneeded stuff 2024-09-30 19:56:23 -04:00
Mars 658595e0c5
weh 2024-09-30 19:49:44 -04:00
Mars 134b43c1d4
update some stuff so i dont get a ton of useless warnings 2024-09-30 17:52:49 -04:00
Mars 2735eb5807
i think its better to just use the full namespace here 2024-09-30 16:50:58 -04:00
Mars ffd3f44464
vkfw 2024-09-30 16:46:17 -04:00
Mars ee96290c80
ok it works on macos now yay 2024-09-30 15:25:22 -04:00
Mars 329eeb76c7
ughehgehgge 2024-09-30 00:57:13 -04:00
Mars a4c78acebf
physical devices queue families yeah 2024-09-30 00:31:08 -04:00
Mars d489322ab2
blegh 2024-09-29 23:11:12 -04:00
Mars df6ec77374
also this 2024-09-29 23:05:15 -04:00
Mars 01cdd533c5
i dont think i need this?? 2024-09-29 23:04:33 -04:00
Mars 651f339537
i prefer this 2024-09-29 23:03:43 -04:00
Mars d6c93896d1
ok ok ok ok ok ok i got something 2024-09-29 23:02:04 -04:00
Mars 12c4d95aff
started transition to vulkan-hpp 2024-09-29 20:12:56 -04:00
15 changed files with 5778 additions and 2101 deletions

View file

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

View file

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

4
.envrc
View file

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

View file

@ -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";

View file

@ -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
View file

@ -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

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=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,
) )

File diff suppressed because it is too large Load diff

BIN
src/shaders/frag.spv Normal file

Binary file not shown.

9
src/shaders/shader.frag Normal file
View 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
View 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
View 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

Binary file not shown.

File diff suppressed because it is too large Load diff