diff --git a/.gitmodules b/.gitmodules index afc90ac..ba2ff86 100644 --- a/.gitmodules +++ b/.gitmodules @@ -33,4 +33,10 @@ url = git@github.com:skypjack/entt.git [submodule "external/thread-pool"] path = external/thread-pool - url = https://github.com/DeveloperPaul123/thread-pool.git \ No newline at end of file + url = https://github.com/DeveloperPaul123/thread-pool.git +[submodule "external/zlib"] + path = external/zlib + url = https://github.com/madler/zlib.git +[submodule "external/CRCpp"] + path = external/CRCpp + url = https://github.com/d-bahr/CRCpp.git \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index e8ec3c3..e3c1697 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -19,6 +19,7 @@ set(BOOST_ROOT ${EXTERNAL_ROOT}/boost) set(SLANG_ROOT ${EXTERNAL_ROOT}/slang) set(GLM_ROOT ${EXTERNAL_ROOT}/glm) set(GLFW_ROOT ${EXTERNAL_ROOT}/glfw) +set(CRCPP_ROOT ${EXTERNAL_ROOT}/crcpp) set(JSON_ROOT ${EXTERNAL_ROOT}/json) set(KTX_ROOT ${EXTERNAL_ROOT}/ktx) set(STB_ROOT ${EXTERNAL_ROOT}/stb) @@ -28,6 +29,7 @@ set(SPIRV_ROOT ${EXTERNAL_ROOT}/SPIRV-Cross) set(ENTT_ROOT ${EXTERNAL_ROOT}/entt) set(NSAM_ROOT ${EXTERNAL_ROOT}/aftermath) set(THREADPOOL_ROOT ${EXTERNAL_ROOT}/thread-pool) +set(ZLIB_ROOT ${EXTERNAL_ROOT}/zlib) set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/) set(Boost_NO_WARN_NEW_VERSIONS 1) @@ -36,48 +38,50 @@ project (Seele) include(cmake/Superbuild.cmake) +set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/bin/${CMAKE_BUILD_TYPE}) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/bin/${CMAKE_BUILD_TYPE}) #Workaround for vs, because it places artifacts into an additional subfolder +set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_DEBUG ${CMAKE_CURRENT_SOURCE_DIR}/bin/Debug) +set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_RELEASE ${CMAKE_CURRENT_SOURCE_DIR}/bin/Release) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CMAKE_CURRENT_SOURCE_DIR}/bin/Debug) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_CURRENT_SOURCE_DIR}/bin/Release) set(Boost_USE_STATIC_LIBS OFF) if(WIN32) - set(Boost_LIB_PREFIX lib) + set(Boost_LIB_PREFIX lib) endif() find_package(Vulkan REQUIRED) -find_package(Boost REQUIRED COMPONENTS serialization) +find_package(Boost REQUIRED serialization) if(WIN32) - add_compile_definitions(USE_EXTENSIONS) + add_compile_definitions(USE_EXTENSIONS) endif() if(CMAKE_DEBUG_POSTFIX) - add_compile_definitions(ENABLE_VALIDATION) - add_compile_definitions(SEELE_DEBUG) + add_compile_definitions(ENABLE_VALIDATION) + add_compile_definitions(SEELE_DEBUG) endif() add_library(Engine STATIC "") -target_compile_definitions(Engine PUBLIC GLFW_WINDOWS) -target_include_directories(Engine PUBLIC src/Engine) +target_compile_definitions(Engine PRIVATE GLFW_WINDOWS) +target_include_directories(Engine PRIVATE src/Engine) target_link_libraries(Engine PUBLIC Vulkan::Vulkan) -target_link_libraries(Engine PUBLIC Boost::headers) -target_link_libraries(Engine PUBLIC Boost::serialization) target_link_libraries(Engine PUBLIC EnTT::EnTT) target_link_libraries(Engine PUBLIC glfw) -target_link_libraries(Engine PUBLIC glm::glm) +target_link_libraries(Engine PUBLIC glm) target_link_libraries(Engine PUBLIC freetype) target_link_libraries(Engine PUBLIC slang) target_link_libraries(Engine PUBLIC assimp) -target_link_libraries(Engine PUBLIC nsam) target_link_libraries(Engine PUBLIC ktx) target_link_libraries(Engine PUBLIC stb) target_link_libraries(Engine PUBLIC nlohmann_json::nlohmann_json) target_link_libraries(Engine PUBLIC dp::thread-pool) +target_link_libraries(Engine PUBLIC crcpp) if(UNIX) - target_link_libraries(Engine PUBLIC Threads::Threads) - target_link_libraries(Engine PUBLIC dl) + target_link_libraries(Engine PUBLIC Threads::Threads) + target_link_libraries(Engine PUBLIC dl) endif() + target_precompile_headers(Engine PUBLIC @@ -92,34 +96,70 @@ target_precompile_headers(Engine - - ) + ) if(MSVC) - set(_CRT_SECURE_NO_WARNINGS) - target_compile_options(Engine PUBLIC /Zi /MP15 /W4 /DEBUG "/WX-") + set(_CRT_SECURE_NO_WARNINGS) + target_compile_options(Engine PUBLIC /Zi /MP14 /W4 /DEBUG "/WX-") else() - target_compile_options(Engine PUBLIC -g -Wall -Wextra -Wno-delete-incomplete -pedantic -fcoroutines) + target_compile_options(Engine PUBLIC -g -Wall -Wextra -Wno-delete-incomplete -pedantic -fcoroutines) endif() -add_executable(Editor "") - -target_include_directories(Editor PRIVATE src/Editor) - -target_link_libraries(Editor PUBLIC Engine) - add_subdirectory(src/) add_executable(Seele_unit_tests "") add_subdirectory(test/) add_custom_target(SeeleEngine ALL - COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/res $ - COMMAND ${CMAKE_COMMAND} -E copy $ $ - COMMAND ${CMAKE_COMMAND} -E copy $ $ - COMMAND ${CMAKE_COMMAND} -E copy $ $ - COMMAND ${CMAKE_COMMAND} -E copy $ $ - COMMAND ${CMAKE_COMMAND} -E copy $ $ - COMMAND_EXPAND_LISTS + COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/res $ + COMMAND ${CMAKE_COMMAND} -E copy $ $ + COMMAND ${CMAKE_COMMAND} -E copy $ $ + COMMAND_EXPAND_LISTS DEPENDS Editor slang-build) +install( + TARGETS + Engine + EnTT + glfw + glm + freetype + slang + assimp + ktx + stb + crcpp + nlohmann_json + ThreadPool + zlib + zlibstatic + EXPORT + EngineTargets + FILE_SET HEADERS + PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_PREFIX}/include) + +export(EXPORT EngineTargets + FILE "${CMAKE_BINARY_DIR}/EngineTargets.cmake" + NAMESPACE Seele::) + +include(CMakePackageConfigHelpers) + +configure_package_config_file(cmake/EngineConfig.cmake.in + "SeeleConfig.cmake" + INSTALL_DESTINATION ${CMAKE_BINARY_DIR}) + +install(EXPORT EngineTargets + FILE + EngineTargets.cmake + NAMESPACE + Seele:: + DESTINATION + ${CMAKE_INSTALL_PREFIX} +) + +install( + FILES + ${CMAKE_BINARY_DIR}/SeeleConfig.cmake + DESTINATION + ${CMAKE_INSTALL_PREFIX} +) diff --git a/cmake-variants.json b/cmake-variants.json index 8f2f00f..ed05d0c 100644 --- a/cmake-variants.json +++ b/cmake-variants.json @@ -35,25 +35,5 @@ } } } - }, - "superbuild": { - "default": "off", - "description": "Use Superbuild", - "choices": { - "off": { - "short": "off", - "long": "Don't rebuild superbuild", - "settings": { - "USE_SUPERBUILD": "OFF" - } - }, - "on": { - "short": "on", - "long": "Rebuild dependencies", - "settings": { - "USE_SUPERBUILD": "ON" - } - } - } } } \ No newline at end of file diff --git a/cmake/EngineConfig.cmake.in b/cmake/EngineConfig.cmake.in new file mode 100644 index 0000000..929792d --- /dev/null +++ b/cmake/EngineConfig.cmake.in @@ -0,0 +1,5 @@ +@PACKAGE_INIT@ + +include("${CMAKE_CURRENT_LIST_DIR}/EngineTargets.cmake") + +check_required_components(Engine) \ No newline at end of file diff --git a/cmake/SuperBuild.cmake b/cmake/SuperBuild.cmake index f674783..d81d0b8 100644 --- a/cmake/SuperBuild.cmake +++ b/cmake/SuperBuild.cmake @@ -1,8 +1,9 @@ include (ExternalProject) -#--------------FreeType------------------------------ -set(FT_DISABLE_ZLIB ON) +#--------------ZLIB------------------------------ +add_subdirectory(${ZLIB_ROOT}) +#--------------FreeType------------------------------ add_subdirectory(${FREETYPE_ROOT}) #------------ASSIMP--------------- @@ -17,8 +18,6 @@ else() target_compile_options(assimp PRIVATE -Wno-error -fPIC) target_compile_options(IrrXML PRIVATE -fPIC) endif() -#-------------BOOST---------------- -add_subdirectory(${BOOST_ROOT}) #-----------------KTX---------------------------- set(KTX_FEATURE_TESTS off) @@ -28,13 +27,10 @@ add_subdirectory(${KTX_ROOT} ${KTX_ROOT}) #--------------------JSON------------------ set(JSON_MultipleHeaders ON CACHE INTERNAL "") set(JSON_BuildTests OFF CACHE INTERNAL "") -set(JSON_Install OFF CACHE INTERNAL "") +set(JSON_Install ON CACHE INTERNAL "") add_subdirectory(${JSON_ROOT}) -#--------------GLM------------------------------ -add_subdirectory(${GLM_ROOT}) -target_compile_options(glm INTERFACE /W0) #--------------GLFW------------------------------ set(ENKITS_BUILD_EXAMPLES OFF CACHE BOOL "Build basic example applications" ) @@ -49,19 +45,6 @@ add_subdirectory(${GLFW_ROOT}) #--------------EnTT------------------------------ add_subdirectory(${ENTT_ROOT}) -#--------------STB----------------------------------- -add_library(stb INTERFACE) - -target_include_directories(stb INTERFACE ${STB_ROOT}) - -#--------------Aftermath------------------------------ -add_library(nsam INTERFACE) - -target_include_directories(nsam INTERFACE ${NSAM_ROOT}/include) -target_link_libraries(nsam INTERFACE ${NSAM_ROOT}/lib/${CMAKE_PLATFORM}/*.lib) -set_target_properties(nsam PROPERTIES NSAM_BINARY ${NSAM_ROOT}/lib/${CMAKE_PLATFORM}/GFSDK_Aftermath_Lib.${CMAKE_PLATFORM}.dll) -set_target_properties(nsam PROPERTIES LLVM_BINARY ${NSAM_ROOT}/lib/${CMAKE_PLATFORM}/llvm_7_0_1.dll) - #--------------thread-pool------------------------------ add_subdirectory(${THREADPOOL_ROOT}) @@ -74,22 +57,79 @@ string(TOLOWER ${SLANG_ROOT}/bin/windows-${CMAKE_PLATFORM}/release SLANG_BINARY_ ExternalProject_Add(slang-build SOURCE_DIR ${SLANG_ROOT} BINARY_DIR ${SLANG_ROOT} - CONFIGURE_COMMAND ${SLANG_ROOT}/premake.bat vs2019 --file=${CMAKE_SOURCE_DIR}/external/slang/premake5.lua gmake --arch=${CMAKE_PLATFORM} --deps=true + CONFIGURE_COMMAND ${SLANG_ROOT}/premake.bat vs2019 --file=${SLANG_ROOT}/premake5.lua gmake --arch=${CMAKE_PLATFORM} --deps=true BUILD_COMMAND msbuild slang.sln -p:Configuration=Release -p:Platform=${CMAKE_PLATFORM} - INSTALL_COMMAND "") + INSTALL_COMMAND "" +) elseif(UNIX) ExternalProject_Add(slang-build SOURCE_DIR ${SLANG_ROOT} BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR} CONFIGURE_COMMAND ${CMAKE_SOURCE_DIR}/premake5 --file=${CMAKE_SOURCE_DIR}/external/slang/premake5.lua gmake --arch=${CMAKE_PLATFORM} --deps=true --build-location=build/linux BUILD_COMMAND make -C ${CMAKE_SOURCE_DIR}/external/slang/build/linux config=${SLANG_CONFIG} - INSTALL_COMMAND "") + INSTALL_COMMAND "" +) endif() add_library(slang INTERFACE) -target_include_directories(slang INTERFACE ${SLANG_ROOT}) +target_include_directories(slang INTERFACE + $ + $ +) target_link_libraries(slang INTERFACE ${SLANG_BINARY_DIR}/*.lib) set_target_properties(slang PROPERTIES SLANG_BINARY ${SLANG_BINARY_DIR}/slang.dll) set_target_properties(slang PROPERTIES GLSLANG_BINARY ${SLANG_BINARY_DIR}/slang-glslang.dll) +install(DIRECTORY + ${SLANG_ROOT} + DESTINATION ${CMAKE_INSTALL_PREFIX}/include + FILES_MATCHING PATTERN "*.h" +) + +#--------------CRC++------------------------------ +add_library(crcpp INTERFACE) + +target_include_directories(crcpp INTERFACE + $ + $ +) + +install(FILES + ${CRCPP_ROOT}/inc/CRC.h + DESTINATION ${CMAKE_INSTALL_PREFIX}/include +) + +#--------------GLM------------------------------ +add_library(glm INTERFACE) +target_include_directories(glm INTERFACE + $ + $ +) + +install(DIRECTORY + ${GLM_ROOT}/glm + DESTINATION ${CMAKE_INSTALL_PREFIX}/include + FILES_MATCHING PATTERN "*.h*" +) + +install(DIRECTORY + ${GLM_ROOT}/glm + DESTINATION ${CMAKE_INSTALL_PREFIX}/include + FILES_MATCHING PATTERN "*.inl" +) + +#--------------STB----------------------------------- +add_library(stb INTERFACE) + +target_include_directories(stb INTERFACE + $ + $ +) + +install(DIRECTORY + ${STB_HEADERS} + DESTINATION ${CMAKE_INSTALL_PREFIX}/include + FILES_MATCHING PATTERN "*.h" +) + diff --git a/external/CRCpp b/external/CRCpp new file mode 160000 index 0000000..71f2152 --- /dev/null +++ b/external/CRCpp @@ -0,0 +1 @@ +Subproject commit 71f2152b639f8fc0efa3d1fec01c7c0dbb96dc76 diff --git a/external/glm b/external/glm index 8e58cdb..bf71a83 160000 --- a/external/glm +++ b/external/glm @@ -1 +1 @@ -Subproject commit 8e58cdbbf8dbaddd52b0703da4cf61f484f0ac24 +Subproject commit bf71a834948186f4097caa076cd2663c69a10e1e diff --git a/external/zlib b/external/zlib new file mode 160000 index 0000000..04f42ce --- /dev/null +++ b/external/zlib @@ -0,0 +1 @@ +Subproject commit 04f42ceca40f73e2978b50e93806c2a18c1281fc diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 85b3389..6c815da 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,2 +1 @@ -add_subdirectory(Editor/) add_subdirectory(Engine/) \ No newline at end of file diff --git a/src/Engine/Actor/CMakeLists.txt b/src/Engine/Actor/CMakeLists.txt index 9a82d7c..810129b 100644 --- a/src/Engine/Actor/CMakeLists.txt +++ b/src/Engine/Actor/CMakeLists.txt @@ -5,4 +5,11 @@ target_sources(Engine CameraActor.cpp CameraActor.h Entity.cpp - Entity.h) \ No newline at end of file + Entity.h) + +target_sources(Engine + PUBLIC FILE_SET HEADERS + FILES + Actor.h + CameraActor.h + Entity.h) diff --git a/src/Engine/Asset/CMakeLists.txt b/src/Engine/Asset/CMakeLists.txt index 2e3e90a..0f98654 100644 --- a/src/Engine/Asset/CMakeLists.txt +++ b/src/Engine/Asset/CMakeLists.txt @@ -17,4 +17,17 @@ target_sources(Engine TextureAsset.h TextureAsset.cpp TextureLoader.h - TextureLoader.cpp) \ No newline at end of file + TextureLoader.cpp) + +target_sources(Engine + PUBLIC FILE_SET HEADERS + FILES + Asset.h + AssetRegistry.h + FontAsset.h + FontLoader.h + MaterialLoader.h + MeshAsset.h + MeshLoader.h + TextureAsset.h + TextureLoader.h) \ No newline at end of file diff --git a/src/Engine/Asset/MeshAsset.cpp b/src/Engine/Asset/MeshAsset.cpp index 39e4567..da07387 100644 --- a/src/Engine/Asset/MeshAsset.cpp +++ b/src/Engine/Asset/MeshAsset.cpp @@ -1,12 +1,9 @@ #include "MeshAsset.h" #include "Graphics/Mesh.h" #include "Graphics/VertexShaderInput.h" -#include -#include using namespace Seele; - MeshAsset::MeshAsset() { } diff --git a/src/Engine/CMakeLists.txt b/src/Engine/CMakeLists.txt index a92b50b..12b7968 100644 --- a/src/Engine/CMakeLists.txt +++ b/src/Engine/CMakeLists.txt @@ -4,6 +4,12 @@ target_sources(Engine MinimalEngine.h MinimalEngine.cpp) +target_sources(Engine + PUBLIC FILE_SET HEADERS + FILES + EngineTypes.h + MinimalEngine.h) + add_subdirectory(Actor/) add_subdirectory(Asset/) add_subdirectory(Component/) diff --git a/src/Engine/Component/CMakeLists.txt b/src/Engine/Component/CMakeLists.txt index cc1f3e0..a165b30 100644 --- a/src/Engine/Component/CMakeLists.txt +++ b/src/Engine/Component/CMakeLists.txt @@ -5,4 +5,12 @@ target_sources(Engine Component.h StaticMesh.h Transform.h - Transform.cpp) \ No newline at end of file + Transform.cpp) + +target_sources(Engine + PUBLIC FILE_SET HEADERS + FILES + Camera.h + Component.h + StaticMesh.h + Transform.h) \ No newline at end of file diff --git a/src/Engine/Containers/Array.h b/src/Engine/Containers/Array.h index 730299b..5134fda 100644 --- a/src/Engine/Containers/Array.h +++ b/src/Engine/Containers/Array.h @@ -5,7 +5,6 @@ #include #include #include -#include #ifndef DEFAULT_ALLOC_SIZE #define DEFAULT_ALLOC_SIZE 16 @@ -548,16 +547,6 @@ private: } markIteratorDirty(); } - friend class boost::serialization::access; - template - void serialize(Archive& ar, const unsigned int) - { - ar & arraySize; - resize(arraySize); - for(size_type i = 0; i < arraySize; ++i) - ar & _data[i]; - markIteratorDirty(); - } size_type arraySize = 0; size_type allocated = 0; Iterator beginIt; @@ -745,13 +734,5 @@ private: T _data[N]; iterator beginIt; iterator endIt; - friend class boost::serialization::access; - template - void serialize(Archive& ar, const unsigned int version) - { - ar & version; - ar & N; - ar & _data; - } }; } // namespace Seele \ No newline at end of file diff --git a/src/Engine/Containers/CMakeLists.txt b/src/Engine/Containers/CMakeLists.txt index 9e81f08..8f560f3 100644 --- a/src/Engine/Containers/CMakeLists.txt +++ b/src/Engine/Containers/CMakeLists.txt @@ -2,4 +2,12 @@ target_sources(Engine PRIVATE Array.h Map.h - List.h) \ No newline at end of file + List.h) + + +target_sources(Engine + PUBLIC FILE_SET HEADERS + FILES + Array.h + Map.h + List.h) \ No newline at end of file diff --git a/src/Engine/Graphics/CMakeLists.txt b/src/Engine/Graphics/CMakeLists.txt index 608fc3b..a52dbbc 100644 --- a/src/Engine/Graphics/CMakeLists.txt +++ b/src/Engine/Graphics/CMakeLists.txt @@ -19,6 +19,20 @@ target_sources(Engine VertexShaderInput.cpp StaticMeshVertexInput.h StaticMeshVertexInput.cpp) + +target_sources(Engine + PUBLIC FILE_SET HEADERS + FILES + GraphicsResources.h + GraphicsInitializer.h + GraphicsEnums.h + Graphics.h + Mesh.h + MeshBatch.h + RenderMaterial.h + ShaderCompiler.h + VertexShaderInput.h + StaticMeshVertexInput.h) add_subdirectory(RenderPass/) add_subdirectory(Vulkan/) \ No newline at end of file diff --git a/src/Engine/Graphics/GraphicsResources.cpp b/src/Engine/Graphics/GraphicsResources.cpp index e26d96f..ae06da4 100644 --- a/src/Engine/Graphics/GraphicsResources.cpp +++ b/src/Engine/Graphics/GraphicsResources.cpp @@ -401,9 +401,7 @@ static Map vertexDeclarationCache; PVertexDeclaration VertexDeclaration::createDeclaration(PGraphics graphics, const Array& elementList) { std::scoped_lock lock(vertexDeclarationLock); - boost::crc_32_type result; - result.process_bytes(&elementList, sizeof(VertexElement) * elementList.size()); - uint32 key = result.checksum(); + uint32 key = CRC::Calculate(&elementList, sizeof(VertexElement) * elementList.size(), CRC::CRC_32()); auto found = vertexDeclarationCache[key]; if(found == nullptr) diff --git a/src/Engine/Graphics/GraphicsResources.h b/src/Engine/Graphics/GraphicsResources.h index 46b2449..efe9834 100644 --- a/src/Engine/Graphics/GraphicsResources.h +++ b/src/Engine/Graphics/GraphicsResources.h @@ -3,10 +3,7 @@ #include "Containers/Array.h" #include "Containers/List.h" #include "GraphicsInitializer.h" -#pragma warning(push) -#pragma warning(disable: 4701) -#include -#pragma warning(pop) +#include "CRC.h" #include @@ -103,9 +100,7 @@ struct PermutationId {} PermutationId(ShaderPermutation permutation) { - boost::crc_32_type result; - result.process_bytes(&permutation, sizeof(ShaderPermutation)); - hash = result.checksum(); + hash = CRC::Calculate(&permutation, sizeof(ShaderPermutation), CRC::CRC_32()); } friend inline bool operator==(const PermutationId& lhs, const PermutationId& rhs) { diff --git a/src/Engine/Graphics/RenderPass/BasePass.cpp b/src/Engine/Graphics/RenderPass/BasePass.cpp index b86494c..1fd1658 100644 --- a/src/Engine/Graphics/RenderPass/BasePass.cpp +++ b/src/Engine/Graphics/RenderPass/BasePass.cpp @@ -9,9 +9,9 @@ using namespace Seele; -BasePassMeshProcessor::BasePassMeshProcessor(Gfx::PGraphics graphics, uint8 translucentBasePass) +BasePassMeshProcessor::BasePassMeshProcessor(Gfx::PGraphics graphics) : MeshProcessor(graphics) - , translucentBasePass(translucentBasePass) +// , translucentBasePass(translucentBasePass) //, cachedPrimitiveIndex(0) { } @@ -71,7 +71,7 @@ void BasePassMeshProcessor::processMeshBatch( BasePass::BasePass(Gfx::PGraphics graphics) : RenderPass(graphics) - , processor(new BasePassMeshProcessor(graphics, false)) + , processor(new BasePassMeshProcessor(graphics)) , descriptorSets(4) { UniformBufferCreateInfo uniformInitializer; diff --git a/src/Engine/Graphics/RenderPass/BasePass.h b/src/Engine/Graphics/RenderPass/BasePass.h index 3e55441..2efb8a3 100644 --- a/src/Engine/Graphics/RenderPass/BasePass.h +++ b/src/Engine/Graphics/RenderPass/BasePass.h @@ -8,7 +8,7 @@ namespace Seele class BasePassMeshProcessor : public MeshProcessor { public: - BasePassMeshProcessor(Gfx::PGraphics graphics, uint8 translucentBasePass); + BasePassMeshProcessor(Gfx::PGraphics graphics); virtual ~BasePassMeshProcessor(); virtual void processMeshBatch( @@ -21,8 +21,7 @@ public: int32 staticMeshId = -1) override; private: //Array cachedPrimitiveSets; - Gfx::PViewport target; - uint8 translucentBasePass; + //uint8 translucentBasePass; //uint32 cachedPrimitiveIndex; }; DEFINE_REF(BasePassMeshProcessor) diff --git a/src/Engine/Graphics/RenderPass/CMakeLists.txt b/src/Engine/Graphics/RenderPass/CMakeLists.txt index e1d4094..ee97bc7 100644 --- a/src/Engine/Graphics/RenderPass/CMakeLists.txt +++ b/src/Engine/Graphics/RenderPass/CMakeLists.txt @@ -15,4 +15,17 @@ target_sources(Engine TextPass.h TextPass.cpp UIPass.h - UIPass.cpp) \ No newline at end of file + UIPass.cpp) + +target_sources(Engine + PUBLIC FILE_SET HEADERS + FILES + BasePass.h + DepthPrepass.h + LightCullingPass.h + MeshProcessor.h + RenderGraph.h + RenderGraphResources.h + RenderPass.h + TextPass.h + UIPass.h) \ No newline at end of file diff --git a/src/Engine/Graphics/Vulkan/CMakeLists.txt b/src/Engine/Graphics/Vulkan/CMakeLists.txt index bf2f494..3d2dc41 100644 --- a/src/Engine/Graphics/Vulkan/CMakeLists.txt +++ b/src/Engine/Graphics/Vulkan/CMakeLists.txt @@ -1,10 +1,5 @@ target_sources(Engine PRIVATE - NsightAftermathGpuCrashTracker.h - NsightAftermathGpuCrashTracker.cpp - NsightAftermathHelpers.h - NsightAftermathShaderDatabase.h - NsightAftermathShaderDatabase.cpp VulkanAllocator.h VulkanAllocator.cpp VulkanBuffer.cpp @@ -34,3 +29,22 @@ target_sources(Engine VulkanQueue.h VulkanQueue.cpp VulkanViewport.cpp) + +target_sources(Engine + PUBLIC FILE_SET HEADERS + FILES + VulkanAllocator.h + VulkanBuffer.cpp + VulkanCommandBuffer.h + VulkanFramebuffer.h + VulkanGraphics.h + VulkanGraphicsResources.h + VulkanDescriptorSets.h + VulkanGraphicsEnums.h + VulkanInitializer.h + VulkanRenderPass.h + VulkanPipeline.h + VulkanPipelineCache.h + VulkanShader.h + VulkanQueue.h) + \ No newline at end of file diff --git a/src/Engine/Graphics/Vulkan/NsightAftermathGpuCrashTracker.cpp b/src/Engine/Graphics/Vulkan/NsightAftermathGpuCrashTracker.cpp deleted file mode 100644 index b19c44d..0000000 --- a/src/Engine/Graphics/Vulkan/NsightAftermathGpuCrashTracker.cpp +++ /dev/null @@ -1,346 +0,0 @@ -//********************************************************* -// -// Copyright (c) 2019-2020, NVIDIA CORPORATION. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the "Software"), -// to deal in the Software without restriction, including without limitation -// the rights to use, copy, modify, merge, publish, distribute, sublicense, -// and/or sell copies of the Software, and to permit persons to whom the -// Software is furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -// DEALINGS IN THE SOFTWARE. -// -//********************************************************* - -#include -#include -#include - -#include "NsightAftermathGpuCrashTracker.h" - -//********************************************************* -// GpuCrashTracker implementation -//********************************************************* - -GpuCrashTracker::GpuCrashTracker() - : m_initialized(false) - , m_mutex() - , m_shaderDebugInfo() - , m_shaderDatabase() -{ -} - -GpuCrashTracker::~GpuCrashTracker() -{ - // If initialized, disable GPU crash dumps - if (m_initialized) - { - AFTERMATH_CHECK_ERROR(GFSDK_Aftermath_DisableGpuCrashDumps()); - } -} - -// Initialize the GPU Crash Dump Tracker -void GpuCrashTracker::Initialize() -{ - // Enable GPU crash dumps and set up the callbacks for crash dump notifications, - // shader debug information notifications, and providing additional crash - // dump description data.Only the crash dump callback is mandatory. The other two - // callbacks are optional and can be omitted, by passing nullptr, if the corresponding - // functionality is not used. - // The DeferDebugInfoCallbacks flag enables caching of shader debug information data - // in memory. If the flag is set, ShaderDebugInfoCallback will be called only - // in the event of a crash, right before GpuCrashDumpCallback. If the flag is not set, - // ShaderDebugInfoCallback will be called for every shader that is compiled. - AFTERMATH_CHECK_ERROR(GFSDK_Aftermath_EnableGpuCrashDumps( - GFSDK_Aftermath_Version_API, - GFSDK_Aftermath_GpuCrashDumpWatchedApiFlags_Vulkan, - GFSDK_Aftermath_GpuCrashDumpFeatureFlags_DeferDebugInfoCallbacks, // Let the Nsight Aftermath library cache shader debug information. - GpuCrashDumpCallback, // Register callback for GPU crash dumps. - ShaderDebugInfoCallback, // Register callback for shader debug information. - CrashDumpDescriptionCallback, // Register callback for GPU crash dump description. - this)); // Set the GpuCrashTracker object as user data for the above callbacks. - - m_initialized = true; -} - -// Handler for GPU crash dump callbacks from Nsight Aftermath -void GpuCrashTracker::OnCrashDump(const void* pGpuCrashDump, const uint32_t gpuCrashDumpSize) -{ - // Make sure only one thread at a time... - std::scoped_lock lock(m_mutex); - - // Write to file for later in-depth analysis with Nsight Graphics. - WriteGpuCrashDumpToFile(pGpuCrashDump, gpuCrashDumpSize); -} - -// Handler for shader debug information callbacks -void GpuCrashTracker::OnShaderDebugInfo(const void* pShaderDebugInfo, const uint32_t shaderDebugInfoSize) -{ - // Make sure only one thread at a time... - std::scoped_lock lock(m_mutex); - - // Get shader debug information identifier - GFSDK_Aftermath_ShaderDebugInfoIdentifier identifier = {}; - AFTERMATH_CHECK_ERROR(GFSDK_Aftermath_GetShaderDebugInfoIdentifier( - GFSDK_Aftermath_Version_API, - pShaderDebugInfo, - shaderDebugInfoSize, - &identifier)); - - // Store information for decoding of GPU crash dumps with shader address mapping - // from within the application. - std::vector data((uint8_t*)pShaderDebugInfo, (uint8_t*)pShaderDebugInfo + shaderDebugInfoSize); - m_shaderDebugInfo[identifier].swap(data); - - // Write to file for later in-depth analysis of crash dumps with Nsight Graphics - WriteShaderDebugInformationToFile(identifier, pShaderDebugInfo, shaderDebugInfoSize); -} - -// Handler for GPU crash dump description callbacks -void GpuCrashTracker::OnDescription(PFN_GFSDK_Aftermath_AddGpuCrashDumpDescription addDescription) -{ - // Add some basic description about the crash. This is called after the GPU crash happens, but before - // the actual GPU crash dump callback. The provided data is included in the crash dump and can be - // retrieved using GFSDK_Aftermath_GpuCrashDump_GetDescription(). - addDescription(GFSDK_Aftermath_GpuCrashDumpDescriptionKey_ApplicationName, "VkHelloNsightAftermath"); - addDescription(GFSDK_Aftermath_GpuCrashDumpDescriptionKey_ApplicationVersion, "v1.0"); - addDescription(GFSDK_Aftermath_GpuCrashDumpDescriptionKey_UserDefined, "This is a GPU crash dump example."); - addDescription(GFSDK_Aftermath_GpuCrashDumpDescriptionKey_UserDefined + 1, "Engine State: Rendering."); - addDescription(GFSDK_Aftermath_GpuCrashDumpDescriptionKey_UserDefined + 2, "More user-defined information..."); -} - -// Helper for writing a GPU crash dump to a file -void GpuCrashTracker::WriteGpuCrashDumpToFile(const void* pGpuCrashDump, const uint32_t gpuCrashDumpSize) -{ - // Create a GPU crash dump decoder object for the GPU crash dump. - GFSDK_Aftermath_GpuCrashDump_Decoder decoder = {}; - AFTERMATH_CHECK_ERROR(GFSDK_Aftermath_GpuCrashDump_CreateDecoder( - GFSDK_Aftermath_Version_API, - pGpuCrashDump, - gpuCrashDumpSize, - &decoder)); - - // Use the decoder object to read basic information, like application - // name, PID, etc. from the GPU crash dump. - GFSDK_Aftermath_GpuCrashDump_BaseInfo baseInfo = {}; - AFTERMATH_CHECK_ERROR(GFSDK_Aftermath_GpuCrashDump_GetBaseInfo(decoder, &baseInfo)); - - // Use the decoder object to query the application name that was set - // in the GPU crash dump description. - uint32_t applicationNameLength = 0; - AFTERMATH_CHECK_ERROR(GFSDK_Aftermath_GpuCrashDump_GetDescriptionSize( - decoder, - GFSDK_Aftermath_GpuCrashDumpDescriptionKey_ApplicationName, - &applicationNameLength)); - - std::vector applicationName(applicationNameLength, '\0'); - - AFTERMATH_CHECK_ERROR(GFSDK_Aftermath_GpuCrashDump_GetDescription( - decoder, - GFSDK_Aftermath_GpuCrashDumpDescriptionKey_ApplicationName, - uint32_t(applicationName.size()), - applicationName.data())); - - // Create a unique file name for writing the crash dump data to a file. - // Note: due to an Nsight Aftermath bug (will be fixed in an upcoming - // driver release) we may see redundant crash dumps. As a workaround, - // attach a unique count to each generated file name. - static int count = 0; - const std::string baseFileName = - std::string(applicationName.data()) - + "-" - + std::to_string(baseInfo.pid) - + "-" - + std::to_string(++count); - - // Write the the crash dump data to a file using the .nv-gpudmp extension - // registered with Nsight Graphics. - const std::string crashDumpFileName = baseFileName + ".nv-gpudmp"; - std::ofstream dumpFile(crashDumpFileName, std::ios::out | std::ios::binary); - if (dumpFile) - { - dumpFile.write((const char*)pGpuCrashDump, gpuCrashDumpSize); - dumpFile.close(); - } - - // Decode the crash dump to a JSON string. - // Step 1: Generate the JSON and get the size. - uint32_t jsonSize = 0; - AFTERMATH_CHECK_ERROR(GFSDK_Aftermath_GpuCrashDump_GenerateJSON( - decoder, - GFSDK_Aftermath_GpuCrashDumpDecoderFlags_ALL_INFO, - GFSDK_Aftermath_GpuCrashDumpFormatterFlags_NONE, - ShaderDebugInfoLookupCallback, - ShaderLookupCallback, - nullptr, - ShaderSourceDebugInfoLookupCallback, - this, - &jsonSize)); - // Step 2: Allocate a buffer and fetch the generated JSON. - std::vector json(jsonSize); - AFTERMATH_CHECK_ERROR(GFSDK_Aftermath_GpuCrashDump_GetJSON( - decoder, - uint32_t(json.size()), - json.data())); - - // Write the the crash dump data as JSON to a file. - const std::string jsonFileName = crashDumpFileName + ".json"; - std::ofstream jsonFile(jsonFileName, std::ios::out | std::ios::binary); - if (jsonFile) - { - jsonFile.write(json.data(), json.size()); - jsonFile.close(); - } - - // Destroy the GPU crash dump decoder object. - AFTERMATH_CHECK_ERROR(GFSDK_Aftermath_GpuCrashDump_DestroyDecoder(decoder)); -} - -// Helper for writing shader debug information to a file -void GpuCrashTracker::WriteShaderDebugInformationToFile( - GFSDK_Aftermath_ShaderDebugInfoIdentifier identifier, - const void* pShaderDebugInfo, - const uint32_t shaderDebugInfoSize) -{ - // Create a unique file name. - const std::string filePath = "shader-" + std::to_string(identifier) + ".nvdbg"; - - std::ofstream f(filePath, std::ios::out | std::ios::binary); - if (f) - { - f.write((const char*)pShaderDebugInfo, shaderDebugInfoSize); - } -} - -// Handler for shader debug information lookup callbacks. -// This is used by the JSON decoder for mapping shader instruction -// addresses to DXIL lines or HLSl source lines. -void GpuCrashTracker::OnShaderDebugInfoLookup( - const GFSDK_Aftermath_ShaderDebugInfoIdentifier& identifier, - PFN_GFSDK_Aftermath_SetData setShaderDebugInfo) const -{ - // Search the list of shader debug information blobs received earlier. - auto i_debugInfo = m_shaderDebugInfo.find(identifier); - if (i_debugInfo == m_shaderDebugInfo.end()) - { - // Early exit, nothing found. No need to call setShaderDebugInfo. - return; - } - - // Let the GPU crash dump decoder know about the shader debug information - // that was found. - setShaderDebugInfo(i_debugInfo->second.data(), uint32_t(i_debugInfo->second.size())); -} - -// Handler for shader lookup callbacks. -// This is used by the JSON decoder for mapping shader instruction -// addresses to DXIL lines or HLSL source lines. -// NOTE: If the application loads stripped shader binaries (-Qstrip_debug), -// Aftermath will require access to both the stripped and the not stripped -// shader binaries. -void GpuCrashTracker::OnShaderLookup( - const GFSDK_Aftermath_ShaderHash& shaderHash, - PFN_GFSDK_Aftermath_SetData setShaderBinary) const -{ - // Find shader binary data for the shader hash in the shader database. - std::vector shaderBinary; - if (!m_shaderDatabase.FindShaderBinary(shaderHash, shaderBinary)) - { - // Early exit, nothing found. No need to call setShaderBinary. - return; - } - - // Let the GPU crash dump decoder know about the shader data - // that was found. - setShaderBinary(shaderBinary.data(), uint32_t(shaderBinary.size())); -} - -// Handler for shader source debug info lookup callbacks. -// This is used by the JSON decoder for mapping shader instruction addresses to -// HLSL source lines, if the shaders used by the application were compiled with -// separate debug info data files. -void GpuCrashTracker::OnShaderSourceDebugInfoLookup( - const GFSDK_Aftermath_ShaderDebugName& shaderDebugName, - PFN_GFSDK_Aftermath_SetData setShaderBinary) const -{ - // Find source debug info for the shader DebugName in the shader database. - std::vector shaderBinary; - if (!m_shaderDatabase.FindShaderBinaryWithDebugData(shaderDebugName, shaderBinary)) - { - // Early exit, nothing found. No need to call setShaderBinary. - return; - } - - // Let the GPU crash dump decoder know about the shader debug data that was - // found. - setShaderBinary(shaderBinary.data(), uint32_t(shaderBinary.size())); -} - -// Static callback wrapper for OnCrashDump -void GpuCrashTracker::GpuCrashDumpCallback( - const void* pGpuCrashDump, - const uint32_t gpuCrashDumpSize, - void* pUserData) -{ - GpuCrashTracker* pGpuCrashTracker = reinterpret_cast(pUserData); - pGpuCrashTracker->OnCrashDump(pGpuCrashDump, gpuCrashDumpSize); -} - -// Static callback wrapper for OnShaderDebugInfo -void GpuCrashTracker::ShaderDebugInfoCallback( - const void* pShaderDebugInfo, - const uint32_t shaderDebugInfoSize, - void* pUserData) -{ - GpuCrashTracker* pGpuCrashTracker = reinterpret_cast(pUserData); - pGpuCrashTracker->OnShaderDebugInfo(pShaderDebugInfo, shaderDebugInfoSize); -} - -// Static callback wrapper for OnDescription -void GpuCrashTracker::CrashDumpDescriptionCallback( - PFN_GFSDK_Aftermath_AddGpuCrashDumpDescription addDescription, - void* pUserData) -{ - GpuCrashTracker* pGpuCrashTracker = reinterpret_cast(pUserData); - pGpuCrashTracker->OnDescription(addDescription); -} - -// Static callback wrapper for OnShaderDebugInfoLookup -void GpuCrashTracker::ShaderDebugInfoLookupCallback( - const GFSDK_Aftermath_ShaderDebugInfoIdentifier* pIdentifier, - PFN_GFSDK_Aftermath_SetData setShaderDebugInfo, - void* pUserData) -{ - GpuCrashTracker* pGpuCrashTracker = reinterpret_cast(pUserData); - pGpuCrashTracker->OnShaderDebugInfoLookup(*pIdentifier, setShaderDebugInfo); -} - -// Static callback wrapper for OnShaderLookup -void GpuCrashTracker::ShaderLookupCallback( - const GFSDK_Aftermath_ShaderHash* pShaderHash, - PFN_GFSDK_Aftermath_SetData setShaderBinary, - void* pUserData) -{ - GpuCrashTracker* pGpuCrashTracker = reinterpret_cast(pUserData); - pGpuCrashTracker->OnShaderLookup(*pShaderHash, setShaderBinary); -} - -// Static callback wrapper for OnShaderSourceDebugInfoLookup -void GpuCrashTracker::ShaderSourceDebugInfoLookupCallback( - const GFSDK_Aftermath_ShaderDebugName* pShaderDebugName, - PFN_GFSDK_Aftermath_SetData setShaderBinary, - void* pUserData) -{ - GpuCrashTracker* pGpuCrashTracker = reinterpret_cast(pUserData); - pGpuCrashTracker->OnShaderSourceDebugInfoLookup(*pShaderDebugName, setShaderBinary); -} diff --git a/src/Engine/Graphics/Vulkan/NsightAftermathGpuCrashTracker.h b/src/Engine/Graphics/Vulkan/NsightAftermathGpuCrashTracker.h deleted file mode 100644 index 289d380..0000000 --- a/src/Engine/Graphics/Vulkan/NsightAftermathGpuCrashTracker.h +++ /dev/null @@ -1,159 +0,0 @@ -//********************************************************* -// -// Copyright (c) 2019-2020, NVIDIA CORPORATION. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the "Software"), -// to deal in the Software without restriction, including without limitation -// the rights to use, copy, modify, merge, publish, distribute, sublicense, -// and/or sell copies of the Software, and to permit persons to whom the -// Software is furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -// DEALINGS IN THE SOFTWARE. -// -//********************************************************* - -#pragma once - -#include -#include - -#include "NsightAftermathHelpers.h" -#include "NsightAftermathShaderDatabase.h" - -//********************************************************* -// Implements GPU crash dump tracking using the Nsight -// Aftermath API. -// -class GpuCrashTracker -{ -public: - GpuCrashTracker(); - ~GpuCrashTracker(); - - // Initialize the GPU crash dump tracker. - void Initialize(); - -private: - - //********************************************************* - // Callback handlers for GPU crash dumps and related data. - // - - // Handler for GPU crash dump callbacks. - void OnCrashDump(const void* pGpuCrashDump, const uint32_t gpuCrashDumpSize); - - // Handler for shader debug information callbacks. - void OnShaderDebugInfo(const void* pShaderDebugInfo, const uint32_t shaderDebugInfoSize); - - // Handler for GPU crash dump description callbacks. - void OnDescription(PFN_GFSDK_Aftermath_AddGpuCrashDumpDescription addDescription); - - //********************************************************* - // Helpers for writing a GPU crash dump and debug information - // data to files. - // - - // Helper for writing a GPU crash dump to a file. - void WriteGpuCrashDumpToFile(const void* pGpuCrashDump, const uint32_t gpuCrashDumpSize); - - // Helper for writing shader debug information to a file - void WriteShaderDebugInformationToFile( - GFSDK_Aftermath_ShaderDebugInfoIdentifier identifier, - const void* pShaderDebugInfo, - const uint32_t shaderDebugInfoSize); - - //********************************************************* - // Helpers for decoding GPU crash dump to JSON. - // - - // Handler for shader debug info lookup callbacks. - void OnShaderDebugInfoLookup( - const GFSDK_Aftermath_ShaderDebugInfoIdentifier& identifier, - PFN_GFSDK_Aftermath_SetData setShaderDebugInfo) const; - - // Handler for shader lookup callbacks. - void OnShaderLookup( - const GFSDK_Aftermath_ShaderHash& shaderHash, - PFN_GFSDK_Aftermath_SetData setShaderBinary) const; - - // Handler for shader instructions lookup callbacks. - void OnShaderInstructionsLookup( - const GFSDK_Aftermath_ShaderInstructionsHash& shaderInstructionsHash, - PFN_GFSDK_Aftermath_SetData setShaderBinary) const; - - // Handler for shader source debug info lookup callbacks. - void OnShaderSourceDebugInfoLookup( - const GFSDK_Aftermath_ShaderDebugName& shaderDebugName, - PFN_GFSDK_Aftermath_SetData setShaderBinary) const; - - //********************************************************* - // Static callback wrappers. - // - - // GPU crash dump callback. - static void GpuCrashDumpCallback( - const void* pGpuCrashDump, - const uint32_t gpuCrashDumpSize, - void* pUserData); - - // Shader debug information callback. - static void ShaderDebugInfoCallback( - const void* pShaderDebugInfo, - const uint32_t shaderDebugInfoSize, - void* pUserData); - - // GPU crash dump description callback. - static void CrashDumpDescriptionCallback( - PFN_GFSDK_Aftermath_AddGpuCrashDumpDescription addDescription, - void* pUserData); - - // Shader debug information lookup callback. - static void ShaderDebugInfoLookupCallback( - const GFSDK_Aftermath_ShaderDebugInfoIdentifier* pIdentifier, - PFN_GFSDK_Aftermath_SetData setShaderDebugInfo, - void* pUserData); - - // Shader lookup callback. - static void ShaderLookupCallback( - const GFSDK_Aftermath_ShaderHash* pShaderHash, - PFN_GFSDK_Aftermath_SetData setShaderBinary, - void* pUserData); - - // Shader instructions lookup callback. - static void ShaderInstructionsLookupCallback( - const GFSDK_Aftermath_ShaderInstructionsHash* pShaderInstructionsHash, - PFN_GFSDK_Aftermath_SetData setShaderBinary, - void* pUserData); - - // Shader source debug info lookup callback. - static void ShaderSourceDebugInfoLookupCallback( - const GFSDK_Aftermath_ShaderDebugName* pShaderDebugName, - PFN_GFSDK_Aftermath_SetData setShaderBinary, - void* pUserData); - - //********************************************************* - // GPU crash tracker state. - // - - // Is the GPU crash dump tracker initialized? - bool m_initialized; - - // For thread-safe access of GPU crash tracker state. - mutable std::mutex m_mutex; - - // List of Shader Debug Information by ShaderDebugInfoIdentifier. - std::map> m_shaderDebugInfo; - - // The mock shader database. - ShaderDatabase m_shaderDatabase; -}; diff --git a/src/Engine/Graphics/Vulkan/NsightAftermathHelpers.h b/src/Engine/Graphics/Vulkan/NsightAftermathHelpers.h deleted file mode 100644 index 18d7889..0000000 --- a/src/Engine/Graphics/Vulkan/NsightAftermathHelpers.h +++ /dev/null @@ -1,142 +0,0 @@ -//********************************************************* -// -// Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the "Software"), -// to deal in the Software without restriction, including without limitation -// the rights to use, copy, modify, merge, publish, distribute, sublicense, -// and/or sell copies of the Software, and to permit persons to whom the -// Software is furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -// DEALINGS IN THE SOFTWARE. -// -//********************************************************* - -#pragma once - -#include -#include -#include - -#include -#include "GFSDK_Aftermath.h" -#include "GFSDK_Aftermath_GpuCrashDump.h" -#include "GFSDK_Aftermath_GpuCrashDumpDecoding.h" - -//********************************************************* -// Some std::to_string overloads for some Nsight Aftermath -// API types. -// - -namespace std -{ - template - inline std::string to_hex_string(T n) - { - std::stringstream stream; - stream << std::setfill('0') << std::setw(2 * sizeof(T)) << std::hex << n; - return stream.str(); - } - - inline std::string to_string(GFSDK_Aftermath_Result result) - { - return std::string("0x") + to_hex_string(static_cast(result)); - } - - inline std::string to_string(const GFSDK_Aftermath_ShaderDebugInfoIdentifier& identifier) - { - return to_hex_string(identifier.id[0]) + "-" + to_hex_string(identifier.id[1]); - } - - inline std::string to_string(const GFSDK_Aftermath_ShaderHash& hash) - { - return to_hex_string(hash.hash); - } - - inline std::string to_string(const GFSDK_Aftermath_ShaderInstructionsHash& hash) - { - return to_hex_string(hash.hash) + "-" + to_hex_string(hash.hash); - } -} // namespace std - -//********************************************************* -// Helper for comparing shader hashes and debug info identifier. -// - -// Helper for comparing GFSDK_Aftermath_ShaderDebugInfoIdentifier. -inline bool operator<(const GFSDK_Aftermath_ShaderDebugInfoIdentifier& lhs, const GFSDK_Aftermath_ShaderDebugInfoIdentifier& rhs) -{ - if (lhs.id[0] == rhs.id[0]) - { - return lhs.id[1] < rhs.id[1]; - } - return lhs.id[0] < rhs.id[0]; -} - -// Helper for comparing GFSDK_Aftermath_ShaderHash. -inline bool operator<(const GFSDK_Aftermath_ShaderHash& lhs, const GFSDK_Aftermath_ShaderHash& rhs) -{ - return lhs.hash < rhs.hash; -} - -// Helper for comparing GFSDK_Aftermath_ShaderInstructionsHash. -inline bool operator<(const GFSDK_Aftermath_ShaderInstructionsHash& lhs, const GFSDK_Aftermath_ShaderInstructionsHash& rhs) -{ - return lhs.hash < rhs.hash; -} - -// Helper for comparing GFSDK_Aftermath_ShaderDebugName. -inline bool operator<(const GFSDK_Aftermath_ShaderDebugName& lhs, const GFSDK_Aftermath_ShaderDebugName& rhs) -{ - return strncmp(lhs.name, rhs.name, sizeof(lhs.name)) < 0; -} - -//********************************************************* -// Helper for checking Nsight Aftermath failures. -// - -inline std::string AftermathErrorMessage(GFSDK_Aftermath_Result result) -{ - switch (result) - { - case GFSDK_Aftermath_Result_FAIL_DriverVersionNotSupported: - return "Unsupported driver version - requires a recent NVIDIA R445 display driver or newer."; - default: - return "Aftermath Error 0x" + std::to_hex_string(result); - } -} - -// Helper macro for checking Nsight Aftermath results and throwing exception -// in case of a failure. -#ifdef _WIN32 -#define AFTERMATH_CHECK_ERROR(FC) \ -[&]() { \ - GFSDK_Aftermath_Result _result = FC; \ - if (!GFSDK_Aftermath_SUCCEED(_result)) \ - { \ - std::cout << AftermathErrorMessage(_result).c_str() << std::endl; \ - exit(1); \ - } \ -}() -#else -#define AFTERMATH_CHECK_ERROR(FC) \ -[&]() { \ - GFSDK_Aftermath_Result _result = FC; \ - if (!GFSDK_Aftermath_SUCCEED(_result)) \ - { \ - printf("%s\n", AftermathErrorMessage(_result).c_str()); \ - fflush(stdout); \ - exit(1); \ - } \ -}() -#endif diff --git a/src/Engine/Graphics/Vulkan/NsightAftermathShaderDatabase.cpp b/src/Engine/Graphics/Vulkan/NsightAftermathShaderDatabase.cpp deleted file mode 100644 index a93ca30..0000000 --- a/src/Engine/Graphics/Vulkan/NsightAftermathShaderDatabase.cpp +++ /dev/null @@ -1,147 +0,0 @@ -//********************************************************* -// -// Copyright (c) 2019-2020, NVIDIA CORPORATION. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the "Software"), -// to deal in the Software without restriction, including without limitation -// the rights to use, copy, modify, merge, publish, distribute, sublicense, -// and/or sell copies of the Software, and to permit persons to whom the -// Software is furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -// DEALINGS IN THE SOFTWARE. -// -//********************************************************* - -#include -#include - -#include "NsightAftermathShaderDatabase.h" - -//********************************************************* -// ShaderDatabase implementation -//********************************************************* - -ShaderDatabase::ShaderDatabase() - : m_shaderBinaries() - , m_shaderBinariesWithDebugInfo() -{ - // Add shader binaries to database - AddShaderBinary("cube.vert.spirv"); - AddShaderBinary("cube.frag.spirv"); - - // Add the not stripped shader binaries to the database, too. - AddShaderBinaryWithDebugInfo("cube.vert.spirv", "cube.vert.full.spirv"); - AddShaderBinaryWithDebugInfo("cube.frag.spirv", "cube.frag.full.spirv"); -} - -ShaderDatabase::~ShaderDatabase() -{ -} - -bool ShaderDatabase::ReadFile(const char* filename, std::vector& data) -{ - std::ifstream fs(filename, std::ios::in | std::ios::binary); - if (!fs) - { - return false; - } - - fs.seekg(0, std::ios::end); - data.resize(fs.tellg()); - fs.seekg(0, std::ios::beg); - fs.read(reinterpret_cast(data.data()), data.size()); - fs.close(); - - return true; -} - -void ShaderDatabase::AddShaderBinary(const char* shaderFilePath) -{ - // Read the shader binary code from the file - std::vector data; - if (!ReadFile(shaderFilePath, data)) - { - return; - } - - // Create shader hash for the shader - const GFSDK_Aftermath_SpirvCode shader{ data.data(), uint32_t(data.size()) }; - GFSDK_Aftermath_ShaderHash shaderHash; - AFTERMATH_CHECK_ERROR(GFSDK_Aftermath_GetShaderHashSpirv( - GFSDK_Aftermath_Version_API, - &shader, - &shaderHash)); - - // Store the data for shader mapping when decoding GPU crash dumps. - // cf. FindShaderBinary() - m_shaderBinaries[shaderHash].swap(data); -} - -void ShaderDatabase::AddShaderBinaryWithDebugInfo(const char* strippedShaderFilePath, const char* shaderFilePath) -{ - // Read the shader debug data from the file - std::vector data; - if (!ReadFile(shaderFilePath, data)) - { - return; - } - std::vector strippedData; - if (!ReadFile(strippedShaderFilePath, strippedData)) - { - return; - } - - // Generate shader debug name. - GFSDK_Aftermath_ShaderDebugName debugName; - const GFSDK_Aftermath_SpirvCode shader{ data.data(), uint32_t(data.size()) }; - const GFSDK_Aftermath_SpirvCode strippedShader{ strippedData.data(), uint32_t(strippedData.size()) }; - AFTERMATH_CHECK_ERROR(GFSDK_Aftermath_GetShaderDebugNameSpirv( - GFSDK_Aftermath_Version_API, - &shader, - &strippedShader, - &debugName)); - - // Store the data for shader instruction address mapping when decoding GPU crash dumps. - // cf. FindShaderBinaryWithDebugData() - m_shaderBinariesWithDebugInfo[debugName].swap(data); -} - -// Find a shader binary by shader hash. -bool ShaderDatabase::FindShaderBinary(const GFSDK_Aftermath_ShaderHash& shaderHash, std::vector& shader) const -{ - // Find shader binary data for the shader hash - auto i_shader = m_shaderBinaries.find(shaderHash); - if (i_shader == m_shaderBinaries.end()) - { - // Nothing found. - return false; - } - - shader = i_shader->second; - return true; -} - -// Find a shader binary with debug information by shader debug name. -bool ShaderDatabase::FindShaderBinaryWithDebugData(const GFSDK_Aftermath_ShaderDebugName& shaderDebugName, std::vector& shader) const -{ - // Find shader binary for the shader debug name. - auto i_shader = m_shaderBinariesWithDebugInfo.find(shaderDebugName); - if (i_shader == m_shaderBinariesWithDebugInfo.end()) - { - // Nothing found. - return false; - } - - shader = i_shader->second; - return true; -} diff --git a/src/Engine/Graphics/Vulkan/NsightAftermathShaderDatabase.h b/src/Engine/Graphics/Vulkan/NsightAftermathShaderDatabase.h deleted file mode 100644 index 0402cdb..0000000 --- a/src/Engine/Graphics/Vulkan/NsightAftermathShaderDatabase.h +++ /dev/null @@ -1,64 +0,0 @@ -//********************************************************* -// -// Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the "Software"), -// to deal in the Software without restriction, including without limitation -// the rights to use, copy, modify, merge, publish, distribute, sublicense, -// and/or sell copies of the Software, and to permit persons to whom the -// Software is furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -// DEALINGS IN THE SOFTWARE. -// -//********************************************************* - -#pragma once - -#include -#include -#include - -#include "NsightAftermathHelpers.h" - -//********************************************************* -// Implements a very simple shader database to help demonstrate -// how to use the Nsight Aftermath GPU crash dump decoder API. -// -// In a real world scenario this would be part of an offline -// analysis tool. This is for demonstration purposes only! -// -class ShaderDatabase -{ -public: - ShaderDatabase(); - ~ShaderDatabase(); - - // Find a shader bytecode binary by shader hash. - bool FindShaderBinary(const GFSDK_Aftermath_ShaderHash& shaderHash, std::vector& shader) const; - - // Find a source shader debug info by shader debug name generated by the DXC compiler. - bool FindShaderBinaryWithDebugData(const GFSDK_Aftermath_ShaderDebugName& shaderDebugName, std::vector& shader) const; - -private: - - void AddShaderBinary(const char* shaderFilePath); - void AddShaderBinaryWithDebugInfo(const char* strippedShaderFilePath, const char* shaderFilePath); - - static bool ReadFile(const char* filename, std::vector& data); - - // List of shader binaries by ShaderHash. - std::map> m_shaderBinaries; - - // List of available shader binaries with source debug information by ShaderDebugName. - std::map> m_shaderBinariesWithDebugInfo; -}; diff --git a/src/Engine/Graphics/Vulkan/VulkanDescriptorSets.cpp b/src/Engine/Graphics/Vulkan/VulkanDescriptorSets.cpp index 2ef63f4..0ea7b0a 100644 --- a/src/Engine/Graphics/Vulkan/VulkanDescriptorSets.cpp +++ b/src/Engine/Graphics/Vulkan/VulkanDescriptorSets.cpp @@ -53,9 +53,7 @@ void DescriptorLayout::create() allocator = new DescriptorAllocator(graphics, *this); - boost::crc_32_type result; - result.process_bytes(bindings.data(), sizeof(VkDescriptorSetLayoutBinding) * bindings.size()); - hash = result.checksum(); + hash = CRC::Calculate(bindings.data(), sizeof(VkDescriptorSetLayoutBinding) * bindings.size(), CRC::CRC_32()); } PipelineLayout::~PipelineLayout() @@ -96,10 +94,8 @@ void PipelineLayout::create() createInfo.pushConstantRangeCount = (uint32)vkPushConstants.size(); createInfo.pPushConstantRanges = vkPushConstants.data(); - boost::crc_32_type result; - result.process_bytes(createInfo.pPushConstantRanges, sizeof(VkPushConstantRange) * createInfo.pushConstantRangeCount); - result.process_bytes(createInfo.pSetLayouts, sizeof(VkDescriptorSetLayout) * createInfo.setLayoutCount); - layoutHash = result.checksum(); + layoutHash = CRC::Calculate(createInfo.pPushConstantRanges, sizeof(VkPushConstantRange) * createInfo.pushConstantRangeCount, CRC::CRC_32()); + layoutHash = CRC::Calculate(createInfo.pSetLayouts, sizeof(VkDescriptorSetLayout) * createInfo.setLayoutCount, CRC::CRC_32(), layoutHash); if(layoutCache[layoutHash] != VK_NULL_HANDLE) { diff --git a/src/Engine/Graphics/Vulkan/VulkanFramebuffer.cpp b/src/Engine/Graphics/Vulkan/VulkanFramebuffer.cpp index 64657a8..3765ef1 100644 --- a/src/Engine/Graphics/Vulkan/VulkanFramebuffer.cpp +++ b/src/Engine/Graphics/Vulkan/VulkanFramebuffer.cpp @@ -52,9 +52,7 @@ Framebuffer::Framebuffer(PGraphics graphics, PRenderPass renderPass, Gfx::PRende VK_CHECK(vkCreateFramebuffer(graphics->getDevice(), &createInfo, nullptr, &handle)); - boost::crc_32_type result; - result.process_bytes(&description, sizeof(FramebufferDescription)); - hash = result.checksum(); + hash = CRC::Calculate(&description, sizeof(FramebufferDescription), CRC::CRC_32()); } Framebuffer::~Framebuffer() diff --git a/src/Engine/Graphics/Vulkan/VulkanGraphics.cpp b/src/Engine/Graphics/Vulkan/VulkanGraphics.cpp index cb2989a..d96eb44 100644 --- a/src/Engine/Graphics/Vulkan/VulkanGraphics.cpp +++ b/src/Engine/Graphics/Vulkan/VulkanGraphics.cpp @@ -417,8 +417,6 @@ void Graphics::setupDebugCallback() VK_DEBUG_REPORT_ERROR_BIT_EXT | VK_DEBUG_REPORT_WARNING_BIT_EXT | VK_DEBUG_REPORT_PERFORMANCE_WARNING_BIT_EXT); VK_CHECK(CreateDebugReportCallbackEXT(instance, &createInfo, nullptr, &callback)); - - crashTracker.Initialize(); } void Graphics::pickPhysicalDevice() diff --git a/src/Engine/Graphics/Vulkan/VulkanGraphics.h b/src/Engine/Graphics/Vulkan/VulkanGraphics.h index aa0651c..49078b7 100644 --- a/src/Engine/Graphics/Vulkan/VulkanGraphics.h +++ b/src/Engine/Graphics/Vulkan/VulkanGraphics.h @@ -1,7 +1,6 @@ #pragma once #include "VulkanGraphicsResources.h" #include "Graphics/Graphics.h" -#include "NsightAftermathGpuCrashTracker.h" namespace Seele { @@ -100,7 +99,6 @@ protected: Map allocatedFramebuffers; PAllocator allocator; PStagingManager stagingManager; - GpuCrashTracker crashTracker; friend class Window; }; diff --git a/src/Engine/Graphics/Vulkan/VulkanPipelineCache.cpp b/src/Engine/Graphics/Vulkan/VulkanPipelineCache.cpp index 2ac61ba..10edf3c 100644 --- a/src/Engine/Graphics/Vulkan/VulkanPipelineCache.cpp +++ b/src/Engine/Graphics/Vulkan/VulkanPipelineCache.cpp @@ -318,9 +318,7 @@ PGraphicsPipeline PipelineCache::createPipeline(const GraphicsPipelineCreateInfo PPipelineLayout layout = gfxInfo.pipelineLayout.cast(); hashStruct.pipelineLayoutHash = layout->getHash(); - boost::crc_32_type crc; - crc.process_bytes(&hashStruct, sizeof(PipelineCreateHashStruct)); - uint32 hash = crc.checksum(); + uint32 hash = CRC::Calculate(&hashStruct, sizeof(PipelineCreateHashStruct), CRC::CRC_32()); VkPipeline pipelineHandle; std::scoped_lock lock(createdPipelinesLock); diff --git a/src/Engine/Graphics/Vulkan/VulkanRenderPass.cpp b/src/Engine/Graphics/Vulkan/VulkanRenderPass.cpp index aad958d..ab0d914 100644 --- a/src/Engine/Graphics/Vulkan/VulkanRenderPass.cpp +++ b/src/Engine/Graphics/Vulkan/VulkanRenderPass.cpp @@ -142,7 +142,5 @@ uint32 RenderPass::getFramebufferHash() PTexture2D tex = layout->depthAttachment->getTexture().cast(); description.depthAttachment = tex->getView(); } - boost::crc_32_type result; - result.process_bytes(&description, sizeof(FramebufferDescription)); - return result.checksum(); + return CRC::Calculate(&description, sizeof(FramebufferDescription), CRC::CRC_32()); } \ No newline at end of file diff --git a/src/Engine/Graphics/Vulkan/VulkanShader.cpp b/src/Engine/Graphics/Vulkan/VulkanShader.cpp index 6a8696d..72f1596 100644 --- a/src/Engine/Graphics/Vulkan/VulkanShader.cpp +++ b/src/Engine/Graphics/Vulkan/VulkanShader.cpp @@ -155,8 +155,6 @@ void Shader::create(const ShaderCreateInfo& createInfo) moduleInfo.pCode = (uint32_t*)kernelBlob->getBufferPointer(); VK_CHECK(vkCreateShaderModule(graphics->getDevice(), &moduleInfo, nullptr, &module)); - boost::crc_32_type result; - result.process_bytes(entryPointName.data(), entryPointName.size()); - result.process_bytes(kernelBlob->getBufferPointer(), kernelBlob->getBufferSize()); - hash = result.checksum(); + hash = CRC::Calculate(entryPointName.data(), entryPointName.size(), CRC::CRC_32()); + hash = CRC::Calculate(kernelBlob->getBufferPointer(), kernelBlob->getBufferSize(), CRC::CRC_32(), hash); } \ No newline at end of file diff --git a/src/Engine/Material/CMakeLists.txt b/src/Engine/Material/CMakeLists.txt index 34244ca..7a9e3e9 100644 --- a/src/Engine/Material/CMakeLists.txt +++ b/src/Engine/Material/CMakeLists.txt @@ -5,4 +5,12 @@ target_sources(Engine MaterialAsset.h MaterialAsset.cpp ShaderExpression.h - ShaderExpression.cpp) \ No newline at end of file + ShaderExpression.cpp) + +target_sources(Engine + PUBLIC FILE_SET HEADERS + FILES + BRDF.h + MaterialAsset.h + ShaderExpression.h) + diff --git a/src/Engine/Math/CMakeLists.txt b/src/Engine/Math/CMakeLists.txt index 41125a6..70547c0 100644 --- a/src/Engine/Math/CMakeLists.txt +++ b/src/Engine/Math/CMakeLists.txt @@ -5,4 +5,12 @@ target_sources(Engine Transform.h Transform.cpp Vector.h - Vector.cpp) \ No newline at end of file + Vector.cpp) + +target_sources(Engine + PUBLIC FILE_SET HEADERS + FILES + Math.h + Matrix.h + Transform.h + Vector.h) diff --git a/src/Engine/MinimalEngine.h b/src/Engine/MinimalEngine.h index bec6615..d796089 100644 --- a/src/Engine/MinimalEngine.h +++ b/src/Engine/MinimalEngine.h @@ -263,12 +263,6 @@ public: private: RefObject *object; - friend class boost::serialization::access; - template - void serialize(Archive& ar, const unsigned int) - { - ar & *object->getHandle(); - } }; template class UniquePtr @@ -326,12 +320,6 @@ public: private: T *handle; - friend class boost::serialization::access; - template - void serialize(Archive& ar, const unsigned int version) - { - ar & *handle; - } }; //A weak pointer has no ownership over an object and thus cant delete it template diff --git a/src/Engine/Scene/CMakeLists.txt b/src/Engine/Scene/CMakeLists.txt index 81fdb35..5015ebe 100644 --- a/src/Engine/Scene/CMakeLists.txt +++ b/src/Engine/Scene/CMakeLists.txt @@ -1,5 +1,11 @@ target_sources(Engine - PRIVATE + PRIVATE Util.h Scene.cpp Scene.h) + +target_sources(Engine + PUBLIC FILE_SET HEADERS + FILES + Util.h + Scene.h) \ No newline at end of file diff --git a/src/Engine/System/CMakeLists.txt b/src/Engine/System/CMakeLists.txt index a81e825..dd8df78 100644 --- a/src/Engine/System/CMakeLists.txt +++ b/src/Engine/System/CMakeLists.txt @@ -2,4 +2,10 @@ target_sources(Engine PRIVATE Executor.h Executor.cpp - SystemBase.h) \ No newline at end of file + SystemBase.h) + +target_sources(Engine + PUBLIC FILE_SET HEADERS + FILES + Executor.h + SystemBase.h) \ No newline at end of file diff --git a/src/Engine/ThreadPool.h b/src/Engine/ThreadPool.h index 4e14da1..fa67145 100644 --- a/src/Engine/ThreadPool.h +++ b/src/Engine/ThreadPool.h @@ -348,7 +348,7 @@ public: std::scoped_lock lock(mainJobLock); for(auto job : jobs) { - std::scoped_lock lock(job.promise->promiseLock); + std::scoped_lock l(job.promise->promiseLock); job.promise->validate(); job.promise->state = JobPromiseBase::State::SCHEDULED; mainJobs.add(job); @@ -362,7 +362,7 @@ public: std::scoped_lock lock(jobQueueLock); for(auto job : jobs) { - std::scoped_lock lock(job.promise->promiseLock); + std::scoped_lock l(job.promise->promiseLock); job.promise->validate(); job.promise->state = JobPromiseBase::State::SCHEDULED; jobQueue.add(job); diff --git a/src/Engine/UI/CMakeLists.txt b/src/Engine/UI/CMakeLists.txt index c1bb37c..5f7c12c 100644 --- a/src/Engine/UI/CMakeLists.txt +++ b/src/Engine/UI/CMakeLists.txt @@ -11,4 +11,14 @@ target_sources(Engine VerticalLayout.h VerticalLayout.cpp) +target_sources(Engine + PUBLIC FILE_SET HEADERS + FILES + HorizontalLayout.h + Layout.h + RenderHierarchy.h + System.h + VerticalLayout.h) + + add_subdirectory(Elements/) \ No newline at end of file diff --git a/src/Engine/UI/Elements/CMakeLists.txt b/src/Engine/UI/Elements/CMakeLists.txt index 005c939..8cc1a34 100644 --- a/src/Engine/UI/Elements/CMakeLists.txt +++ b/src/Engine/UI/Elements/CMakeLists.txt @@ -7,4 +7,12 @@ target_sources(Engine Label.h Label.cpp Panel.h - Panel.cpp) \ No newline at end of file + Panel.cpp) + +target_sources(Engine + PUBLIC FILE_SET HEADERS + FILES + Button.h + Element.h + Label.h + Panel.h) diff --git a/src/Engine/Window/CMakeLists.txt b/src/Engine/Window/CMakeLists.txt index 597edbf..68c4ab7 100644 --- a/src/Engine/Window/CMakeLists.txt +++ b/src/Engine/Window/CMakeLists.txt @@ -6,3 +6,10 @@ target_sources(Engine Window.h WindowManager.h WindowManager.cpp) + +target_sources(Engine + PUBLIC FILE_SET HEADERS + FILES + View.h + Window.h + WindowManager.h) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index b2b8765..e6312e5 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -7,9 +7,8 @@ add_subdirectory(Engine/) target_include_directories(Seele_unit_tests PRIVATE ${ENGINE_ROOT}) +target_link_libraries(Seele_unit_tests PRIVATE Engine) target_link_libraries(Seele_unit_tests PRIVATE Boost::unit_test_framework) -target_link_libraries(Seele_unit_tests PRIVATE Vulkan::Vulkan) -target_link_libraries(Seele_unit_tests PRIVATE nsam) if(UNIX) target_compile_definitions(Seele_unit_tests PRIVATE -DBOOST_TEST_DYN_LINK) endif() diff --git a/test/Engine/Containers/Array.cpp b/test/Engine/Containers/Array.cpp index cbed168..267f6a2 100644 --- a/test/Engine/Containers/Array.cpp +++ b/test/Engine/Containers/Array.cpp @@ -60,7 +60,7 @@ BOOST_AUTO_TEST_CASE(remove_keeporder) BOOST_AUTO_TEST_CASE(find) { Array array; - for(uint32 i = 0; i < 100; ++i) + for(uint8 i = 0; i < 100; ++i) { array.add(i); } diff --git a/test/Engine/Math/Vector.cpp b/test/Engine/Math/Vector.cpp index 6df3059..9f7fb01 100644 --- a/test/Engine/Math/Vector.cpp +++ b/test/Engine/Math/Vector.cpp @@ -3,6 +3,7 @@ #include using namespace Seele; +using namespace Seele::Math; BOOST_AUTO_TEST_SUITE(VectorParse)