Fixing linux build kind of

This commit is contained in:
2021-10-13 15:20:30 +02:00
parent 99760724cd
commit 59b262777c
18 changed files with 111 additions and 100 deletions
+2 -2
View File
@@ -4,7 +4,7 @@
"name": "Win32",
"includePath": [
"${workspaceFolder}/**",
"${VULKAN_SDK}\\Include"
"external/**"
],
"defines": [
"_DEBUG",
@@ -16,7 +16,7 @@
"cppStandard": "c++20",
"browse": {
"path": [
"${VULKAN_SDK}/**"
"external/**"
]
}
}
+4 -4
View File
@@ -5,7 +5,6 @@ set(CMAKE_CXX_STANDARD 20)
# Handle superbuild first
option (USE_SUPERBUILD "Whether or not a superbuild should be invoked" ON)
set(ENGINE_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/src/Engine)
set(EXTERNAL_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/external)
set(ASSIMP_ROOT ${EXTERNAL_ROOT}/assimp)
@@ -22,7 +21,6 @@ set(NSAM_ROOT ${EXTERNAL_ROOT}/aftermath)
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/)
set(Boost_USE_STATIC_LIBS OFF)
set(Boost_LIB_PREFIX lib)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/bin/${CMAKE_BUILD_TYPE})
#Workaround for vs, because it places artifacts into an additional subfolder
@@ -81,8 +79,10 @@ target_link_libraries(SeeleEngine ${SLANG_LIBRARIES})
target_link_libraries(SeeleEngine ${ASSIMP_LIBRARIES})
target_link_libraries(SeeleEngine ${NSAM_LIBRARIES})
target_link_libraries(SeeleEngine ${KTX_LIBRARIES})
#target_link_libraries(SeeleEngine ${SPIRV_LIBRARIES})
if(UNIX)
target_link_libraries(SeeleEngine Threads::Threads)
target_link_libraries(SeeleEngine dl)
endif()
target_precompile_headers(SeeleEngine
PRIVATE
<assert.h>
+5 -20
View File
@@ -62,33 +62,18 @@ else()
# Find include files
find_path(
NSAM_INCLUDE_DIR
NAMES NSAM/nsam3.h
NAMES GFSDK_Aftermath.h
PATHS
/usr/include
/usr/local/include
/sw/include
/opt/local/include
${NSAM_ROOT}/include
DOC "The directory where GL/nsam.h resides")
# Find library files
# Try to use static libraries
#find_library(
# NSAM_LIBRARY
# NAMES nsam3
# PATHS
# /usr/lib64
# /usr/lib
# /usr/local/lib64
# /usr/local/lib
# /sw/lib
# /opt/local/lib
# ${NSAM_ROOT}/lib
# DOC "The NSAM library")
set(NSAM_LIBRARY "")
find_file(
NSAM_BINARY
NAMES libnsam${CMAKE_DEBUG_POSTFIX}.so
NAMES libGFSDK_Aftermath_Lib.${CMAKE_PLATFORM}.so
PATHS
/usr/lib64
/usr/lib
@@ -96,8 +81,8 @@ else()
/usr/local/lib
/sw/lib
/opt/local/lib
${NSAM_ROOT}/src
)
${NSAM_ROOT}/lib
PATH_SUFFIXES x64 x86)
endif()
# Handle REQUIRD argument, define *_FOUND variable
+15 -2
View File
@@ -55,6 +55,19 @@ else()
# Find library files
find_library(
ASSIMP_LIBRARY
NAMES libassimp${CMAKE_DEBUG_POSTFIX}.a
PATHS
/usr/lib64
/usr/lib
/usr/local/lib64
/usr/local/lib
/sw/lib
/opt/local/lib
${ASSIMP_ROOT}/code
DOC "Assimp library file")
find_file(
ASSIMP_BINARY
NAMES libassimp${CMAKE_DEBUG_POSTFIX}.so
PATHS
/usr/lib64
@@ -63,12 +76,12 @@ else()
/usr/local/lib
/sw/lib
/opt/local/lib
${ASSIMP_ROOT}/bin
${ASSIMP_ROOT}/code
DOC "The Assimp library")
endif()
# Handle REQUIRD argument, define *_FOUND variable
find_package_handle_standard_args(assimp DEFAULT_MSG ASSIMP_INCLUDE_DIR ASSIMP_LIBRARY)
find_package_handle_standard_args(assimp DEFAULT_MSG ASSIMP_INCLUDE_DIR ASSIMP_BINARY)
# Define GLFW_LIBRARIES and GLFW_INCLUDE_DIRS
if (ASSIMP_FOUND)
+14 -15
View File
@@ -70,20 +70,19 @@ else()
# Find library files
# Try to use static libraries
#find_library(
# GLFW_LIBRARY
# NAMES glfw3
# PATHS
# /usr/lib64
# /usr/lib
# /usr/local/lib64
# /usr/local/lib
# /sw/lib
# /opt/local/lib
# ${GLFW_ROOT}/lib
# DOC "The GLFW library")
set(GLFW_LIBRARY "")
find_library(
GLFW_LIBRARY
NAMES libglfw3${CMAKE_DEBUG_POSTFIX}.a
PATHS
/usr/lib64
/usr/lib
/usr/local/lib64
/usr/local/lib
/sw/lib
/opt/local/lib
${GLFW_ROOT}/src
DOC "The GLFW library")
find_file(
GLFW_BINARY
NAMES libglfw${CMAKE_DEBUG_POSTFIX}.so
@@ -99,7 +98,7 @@ else()
endif()
# Handle REQUIRD argument, define *_FOUND variable
find_package_handle_standard_args(GLFW DEFAULT_MSG GLFW_INCLUDE_DIR GLFW_BINARY)
find_package_handle_standard_args(GLFW DEFAULT_MSG GLFW_INCLUDE_DIR GLFW_LIBRARY GLFW_BINARY)
# Define GLFW_LIBRARIES and GLFW_INCLUDE_DIRS
if (GLFW_FOUND)
+11
View File
@@ -47,6 +47,17 @@ else()
/opt/local/include
${KTX_ROOT}
DOC "The directory where KTX/ktx.h resides")
find_library(
KTX_LIBRARY
NAMES libktx${CMAKE_DEBUG_POSTFIX}.so
PATHS
/usr/include
/usr/local/include
/sw/include
/opt/local/include
${KTX_ROOT}
DOC "The directory where KTX/libktx.so resides")
endif()
# Handle REQUIRD argument, define *_FOUND variable
+25 -18
View File
@@ -49,7 +49,7 @@ if (WIN32)
PATHS
${SLANG_BINARY_PATH})
else()
set(SLANG_BINARY_PATH ${SLANG_ROOT}/bin/linux-${CMAKE_PLATFORM}/release/)
set(SLANG_BINARY_PATH ${SLANG_ROOT}/bin/linux-${CMAKE_PLATFORM}/debug/)
# Find include files
find_path(
SLANG_INCLUDE_DIR
@@ -62,9 +62,29 @@ else()
${SLANG_ROOT}
DOC "The directory where GL/glfw.h resides")
find_library(
SLANG_LIBRARY
NAMES libcore.a
PATHS
/usr/include
/usr/local/include
/sw/include
/opt/local/include
${SLANG_BINARY_PATH}
DOC "The directory where GL/glfw.h resides")
find_library(
SLANG_COMPILER
NAMES libcompiler-core.a
PATHS
/usr/include
/usr/local/include
/sw/include
/opt/local/include
${SLANG_BINARY_PATH}
DOC "The directory where GL/glfw.h resides")
# Find library files
# Try to use static libraries
set(SLANG_LIBRARY "")
find_library(
SLANG_BINARY
NAMES libslang.so
@@ -77,28 +97,15 @@ else()
/opt/local/lib
${SLANG_BINARY_PATH}
DOC "The SLANG library")
find_file(
SLANG_GLSLANG
NAMES libslang-glslang.so
PATHS
/usr/lib64
/usr/lib
/usr/local/lib64
/usr/local/lib
/sw/lib
/opt/local/lib
${SLANG_BINARY_PATH}
)
endif()
# Handle REQUIRD argument, define *_FOUND variable
find_package_handle_standard_args(SLANG DEFAULT_MSG SLANG_INCLUDE_DIR SLANG_BINARY SLANG_GLSLANG)
find_package_handle_standard_args(SLANG DEFAULT_MSG SLANG_INCLUDE_DIR SLANG_LIBRARY SLANG_BINARY)
# Define SLANG_LIBRARIES and SLANG_INCLUDE_DIRS
if (SLANG_FOUND)
set(SLANG_BINARIES ${SLANG_BINARY} ${SLANG_GLSLANG})
set(SLANG_LIBRARIES ${SLANG_LIBRARY})
set(SLANG_LIBRARIES ${SLANG_LIBRARY} ${SLANG_COMPILER})
set(SLANG_INCLUDE_DIRS ${SLANG_INCLUDE_DIR})
endif()
+11 -16
View File
@@ -10,15 +10,15 @@ set(ASSIMP_BUILD_OVERALLS OFF CACHE INTERNAL "")
set(ASSIMP_BUILD_ASSIMP_TOOLS OFF CACHE INTERNAL "")
set(ASSIMP_INSTALL OFF CACHE INTERNAL "")
set(ASSIMP_BUILD_ZLIB OFF CACHE INTERNAL "")
set(BUILD_SHARED_LIBS ON CACHE INTERNAL "")
set(BUILD_SHARED_LIBS OFF CACHE INTERNAL "")
add_subdirectory(${ASSIMP_ROOT} ${ASSIMP_ROOT})
target_compile_definitions(assimp PRIVATE _SILENCE_CXX17_ITERATOR_BASE_CLASS_DEPRECATION_WARNING)
#if(WIN32)
# target_compile_options(assimp PRIVATE /WX-)
#else()
# target_compile_options(assimp PRIVATE -Wno-error)
#endif()
if(WIN32)
target_compile_options(assimp PRIVATE /WX-)
else()
target_compile_options(assimp PRIVATE -Wno-error -fPIC)
endif()
#-------------BOOST----------------
list(APPEND DEPENDENCIES boost)
if(WIN32)
@@ -30,7 +30,7 @@ ExternalProject_Add(boost
SOURCE_DIR ${BOOST_ROOT}
UPDATE_COMMAND ""
CONFIGURE_COMMAND ./bootstrap.${BOOTSTRAP_EXTENSION} --with-libraries=serialization,test
BUILD_COMMAND ./b2 link=static -d0
BUILD_COMMAND ./b2 -d0
BUILD_IN_SOURCE 1
INSTALL_COMMAND "")
@@ -59,12 +59,13 @@ set(GLFW_BUILD_EXAMPLES OFF CACHE BOOL "GLFW lib only" )
set(GLFW_BUILD_TESTS OFF CACHE BOOL "GLFW lib only" )
set(GLFW_BUILD_DOCS OFF CACHE BOOL "GLFW lib only" )
set(GLFW_BUILD_INSTALL OFF CACHE BOOL "GLFW lib only" )
set(GLFW_VULKAN_STATIC ON CACHE BOOL "GLFW vulkan static")
add_subdirectory(${GLFW_ROOT} ${GLFW_ROOT})
#--------------SLang------------------------------
list(APPEND DEPENDENCIES slang)
string(TOLOWER release_${CMAKE_PLATFORM} SLANG_CONFIG)
string(TOLOWER debug_${CMAKE_PLATFORM} SLANG_CONFIG)
if(WIN32)
ExternalProject_Add(slang
SOURCE_DIR ${SLANG_ROOT}
@@ -72,19 +73,13 @@ ExternalProject_Add(slang
CONFIGURE_COMMAND ""
BUILD_COMMAND msbuild slang.sln -p:Configuration=Release -p:Platform=${CMAKE_PLATFORM}
INSTALL_COMMAND "")
set(SLANG_LIB_PATH ${SLANG_ROOT}/${SLANG_LIB_PATH})
elseif(UNIX)
ExternalProject_Add(slang
SOURCE_DIR ${SLANG_ROOT}
BINARY_DIR ${SLANG_ROOT}/lib
CONFIGURE_COMMAND ${CMAKE_SOURCE_DIR}/premake5 --file=${CMAKE_SOURCE_DIR}/external/slang/premake5.lua gmake2 --build-location=build.linux
BUILD_COMMAND make -C ${CMAKE_SOURCE_DIR}/external/slang/build.linux config=${SLANG_CONFIG}
CONFIGURE_COMMAND ${CMAKE_SOURCE_DIR}/premake5 --file=${CMAKE_SOURCE_DIR}/external/slang/premake5.lua gmake2 --build-location=build/linux
BUILD_COMMAND make -C ${CMAKE_SOURCE_DIR}/external/slang/build/linux config=${SLANG_CONFIG}
INSTALL_COMMAND "")
string(TOLOWER bin/linux-${CMAKE_PLATFORM}/Release/libslang.so SLANG_BINARY)
string(TOLOWER bin/linux-${CMAKE_PLATFORM}/Release/libslang-glslang.so SLANG_GLSLANG)
set(SLANG_LIB_PATH)
endif()
@@ -28,14 +28,14 @@ private:
void setupFrustums();
static constexpr uint32 BLOCK_SIZE = 8;
static constexpr uint32 INDEX_LIGHT_ENV = 1;
_declspec(align(16)) struct DispatchParams
struct DispatchParams
{
glm::uvec3 numThreadGroups;
uint32_t pad0;
glm::uvec3 numThreads;
uint32_t pad1;
} dispatchParams;
__declspec(align(16)) struct Plane
struct Plane
{
Vector n;
float d;
@@ -43,7 +43,7 @@ private:
Vector p1;
Vector p2;
};
__declspec(align(16)) struct Frustum
struct Frustum
{
Plane planes[4];
};
+1 -1
View File
@@ -28,7 +28,7 @@ public:
virtual void createRenderPass() = 0;
void setResources(PRenderGraphResources resources) { this->resources = resources; }
protected:
_declspec(align(16)) struct ViewParameter
struct ViewParameter
{
Matrix4 viewMatrix;
Matrix4 projectionMatrix;
@@ -1,10 +1,5 @@
target_sources(SeeleEngine
PRIVATE
NsightAftermathGpuCrashTracker.h
NsightAftermathGpuCrashTracker.cpp
NsightAftermathHelpers.h
NsightAftermathShaderDatabase.h
NsightAftermathShaderDatabase.cpp
VulkanAllocator.h
VulkanAllocator.cpp
VulkanBuffer.cpp
@@ -45,7 +45,7 @@ GpuCrashTracker::~GpuCrashTracker()
// If initialized, disable GPU crash dumps
if (m_initialized)
{
GFSDK_Aftermath_DisableGpuCrashDumps();
AFTERMATH_CHECK_ERROR(GFSDK_Aftermath_DisableGpuCrashDumps());
}
}
@@ -91,7 +91,7 @@ void GpuCrashTracker::OnShaderDebugInfo(const void* pShaderDebugInfo, const uint
// Get shader debug information identifier
GFSDK_Aftermath_ShaderDebugInfoIdentifier identifier = {};
AFTERMATH_CHECK_ERROR(GFSDK_Aftermath_GetShaderDebugInfoIdentifier(
AFTERMATH_CHECK_ERROR(PFN_GFSDK_Aftermath_GetShaderDebugInfoIdentifier(
GFSDK_Aftermath_Version_API,
pShaderDebugInfo,
shaderDebugInfoSize,
@@ -124,7 +124,7 @@ void GpuCrashTracker::WriteGpuCrashDumpToFile(const void* pGpuCrashDump, const u
{
// Create a GPU crash dump decoder object for the GPU crash dump.
GFSDK_Aftermath_GpuCrashDump_Decoder decoder = {};
AFTERMATH_CHECK_ERROR(GFSDK_Aftermath_GpuCrashDump_CreateDecoder(
AFTERMATH_CHECK_ERROR(PFN_GFSDK_Aftermath_GpuCrashDump_CreateDecoder(
GFSDK_Aftermath_Version_API,
pGpuCrashDump,
gpuCrashDumpSize,
@@ -133,19 +133,19 @@ void GpuCrashTracker::WriteGpuCrashDumpToFile(const void* pGpuCrashDump, const u
// 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));
AFTERMATH_CHECK_ERROR(PFN_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(
AFTERMATH_CHECK_ERROR(PFN_GFSDK_Aftermath_GpuCrashDump_GetDescriptionSize(
decoder,
GFSDK_Aftermath_GpuCrashDumpDescriptionKey_ApplicationName,
&applicationNameLength));
std::vector<char> applicationName(applicationNameLength, '\0');
AFTERMATH_CHECK_ERROR(GFSDK_Aftermath_GpuCrashDump_GetDescription(
AFTERMATH_CHECK_ERROR(PFN_GFSDK_Aftermath_GpuCrashDump_GetDescription(
decoder,
GFSDK_Aftermath_GpuCrashDumpDescriptionKey_ApplicationName,
uint32_t(applicationName.size()),
@@ -176,7 +176,7 @@ void GpuCrashTracker::WriteGpuCrashDumpToFile(const void* pGpuCrashDump, const u
// 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(
AFTERMATH_CHECK_ERROR(PFN_GFSDK_Aftermath_GpuCrashDump_GenerateJSON(
decoder,
GFSDK_Aftermath_GpuCrashDumpDecoderFlags_ALL_INFO,
GFSDK_Aftermath_GpuCrashDumpFormatterFlags_NONE,
@@ -188,7 +188,7 @@ void GpuCrashTracker::WriteGpuCrashDumpToFile(const void* pGpuCrashDump, const u
&jsonSize));
// Step 2: Allocate a buffer and fetch the generated JSON.
std::vector<char> json(jsonSize);
AFTERMATH_CHECK_ERROR(GFSDK_Aftermath_GpuCrashDump_GetJSON(
AFTERMATH_CHECK_ERROR(PFN_GFSDK_Aftermath_GpuCrashDump_GetJSON(
decoder,
uint32_t(json.size()),
json.data()));
@@ -203,7 +203,7 @@ void GpuCrashTracker::WriteGpuCrashDumpToFile(const void* pGpuCrashDump, const u
}
// Destroy the GPU crash dump decoder object.
AFTERMATH_CHECK_ERROR(GFSDK_Aftermath_GpuCrashDump_DestroyDecoder(decoder));
AFTERMATH_CHECK_ERROR(PFN_GFSDK_Aftermath_GpuCrashDump_DestroyDecoder(decoder));
}
// Helper for writing shader debug information to a file
@@ -414,7 +414,7 @@ void Graphics::setupDebugCallback()
VK_CHECK(CreateDebugReportCallbackEXT(instance, &createInfo, nullptr, &callback));
crashTracker.Initialize();
//crashTracker.Initialize();
}
void Graphics::pickPhysicalDevice()
+1 -2
View File
@@ -1,7 +1,6 @@
#pragma once
#include "VulkanGraphicsResources.h"
#include "Graphics/Graphics.h"
#include "NsightAftermathGpuCrashTracker.h"
namespace Seele
{
@@ -99,7 +98,7 @@ protected:
Map<uint32, PFramebuffer> allocatedFramebuffers;
PAllocator allocator;
PStagingManager stagingManager;
GpuCrashTracker crashTracker;
//GpuCrashTracker crashTracker;
friend class Window;
};
+1
View File
@@ -58,6 +58,7 @@ public:
}
private:
Array<std::thread> workers;
Map<JobStage, List<Job>> jobs;
void threadLoop();
};
static ThreadPool& getGlobalThreadPool();
+1 -1
View File
@@ -60,7 +60,7 @@ void RenderHierarchy::moveElement(PElement elementToMove, PElement newParent)
void RenderHierarchy::updateHierarchy()
{
Array<RenderHierarchyUpdate*> localUpdates;
List<RenderHierarchyUpdate*> localUpdates;
{ // make a local copy of the updates so we dont hold the lock for too long
std::lock_guard lock(updateLock);
localUpdates = updates;
+7
View File
@@ -26,12 +26,19 @@ struct AddElementRenderHierarchyUpdate : public RenderHierarchyUpdate
{
Element* addedElement;
Element* parent;
AddElementRenderHierarchyUpdate(Element* addedElement, Element* parent)
: addedElement(addedElement)
, parent(parent)
{}
virtual void apply(Array<RenderElement>& elements) override;
};
struct RemoveElementRenderHierarchyUpdate : public RenderHierarchyUpdate
{
Element* element;
RemoveElementRenderHierarchyUpdate(Element* elementToRemove)
: element(elementToRemove)
{}
virtual void apply(Array<RenderElement>& elements) override;
};
-1
View File
@@ -1,5 +1,4 @@
#pragma once
#include "Fibers/JobQueue.h"
namespace Seele
{