Skip to content

Commit 2757318

Browse files
committed
Merge branch 'master' into erfan_device_features
2 parents b8e6c2c + c47480b commit 2757318

38 files changed

+713
-88
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ option(NBL_BUILD_EXAMPLES "Enable building examples" ON)
268268

269269
option(NBL_BUILD_TOOLS "Enable building tools (just convert2BAW as for now)" ON)
270270

271-
option(NBL_BUILD_MITSUBA_LOADER "Enable nbl::ext::MitsubaLoader?" ON)
271+
option(NBL_BUILD_MITSUBA_LOADER "Enable nbl::ext::MitsubaLoader?" OFF) # TODO: once it compies turn this ON by default!
272272

273273
option(NBL_BUILD_OPTIX "Enable nbl::ext::OptiX?" OFF)
274274
if(NBL_COMPILE_WITH_CUDA)

cmake/common.cmake

Lines changed: 16 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -39,19 +39,6 @@ macro(nbl_create_executable_project _EXTRA_SOURCES _EXTRA_OPTIONS _EXTRA_INCLUDE
3939
if(ANDROID)
4040
add_library(${EXECUTABLE_NAME} SHARED main.cpp ${_EXTRA_SOURCES})
4141
else()
42-
if(NOT NBL_STATIC_BUILD)
43-
set(NBL_CONFIG_OUTPUT_DIRECTORY "${PROJECT_SOURCE_DIR}/bin")
44-
set(NBL_CONFIG_OUTPUT_FILE ${NBL_CONFIG_OUTPUT_DIRECTORY}/${EXECUTABLE_NAME}$<IF:$<CONFIG:Release>,,$<IF:$<CONFIG:Debug>,_d,_rwdi>>.exe.config)
45-
46-
add_custom_command(OUTPUT "${NBL_CONFIG_OUTPUT_FILE}"
47-
COMMAND ${CMAKE_COMMAND} -DNBL_ROOT_PATH:PATH=${NBL_ROOT_PATH} -DNBL_GEN_DIRECTORY:PATH=${NBL_CONFIG_OUTPUT_DIRECTORY} -DNBL_DLL_PATH:FILEPATH=$<TARGET_FILE:Nabla> -DNBL_TARGET_PATH:FILEPATH=$<TARGET_FILE:${EXECUTABLE_NAME}> -P ${NBL_ROOT_PATH}/cmake/scripts/nbl/applicationMSVCConfig.cmake
48-
COMMENT "Launching ${EXECUTABLE_NAME}.exe.config generation script!"
49-
VERBATIM
50-
)
51-
52-
add_custom_target(${EXECUTABLE_NAME}_with_config ALL DEPENDS ${NBL_CONFIG_OUTPUT_FILE} ${NBL_ROOT_PATH}/cmake/scripts/nbl/applicationMSVCConfig.cmake)
53-
endif()
54-
5542
set(NBL_EXECUTABLE_SOURCES
5643
main.cpp
5744
${_EXTRA_SOURCES}
@@ -61,19 +48,22 @@ macro(nbl_create_executable_project _EXTRA_SOURCES _EXTRA_OPTIONS _EXTRA_INCLUDE
6148

6249
if(NBL_DYNAMIC_MSVC_RUNTIME)
6350
set_property(TARGET ${EXECUTABLE_NAME} PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>DLL")
51+
52+
if(WIN32 AND MSVC)
53+
set(_NABLA_OUTPUT_DIR_ "${NBL_ROOT_PATH_BINARY}/src/nbl/$<CONFIG>/devshgraphicsprogramming.nabla")
54+
55+
target_link_options(${EXECUTABLE_NAME} PUBLIC "/DELAYLOAD:$<TARGET_FILE_NAME:Nabla>")
56+
target_compile_definitions(${EXECUTABLE_NAME} PUBLIC
57+
_NABLA_DLL_NAME_="$<TARGET_FILE_NAME:Nabla>";_NABLA_OUTPUT_DIR_="${_NABLA_OUTPUT_DIR_}";_NABLA_INSTALL_DIR_="${CMAKE_INSTALL_PREFIX}"
58+
)
59+
endif()
6460
else()
6561
set_property(TARGET ${EXECUTABLE_NAME} PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
6662
endif()
6763
endif()
6864

6965
# EXTRA_SOURCES is var containing non-common names of sources (if any such sources, then EXTRA_SOURCES must be set before including this cmake code)
70-
if(NBL_STATIC_BUILD)
71-
add_dependencies(${EXECUTABLE_NAME} Nabla)
72-
else()
73-
add_dependencies(${EXECUTABLE_NAME}_with_config Nabla_with_manifest)
74-
#target_link_options(${EXECUTABLE_NAME} PRIVATE "/manifestdependency:\"type='win32' name='devshgraphicsprogramming.nabla' version='1.2.3.4' processorArchitecture='x86' language='*'\"")
75-
endif()
76-
66+
add_dependencies(${EXECUTABLE_NAME} Nabla)
7767
get_target_property(NBL_EGL_INCLUDE_DIRECORIES egl INCLUDE_DIRECTORIES)
7868

7969
target_include_directories(${EXECUTABLE_NAME}
@@ -324,6 +314,12 @@ function(nbl_install_headers _HEADERS _BASE_HEADERS_DIR)
324314
endforeach()
325315
endfunction()
326316

317+
function(nbl_install_file _FILE _RELATIVE_DESTINATION)
318+
install(FILES ${_FILE} DESTINATION include/${_RELATIVE_DESTINATION} CONFIGURATIONS Release)
319+
install(FILES ${_FILE} DESTINATION debug/include/${_RELATIVE_DESTINATION} CONFIGURATIONS Debug)
320+
install(FILES ${_FILE} DESTINATION relwithdebinfo/include/${_RELATIVE_DESTINATION} CONFIGURATIONS RelWithDebInfo)
321+
endfunction()
322+
327323
function(nbl_install_config_header _CONF_HDR_NAME)
328324
nbl_get_conf_dir(dir_deb Debug)
329325
nbl_get_conf_dir(dir_rel Release)

cmake/install/nbl/sharedDefines.h.in

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
/*
2+
Those defines are included to the installed define.h header
3+
if the library has been built as DLL.
4+
*/
5+
6+
#define _NABLA_DLL_NAME_ "@_NABLA_DLL_NAME_@"
7+
#define _NABLA_INSTALL_DIR_ @_NABLA_INSTALL_DIR_@

cmake/scripts/nbl/nablaHeader.cmake renamed to cmake/scripts/nbl/nablaDefines.cmake

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,17 @@ else()
3838
message(FATAL_ERROR "NBL_GEN_DIRECTORY variable must be specified for this script!")
3939
endif()
4040

41-
file(READ "${NBL_ROOT_PATH}/include/nabla.h.in" NBL_NABLA_IMPORT_HEADER_CODE)
42-
file(READ "${NBL_WRAPPER_FILE}" NBL_WRAPPER_CODE)
41+
if(NOT DEFINED _NABLA_DLL_NAME_)
42+
message(FATAL_ERROR "_NABLA_DLL_NAME_ variable must be specified for this script!")
43+
endif()
4344

44-
string(APPEND NBL_NABLA_HEADER "${NBL_WRAPPER_CODE}")
45-
string(APPEND NBL_NABLA_HEADER "${NBL_NABLA_IMPORT_HEADER_CODE}")
45+
if(NOT DEFINED _NABLA_INSTALL_DIR_)
46+
message(FATAL_ERROR "_NABLA_INSTALL_DIR_ variable must be specified for this script!")
47+
endif()
48+
49+
configure_file("${NBL_ROOT_PATH}/cmake/install/nbl/sharedDefines.h.in" "${NBL_GEN_DIRECTORY}/define.h")
50+
file(READ "${NBL_WRAPPER_FILE}" NBL_WRAPPER_CODE)
51+
file(READ "${NBL_GEN_DIRECTORY}/define.h" NBL_WRAPPER_CODE_2)
4652

47-
file(WRITE "${NBL_GEN_DIRECTORY}/nabla.h.in" "${NBL_NABLA_HEADER}")
48-
configure_file("${NBL_GEN_DIRECTORY}/nabla.h.in" "${NBL_GEN_DIRECTORY}/nabla.h") # TODO: replace it with string(CONFIGURE ...) when CMake dev team fix this utility
53+
string(APPEND NBL_NABLA_INSTALL_HEADER "${NBL_WRAPPER_CODE}${NBL_WRAPPER_CODE_2}")
54+
file(WRITE "${NBL_GEN_DIRECTORY}/define.h" "${NBL_NABLA_INSTALL_HEADER}")

include/nbl/asset/IAccelerationStructure.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
#include "nbl/asset/format/EFormat.h"
1212
#include "aabbox3d.h"
1313
#define uint uint32_t
14+
#include <compare>
1415
#include "nbl/builtin/glsl/utils/acceleration_structures.glsl"
1516
#undef uint
1617

include/nbl/asset/IBuffer.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,11 @@ struct NBL_API SBufferBinding
6262
template<typename BufferType>
6363
struct NBL_API SBufferRange
6464
{
65+
// Temp Fix, If you want to uncomment this then fix every example having compile issues -> add core::smart_refctd_ptr around the buffer to be an r-value ref
66+
// SBufferRange(const size_t& _offset, const size_t& _size, core::smart_refctd_ptr<BufferType>&& _buffer)
67+
// : offset(_offset), size(_size), buffer(core::smart_refctd_ptr<BufferType>(_buffer)) {}
68+
// SBufferRange() : offset(0ull), size(0ull), buffer(nullptr) {}
69+
6570
inline bool isValid() const
6671
{
6772
return buffer && size && (offset+size<=buffer->getSize());
@@ -70,6 +75,7 @@ struct NBL_API SBufferRange
7075
size_t offset = 0ull;
7176
size_t size = 0ull;
7277
core::smart_refctd_ptr<BufferType> buffer = nullptr;
78+
7379
inline bool operator==(const SBufferRange<BufferType>& rhs) const { return buffer==rhs.buffer && offset==rhs.offset && size==rhs.size; }
7480
inline bool operator!=(const SBufferRange<BufferType>& rhs) const { return !operator==(rhs); }
7581
};

include/nbl/asset/ICPUAnimationLibrary.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ class NBL_API ICPUAnimationLibrary final : public IAnimationLibrary<ICPUBuffer>,
9999
SBufferBinding<ICPUBuffer> _keyframeStorageBinding = {m_keyframeStorageBinding.offset,_depth>0u ? core::smart_refctd_ptr_static_cast<ICPUBuffer>(m_keyframeStorageBinding.buffer->clone(_depth-1u)):m_keyframeStorageBinding.buffer};
100100
SBufferBinding<ICPUBuffer> _timestampStorageBinding = {m_timestampStorageBinding.offset,_depth>0u ? core::smart_refctd_ptr_static_cast<ICPUBuffer>(m_timestampStorageBinding.buffer->clone(_depth-1u)):m_timestampStorageBinding.buffer};
101101

102-
SBufferRange<ICPUBuffer> _animationStorageRange = {m_animationStorageRange.offset,m_animationStorageRange.size,_depth>0u&&m_animationStorageRange.buffer ? core::smart_refctd_ptr_static_cast<ICPUBuffer>(m_animationStorageRange.buffer->clone(_depth-1u)):m_animationStorageRange.buffer};
102+
SBufferRange<ICPUBuffer> _animationStorageRange = {m_animationStorageRange.offset,m_animationStorageRange.size,_depth>0u&&m_animationStorageRange.buffer ? core::smart_refctd_ptr_static_cast<ICPUBuffer>(m_animationStorageRange.buffer->clone(_depth-1u)):core::smart_refctd_ptr(m_animationStorageRange.buffer)};
103103

104104
auto cp = core::make_smart_refctd_ptr<ICPUAnimationLibrary>(std::move(_keyframeStorageBinding),std::move(_timestampStorageBinding),m_keyframeCount,std::move(_animationStorageRange));
105105
clone_common(cp.get());

include/nbl/asset/IDescriptorSet.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
#define _NBL_ASSET_I_DESCRIPTOR_SET_H_INCLUDED_
77

88
#include <algorithm>
9+
#include <compare>
910

1011

1112
#include "nbl/core/declarations.h"

include/nbl/asset/IImage.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
#include "nbl/asset/ECommonEnums.h"
1818
#include "nbl/system/ILogger.h"
1919

20+
#include <compare>
21+
2022
namespace nbl::asset
2123
{
2224

0 commit comments

Comments
 (0)