diff --git a/.clangd b/.clangd
index 028d859..0a8dc64 100644
--- a/.clangd
+++ b/.clangd
@@ -1,5 +1,6 @@
CompileFlags:
- Add:
+ Add:
- -I./include
- - -I/usr/include/vulkan
+ - -I./src
+ - -I./src/public
- -std=c++20
diff --git a/Learning Vulkan.vcxproj b/Learning Vulkan.vcxproj
index 0a4340b..c1d6ef7 100644
--- a/Learning Vulkan.vcxproj
+++ b/Learning Vulkan.vcxproj
@@ -140,11 +140,11 @@
-
+
-
+
@@ -157,4 +157,4 @@
-
\ No newline at end of file
+
diff --git a/Learning Vulkan.vcxproj.filters b/Learning Vulkan.vcxproj.filters
index 888d47a..03a207b 100644
--- a/Learning Vulkan.vcxproj.filters
+++ b/Learning Vulkan.vcxproj.filters
@@ -1,4 +1,4 @@
-
+
@@ -41,7 +41,7 @@
-
+
Header Files
@@ -59,7 +59,7 @@
Header Files
-
+
Header Files
@@ -75,4 +75,4 @@
Shaders
-
\ No newline at end of file
+
diff --git a/LearningVulkan b/LearningVulkan
new file mode 100755
index 0000000..5cc0525
Binary files /dev/null and b/LearningVulkan differ
diff --git a/Makefile b/Makefile
index 0f42e59..7b1cb31 100644
--- a/Makefile
+++ b/Makefile
@@ -1,13 +1,27 @@
CXX = g++
-CFLAGS = -std=c++20 -O2 -Wall -Wextra -I./include
+CXXFLAGS = -std=c++20 -O2 -Wall -Wextra -I./include -I./src -I./src/private -I./src/public
LDFLAGS = -lglfw -lvulkan -ldl -lpthread -lX11 -lXxf86vm -lXrandr -lXi
-TARGET := LearningVulkan
+BUILDDIR = build
+OBJDIR = $(BUILDDIR)/obj
-$(TARGET): ./src/main.cpp
- $(CXX) $(CFLAGS) -o $(TARGET) ./src/main.cpp $(LDFLAGS)
+SOURCES = $(shell find ./src -name "*.cpp")
+
+OBJECTS = $(SOURCES:./src/%.cpp=$(OBJDIR)/%.o)
+
+TARGET = LearningVulkan
+
+$(OBJDIR):
+ @mkdir -p $@
+
+$(OBJDIR)/%.o: ./src/%.cpp | $(OBJDIR)
+ @mkdir -p $(@D)
+ $(CXX) $(CXXFLAGS) -c $< -o $@
+
+$(TARGET): $(OBJECTS)
+ $(CXX) $(OBJECTS) -o $@ $(LDFLAGS)
.PHONY: test clean
@@ -15,4 +29,4 @@ test: $(TARGET)
./$(TARGET)
clean:
- rm -f $(TARGET)
+ rm -rf $(BUILDDIR)
diff --git a/Shaders/compile.sh b/Shaders/compile.sh
new file mode 100755
index 0000000..5cd654c
--- /dev/null
+++ b/Shaders/compile.sh
@@ -0,0 +1,3 @@
+#!/bin/bash
+glslc ./shader.vert -o vert.spv
+glslc ./shader.frag -o frag.spv
diff --git a/Shaders/shader.vert b/Shaders/shader.vert
index 66d6766..fa977f6 100644
--- a/Shaders/shader.vert
+++ b/Shaders/shader.vert
@@ -1,20 +1,12 @@
#version 450
+layout(location = 0) in vec2 inPosition;
+layout(location = 1) in vec3 inColor;
+
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];
-}
\ No newline at end of file
+ gl_Position = vec4(inPosition, 0.0, 1.0);
+ fragColor = inColor;
+}
+
diff --git a/Shaders/vert.spv b/Shaders/vert.spv
index cf7123f..a8ec1a6 100644
Binary files a/Shaders/vert.spv and b/Shaders/vert.spv differ
diff --git a/src/VulkanContext.cpp b/src/VulkanContext.cpp
deleted file mode 100644
index e69e7b8..0000000
--- a/src/VulkanContext.cpp
+++ /dev/null
@@ -1 +0,0 @@
-#include "VulkanContext.h"
diff --git a/src/VulkanContext.h b/src/VulkanContext.h
deleted file mode 100644
index 3a0976e..0000000
--- a/src/VulkanContext.h
+++ /dev/null
@@ -1,52 +0,0 @@
-#pragma once
-// #include
-// #include
-//
-#include "VulkanInstanceManager.h"
-#include "VulkanDebugManager.h"
-
-#define GLFW_INCLUDE_VULKAN
-#include
-
-const std::vector ValidationLayers = {
- "VK_LAYER_KHRONOS_validation"
-};
-
-struct FVulkanConfig
-{
- bool bValidationEnabled = true;
- bool bVerboseLogging = false;
-};
-
-class VulkanContext
-{
-public:
- VulkanContext();
- ~VulkanContext();
-
- void Initialize(FVulkanConfig& Config);
- void Cleanup();
-
-private:
- FVulkanConfig Config = {};
-
- VkInstance Instance = VK_NULL_HANDLE;
- VkPhysicalDevice PhysicalDevice = VK_NULL_HANDLE;
- VkDevice Device = VK_NULL_HANDLE;
- VkQueue GraphicsQueue = VK_NULL_HANDLE;
- VkSurfaceKHR Surface = VK_NULL_HANDLE;
- VkDebugUtilsMessengerEXT debugMessenger = VK_NULL_HANDLE;
-
-public:
- static VulkanDebugManager DebugManager;
-
-private:
- VulkanInstanceManager InstanceManager;
-
-public:
- VkInstance GetInstance() const { return Instance; }
- VkPhysicalDevice GetPhysicalDevice() const { return PhysicalDevice; }
- VkDevice GetDevice() const { return Device; }
- VkQueue GetGraphicsQueue() const { return GraphicsQueue; }
- VkSurfaceKHR GetSurface() const { return Surface; }
-};
diff --git a/src/VulkanDeviceManager.cpp b/src/VulkanDeviceManager.cpp
deleted file mode 100644
index 467bb1b..0000000
--- a/src/VulkanDeviceManager.cpp
+++ /dev/null
@@ -1,442 +0,0 @@
-#include "VulkanDeviceManager.h"
-
-#include
-#include