Skip to content

Commit 8f8899f

Browse files
authored
Merge branch 'Devsh-Graphics-Programming:master' into hlsl
2 parents 8404e62 + 62a8b72 commit 8f8899f

File tree

158 files changed

+7922
-5317
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

158 files changed

+7922
-5317
lines changed

3rdparty/CMakeLists.txt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,11 @@ add_subdirectory(openssl openssl EXCLUDE_FROM_ALL)
2121

2222
# DXC
2323
set(SPIRV-Headers_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/dxc/dxc/external/SPIRV-Headers")
24-
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /fp:fast")
24+
if(WIN32)
25+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /fp:fast")
26+
elseif(UNIX)
27+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ffast-math")
28+
endif()
2529
option(_NBL_ENABLE_DXC_COMPILE_TESTS_ "Enable it in order to test compilation of Nabla shaders at build time" OFF)
2630
option(_NBL_DXC_COMPILE_TESTS_ENABLE_CMAKE_LOG_ "Enable more verbose log when creating DXC compile test target - only for Nabla developers!" OFF)
2731
set(_NBL_DXC_CT_PREFIX_CMAKE_LOG_DEBUG_ "[DXC_CT]:" CACHE INTERNAL "only for Nabla developers")
@@ -47,10 +51,6 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
4751
endif()
4852

4953

50-
# TODO: redo
51-
find_package(Wayland) # TODO: remove, load Wayland dynamically
52-
53-
5454
# zlib (target is zlibstatic)
5555
set(_OLD_BUILD_SHARED_LIBS ${BUILD_SHARED_LIBS})
5656
set(_OLD_SKIP_INSTALL_ALL ${SKIP_INSTALL_ALL})

3rdparty/dxc/CMakeLists.txt

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,24 @@ else()
6060
endif()
6161

6262
set(DXC_BUILD_DIR "${CMAKE_CURRENT_BINARY_DIR}/build" CACHE INTERNAL "")
63-
execute_process(COMMAND "${CMAKE_COMMAND}" -S "${CMAKE_CURRENT_SOURCE_DIR}/dxc" -B "${DXC_BUILD_DIR}" -G "${CMAKE_GENERATOR}" "-Ax64" -T "${CMAKE_GENERATOR_TOOLSET}" ${NBL_DXC_CMAKE_OPTIONS}
64-
RESULT_VARIABLE DXC_CMAKE_RESULT
65-
OUTPUT_VARIABLE DXC_CMAKE_STREAM_PIPE
66-
)
63+
64+
if(WIN32)
65+
execute_process(COMMAND "${CMAKE_COMMAND}" -C "${CMAKE_CURRENT_SOURCE_DIR}/dxc/cmake/caches/PredefinedParams.cmake" -S "${CMAKE_CURRENT_SOURCE_DIR}/dxc" -B "${DXC_BUILD_DIR}" -G "${CMAKE_GENERATOR}" "-Ax64" -T "${CMAKE_GENERATOR_TOOLSET}" ${NBL_DXC_CMAKE_OPTIONS}
66+
RESULT_VARIABLE DXC_CMAKE_RESULT
67+
OUTPUT_VARIABLE DXC_CMAKE_STREAM_PIPE
68+
)
69+
else()
70+
execute_process(COMMAND "${CMAKE_COMMAND}"
71+
-S "${CMAKE_CURRENT_SOURCE_DIR}/dxc"
72+
-C "${CMAKE_CURRENT_SOURCE_DIR}/dxc/cmake/caches/PredefinedParams.cmake"
73+
-G "${CMAKE_GENERATOR}"
74+
-T "${CMAKE_GENERATOR_TOOLSET}"
75+
-B "${DXC_BUILD_DIR}"
76+
-D "CMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE}"
77+
RESULT_VARIABLE DXC_CMAKE_RESULT
78+
OUTPUT_VARIABLE DXC_CMAKE_STREAM_PIPE
79+
)
80+
endif()
6781

6882
if(NOT "${DXC_CMAKE_RESULT}" STREQUAL "0")
6983
message(FATAL_ERROR "${DXC_CMAKE_STREAM_PIPE}")

3rdparty/dxc/test/test.cpp

-293 Bytes
Binary file not shown.

3rdparty/pstl/CMakeLists.txt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
1-
if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang") # only non-multi-generators and clang supported
1+
if(NBL_BUILD_DPL AND CMAKE_CXX_COMPILER_ID STREQUAL "Clang") # only non-multi-generators and clang ifsupported
22
get_filename_component(CCBD_ABSOLUTE "${CMAKE_CURRENT_BINARY_DIR}" ABSOLUTE)
33

4+
if (NBL_BUILD_DPL)
5+
set(_NBL_BUILD_DPL_ ${NBL_BUILD_DPL})
6+
endif()
7+
48
set(TBB_INSTALL_VARS ON CACHE BOOL "" FORCE)
59
set(TBB_TEST OFF CACHE BOOL "" FORCE)
610
set(TBB_STRICT ON CACHE BOOL "" FORCE)
@@ -45,7 +49,7 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang") # only non-multi-generators and clang
4549
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/oneDPL
4650
BINARY_DIR ${ONEDPL_BUILD}
4751
CMAKE_ARGS ${CMAKE_ARGS_ONEDPL}
48-
BUILD_COMMAND cmake --build ${ONEDPL_BUILD} --target build-all
52+
BUILD_COMMAND cmake --build ${ONEDPL_BUILD}
4953
INSTALL_COMMAND cmake --install ${ONEDPL_BUILD} --prefix ${ONEDPL_INSTALL_DIR}
5054
USES_TERMINAL_BUILD 1
5155
COMMENT "Building oneDPL..."

3rdparty/tcpp

CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ include(ExternalProject)
1212
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/toolchains/android/build.cmake)
1313

1414
project(Nabla LANGUAGES CXX C)
15+
enable_language(C CXX ASM)
1516

1617
option(NBL_STATIC_BUILD "" ON) # ON for static builds, OFF for shared
1718
option(NBL_DYNAMIC_MSVC_RUNTIME "" OFF)
@@ -260,6 +261,8 @@ endif()
260261
#uncomment in the future
261262
#option(NBL_TARGET_ARCH_ARM "Build for ARM?" OFF)
262263

264+
option(NBL_BUILD_DPL "Enable DPL (Dynamic Parallelism Library)" OFF)
265+
263266
option(NBL_PCH "Enable pre-compiled header" ON)
264267

265268
option(NBL_FAST_MATH "Enable fast low-precision math" ON)

cmake/common.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ macro(nbl_create_executable_project _EXTRA_SOURCES _EXTRA_OPTIONS _EXTRA_INCLUDE
8484

8585
target_include_directories(${EXECUTABLE_NAME}
8686
PUBLIC "${NBL_ROOT_PATH}/examples_tests/common"
87+
PUBLIC "${NBL_ROOT_PATH_BINARY}/include"
8788
PUBLIC ../../include
8889
PRIVATE ${_EXTRA_INCLUDES}
8990
)

include/nbl/asset/IAssetManager.h

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -330,14 +330,12 @@ class NBL_API2 IAssetManager : public core::IReferenceCounted, public core::Quit
330330
filePath = _params.workingDirectory/filePath;
331331
_override->getLoadFilename(filePath, m_system.get(), ctx, _hierarchyLevel);
332332
}
333-
333+
334334
system::ISystem::future_t<core::smart_refctd_ptr<system::IFile>> future;
335335
m_system->createFile(future, filePath, system::IFile::ECF_READ);
336-
auto file = future.get();
337-
if (!file)
338-
return SAssetBundle(0);
339-
340-
return getAssetInHierarchy_impl<RestoreWholeBundle>(file.get(), filePath.string(), ctx.params, _hierarchyLevel, _override);
336+
if (auto file=future.acquire())
337+
return getAssetInHierarchy_impl<RestoreWholeBundle>(file->get(), filePath.string(), ctx.params, _hierarchyLevel, _override);
338+
return SAssetBundle(0);
341339
}
342340

343341
//TODO change name
@@ -652,15 +650,10 @@ class NBL_API2 IAssetManager : public core::IReferenceCounted, public core::Quit
652650
_override = &defOverride;
653651

654652
system::ISystem::future_t<core::smart_refctd_ptr<system::IFile>> future;
655-
m_system->createFile(future, (_params.workingDirectory.generic_string() + _filename).c_str(), system::IFile::ECF_WRITE);
656-
auto file = future.get();
657-
if (file) // could fail creating file (lack of permissions)
658-
{
659-
bool res = writeAsset(file.get(), _params, _override);
660-
return res;
661-
}
662-
else
663-
return false;
653+
m_system->createFile(future, (_params.workingDirectory.generic_string()+_filename).c_str(), system::IFile::ECF_WRITE);
654+
if (auto file=future.acquire())
655+
return writeAsset(file->get(), _params, _override);
656+
return false;
664657
}
665658
bool writeAsset(system::IFile* _file, const IAssetWriter::SAssetWriteParams& _params, IAssetWriter::IAssetWriterOverride* _override)
666659
{

include/nbl/asset/ICPUBuffer.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ class ICPUBuffer : public asset::IBuffer, public asset::IAsset
7070
}
7171

7272
_NBL_STATIC_INLINE_CONSTEXPR auto AssetType = ET_BUFFER;
73-
inline E_TYPE getAssetType() const override { return AssetType; }
73+
inline IAsset::E_TYPE getAssetType() const override { return AssetType; }
7474

7575
virtual size_t conservativeSizeEstimate() const override { return getSize(); }
7676

@@ -117,13 +117,13 @@ class ICPUBuffer : public asset::IBuffer, public asset::IAsset
117117
}
118118

119119
void* data;
120-
};
120+
};
121121

122-
template<
123-
typename Allocator = _NBL_DEFAULT_ALLOCATOR_METATYPE<uint8_t>,
124-
bool = std::is_same<Allocator, core::null_allocator<typename Allocator::value_type> >::value
125-
>
126-
class CCustomAllocatorCPUBuffer;
122+
template<
123+
typename Allocator = _NBL_DEFAULT_ALLOCATOR_METATYPE<uint8_t>,
124+
bool = std::is_same<Allocator, core::null_allocator<typename Allocator::value_type> >::value
125+
>
126+
class CCustomAllocatorCPUBuffer;
127127

128128
using CDummyCPUBuffer = CCustomAllocatorCPUBuffer<core::null_allocator<uint8_t>, true>;
129129

0 commit comments

Comments
 (0)