Skip to content

Commit

Permalink
Merge pull request #7 from Kataglyphis/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
Kataglyphis authored Nov 16, 2024
2 parents 09d38ed + 3e7fa8b commit 8a067ca
Show file tree
Hide file tree
Showing 114 changed files with 1,031 additions and 1,308 deletions.
22 changes: 10 additions & 12 deletions .github/workflows/Linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,20 @@ jobs:
run: sudo apt-get install libosmesa6-dev
- name: Prepare python env for sphynx
run: |
pip install sphinx
pip install sphinx-press-theme
pip install myst-parser
pip install -r requirements.txt
- name: Create docs
run: |
cd docs
make html
- name: 📂 Sync files to dev domain
uses: SamKirkland/[email protected]
with:
server: ${{ secrets.SERVER }}
username: ${{ secrets.USERNAME }}
password: ${{ secrets.PW }}
local-dir: "./docs/build/html"

- name: Install Vulkan
run: |
wget -qO- https://packages.lunarg.com/lunarg-signing-key-pub.asc | sudo tee /etc/apt/trusted.gpg.d/lunarg.asc
Expand Down Expand Up @@ -107,12 +114,3 @@ jobs:
name: codecov-umbrella # optional
fail_ci_if_error: false # optional (default = false)
verbose: false # optional (default = false)

- name: 📂 Sync files to dev domain
if: github.ref == 'refs/heads/dev'
uses: SamKirkland/[email protected]
with:
server: ${{ secrets.SERVER }}
username: ${{ secrets.DEV_USERNAME }}
password: ${{ secrets.DEV_PW }}
local-dir: "./docs/build/html"
10 changes: 8 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
dist/*
dist
.mypy_cache
.conda
build
*.profraw


# Prerequisites
*.d
Expand Down Expand Up @@ -43,4 +48,5 @@ out/*
Documents/doxygen/*

# cmake configure file
include/renderer/VulkanRendererConfig.hpp
Src/GraphicsEngineOpenGL/renderer/VulkanRendererConfig.hpp
Src/GraphicsEngineVulkan/renderer/OpenGLRendererConfig.hpp
26 changes: 1 addition & 25 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,27 +32,8 @@ add_subdirectory(ExternalLib)

add_subdirectory(Src)

# compile shaders as part of my cmake routine right away :)
include(cmake/CompileShadersToSPV.cmake)

foreach(Shader ${POST_SHADER_FILTER})
add_shader(${PROJECT_NAME} ${Shader})
endforeach()

foreach(Shader ${RAYTRACING_SHADER_FILTER})
add_shader(${PROJECT_NAME} ${Shader})
endforeach()

foreach(Shader ${RASTER_SHADER_FILTER})
add_shader(${PROJECT_NAME} ${Shader})
endforeach()

foreach(Shader ${PATH_TRACING_SHADER_FILTER})
add_shader(${PROJECT_NAME} ${Shader})
endforeach()

if(NOT WINDOWS_CI)
include(CTest)
include(CTest)
enable_testing()
message(STATUS "WINDOWS_CI is OFF or not defined.")
else()
Expand Down Expand Up @@ -80,11 +61,6 @@ install(
install(DIRECTORY Resources/ DESTINATION Resources/)
install(DIRECTORY ExternalLib/IMGUI/misc/fonts/ DESTINATION ExternalLib/IMGUI/misc/fonts/)

# we are using this dir strings for removing hard coded file locations
# at c++ side
configure_file(VulkanRendererConfig.hpp.in "${CMAKE_CURRENT_SOURCE_DIR}/include/renderer/VulkanRendererConfig.hpp")
configure_file(OpenGLRendererConfig.hpp.in "${CMAKE_CURRENT_SOURCE_DIR}/Src/GraphicsEngineOpenGL/renderer/OpenGLRendererConfig.hpp")

include(InstallRequiredSystemLibraries)

include(cmake/CPackOptions.cmake)
Expand Down
48 changes: 45 additions & 3 deletions CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,25 @@
"rhs": "Linux"
}
},
{
"name": "linux-RelWithDebInfo-GNU",
"displayName": "Linux RelWithDebInfo GNU",
"description": "Go with Linux",
"generator": "Ninja",
"binaryDir": "${sourceDir}/build/",
"installDir": "${sourceDir}/build/",
"cacheVariables": {
"CMAKE_VERBOSE_MAKEFILE": "ON",
"CMAKE_BUILD_TYPE": "RelWithDebInfo",
"CMAKE_C_COMPILER": "gcc",
"CMAKE_CXX_COMPILER": "g++"
},
"condition": {
"type": "equals",
"lhs": "${hostSystemName}",
"rhs": "Linux"
}
},
{
"name": "linux-release-GNU",
"displayName": "Linux Release GNU",
Expand All @@ -102,15 +121,38 @@
}
},
{
"name": "x64-MSVC-Windows",
"description": "Windows and standard MSVC",
"name": "x64-MSVC-Windows-Debug",
"description": "Windows and standard MSVC - Debug",
"generator": "Visual Studio 17 2022",
"binaryDir": "${sourceDir}/build/",
"installDir": "${sourceDir}/build/",
"cacheVariables": {
"CMAKE_VERBOSE_MAKEFILE": "ON",
"CMAKE_C_COMPILER": "cl",
"CMAKE_CXX_COMPILER": "cl",
"CMAKE_BUILD_TYPE": "Debug"
},
"condition": {
"type": "equals",
"lhs": "${hostSystemName}",
"rhs": "Windows"
},
"architecture": {
"value": "x64",
"strategy": "set"
}
},
{
"name": "x64-MSVC-Windows-Release",
"description": "Windows and standard MSVC - Release",
"generator": "Visual Studio 17 2022",
"binaryDir": "${sourceDir}/build/",
"installDir": "${sourceDir}/build/",
"cacheVariables": {
"CMAKE_VERBOSE_MAKEFILE": "ON",
"CMAKE_C_COMPILER": "cl",
"CMAKE_CXX_COMPILER": "cl"
"CMAKE_CXX_COMPILER": "cl",
"CMAKE_BUILD_TYPE": "Release"
},
"condition": {
"type": "equals",
Expand Down
14 changes: 4 additions & 10 deletions ExternalLib/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
include(FetchContent)

# hotfix for issue:
# https://github.com/google/benchmark/pull/1875
add_compile_options(-Wno-c++17-attribute-extensions)

# include google test to project
FetchContent_Declare(
googletest
Expand All @@ -24,12 +20,6 @@ set(BENCHMARK_USE_BUNDLED_GTEST OFF CACHE BOOL "Disable the bundled GTest usage.

add_subdirectory(GOOGLE_BENCHMARK)

# hotfix for issue:
# https://github.com/google/benchmark/pull/1875
target_compile_options(benchmark INTERFACE -Wno-c++17-attribute-extensions)
target_compile_options(benchmark_main INTERFACE -Wno-c++17-attribute-extensions)


if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
message(STATUS "This is a Linux system.")
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES ".*Clang")
Expand Down Expand Up @@ -88,6 +78,10 @@ target_include_directories(ktx SYSTEM

add_subdirectory(GLFW)

if(myproject_DISABLE_EXCEPTIONS)
set(SPDLOG_NO_EXCEPTIONS ON CACHE BOOL "Disable SPDLOG exceptions.")
endif()

add_subdirectory(SPDLOG)

add_subdirectory(NLOHMANN_JSON)
Expand Down
2 changes: 1 addition & 1 deletion ExternalLib/VULKAN_MEMORY_ALLOCATOR
14 changes: 13 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<br>
<a href="https://jonasheinle.de"><img src="images/logo.png" alt="VulkanEngine" width="200"></a>
<br>
Cataglyphis Renderer
Kataglyphis-Renderer
<br>
</h1>

Expand All @@ -16,13 +16,16 @@

<h4 align="center">A graphics engine built on top of Vulkan+OpenGL <a href="https://jonasheinle.de" target="_blank"></a>.</h4>

(see also [**__Official homepage__**](https://kataglyphisrenderer.jonasheinle.de))

[![Linux build + tests + code coverage](https://github.com/Kataglyphis/GraphicsEngineVulkan/actions/workflows/Linux.yml/badge.svg)](https://github.com/Kataglyphis/GraphicsEngineVulkan/actions/workflows/Linux.yml)
[![Windows build](https://github.com/Kataglyphis/GraphicsEngineVulkan/actions/workflows/Windows.yml/badge.svg)](https://github.com/Kataglyphis/GraphicsEngineVulkan/actions/workflows/Windows.yml)
[![TopLang](https://img.shields.io/github/languages/top/Kataglyphis/GraphicsEngineVulkan)]()
[![Donate](https://img.shields.io/badge/Donate-PayPal-green.svg)](https://www.paypal.com/donate/?hosted_button_id=BX9AVVES2P9LN)
[![Twitter](https://img.shields.io/twitter/follow/Cataglyphis_?style=social)](https://twitter.com/Cataglyphis_)
[![YouTube](https://img.shields.io/youtube/channel/subscribers/UC3LZiH4sZzzaVBCUV8knYeg?style=social)](https://www.youtube.com/channel/UC3LZiH4sZzzaVBCUV8knYeg)

[**__Official homepage__**](https://kataglyphisrenderer.jonasheinle.de)

<p align="center">
<a href="#key-features">Key Features</a> •
Expand Down Expand Up @@ -246,6 +249,15 @@ cmake-format -c ./.cmake-format.yaml -i $(find cmake -name '*.cmake' -o -name 'C
clang-format -i $(find include -name "*.cpp" -or -name "*.h" -or -name "*.hpp")
```

# Docs
Build the docs
```bash
pip install sphinx
pip install sphinx-press-theme
pip install myst-parser
cd docs
make html
```
<!-- ROADMAP -->
## Roadmap
Watch the refman generated by doxygen. <br/>
Expand Down
Binary file modified Resources/Shaders/post/spv/post.frag.spv
Binary file not shown.
Binary file modified Resources/Shaders/post/spv/post.vert.spv
Binary file not shown.
Binary file not shown.
6 changes: 3 additions & 3 deletions Resources/Shaders/rasterizer/shader.vert
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@

#include "../hostDevice/host_device_shared_vars.hpp"

#include "../../../include/renderer/GlobalUBO.hpp"
#include "../../../include/renderer/SceneUBO.hpp"
#include "../../../Src/GraphicsEngineVulkan/renderer/GlobalUBO.hpp"
#include "../../../Src/GraphicsEngineVulkan/renderer/SceneUBO.hpp"

#include "../../../include/renderer/pushConstants/PushConstantRasterizer.hpp"
#include "../../../Src/GraphicsEngineVulkan/renderer/pushConstants/PushConstantRasterizer.hpp"

layout (location = 0) in vec3 positions;
layout (location = 1) in vec3 normal;
Expand Down
Binary file modified Resources/Shaders/rasterizer/spv/shader.frag.spv
Binary file not shown.
Binary file modified Resources/Shaders/rasterizer/spv/shader.vert.spv
Binary file not shown.
Binary file not shown.
10 changes: 10 additions & 0 deletions Src/GraphicsEngineOpenGL/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,16 @@ add_executable(
${COMMON_FILTER}
${APP_FILTER})

if(NOT MSVC)
target_compile_definitions(${OpenGlEnigneTargetName} PRIVATE RELATIVE_RESOURCE_PATH="/../Resources/")
else()
target_compile_definitions(${OpenGlEnigneTargetName} PRIVATE RELATIVE_RESOURCE_PATH="/../../Resources/")
endif()

# we are using this dir strings for removing hard coded file locations
# at c++ side
configure_file(OpenGLRendererConfig.hpp.in "renderer/OpenGLRendererConfig.hpp")

target_include_directories(
${OpenGlEnigneTargetName}
PUBLIC ${PROJECT_INCLUDE_DIR}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,4 @@
#define OPENGL_VERSION_MAJOR "@OPENGL_VERSION_MAJOR@"
#define OPENGL_VERSION_MINOR "@OPENGL_VERSION_MINOR@"

// change this path when installing
// "${CMAKE_CURRENT_SOURCE_DIR}/Resources/"
#define RELATIVE_RESOURCE_PATH "/../Resources/"

#endif
4 changes: 0 additions & 4 deletions Src/GraphicsEngineOpenGL/renderer/OpenGLRendererConfig.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,4 @@
#define OPENGL_VERSION_MAJOR "4"
#define OPENGL_VERSION_MINOR "6"

// change this path when installing
// "/home/jones/GraphicsEngineVulkan/Resources/"
#define RELATIVE_RESOURCE_PATH "/../Resources/"

#endif
14 changes: 12 additions & 2 deletions Src/GraphicsEngineOpenGL/renderer/ShaderIncludes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,18 @@
#include <filesystem>

#include "File.hpp"
#include "spdlog/spdlog.h"

// this method is setting all files we want to use in a shader per #include
// you have to specify the name(how file appears in shader)
// and its actual file location relatively
// https://www.khronos.org/registry/OpenGL/extensions/ARB/ARB_shading_language_include.txt
ShaderIncludes::ShaderIncludes() {
assert(includeNames.size() == file_locations_relative.size());

if (!isExtensionSupported("GL_ARB_shading_language_include")) {
spdlog::error("GL_ARB_shading_language_include is supported!");
}

std::vector<std::string> file_locations_abs;
for (uint32_t i = 0; i < static_cast<uint32_t>(includeNames.size()); i++) {
Expand All @@ -34,8 +39,13 @@ ShaderIncludes::ShaderIncludes() {
for (uint32_t i = 0; i < static_cast<uint32_t>(includeNames.size()); i++) {
File file(file_locations_abs[i]);
std::string file_content = file.read();
char tmpstr[200];
snprintf(tmpstr, 200, "/%s", includeNames[i]);
char tmpstr[2000];
snprintf(tmpstr, 2000, "/%s", includeNames[i]);
if (glNamedStringARB) {
spdlog::info("glNamedStringARB successfully loaded!");
} else {
spdlog::error("Failed to load glNamedStringARB!");
}
glNamedStringARB(GL_SHADER_INCLUDE_ARB, static_cast<GLint>(strlen(tmpstr)),
tmpstr, static_cast<GLint>(strlen(file_content.c_str())),
file_content.c_str());
Expand Down
14 changes: 14 additions & 0 deletions Src/GraphicsEngineOpenGL/renderer/ShaderIncludes.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#pragma once

#include <vector>
#include <string>
#include <glad/glad.h>

// https://www.khronos.org/registry/OpenGL/extensions/ARB/ARB_shading_language_include.txt
class ShaderIncludes {
Expand All @@ -10,6 +12,18 @@ class ShaderIncludes {
~ShaderIncludes();

private:
bool isExtensionSupported(const std::string& extension) {
GLint numExtensions = 0;
glGetIntegerv(GL_NUM_EXTENSIONS, &numExtensions);

for (int i = 0; i < numExtensions; ++i) {
const char* ext = reinterpret_cast<const char*>(glGetStringi(GL_EXTENSIONS, i));
if (extension == ext) {
return true;
}
}
return false;
}
std::vector<const char*> includeNames = {
"host_device_shared.hpp", "Matlib.glsl", "microfacet.glsl",
"ShadingLibrary.glsl", "disney.glsl", "frostbite.glsl",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include <iostream>

#include "bindings.hpp"
#include "spdlog/spdlog.h"

CascadedShadowMap::CascadedShadowMap()
:
Expand Down Expand Up @@ -46,8 +47,7 @@ bool CascadedShadowMap::init(GLuint width, GLuint height, GLuint num_cascades) {

int status = glCheckFramebufferStatus(GL_FRAMEBUFFER);
if (status != GL_FRAMEBUFFER_COMPLETE) {
std::cout << "ERROR::FRAMEBUFFER:: Framebuffer is not complete!";
throw 0;
spdlog::error("ERROR::FRAMEBUFFER:: Framebuffer is not complete!");
}

glBindFramebuffer(GL_FRAMEBUFFER, 0);
Expand Down
Loading

0 comments on commit 8a067ca

Please sign in to comment.