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: >
*,
-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
use_flake . --impure
PATH_add ./src/shaders
use_flake

View file

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

100
flake.nix
View file

@ -16,21 +16,22 @@
}:
utils.lib.eachDefaultSystem (
system: let
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;
pkgs = import nixpkgs {
inherit system;
config = {
allowUnfree = true;
allowUnsupportedSystem = true;
};
};
mkPkg = name:
pkgs.${name}.overrideAttrs {
inherit (sources.${name}) pname version src;
};
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;};
fmt = mkPkg "fmt";
@ -38,60 +39,60 @@
fmt
glfw
glm
shaderc
vulkan-extension-layer
vulkan-memory-allocator
vulkan-utility-libraries
vulkan-headers
vulkan-loader
vulkan-tools
];
in
with pkgs; rec {
packages = rec {
graphics-test = stdenv.mkDerivation {
name = "graphics-test";
version = "0.1.0";
src = self;
in rec {
packages = rec {
graphics-test = stdenv.mkDerivation {
name = "graphics-test";
version = "0.1.0";
src = self;
nativeBuildInputs = [
meson
ninja
pkg-config
];
nativeBuildInputs = with pkgs; [
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
'';
};
default = graphics-test;
installPhase = ''
mkdir -p $out/bin
mv build/graphics-test $out/bin/graphics-test
'';
};
formatter = treefmt-nix.lib.mkWrapper pkgs {
default = graphics-test;
};
formatter = with pkgs;
treefmt-nix.lib.mkWrapper pkgs {
projectRootFile = "flake.nix";
programs = {
alejandra.enable = true;
deadnix.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
@ -99,6 +100,7 @@
(llvmPackages_18.clang-tools.override {enableLibcxx = true;})
lldb
meson
nil
ninja
nvfetcher
pkg-config
@ -113,6 +115,14 @@
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"
@ -120,6 +130,6 @@
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',
'cpp',
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')
@ -35,14 +35,15 @@ foreach file : source_file_names
endforeach
deps = [
dependency('fmt', static: true),
dependency('glfw3'),
dependency('glm'),
dependency('vulkan'),
dependency('fmt', include_type: 'system'),
dependency('glfw3', include_type: 'system'),
dependency('glm', include_type: 'system'),
dependency('vulkan', include_type: 'system'),
]
executable(
'graphics-test',
sources,
include_directories: include_directories('include', is_system: true),
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