Jackalope / jen (public) (License: GPLv3 or later version) (since 2018-10-24) (hash sha1)
----> ABOUT:

3D rendering and computing framework based on Vulkan API.

Libraries:
- simdcpp submodule (see my simdcpp repo)
- jmath submodule (see my jmath repo)
- mesh (constexpr generation of cubes, spheres, icosahedrons subdivisions)
- atlas (1D lines and 2D rectangles cutting)
- jlib submodule (see my jlib repo)
- jrf submodule (see my jrf repo)
- vkw (Vulkan API C++ wrapper)
Modules:
- compute (run compute shaders on gpu)
- graphics (draw models with clustered forward rendering and onscreen text)
- resource manager (load meshes, models, textures, scene data from
files and create related objects in graphics module)

----> INSTALLING:

To download all the parts of this framework it's enough to launch
git clone with recursive flag:

$ git clone —recursive ssh://rocketgit@ssh.rocketgit.com/user/Jackalope/jen

After this look at git tags:

$ git tag

It is recommended to use a tagged version instead of the latest commit,
because the first commit after the tagged one mostly includes incompatible
parts of future changes for the next version.

$ git checkout v0.1.0

----> DEPENDENCIES:

To use JEN as CMake subdirectory and successfully build programs with it
you need to make sure you have all of its dependencies:
- compiler: Clang or GCC, support for C++17. Clang 10+ or GCC 9+ is recommended,
compiling on Windows OS is tricky and requires something like MinGW with MSYS,
there are also some complications to go through to make dependencies work;
- GLFW3 library, supported version is 3.2.1;
- FreeType library, if graphics module will be used;
- Vulkan API headers, and optional validation layers to debug sneaky problems,
you also need Vulkan support in your graphics driver to run compiled programs;
- LibZip can be necessary, if JRF is used to read zip files;
- CMake, for obvious reasons;
- glslangValidator to compile shader for the graphics module.

CMake must be able to find GLFW3, Vulkan and FreeType (for graphics)
with find_package().

----> HOW TO USE IT:

To use JEN, you need to add it as a subdirectory:

add_subdirecroty(${PATH_TO_JEN})

There are several configuration options:
- JEN_MODULE_COMPUTE - turn compute module on for compiling and including;
- JEN_MODULE_GRAPHICS - turn graphics module on ...;
- JEN_MULTITHREADED_DRAW_FRAME - draw_frame function will use thread pool queue
instead of linear executing;
- JEN_MODULE_RESOURCE_MANAGER - resource manager module ON, if graphics is ON;
- JEN_VLK_VALIDATION - enable Vulkan Validation Layers to debug some errors
related to JEN. This will often produce false-positive,
as well as true-positive errors.

Look in CMakeLists.txt at JenExamples repo for details on how to use and
configure JEN automatically:

$ git clone ssh://rocketgit@ssh.rocketgit.com/user/Jackalope/JenExamples

Also I recommend to compile and run examples to make sure it works correctly.

----> SUPPORTED HARDWARE:

JEN has not been tested well, because it requires running it on large amount of
different hardware to do so. It must work with mesa driver and modern
Intel i965 GPUs as well as AMD GPUs.


----> DOCUMENTATION:

You can generate Doxygen documentation, to do so
turn on any of JEN_DOXYGEN_* options and run documentation target in cmake:

$ cmake -G %1 -DJEN_DOXYGEN_HTML=ON -DJEN_DOXYGEN_LATEX=ON
$ cmake —build —target documentation

Resource manager is not documented because it still requires large enhancements.
List of commits:
Subject Hash Author Date (UTC)
GCC Compatibility. c828a38456627d0383d431165b802f97fd303349 Jackalope 2020-05-29 16:48:24
Solved clang compiler warnings from compute module. b9416237761f8648bbddb7e7ba59e833a7879528 Jackalope 2020-05-28 11:09:55
CMake: two shaders targets, instead of single target per shader. a708650319e44c7b98056f3bc85a896dd65d96f3 Jackalope 2020-05-28 11:06:13
Reduced amount of warnings. 18bf33ca4e0e7f0369f6b5fdc59b81a8420dde8e Jackalope 2020-05-27 15:11:37
Replace jl::rarray with generic structure in shader header file. 1cedb5886becc0f70c19d1c649e96f7eac5e0037 Jackalope 2020-05-27 13:07:31
Embedding shaders in obj library. e877e7a688ee4a899480c12acba55c340622f993 Jackalope 2020-05-27 12:40:34
Update jlib 0.3.0 (refactoring of threads, new thread pool). 1c713a320ced91d0ad5f1606c39f1187871d28e5 Jackalope 2020-05-26 14:44:35
Update graphics after change of "wait for monitor" flag. 29d9b749c803646006b9b0071b54256bd3c08ca8 Jackalope 2020-05-26 14:40:34
reduced number of -Wno* warnings bf3ec94ce3020715e246107a47efc9a8772db382 Jackalope 2020-05-25 01:48:40
Disable "find_package(jlib 0.2.0 REQUIRED)" in jrf b4903e20d9128227163119fe73e32cda5050cb67 Jackalope 2020-05-24 16:40:26
Update jrf-0.2.1 3518adb37045d4e4eb4488c8c07e3f674f5fbac3 Jackalope 2020-05-24 14:33:14
Update jrf-0.2.0 8720e50ca5f692a96ba764cab1a250683c6a0c59 Jackalope 2020-05-24 13:42:55
Update jlib-0.2.0 98c73665c12797a530d12e34dc764e72a8767ad1 Jackalope 2020-05-24 00:32:02
Mistake in CMake option 112275a2e0bc8619612ab49d808daeeeb599b8de Jackalope 2020-05-24 00:11:04
Device selection settings: 1. First suitable. 2. User can select with stdin/stdout. 3. User function callback. adcfd55f60dfc6eea019f083019012a0b4aa8f02 Jackalope 2020-05-23 13:52:07
ModuleGraphics: fix for mip level computation was wrong because depth is ignored. 834ceab8e0ea99b6b8c25928c9f3be968679cff3 Jackalope 2020-05-21 11:57:26
Compute module. Image copy staging buffer size limit problem fixed by representing row image memory in staging buffer. 740d8bf1d12352b08da05a63957afcb508ea6fd5 Jackalope 2020-05-21 11:55:31
Math new types update d0069637df7a0f74a9492a2a2a2d7a33102afde6 Jackalope 2020-05-21 11:51:46
Checking for blit support and fix typo in texture write f1adac801689ee3f7905d2582ac26948260bb352 Jackalope 2020-05-20 18:39:36
Added VkFormat properties checks and fallbacks to follow specification rules. 3c38bb0e9916aea31ef796a53a024aa3111e1ec7 Jackalope 2020-05-19 17:42:59
Commit c828a38456627d0383d431165b802f97fd303349 - GCC Compatibility.
Author: Jackalope
Author date (UTC): 2020-05-29 16:48
Committer name: Jackalope
Committer date (UTC): 2020-05-29 16:55
Parent(s): b9416237761f8648bbddb7e7ba59e833a7879528
Signing key:
Tree: a36ae2b5688ca9d487889ea690cdb2cb0752ad68
File Lines added Lines deleted
include/jen/detail/gpu_image.h 1 1
libs/jlib 1 1
libs/math 1 1
libs/noise/noise_simplex.inl 25 18
libs/simdcpp 1 1
src/CMakeLists.txt 2 8
src/compute/cmd_unit.cpp 2 1
src/graphics/debug_overlay.cpp 4 1
src/graphics/draw_data/text_data/free_type.h 0 5
src/graphics/draw_data/text_data/glyphs.cpp 3 7
src/graphics/graphics.cpp 2 2
File include/jen/detail/gpu_image.h changed (mode: 100644) (index b1ce5b6..139df76)
... ... namespace jen
152 152 }; };
153 153
154 154 #define EXTERN_DEF(x) \ #define EXTERN_DEF(x) \
155 [[nodiscard]] extern template Result GpuImage<GpuImageMode:: x >:: \
155 extern template Result GpuImage<GpuImageMode:: x >:: \
156 156 init( Device*, \ init( Device*, \
157 157 const GpuImageInfo*, \ const GpuImageInfo*, \
158 158 const GpuImageViewInfo*, \ const GpuImageViewInfo*, \
File libs/jlib changed (mode: 160000) (index 616c945..8392eb8)
1 Subproject commit 616c945f21a8da901facc7363c3b204216776a1d
1 Subproject commit 8392eb800adc01d587d9f6ce962ad403f1e5c80c
File libs/math changed (mode: 160000) (index e1d8066..1225bb2)
1 Subproject commit e1d8066084bfcc83e9b9a06513324d50c1968dba
1 Subproject commit 1225bb2c0d6f2b44ae65e1ca54b87f036c75d919
File libs/noise/noise_simplex.inl changed (mode: 100755) (index e2e77da..a2011a5)
22 22
23 23 namespace noise::detail namespace noise::detail
24 24 { {
25 constexpr inline float binary_float(uint32_t bits) {
26 #ifdef __clang__
27 return __builtin_bit_cast(float, bits);
28 #elif __cplusplus > 201703L
29 #include <bit>
30 return std::bit_cast<float>(bits);
31 #else
32 return 1;
33 #endif
34 }
35
25 36 template<int32_t D> constexpr static const template<int32_t D> constexpr static const
26 37 float SKEW_CONST = (jm::sqrt(D+1.f) - 1) / D; float SKEW_CONST = (jm::sqrt(D+1.f) - 1) / D;
27 38 template<int32_t D> constexpr static const template<int32_t D> constexpr static const
 
... ... namespace noise::detail
29 40
30 41 template<SimplexRadius STO> constexpr static const template<SimplexRadius STO> constexpr static const
31 42 float SIMPLEX_R_p2 = 0.5f; float SIMPLEX_R_p2 = 0.5f;
32 template<> constexpr static const
43 template<> constexpr
33 44 float SIMPLEX_R_p2<SimplexRadius::VISUAL_QUALITY> = 0.6f; float SIMPLEX_R_p2<SimplexRadius::VISUAL_QUALITY> = 0.6f;
34 45
35 46 template<SimplexRadius STO, int D> constexpr static const template<SimplexRadius STO, int D> constexpr static const
36 47 float KERNEL_MAX = 1; float KERNEL_MAX = 1;
37
38 #define BINARY_FLOAT(value) __builtin_bit_cast(float, value)
39
40 48 // max(gradient(x)) * (max(1 - x*x,0)**4) // max(gradient(x)) * (max(1 - x*x,0)**4)
41 49 // max(gradient(x)) = x // max(gradient(x)) = x
42 50 // t = x * (max(1 - x*x,0)**4) // t = x * (max(1 - x*x,0)**4)
43 51 // max = 0.316406 // max = 0.316406
44 52 constexpr static const constexpr static const
45 float KERNEL_MAX_1D =
46 BINARY_FLOAT(0b111110101000100000000000000000);
53 float KERNEL_MAX_1D = binary_float(0b111110101000100000000000000000);
47 54
48 55 // max(gradient(x,y)) * (max(Radius - x*x - y*y,0)**4) // max(gradient(x,y)) * (max(Radius - x*x - y*y,0)**4)
49 56 // max(gradient(x,y)) = x, because y = 0 when direction (1,0) // max(gradient(x,y)) = x, because y = 0 when direction (1,0)
50 57 // t = x * (max(Radius - x*x,0)**4) // t = x * (max(Radius - x*x,0)**4)
51 58 // Radius = 0.6; max = 0.027790 // Radius = 0.6; max = 0.027790
52 59 // Radius = 0.5; max = 0.009771 // Radius = 0.5; max = 0.009771
53 template<> constexpr static const
60 template<> constexpr const
54 61 float KERNEL_MAX<SimplexRadius::VISUAL_QUALITY, 2> = float KERNEL_MAX<SimplexRadius::VISUAL_QUALITY, 2> =
55 BINARY_FLOAT(0b111100111000111010100101000000);
56 template<> constexpr static const
62 binary_float(0b111100111000111010100101000000);
63 template<> constexpr const
57 64 float KERNEL_MAX<SimplexRadius::NO_DISCONTINUITIES, 2> = float KERNEL_MAX<SimplexRadius::NO_DISCONTINUITIES, 2> =
58 BINARY_FLOAT(0b111100001000000001011101010110);
65 binary_float(0b111100001000000001011101010110);
59 66
60 67 //0.030494 max //0.030494 max
61 template<> constexpr static const
68 template<> constexpr const
62 69 float KERNEL_MAX<SimplexRadius::VISUAL_QUALITY, 3> = float KERNEL_MAX<SimplexRadius::VISUAL_QUALITY, 3> =
63 BINARY_FLOAT(0b111100111110100000000000000000);
70 binary_float(0b111100111110100000000000000000);
64 71 //0.013007 max //0.013007 max
65 template<> constexpr static const
72 template<> constexpr const
66 73 float KERNEL_MAX<SimplexRadius::NO_DISCONTINUITIES, 3> = float KERNEL_MAX<SimplexRadius::NO_DISCONTINUITIES, 3> =
67 BINARY_FLOAT(0b111100010101010001101101000000);
74 binary_float(0b111100010101010001101101000000);
68 75
69 76 //0.036283 max //0.036283 max
70 template<> constexpr static const
77 template<> constexpr const
71 78 float KERNEL_MAX<SimplexRadius::VISUAL_QUALITY, 4> = float KERNEL_MAX<SimplexRadius::VISUAL_QUALITY, 4> =
72 BINARY_FLOAT(0b111101000101001100000000000000);
79 binary_float(0b111101000101001100000000000000);
73 80 //0.015929 max //0.015929 max
74 template<> constexpr static const
81 template<> constexpr const
75 82 float KERNEL_MAX<SimplexRadius::NO_DISCONTINUITIES, 4> = float KERNEL_MAX<SimplexRadius::NO_DISCONTINUITIES, 4> =
76 BINARY_FLOAT(0b111100100000100111110111110110);
83 binary_float(0b111100100000100111110111110110);
77 84
78 85 #undef BINARY_FLOAT #undef BINARY_FLOAT
79 86 constexpr static const constexpr static const
File libs/simdcpp changed (mode: 160000) (index 83fc96e..78ec2e3)
1 Subproject commit 83fc96e82f62836e87911ee4e0f3d7d7304bc377
1 Subproject commit 78ec2e35ac07fc82f2daeb268d83696be4d83fcb
File src/CMakeLists.txt changed (mode: 100644) (index 78264fc..9de08b8)
... ... cmake_minimum_required(VERSION 3.5)
19 19
20 20 if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
21 21 set(JEN_COMPILE_OPTIONS set(JEN_COMPILE_OPTIONS
22 -Wall -Wextra
22 -Wall
23 -Wextra
23 24 -Wno-missing-field-initializers -Wno-missing-field-initializers
24 -Wno-unknown-pragmas
25 -Wno-ignored-attributes
26 -Wno-misleading-indentation
27 -Wno-pragmas
28 -Wno-switch-enum
29 -Wno-missing-braces
30 -Wno-zero-length-array
31 25 ) )
32 26 elseif (CMAKE_CXX_COMPILER_ID STREQUAL "Clang") elseif (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
33 27 set(JEN_COMPILE_OPTIONS set(JEN_COMPILE_OPTIONS
File src/compute/cmd_unit.cpp changed (mode: 100644) (index 476c617..b929579)
... ... compute(const ComputeInfo &info)
441 441 } }
442 442 cmd.cmd_set_pipeline(pipeline, vkw::BindPoint::COMPUTE); cmd.cmd_set_pipeline(pipeline, vkw::BindPoint::COMPUTE);
443 443 cmd.cmd_set_descr_sets(vkw::BindPoint::COMPUTE, pipelineLayout, set, 0); cmd.cmd_set_descr_sets(vkw::BindPoint::COMPUTE, pipelineLayout, set, 0);
444 cmd.cmd_dispatch(*reinterpret_cast<const vkw::Vector3D*>(&info.group_count));
444 auto &gc = info.group_count;
445 cmd.cmd_dispatch({gc.x,gc.y,gc.z});
445 446 res = cmd.end(); res = cmd.end();
446 447 if (res != VK_SUCCESS) if (res != VK_SUCCESS)
447 448 return res; return res;
File src/graphics/debug_overlay.cpp changed (mode: 100644) (index 451ee59..09a40fc)
17 17 * along with this library. If not, see <https://www.gnu.org/licenses/> * along with this library. If not, see <https://www.gnu.org/licenses/>
18 18 */ */
19 19 #include "debug_overlay.h" #include "debug_overlay.h"
20 #ifdef __clang__
21 #pragma clang diagnostic ignored "-Wfloat-equal"
22 #endif
20 23
21 24 // TODO use charconv // TODO use charconv
22 25 template<typename floating_t> template<typename floating_t>
 
... ... static bool float_to_str(floating_t num, uint32_t str[],
61 64 str[--i] = SPACE; str[--i] = SPACE;
62 65
63 66 i = dot_pos; i = dot_pos;
64 #pragma clang diagnostic ignored "-Wfloat-equal"
67
65 68 if (num != 0) if (num != 0)
66 69 { {
67 70 str[i] = DOT; str[i] = DOT;
File src/graphics/draw_data/text_data/free_type.h changed (mode: 100644) (index 3a6078b..5118086)
17 17 * along with this library. If not, see <https://www.gnu.org/licenses/> * along with this library. If not, see <https://www.gnu.org/licenses/>
18 18 */ */
19 19 #pragma once #pragma once
20
21 20 #include <cinttypes> #include <cinttypes>
22
23 #pragma clang diagnostic push
24 #pragma GCC diagnostic ignored "-Weverything"
25 21 extern "C" { extern "C" {
26 22 #include <ft2build.h> #include <ft2build.h>
27 23 #include FT_FREETYPE_H #include FT_FREETYPE_H
28 24 } }
29 #pragma clang diagnostic pop
30 25
31 26 namespace free_type namespace free_type
32 27 { {
File src/graphics/draw_data/text_data/glyphs.cpp changed (mode: 100644) (index 7db5684..26dbfda)
... ... fill_buffer(
162 162 GpuText *p_text) GpuText *p_text)
163 163 { {
164 164 using GM = jen::GlyphManager; using GM = jen::GlyphManager;
165 jm::v2i32 offset;
165 jm::v2i32 offset = {};
166 166 switch (layout) switch (layout)
167 167 { {
168 168 case TextLayout::LEFT: case TextLayout::LEFT:
 
... ... fill_buffer(
181 181 uint8_t *p_indices = p_vertices + GM::BOX_VER_SIZE * g_total_count; uint8_t *p_indices = p_vertices + GM::BOX_VER_SIZE * g_total_count;
182 182
183 183 for (uint16_t i = g_offset; i < g_offset + g_count; ++i) { for (uint16_t i = g_offset; i < g_offset + g_count; ++i) {
184 uint16_t g_i;
185 switch (layout) {
186 case TextLayout::LEFT : g_i = i; break;
187 case TextLayout::RIGHT : g_i = (g_count - 1) - i; break;
188 case TextLayout::CENTER: g_i = i; break;
189 }
184 uint16_t g_i = layout == TextLayout::RIGHT
185 ? (g_count - 1) - i : i;
190 186 if (ids[g_i] == UINT32_MAX) { if (ids[g_i] == UINT32_MAX) {
191 187 switch (layout) { switch (layout) {
192 188 case TextLayout::LEFT: case TextLayout::LEFT:
File src/graphics/graphics.cpp changed (mode: 100644) (index efead9f..d750a0e)
... ... cmd_secondary_texts(GraphicsData *p_g, vkw::CmdBuffer cmd) {
278 278 cmd.cmd_set_descr_sets(vkw::BindPoint::GRAPHICS, fonts.layout, cmd.cmd_set_descr_sets(vkw::BindPoint::GRAPHICS, fonts.layout,
279 279 fonts.atlas.descriptor.set); fonts.atlas.descriptor.set);
280 280
281 auto sc_half_extent = *reinterpret_cast<const jm::v2u32*>
282 (&stages.swap_chain.extent) / 2;
281 auto &sc_ex = stages.swap_chain.extent;
282 auto sc_half_extent = jm::v2u32{sc_ex.width, sc_ex.height} / 2;
283 283
284 284 jm::v2f scale = (jm::v2f{}+1) / jm::v2f::from(sc_half_extent); jm::v2f scale = (jm::v2f{}+1) / jm::v2f::from(sc_half_extent);
285 285 cmd.cmd_set_pushs(fonts.layout, {vkw::ShaderStage::VERTEX, 0, sizeof(scale)}, cmd.cmd_set_pushs(fonts.layout, {vkw::ShaderStage::VERTEX, 0, sizeof(scale)},
Hints:
Before first commit, do not forget to setup your git environment:
git config --global user.name "your_name_here"
git config --global user.email "your@email_here"

Clone this repository using HTTP(S):
git clone https://rocketgit.com/user/Jackalope/jen

Clone this repository using ssh (do not forget to upload a key first):
git clone ssh://rocketgit@ssh.rocketgit.com/user/Jackalope/jen

Clone this repository using git:
git clone git://git.rocketgit.com/user/Jackalope/jen

You are allowed to anonymously push to this repository.
This means that your pushed commits will automatically be transformed into a merge request:
... clone the repository ...
... make some changes and some commits ...
git push origin main