From 6dc3c9b7029fc54e04f2c56ae403957f9f3c81dd Mon Sep 17 00:00:00 2001 From: Anish Bhobe Date: Wed, 4 Jun 2025 22:13:17 +0200 Subject: [PATCH] Initial project and created a plan. --- .gitignore | 6 ++ Blaze.cpp | 88 +++++++++++++++++++++ Blaze.sln | 31 ++++++++ Blaze.vcxproj | 166 +++++++++++++++++++++++++++++++++++++++ Blaze.vcxproj.filters | 39 +++++++++ PLAN.md | 50 ++++++++++++ README.md | 10 ++- vcpkg-configuration.json | 14 ++++ vcpkg.json | 10 +++ 9 files changed, 413 insertions(+), 1 deletion(-) create mode 100644 Blaze.cpp create mode 100644 Blaze.sln create mode 100644 Blaze.vcxproj create mode 100644 Blaze.vcxproj.filters create mode 100644 PLAN.md create mode 100644 vcpkg-configuration.json create mode 100644 vcpkg.json diff --git a/.gitignore b/.gitignore index d9b761b..3077ef9 100644 --- a/.gitignore +++ b/.gitignore @@ -133,6 +133,12 @@ StyleCopReport.xml *.svclog *.scc +# Vcpkg +vcpkg-manifest-install.log + +## Manifest Mode +vcpkg_installed/ + # Chutzpah Test files _Chutzpah* diff --git a/Blaze.cpp b/Blaze.cpp new file mode 100644 index 0000000..53aaeb1 --- /dev/null +++ b/Blaze.cpp @@ -0,0 +1,88 @@ +// Blaze.cpp : This file contains the 'main' function. Program execution begins and ends there. +// + +#include + +#include + +#include +#include +#include + +#define ASSERT(COND) assert((COND)) + +#define VK_CHECK(RESULT) ASSERT((RESULT) == VK_SUCCESS) + +constexpr uint32_t WIDTH = 1280; +constexpr uint32_t HEIGHT = 720; + +int main() +{ + volkInitialize(); + + SDL_Init(SDL_INIT_VIDEO | SDL_INIT_EVENTS); + + SDL_Window* window = SDL_CreateWindow("Blaze Test", WIDTH, HEIGHT, SDL_WINDOW_VULKAN); + + VkApplicationInfo applicationInfo{ + .sType = VK_STRUCTURE_TYPE_APPLICATION_INFO, + .pNext = nullptr, + .pApplicationName = "Test", + .applicationVersion = VK_MAKE_API_VERSION(0, 0, 1, 0), + .pEngineName = "Blaze", + .engineVersion = VK_MAKE_API_VERSION(0, 0, 1, 0), + .apiVersion = VK_API_VERSION_1_3, + }; + + uint32_t instanceExtensionCount; + char const* const* instanceExtensions = SDL_Vulkan_GetInstanceExtensions(&instanceExtensionCount); + + VkInstanceCreateInfo createInfo{ + .sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO, + .pNext = nullptr, + .flags = 0, + .pApplicationInfo = &applicationInfo, + .enabledLayerCount = 0, + .ppEnabledLayerNames = nullptr, + .enabledExtensionCount = instanceExtensionCount, + .ppEnabledExtensionNames = instanceExtensions, + }; + + VkInstance instance; + VK_CHECK(vkCreateInstance(&createInfo, nullptr, &instance)); + volkLoadInstance(instance); + + VkSurfaceKHR surface; + ASSERT(SDL_Vulkan_CreateSurface(window, instance, nullptr, &surface)); + + bool isRunning = true; + while (isRunning) + { + SDL_PumpEvents(); + + SDL_Event event; + while(SDL_PollEvent(&event)) + { + switch (event.type) + { + case SDL_EVENT_QUIT: + isRunning = false; + break; + default: + break; + } + } + } + + SDL_Vulkan_DestroySurface(instance, surface, nullptr); + + vkDestroyInstance(instance, nullptr); + + volkFinalize(); + + //Blaze blaze; + + SDL_DestroyWindow(window); + + SDL_Quit(); +} \ No newline at end of file diff --git a/Blaze.sln b/Blaze.sln new file mode 100644 index 0000000..acd7e1c --- /dev/null +++ b/Blaze.sln @@ -0,0 +1,31 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.13.36105.23 d17.13 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Blaze", "Blaze.vcxproj", "{92E725FE-D87B-4FDE-8371-5B2CE60945FD}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {92E725FE-D87B-4FDE-8371-5B2CE60945FD}.Debug|x64.ActiveCfg = Debug|x64 + {92E725FE-D87B-4FDE-8371-5B2CE60945FD}.Debug|x64.Build.0 = Debug|x64 + {92E725FE-D87B-4FDE-8371-5B2CE60945FD}.Debug|x86.ActiveCfg = Debug|Win32 + {92E725FE-D87B-4FDE-8371-5B2CE60945FD}.Debug|x86.Build.0 = Debug|Win32 + {92E725FE-D87B-4FDE-8371-5B2CE60945FD}.Release|x64.ActiveCfg = Release|x64 + {92E725FE-D87B-4FDE-8371-5B2CE60945FD}.Release|x64.Build.0 = Release|x64 + {92E725FE-D87B-4FDE-8371-5B2CE60945FD}.Release|x86.ActiveCfg = Release|Win32 + {92E725FE-D87B-4FDE-8371-5B2CE60945FD}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {66453C96-B8B9-4B1A-BC89-5BE11F9DF335} + EndGlobalSection +EndGlobal diff --git a/Blaze.vcxproj b/Blaze.vcxproj new file mode 100644 index 0000000..ccd2400 --- /dev/null +++ b/Blaze.vcxproj @@ -0,0 +1,166 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + 17.0 + Win32Proj + {92e725fe-d87b-4fde-8371-5b2ce60945fd} + Blaze + 10.0 + + + + Application + true + v143 + Unicode + + + Application + false + v143 + true + Unicode + + + Application + true + v143 + Unicode + + + Application + false + v143 + true + Unicode + + + + + + + + + + + + + + + + + + + + + true + + + + Level3 + true + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + + + + + Level3 + true + true + true + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + true + true + + + + + EnableAllWarnings + true + _DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + stdcpp20 + false + false + Sync + false + /utf-8 %(AdditionalOptions) + true + TurnOffAllWarnings + + + Console + true + C:\Users\Eon\source\repos\Blaze\vcpkg_installed\x64-windows\x64-windows\bin;%(AdditionalLibraryDirectories) + + + + + EnableAllWarnings + true + true + true + NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + stdcpp20 + false + false + /EH- + false + /utf-8 %(AdditionalOptions) + true + TurnOffAllWarnings + + + Console + true + true + true + C:\Users\Eon\source\repos\Blaze\vcpkg_installed\x64-windows\x64-windows\bin;%(AdditionalLibraryDirectories) + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Blaze.vcxproj.filters b/Blaze.vcxproj.filters new file mode 100644 index 0000000..5572f79 --- /dev/null +++ b/Blaze.vcxproj.filters @@ -0,0 +1,39 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + + + Source Files + + + + + Resource Files + + + Resource Files + + + Resource Files + + + Resource Files + + + Resource Files + + + \ No newline at end of file diff --git a/PLAN.md b/PLAN.md new file mode 100644 index 0000000..b680a7d --- /dev/null +++ b/PLAN.md @@ -0,0 +1,50 @@ +# Plan for Blaze + +## Local Steps +- [X] Initial Setup and Yak-shaving. + - [X] vcpkg + - [X] compile flags etc. + - [X] SDL3 + - [X] volk +- [ ] Create a Triangle + - [X] Create Window + - [X] Load instance + - [X] Create surface + - [ ] Choose physical device + - [ ] Create logical device + - [ ] Create swapchain + - [ ] Create pipeline + - [ ] Draw +- [ ] Create a Box + - [ ] Create Vertex buffer + - [ ] Load texture + - [ ] Draw +- [ ] Refactor + +## Features +- [ ] Scene Rendering + - [ ] glTF2.0 Loading + - [ ] Level of Detail + - [ ] Model Optimization + - [ ] Occlusion Culling + - [ ] Terrain + - TBD +- [ ] Rendering Methods + - [ ] Forward + - [ ] Deferred + - [ ] Clustered-Forward + - [ ] V-Buffer +- [ ] Shadows + - [ ] Directional Shadow + - [ ] Percentage-Closer Filtering + - [ ] Cascaded Shadow Maps + - [ ] Percentage-Closer Soft Shadows + - [ ] Omni-directional Shadows + - [ ] Cubemap + - [ ] Dual-Paraboloid +- [ ] Animation + - [ ] Skeletal-Animation + - [ ] GPU based instanced skeletal-animation +- [ ] Tranparency + - [ ] Transparency pass + - [ ] Depth-peeling Order-independent Transparency \ No newline at end of file diff --git a/README.md b/README.md index 4e2653d..2fc943e 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,11 @@ # Blaze -A Vulkan 1.3 renderer in C++. \ No newline at end of file +A Vulkan 1.3 renderer in C++. + +## Objectives + +### Goals and Non-Goals +- Easy(ier) to use than raw Vulkan. +- Clear, understandable code. +- Easy to iterate, follow the flow. +- Well documented behavior. diff --git a/vcpkg-configuration.json b/vcpkg-configuration.json new file mode 100644 index 0000000..ab94008 --- /dev/null +++ b/vcpkg-configuration.json @@ -0,0 +1,14 @@ +{ + "default-registry": { + "kind": "git", + "baseline": "f26ec398c25c4980f33a50391f00a75f7ad62ef7", + "repository": "https://github.com/microsoft/vcpkg" + }, + "registries": [ + { + "kind": "artifact", + "location": "https://github.com/microsoft/vcpkg-ce-catalog/archive/refs/heads/main.zip", + "name": "microsoft" + } + ] +} \ No newline at end of file diff --git a/vcpkg.json b/vcpkg.json new file mode 100644 index 0000000..4e93083 --- /dev/null +++ b/vcpkg.json @@ -0,0 +1,10 @@ +{ + "dependencies": [ + "fmt", + "volk", + { + "name": "sdl3", + "features": [ "vulkan" ] + } + ] +} \ No newline at end of file