Skip to content

Commit 8a067ca

Browse files
authored
Merge pull request #7 from Kataglyphis/develop
Develop
2 parents 09d38ed + 3e7fa8b commit 8a067ca

File tree

114 files changed

+1031
-1308
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

114 files changed

+1031
-1308
lines changed

.github/workflows/Linux.yml

+10-12
Original file line numberDiff line numberDiff line change
@@ -50,13 +50,20 @@ jobs:
5050
run: sudo apt-get install libosmesa6-dev
5151
- name: Prepare python env for sphynx
5252
run: |
53-
pip install sphinx
54-
pip install sphinx-press-theme
55-
pip install myst-parser
53+
pip install -r requirements.txt
5654
- name: Create docs
5755
run: |
5856
cd docs
5957
make html
58+
59+
- name: 📂 Sync files to dev domain
60+
uses: SamKirkland/[email protected]
61+
with:
62+
server: ${{ secrets.SERVER }}
63+
username: ${{ secrets.USERNAME }}
64+
password: ${{ secrets.PW }}
65+
local-dir: "./docs/build/html"
66+
6067
- name: Install Vulkan
6168
run: |
6269
wget -qO- https://packages.lunarg.com/lunarg-signing-key-pub.asc | sudo tee /etc/apt/trusted.gpg.d/lunarg.asc
@@ -107,12 +114,3 @@ jobs:
107114
name: codecov-umbrella # optional
108115
fail_ci_if_error: false # optional (default = false)
109116
verbose: false # optional (default = false)
110-
111-
- name: 📂 Sync files to dev domain
112-
if: github.ref == 'refs/heads/dev'
113-
uses: SamKirkland/[email protected]
114-
with:
115-
server: ${{ secrets.SERVER }}
116-
username: ${{ secrets.DEV_USERNAME }}
117-
password: ${{ secrets.DEV_PW }}
118-
local-dir: "./docs/build/html"

.gitignore

+8-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
1-
dist/*
1+
dist
2+
.mypy_cache
3+
.conda
4+
build
5+
*.profraw
6+
27

38
# Prerequisites
49
*.d
@@ -43,4 +48,5 @@ out/*
4348
Documents/doxygen/*
4449

4550
# cmake configure file
46-
include/renderer/VulkanRendererConfig.hpp
51+
Src/GraphicsEngineOpenGL/renderer/VulkanRendererConfig.hpp
52+
Src/GraphicsEngineVulkan/renderer/OpenGLRendererConfig.hpp

CMakeLists.txt

+1-25
Original file line numberDiff line numberDiff line change
@@ -32,27 +32,8 @@ add_subdirectory(ExternalLib)
3232

3333
add_subdirectory(Src)
3434

35-
# compile shaders as part of my cmake routine right away :)
36-
include(cmake/CompileShadersToSPV.cmake)
37-
38-
foreach(Shader ${POST_SHADER_FILTER})
39-
add_shader(${PROJECT_NAME} ${Shader})
40-
endforeach()
41-
42-
foreach(Shader ${RAYTRACING_SHADER_FILTER})
43-
add_shader(${PROJECT_NAME} ${Shader})
44-
endforeach()
45-
46-
foreach(Shader ${RASTER_SHADER_FILTER})
47-
add_shader(${PROJECT_NAME} ${Shader})
48-
endforeach()
49-
50-
foreach(Shader ${PATH_TRACING_SHADER_FILTER})
51-
add_shader(${PROJECT_NAME} ${Shader})
52-
endforeach()
53-
5435
if(NOT WINDOWS_CI)
55-
include(CTest)
36+
include(CTest)
5637
enable_testing()
5738
message(STATUS "WINDOWS_CI is OFF or not defined.")
5839
else()
@@ -80,11 +61,6 @@ install(
8061
install(DIRECTORY Resources/ DESTINATION Resources/)
8162
install(DIRECTORY ExternalLib/IMGUI/misc/fonts/ DESTINATION ExternalLib/IMGUI/misc/fonts/)
8263

83-
# we are using this dir strings for removing hard coded file locations
84-
# at c++ side
85-
configure_file(VulkanRendererConfig.hpp.in "${CMAKE_CURRENT_SOURCE_DIR}/include/renderer/VulkanRendererConfig.hpp")
86-
configure_file(OpenGLRendererConfig.hpp.in "${CMAKE_CURRENT_SOURCE_DIR}/Src/GraphicsEngineOpenGL/renderer/OpenGLRendererConfig.hpp")
87-
8864
include(InstallRequiredSystemLibraries)
8965

9066
include(cmake/CPackOptions.cmake)

CMakePresets.json

+45-3
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,25 @@
8282
"rhs": "Linux"
8383
}
8484
},
85+
{
86+
"name": "linux-RelWithDebInfo-GNU",
87+
"displayName": "Linux RelWithDebInfo GNU",
88+
"description": "Go with Linux",
89+
"generator": "Ninja",
90+
"binaryDir": "${sourceDir}/build/",
91+
"installDir": "${sourceDir}/build/",
92+
"cacheVariables": {
93+
"CMAKE_VERBOSE_MAKEFILE": "ON",
94+
"CMAKE_BUILD_TYPE": "RelWithDebInfo",
95+
"CMAKE_C_COMPILER": "gcc",
96+
"CMAKE_CXX_COMPILER": "g++"
97+
},
98+
"condition": {
99+
"type": "equals",
100+
"lhs": "${hostSystemName}",
101+
"rhs": "Linux"
102+
}
103+
},
85104
{
86105
"name": "linux-release-GNU",
87106
"displayName": "Linux Release GNU",
@@ -102,15 +121,38 @@
102121
}
103122
},
104123
{
105-
"name": "x64-MSVC-Windows",
106-
"description": "Windows and standard MSVC",
124+
"name": "x64-MSVC-Windows-Debug",
125+
"description": "Windows and standard MSVC - Debug",
126+
"generator": "Visual Studio 17 2022",
127+
"binaryDir": "${sourceDir}/build/",
128+
"installDir": "${sourceDir}/build/",
129+
"cacheVariables": {
130+
"CMAKE_VERBOSE_MAKEFILE": "ON",
131+
"CMAKE_C_COMPILER": "cl",
132+
"CMAKE_CXX_COMPILER": "cl",
133+
"CMAKE_BUILD_TYPE": "Debug"
134+
},
135+
"condition": {
136+
"type": "equals",
137+
"lhs": "${hostSystemName}",
138+
"rhs": "Windows"
139+
},
140+
"architecture": {
141+
"value": "x64",
142+
"strategy": "set"
143+
}
144+
},
145+
{
146+
"name": "x64-MSVC-Windows-Release",
147+
"description": "Windows and standard MSVC - Release",
107148
"generator": "Visual Studio 17 2022",
108149
"binaryDir": "${sourceDir}/build/",
109150
"installDir": "${sourceDir}/build/",
110151
"cacheVariables": {
111152
"CMAKE_VERBOSE_MAKEFILE": "ON",
112153
"CMAKE_C_COMPILER": "cl",
113-
"CMAKE_CXX_COMPILER": "cl"
154+
"CMAKE_CXX_COMPILER": "cl",
155+
"CMAKE_BUILD_TYPE": "Release"
114156
},
115157
"condition": {
116158
"type": "equals",

ExternalLib/CMakeLists.txt

+4-10
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
include(FetchContent)
22

3-
# hotfix for issue:
4-
# https://github.com/google/benchmark/pull/1875
5-
add_compile_options(-Wno-c++17-attribute-extensions)
6-
73
# include google test to project
84
FetchContent_Declare(
95
googletest
@@ -24,12 +20,6 @@ set(BENCHMARK_USE_BUNDLED_GTEST OFF CACHE BOOL "Disable the bundled GTest usage.
2420

2521
add_subdirectory(GOOGLE_BENCHMARK)
2622

27-
# hotfix for issue:
28-
# https://github.com/google/benchmark/pull/1875
29-
target_compile_options(benchmark INTERFACE -Wno-c++17-attribute-extensions)
30-
target_compile_options(benchmark_main INTERFACE -Wno-c++17-attribute-extensions)
31-
32-
3323
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
3424
message(STATUS "This is a Linux system.")
3525
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES ".*Clang")
@@ -88,6 +78,10 @@ target_include_directories(ktx SYSTEM
8878

8979
add_subdirectory(GLFW)
9080

81+
if(myproject_DISABLE_EXCEPTIONS)
82+
set(SPDLOG_NO_EXCEPTIONS ON CACHE BOOL "Disable SPDLOG exceptions.")
83+
endif()
84+
9185
add_subdirectory(SPDLOG)
9286

9387
add_subdirectory(NLOHMANN_JSON)

README.md

+13-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<br>
33
<a href="https://jonasheinle.de"><img src="images/logo.png" alt="VulkanEngine" width="200"></a>
44
<br>
5-
Cataglyphis Renderer
5+
Kataglyphis-Renderer
66
<br>
77
</h1>
88

@@ -16,13 +16,16 @@
1616

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

19+
(see also [**__Official homepage__**](https://kataglyphisrenderer.jonasheinle.de))
20+
1921
[![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)
2022
[![Windows build](https://github.com/Kataglyphis/GraphicsEngineVulkan/actions/workflows/Windows.yml/badge.svg)](https://github.com/Kataglyphis/GraphicsEngineVulkan/actions/workflows/Windows.yml)
2123
[![TopLang](https://img.shields.io/github/languages/top/Kataglyphis/GraphicsEngineVulkan)]()
2224
[![Donate](https://img.shields.io/badge/Donate-PayPal-green.svg)](https://www.paypal.com/donate/?hosted_button_id=BX9AVVES2P9LN)
2325
[![Twitter](https://img.shields.io/twitter/follow/Cataglyphis_?style=social)](https://twitter.com/Cataglyphis_)
2426
[![YouTube](https://img.shields.io/youtube/channel/subscribers/UC3LZiH4sZzzaVBCUV8knYeg?style=social)](https://www.youtube.com/channel/UC3LZiH4sZzzaVBCUV8knYeg)
2527

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

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

252+
# Docs
253+
Build the docs
254+
```bash
255+
pip install sphinx
256+
pip install sphinx-press-theme
257+
pip install myst-parser
258+
cd docs
259+
make html
260+
```
249261
<!-- ROADMAP -->
250262
## Roadmap
251263
Watch the refman generated by doxygen. <br/>
0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
Binary file not shown.

Resources/Shaders/rasterizer/shader.vert

+3-3
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@
1212

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

15-
#include "../../../include/renderer/GlobalUBO.hpp"
16-
#include "../../../include/renderer/SceneUBO.hpp"
15+
#include "../../../Src/GraphicsEngineVulkan/renderer/GlobalUBO.hpp"
16+
#include "../../../Src/GraphicsEngineVulkan/renderer/SceneUBO.hpp"
1717

18-
#include "../../../include/renderer/pushConstants/PushConstantRasterizer.hpp"
18+
#include "../../../Src/GraphicsEngineVulkan/renderer/pushConstants/PushConstantRasterizer.hpp"
1919

2020
layout (location = 0) in vec3 positions;
2121
layout (location = 1) in vec3 normal;
84 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
Binary file not shown.

Src/GraphicsEngineOpenGL/CMakeLists.txt

+10
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,16 @@ add_executable(
4747
${COMMON_FILTER}
4848
${APP_FILTER})
4949

50+
if(NOT MSVC)
51+
target_compile_definitions(${OpenGlEnigneTargetName} PRIVATE RELATIVE_RESOURCE_PATH="/../Resources/")
52+
else()
53+
target_compile_definitions(${OpenGlEnigneTargetName} PRIVATE RELATIVE_RESOURCE_PATH="/../../Resources/")
54+
endif()
55+
56+
# we are using this dir strings for removing hard coded file locations
57+
# at c++ side
58+
configure_file(OpenGLRendererConfig.hpp.in "renderer/OpenGLRendererConfig.hpp")
59+
5060
target_include_directories(
5161
${OpenGlEnigneTargetName}
5262
PUBLIC ${PROJECT_INCLUDE_DIR}

OpenGLRendererConfig.hpp.in renamed to Src/GraphicsEngineOpenGL/OpenGLRendererConfig.hpp.in

-4
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,4 @@
99
#define OPENGL_VERSION_MAJOR "@OPENGL_VERSION_MAJOR@"
1010
#define OPENGL_VERSION_MINOR "@OPENGL_VERSION_MINOR@"
1111

12-
// change this path when installing
13-
// "${CMAKE_CURRENT_SOURCE_DIR}/Resources/"
14-
#define RELATIVE_RESOURCE_PATH "/../Resources/"
15-
1612
#endif

Src/GraphicsEngineOpenGL/renderer/OpenGLRendererConfig.hpp

-4
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,4 @@
99
#define OPENGL_VERSION_MAJOR "4"
1010
#define OPENGL_VERSION_MINOR "6"
1111

12-
// change this path when installing
13-
// "/home/jones/GraphicsEngineVulkan/Resources/"
14-
#define RELATIVE_RESOURCE_PATH "/../Resources/"
15-
1612
#endif

Src/GraphicsEngineOpenGL/renderer/ShaderIncludes.cpp

+12-2
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,18 @@
1313
#include <filesystem>
1414

1515
#include "File.hpp"
16+
#include "spdlog/spdlog.h"
1617

1718
// this method is setting all files we want to use in a shader per #include
1819
// you have to specify the name(how file appears in shader)
1920
// and its actual file location relatively
2021
// https://www.khronos.org/registry/OpenGL/extensions/ARB/ARB_shading_language_include.txt
2122
ShaderIncludes::ShaderIncludes() {
2223
assert(includeNames.size() == file_locations_relative.size());
24+
25+
if (!isExtensionSupported("GL_ARB_shading_language_include")) {
26+
spdlog::error("GL_ARB_shading_language_include is supported!");
27+
}
2328

2429
std::vector<std::string> file_locations_abs;
2530
for (uint32_t i = 0; i < static_cast<uint32_t>(includeNames.size()); i++) {
@@ -34,8 +39,13 @@ ShaderIncludes::ShaderIncludes() {
3439
for (uint32_t i = 0; i < static_cast<uint32_t>(includeNames.size()); i++) {
3540
File file(file_locations_abs[i]);
3641
std::string file_content = file.read();
37-
char tmpstr[200];
38-
snprintf(tmpstr, 200, "/%s", includeNames[i]);
42+
char tmpstr[2000];
43+
snprintf(tmpstr, 2000, "/%s", includeNames[i]);
44+
if (glNamedStringARB) {
45+
spdlog::info("glNamedStringARB successfully loaded!");
46+
} else {
47+
spdlog::error("Failed to load glNamedStringARB!");
48+
}
3949
glNamedStringARB(GL_SHADER_INCLUDE_ARB, static_cast<GLint>(strlen(tmpstr)),
4050
tmpstr, static_cast<GLint>(strlen(file_content.c_str())),
4151
file_content.c_str());

Src/GraphicsEngineOpenGL/renderer/ShaderIncludes.hpp

+14
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
#pragma once
22

33
#include <vector>
4+
#include <string>
5+
#include <glad/glad.h>
46

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

1214
private:
15+
bool isExtensionSupported(const std::string& extension) {
16+
GLint numExtensions = 0;
17+
glGetIntegerv(GL_NUM_EXTENSIONS, &numExtensions);
18+
19+
for (int i = 0; i < numExtensions; ++i) {
20+
const char* ext = reinterpret_cast<const char*>(glGetStringi(GL_EXTENSIONS, i));
21+
if (extension == ext) {
22+
return true;
23+
}
24+
}
25+
return false;
26+
}
1327
std::vector<const char*> includeNames = {
1428
"host_device_shared.hpp", "Matlib.glsl", "microfacet.glsl",
1529
"ShadingLibrary.glsl", "disney.glsl", "frostbite.glsl",

Src/GraphicsEngineOpenGL/scene/light/directional_light/CascadedShadowMap.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
#include <iostream>
44

55
#include "bindings.hpp"
6+
#include "spdlog/spdlog.h"
67

78
CascadedShadowMap::CascadedShadowMap()
89
:
@@ -46,8 +47,7 @@ bool CascadedShadowMap::init(GLuint width, GLuint height, GLuint num_cascades) {
4647

4748
int status = glCheckFramebufferStatus(GL_FRAMEBUFFER);
4849
if (status != GL_FRAMEBUFFER_COMPLETE) {
49-
std::cout << "ERROR::FRAMEBUFFER:: Framebuffer is not complete!";
50-
throw 0;
50+
spdlog::error("ERROR::FRAMEBUFFER:: Framebuffer is not complete!");
5151
}
5252

5353
glBindFramebuffer(GL_FRAMEBUFFER, 0);

0 commit comments

Comments
 (0)