Majorly cleaned up unnecessary includes and reformatted makefile to include shaders now.
This commit is contained in:
parent
5fca2134fe
commit
0fefb85d0a
18
Makefile
18
Makefile
@ -2,14 +2,13 @@ CPPFLAGS=-g
|
||||
LDFLAGS=-lglfw -lvulkan -ldl -lpthread -lX11 -lXxf86vm -lXrandr -lXi
|
||||
DEBUGFLAGS=-DDEBUG -fsanitize=address
|
||||
GDBFLAGS=
|
||||
SRC = $(shell find . -name *.cpp)
|
||||
SRC = $(shell find . -name "*.cpp")
|
||||
SHDRSRC = $(shell find . -name "*.frag" -o -name "*vert")
|
||||
SPV = $(SHDRSRC:%.vert=%.spv) $(SHDRSRC:%.frag=%.spv)
|
||||
OBJ = $(SRC:%.cpp=%.o)
|
||||
VERTEX = $(src/shaders/%.vert=%.spv)
|
||||
FRAGMENT = $(src/shaders/%.frag=%.spv)
|
||||
|
||||
BIN=build/agnosiaengine
|
||||
|
||||
|
||||
.PHONY: all
|
||||
all: $(BIN)
|
||||
|
||||
@ -28,25 +27,30 @@ debug: $(BIN)
|
||||
|
||||
.PHONY: dep
|
||||
dep:
|
||||
sudo pacman -S gcc glfw glm shaderc libxi libxxf86vm gdb glslc
|
||||
sudo pacman -S gcc glfw glm shaderc libxi libxxf86vm gdb shaderc
|
||||
.PHONY: info
|
||||
info:
|
||||
@echo "make: Build executable"
|
||||
@echo "make dep: Make all required dependencies"
|
||||
@echo "make debug: Make with Debug hooked in"
|
||||
@echo "make gdb: Make with GDB hooked in"
|
||||
@echo "make clean: Clean all files"
|
||||
@echo "make run: Run the executable after building"
|
||||
|
||||
$(BIN): $(OBJ) $(VERTEX) $(FRAGMENT)
|
||||
$(BIN): $(OBJ) $(SPV)
|
||||
mkdir -p build
|
||||
g++ $(CPPFLAGS) -o $(BIN) $(OBJ) $(LDFLAGS)
|
||||
|
||||
%.o: %.cpp
|
||||
g++ -c -g $< -o $@ $(LDFLAGS)
|
||||
%.spv: %.vert %.frag
|
||||
|
||||
%.spv: %.frag
|
||||
glslc $< -o $@
|
||||
%.spv: %.vert
|
||||
glslc $< -o $@
|
||||
|
||||
.PHONY: clean
|
||||
clean:
|
||||
rm -rf build
|
||||
find . -name "*.o" -type f -delete
|
||||
find . -name "*.spv" -type f -delete
|
||||
|
@ -1,12 +1,6 @@
|
||||
#include "vulkandebuglibs.h"
|
||||
#include "../global.h"
|
||||
using namespace Debug;
|
||||
|
||||
#include <cstdint>
|
||||
#include <stdexcept>
|
||||
#include <vulkan/vk_platform.h>
|
||||
#include <cstring>
|
||||
|
||||
// This is our messenger object! It handles passing along debug messages to the debug callback we will also set.
|
||||
VkDebugUtilsMessengerEXT debugMessenger;
|
||||
// This is the set of "layers" to hook into. Basically, layers are used to tell the messenger what data we want, its a filter. *validation* is the general blanket layer to cover incorrect usage.
|
||||
|
@ -1,6 +1,8 @@
|
||||
#pragma once
|
||||
#include <vector>
|
||||
#include <vulkan/vulkan_core.h>
|
||||
#include <cstdint>
|
||||
#include <cstring>
|
||||
#include "../global.h"
|
||||
|
||||
namespace Debug {
|
||||
class vulkandebuglibs {
|
||||
|
@ -1,16 +1,6 @@
|
||||
#include "devicelibrary.h"
|
||||
#include "global.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <cstdint>
|
||||
#include <limits>
|
||||
#include <optional>
|
||||
#include <ostream>
|
||||
#include <set>
|
||||
#include <stdexcept>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <vulkan/vulkan_core.h>
|
||||
|
||||
namespace DeviceControl {
|
||||
|
||||
|
@ -1,7 +1,12 @@
|
||||
#pragma once
|
||||
#include "global.h"
|
||||
#include <optional>
|
||||
#include <vulkan/vulkan_core.h>
|
||||
#include <algorithm>
|
||||
#include <limits>
|
||||
#include <ostream>
|
||||
#include <set>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
namespace DeviceControl {
|
||||
class devicelibrary {
|
||||
public:
|
||||
|
@ -5,7 +5,7 @@ Graphics::graphicspipeline graphicsPipeline;
|
||||
RenderPresent::render renderPresentation;
|
||||
VkInstance vulkaninstance;
|
||||
|
||||
|
||||
// Getters and Setters!
|
||||
void EntryApp::setFramebufferResized(bool setter) {
|
||||
framebufferResized = setter;
|
||||
}
|
||||
@ -29,8 +29,6 @@ void initWindow() {
|
||||
glfwSetFramebufferSizeCallback(Global::window, framebufferResizeCallback);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void createInstance() {
|
||||
debugController.checkUnavailableValidationLayers(); // Check if there is a mistake with our Validation Layers.
|
||||
|
||||
@ -83,9 +81,6 @@ void cleanup() { // Similar to th
|
||||
renderPresentation.destroyFenceSemaphores();
|
||||
graphicsPipeline.destroyCommandPool();
|
||||
|
||||
deviceLibs.destroyImageViews();
|
||||
deviceLibs.destroySwapChain();
|
||||
|
||||
vkDestroyDevice(Global::device, nullptr);
|
||||
if(Global::enableValidationLayers) {
|
||||
debugController.DestroyDebugUtilsMessengerEXT(vulkaninstance, nullptr);
|
||||
@ -96,7 +91,7 @@ void cleanup() { // Similar to th
|
||||
glfwDestroyWindow(Global::window);
|
||||
glfwTerminate();
|
||||
}
|
||||
|
||||
// External Functions
|
||||
EntryApp& EntryApp::getInstance() {
|
||||
static EntryApp instance;
|
||||
return instance;
|
||||
|
@ -19,6 +19,4 @@ class EntryApp {
|
||||
|
||||
bool framebufferResized;
|
||||
bool initialized;
|
||||
|
||||
|
||||
};
|
||||
|
@ -1,9 +1,9 @@
|
||||
#pragma once
|
||||
#include "debug/vulkandebuglibs.h"
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
#include <optional>
|
||||
#include <vulkan/vulkan_core.h>
|
||||
#include "debug/vulkandebuglibs.h"
|
||||
|
||||
#define GLFW_INCLUDE_VULKAN
|
||||
#include <GLFW/glfw3.h>
|
||||
|
@ -1,9 +1,5 @@
|
||||
|
||||
#include "graphicspipeline.h"
|
||||
#include "../devicelibrary.h"
|
||||
#include <cstdint>
|
||||
#include <fstream>
|
||||
#include <stdexcept>
|
||||
#include <vulkan/vulkan_core.h>
|
||||
namespace Graphics {
|
||||
std::vector<VkDynamicState> dynamicStates = {
|
||||
VK_DYNAMIC_STATE_VIEWPORT,
|
||||
@ -57,8 +53,8 @@ namespace Graphics {
|
||||
|
||||
void graphicspipeline::createGraphicsPipeline() {
|
||||
// Note to self, for some reason the working directory is not where a read file is called from, but the project folder!
|
||||
auto vertShaderCode = readFile("src/shaders/vert.spv");
|
||||
auto fragShaderCode = readFile("src/shaders/frag.spv");
|
||||
auto vertShaderCode = readFile("src/shaders/vertex.spv");
|
||||
auto fragShaderCode = readFile("src/shaders/fragment.spv");
|
||||
VkShaderModule vertShaderModule = createShaderModule(vertShaderCode, Global::device);
|
||||
VkShaderModule fragShaderModule = createShaderModule(fragShaderCode, Global::device);
|
||||
|
||||
@ -208,7 +204,7 @@ namespace Graphics {
|
||||
}
|
||||
void graphicspipeline::destroyRenderPass() {
|
||||
vkDestroyRenderPass(Global::device, renderPass, nullptr);
|
||||
std::cout << "Destroyed Render Pass Safely\n" << std::endl;
|
||||
if(Global::enableValidationLayers) std::cout << "Destroyed Render Pass Safely\n" << std::endl;
|
||||
}
|
||||
void graphicspipeline::createFramebuffers() {
|
||||
// Resize the container to hold all the framebuffers.
|
||||
@ -275,7 +271,6 @@ namespace Graphics {
|
||||
if (vkBeginCommandBuffer(commandBuffer, &beginInfo) != VK_SUCCESS) {
|
||||
throw std::runtime_error("failed to begin recording command buffer!");
|
||||
}
|
||||
if(Global::enableValidationLayers) std::cout << "Recording command buffer...\n" << std::endl;
|
||||
|
||||
VkRenderPassBeginInfo renderPassInfo{};
|
||||
renderPassInfo.sType = VK_STRUCTURE_TYPE_RENDER_PASS_BEGIN_INFO;
|
||||
|
@ -1,6 +1,7 @@
|
||||
#pragma once
|
||||
#include "../global.h"
|
||||
|
||||
#include "../devicelibrary.h"
|
||||
#include <fstream>
|
||||
namespace Graphics {
|
||||
class graphicspipeline {
|
||||
public:
|
||||
|
@ -1,7 +1,6 @@
|
||||
#include "entrypoint.h"
|
||||
int main() {
|
||||
EntryApp::getInstance().initialize();
|
||||
|
||||
try {
|
||||
EntryApp::getInstance().run();
|
||||
} catch (const std::exception &e) {
|
||||
|
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue
Block a user