Skip to content

Commit

Permalink
Project structure no longer depends on big huge precompiled header file
Browse files Browse the repository at this point in the history
* Merge branch 'only_pch_branch' into issue95

* updated cmake file

* removed wrong inline spec.

* Fix: Lifetime of command buffer used in `imgui_manager::upload_fonts` is now handled

* Fix: Better flags for renderpass created in `window::construct_backbuffers`

* Updated ImGui (which got rid of a validation error in the compute_image_processing example).

* Initializing mHighlightMeshlets in the skinned_meshlets example.

* Just messing around with imgui

* Upgraded to `actions/checkout@v3` in cross-platform-check.yml

* Replaced imgui.cpp with original file once again

* Stupidly playing around with ImGui includes, hoping to be able to fix GCC

* fetch imgui from github repo on cmake build

* fix imgui source paths on windows

* add imgui_tables.cpp to imgui sources

* Code formatting improved

* #include tweaks

* Removed #include <auto_vk_toolkit.hpp> from many files.

* Don't need the /Zm1000 compiler flag anymore for MSVC

(Which specifies precompiled header memory allocation limit)

* #including auto_vk_toolkit in settings.hpp and windows_base.hpp

Not sure if I know what I'm doing...

* Updated nlohmann/json.hpp, which allows to use `c++latest`

* Not forcing including `cg_stdafx.hpp` in both configurations: Debug and Release

* Linked to latest Auto-Vk after some #include changes

* Those files that do not get the `cg_stdafx.hpp` forced include must also be set to not use precompiled headers.

* Switching #include style to using quotes instead of angle brackets for Auto-Vk and Auto-Vk-Toolkit files

* Deleted all the nlohmann/json files again, becase we're going to use the single-file version of it.

* Added single header version of nlohmann/json.hpp

* Towards supporting AVK_USE_SYNCHRONIZATION2_INSTEAD_OF_CORE

* Some adaptions based on latest Auto-Vk changes

---------

Co-authored-by: Johannes Unterguggenberger <johannes.unterguggenberger@gmail.com>
Co-authored-by: Lukas Herzberger <herzberger.lukas@gmail.com>
  • Loading branch information
3 people committed May 24, 2023
1 parent 35f8c25 commit b15af18
Show file tree
Hide file tree
Showing 150 changed files with 21,897 additions and 29,825 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/cross-platform-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:

steps:
- name: Checkout repository and submodules
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
submodules: recursive

Expand Down Expand Up @@ -114,9 +114,9 @@ jobs:
vulkan-sdk: ["latest", "1.2.176.1"]

steps:
# IMPORTANT: apparently checkout@v2 pulls to ${{ github.event.repository.name }}/${{ github.event.repository.name }} instead of just ${{ github.event.repository.name }} on windows
# IMPORTANT: apparently checkout@v3 pulls to ${{ github.event.repository.name }}/${{ github.event.repository.name }} instead of just ${{ github.event.repository.name }} on windows
- name: Checkout repository and submodules
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
submodules: recursive

Expand Down Expand Up @@ -170,9 +170,9 @@ jobs:
vulkan-sdk: ["latest", "1.2.176.1"]

steps:
# IMPORTANT: apparently checkout@v2 pulls to ${{ github.event.repository.name }}/${{ github.event.repository.name }} instead of just ${{ github.event.repository.name }} on windows
# IMPORTANT: apparently checkout@v3 pulls to ${{ github.event.repository.name }}/${{ github.event.repository.name }} instead of just ${{ github.event.repository.name }} on windows
- name: Checkout repository and submodules
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
submodules: recursive

Expand Down
19 changes: 10 additions & 9 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -104,15 +104,6 @@ set(avk_toolkit_Sources
external/universal/src/FileWatcher/FileWatcherOSX.cpp
external/universal/src/FileWatcher/FileWatcherWin32.cpp

# ImGui
external/universal/src/imgui.cpp
external/universal/src/imgui_demo.cpp
external/universal/src/imgui_draw.cpp
external/universal/src/imgui_impl_glfw.cpp
external/universal/src/imgui_impl_vulkan.cpp
external/universal/src/imgui_tables.cpp
external/universal/src/imgui_widgets.cpp

# Auto-Vk-Toolkit framework files:
auto_vk_toolkit/src/animation.cpp
auto_vk_toolkit/src/bezier_curve.cpp
Expand Down Expand Up @@ -140,6 +131,7 @@ set(avk_toolkit_Sources
auto_vk_toolkit/src/quake_camera.cpp
auto_vk_toolkit/src/swapchain_resized_event.cpp
auto_vk_toolkit/src/transform.cpp
auto_vk_toolkit/src/timer_globals.cpp
auto_vk_toolkit/src/updater.cpp
auto_vk_toolkit/src/varying_update_timer.cpp
auto_vk_toolkit/src/vk_convenience_functions.cpp
Expand Down Expand Up @@ -183,6 +175,15 @@ find_package(Vulkan REQUIRED)
target_link_libraries(${PROJECT_NAME} ${avk_toolkit_IncludeScope}
Vulkan::Vulkan)

# Dear ImGui
include(cmake/imgui.cmake)
if (UNIX)
target_include_directories(${PROJECT_NAME} ${avk_toolkit_IncludeScope}
${avk_toolkit_imguiIncludeDirectories})
endif(UNIX)
target_sources(${PROJECT_NAME} ${avk_toolkit_SourceScope}
${avk_toolkit_imguiSources})

# stb
# NOTE: Windows builds use a modified version of stb (including a small custom DLL).
# Since this version doesn't work on Linux, the Linux build process generates its own STB shared library.
Expand Down
2 changes: 1 addition & 1 deletion auto_vk
Submodule auto_vk updated 69 files
+25 −0 CHANGELOG.md
+24 −0 README.md
+1 −1 include/avk/acceleration_structure_size_requirements.hpp
+13 −13 include/avk/attachment.hpp
+137 −89 include/avk/avk.hpp
+0 −1 include/avk/avk_error.hpp
+1 −1 include/avk/binding_data.hpp
+1 −1 include/avk/bindings.hpp
+1 −1 include/avk/border_handling_mode.hpp
+6 −4 include/avk/bottom_level_acceleration_structure.hpp
+17 −3 include/avk/buffer.hpp
+1 −1 include/avk/buffer_meta.hpp
+1 −1 include/avk/buffer_view.hpp
+1 −1 include/avk/command_buffer.hpp
+1 −1 include/avk/command_pool.hpp
+1 −1 include/avk/commands.hpp
+1 −1 include/avk/compute_pipeline.hpp
+1 −1 include/avk/compute_pipeline_config.hpp
+68 −1 include/avk/cpp_utils.hpp
+1 −1 include/avk/descriptor_alloc_request.hpp
+1 −1 include/avk/descriptor_cache.hpp
+1 −1 include/avk/descriptor_pool.hpp
+1 −1 include/avk/descriptor_set.hpp
+1 −1 include/avk/descriptor_set_layout.hpp
+1 −1 include/avk/fence.hpp
+1 −1 include/avk/filter_mode.hpp
+1 −1 include/avk/format_for.hpp
+1 −1 include/avk/framebuffer.hpp
+1 −1 include/avk/geometry_instance.hpp
+1 −1 include/avk/graphics_pipeline.hpp
+1 −1 include/avk/graphics_pipeline_config.hpp
+1 −1 include/avk/image.hpp
+1 −1 include/avk/image_color_channel_format.hpp
+1 −1 include/avk/image_color_channel_order.hpp
+1 −1 include/avk/image_sampler.hpp
+1 −1 include/avk/image_usage.hpp
+1 −1 include/avk/image_view.hpp
+1 −1 include/avk/input_description.hpp
+1 −1 include/avk/layout.hpp
+1 −1 include/avk/mapping_access.hpp
+1 −1 include/avk/mem_handle.hpp
+1 −1 include/avk/memory_access.hpp
+1 −1 include/avk/memory_usage.hpp
+1 −1 include/avk/on_load.hpp
+1 −1 include/avk/on_store.hpp
+8 −1 include/avk/pipeline_stage.hpp
+1 −1 include/avk/push_constants.hpp
+45 −9 include/avk/query_pool.hpp
+1 −1 include/avk/queue.hpp
+2 −1 include/avk/ray_tracing_pipeline.hpp
+1 −1 include/avk/ray_tracing_pipeline_config.hpp
+1 −1 include/avk/renderpass.hpp
+1 −1 include/avk/sampler.hpp
+1 −1 include/avk/semaphore.hpp
+1 −1 include/avk/set_of_descriptor_set_layouts.hpp
+1 −1 include/avk/shader.hpp
+1 −1 include/avk/shader_binding_table.hpp
+1 −1 include/avk/shader_info.hpp
+1 −1 include/avk/shader_type.hpp
+1 −1 include/avk/stage_and_access.hpp
+1 −1 include/avk/subpass_dependency.hpp
+1 −1 include/avk/subpass_usage_type.hpp
+1 −1 include/avk/subpass_usages.hpp
+6 −4 include/avk/top_level_acceleration_structure.hpp
+1 −1 include/avk/vertex_index_buffer_pair.hpp
+1 −1 include/avk/vk_utils.hpp
+1 −1 include/avk/vma_handle.hpp
+1 −1 include/avk/vulkan_helper_functions.hpp
+204 −49 src/avk.cpp
3 changes: 2 additions & 1 deletion auto_vk_toolkit/include/animation.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#pragma once
#include <auto_vk_toolkit.hpp>

#include "model_types.hpp"

namespace avk
{
Expand Down
140 changes: 1 addition & 139 deletions auto_vk_toolkit/include/auto_vk_toolkit.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,146 +110,8 @@
#define DISPATCH_LOADER_EXT_TYPE vk::DispatchLoaderDynamic
#define VULKAN_HPP_DISPATCH_LOADER_DYNAMIC 1
#define AVK_USE_VMA
#include <avk/avk.hpp>
#include "avk/avk.hpp"

// -------------------- Auto-Vk-Toolkit Includes --------------------
#include "format_for.hpp"
#include "conversion_utils.hpp"

#include "context_state.hpp"

#include "cursor.hpp"

#include "context_generic_glfw_types.hpp"
#include "window_base.hpp"

#include "window.hpp"
#include "context_generic_glfw.hpp"

#include "math_utils.hpp"
#include "key_code.hpp"
#include "key_state.hpp"
#include "timer_frame_type.hpp"
#include "timer_interface.hpp"
#include "fixed_update_timer.hpp"
#include "varying_update_timer.hpp"
#include "input_buffer.hpp"
#include "composition_interface.hpp"

#include "vk_convenience_functions.hpp"

#include "settings.hpp"
#include "context_vulkan.hpp"

namespace avk
{
#pragma region global data representing the currently active composition
/** @brief Get the current timer, which represents the current game-/render-time
* This can be nullptr! Use time() for a version which will not return nullptr.
*/
inline timer_interface*& timer_reference()
{
static timer_interface* sTimer = nullptr;
return sTimer;
}


/** @brief Sets a new timer.
* ATTENTION: This timer must live until the end of the application!
*/
inline void set_timer(timer_interface* const aPointerToNewTimer)
{
timer_reference() = aPointerToNewTimer;
}

extern void set_default_timer();

/** @brief Get the current timer, which represents the current game-/render-time
*/
inline timer_interface& time()
{
// If there is no timer set AT THE FIRST INVOCATION, one will be set.
// But at subsequent invocations, no further checks are performed.
static bool sInitialCheckPerformed = []() {
if (nullptr == timer_reference()) {
set_default_timer();
}
return true;
}();

// In every subsequent invocation, just return whatever timer is set:
return *timer_reference();
}

/** @brief Get the current frame's input data
* \remark This is just a shortcut to @ref composition_interface::current()->input();
*/
inline input_buffer& input()
{
return composition_interface::current()->input();
}

/** @brief Get access to the currently active objects
* \remark This is just a shortcut to @ref *composition_interface::current();
*/
inline composition_interface* current_composition()
{
return composition_interface::current();
}

inline auto& context()
{
static context_vulkan sContext;
return sContext;
}
#pragma endregion
}

namespace avk {
class serializer;
}

#include "event_data.hpp"
#include "event.hpp"
#include "files_changed_event.hpp"
#include "swapchain_resized_event.hpp"
#include "swapchain_changed_event.hpp"
#include "swapchain_format_changed_event.hpp"
#include "concurrent_frames_count_changed_event.hpp"
#include "swapchain_additional_attachments_changed_event.hpp"
#include "destroying_events.hpp"
#include "updater.hpp"

#include "invokee.hpp"
#include "sequential_invoker.hpp"

#include "transform.hpp"
#include "camera.hpp"
#include "quake_camera.hpp"
#include "material_config.hpp"
#include "material_gpu_data.hpp"
#include "material_gpu_data_ext.hpp"
#include "material.hpp"
#include "lightsource.hpp"
#include "lightsource_gpu_data.hpp"
#include "model_types.hpp"
#include "animation.hpp"
#include "model.hpp"
#include "orca_scene.hpp"
#include "serializer.hpp"
#include "image_data.hpp"
#include "material_image_helpers.hpp"
#include "meshlet_helpers.hpp"

#include "composition.hpp"
#include "configure_and_compose.hpp"

#include "imgui_manager.hpp"

#include "cp_interpolation.hpp"
#include "bezier_curve.hpp"
#include "catmull_rom_spline.hpp"
#include "quadratic_uniform_b_spline.hpp"
#include "cubic_uniform_b_spline.hpp"

// ReSharper restore CppUnusedIncludeDirective
4 changes: 3 additions & 1 deletion auto_vk_toolkit/include/bezier_curve.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#pragma once
#include <auto_vk_toolkit.hpp>


#include "cp_interpolation.hpp"

namespace avk
{
Expand Down
3 changes: 2 additions & 1 deletion auto_vk_toolkit/include/camera.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#pragma once
#include <auto_vk_toolkit.hpp>

#include "transform.hpp"

namespace avk
{
Expand Down
3 changes: 2 additions & 1 deletion auto_vk_toolkit/include/catmull_rom_spline.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#pragma once
#include <auto_vk_toolkit.hpp>

#include "cp_interpolation.hpp"

namespace avk
{
Expand Down
12 changes: 8 additions & 4 deletions auto_vk_toolkit/include/composition.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
#pragma once
#include <auto_vk_toolkit.hpp>

#include "invokee.hpp"
#include "composition_interface.hpp"
#include "context_vulkan.hpp"
#include "timer_interface.hpp"

#define SINGLE_THREADED 1

Expand Down Expand Up @@ -372,12 +376,12 @@ namespace avk

// TODO: This is a bit (read: a lot) stupid, that this is tied to the main_window => support multiple windows here gracefully:
int width = 0, height = 0;
glfwGetFramebufferSize(avk::context().main_window()->handle()->mHandle, &width, &height);
glfwGetFramebufferSize(context().main_window()->handle()->mHandle, &width, &height);
while (width == 0 || height == 0) {
glfwGetFramebufferSize(avk::context().main_window()->handle()->mHandle, &width, &height);
glfwGetFramebufferSize(context().main_window()->handle()->mHandle, &width, &height);
glfwWaitEvents();
}
avk::context().main_window()->update_resolution();
context().main_window()->update_resolution();

#if !SINGLE_THREADED
// resume render_thread:
Expand Down
14 changes: 13 additions & 1 deletion auto_vk_toolkit/include/composition_interface.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
#pragma once
#include <auto_vk_toolkit.hpp>

#include <string>

#include "input_buffer.hpp"
#include "avk/avk_error.hpp"

namespace avk
{
Expand Down Expand Up @@ -126,4 +130,12 @@ namespace avk
/** The (single) currently active composition_interface */
static composition_interface* sCurrentComposition;
};

static inline composition_interface* current_composition() {
return composition_interface::current();
}

static inline input_buffer& input() {
return composition_interface::current()->input();
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#pragma once
#include <auto_vk_toolkit.hpp>
#include "window.hpp"
#include "event.hpp"

namespace avk
{
Expand Down
3 changes: 2 additions & 1 deletion auto_vk_toolkit/include/configure_and_compose.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#pragma once
#include <auto_vk_toolkit.hpp>

#include "composition.hpp"

namespace avk
{
Expand Down
6 changes: 5 additions & 1 deletion auto_vk_toolkit/include/context_generic_glfw.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
#pragma once
#include <auto_vk_toolkit.hpp>

#include "context_state.hpp"
#include "context_generic_glfw_types.hpp"

class cursor;

namespace avk
{
Expand Down
3 changes: 1 addition & 2 deletions auto_vk_toolkit/include/context_generic_glfw_types.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#pragma once
#include <auto_vk_toolkit.hpp>

#include "avk/avk_error.hpp"
#include <GLFW/glfw3.h>

namespace avk
Expand Down
1 change: 0 additions & 1 deletion auto_vk_toolkit/include/context_state.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#pragma once
#include <auto_vk_toolkit.hpp>

namespace avk
{
Expand Down
17 changes: 15 additions & 2 deletions auto_vk_toolkit/include/context_vulkan.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#pragma once
#include <auto_vk_toolkit.hpp>

#include "context_generic_glfw.hpp"
#include "settings.hpp"

namespace avk
{
Expand All @@ -13,7 +15,13 @@ namespace avk
class context_vulkan : public context_generic_glfw, public avk::root
{
public:
static context_vulkan& get() {
static context_vulkan instance;
return instance;
};
private:
context_vulkan() = default;
public:
context_vulkan(const context_vulkan&) = delete;
context_vulkan(context_vulkan&&) = delete;
context_vulkan& operator=(const context_vulkan&) = delete;
Expand Down Expand Up @@ -95,7 +103,7 @@ namespace avk
#if defined(AVK_USE_VMA)
const VmaAllocator& memory_allocator() const override { return mMemoryAllocator; }
#else
const std::tuple<vk::PhysicalDevice, vk::Device>& memory_allocator() override { return mMemoryAllocator; }
const std::tuple<vk::PhysicalDevice, vk::Device>& memory_allocator() const override { return mMemoryAllocator; }
#endif

const std::vector<uint32_t>& all_queue_family_indices() const { return mDistinctQueueFamilies; }
Expand Down Expand Up @@ -293,4 +301,9 @@ namespace avk

};

static inline auto& context() {
return avk::context_vulkan::get();
}
}


1 change: 0 additions & 1 deletion auto_vk_toolkit/include/conversion_utils.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#pragma once
#include <auto_vk_toolkit.hpp>

namespace avk
{
Expand Down
Loading

0 comments on commit b15af18

Please sign in to comment.