Skip to content

Commit 24c1f6d

Browse files
committed
Merge upstream:master to hlsl branch
2 parents 10a9975 + 7efaebc commit 24c1f6d

40 files changed

+936
-577
lines changed

3rdparty/dxc/CMakeLists.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,4 +135,11 @@ CACHE INTERNAL "")
135135

136136
set(DXC_DLL
137137
$<IF:$<CONFIG:Debug>,${NBL_DXC_DEBUG_DLL},${NBL_DXC_RELEASE_DLL}>
138+
CACHE INTERNAL "")
139+
140+
cmake_path(GET NBL_DXC_DEBUG_DLL FILENAME _NBL_DXC_DEBUG_DLL_NAME_)
141+
cmake_path(GET NBL_DXC_RELEASE_DLL FILENAME _NBL_DXC_RELEASE_DLL_NAME_)
142+
143+
set(DXC_DLL_NAME
144+
$<IF:$<CONFIG:Debug>,${_NBL_DXC_DEBUG_DLL_NAME_},${_NBL_DXC_RELEASE_DLL_NAME_}>
138145
CACHE INTERNAL "")

CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
# Copyright (C) 2018-2020 - DevSH Graphics Programming Sp. z O.O.
22
# This file is part of the "Nabla Engine".
33
# For conditions of distribution and use, see copyright notice in nabla.h.in or nabla.h
4-
5-
cmake_minimum_required(VERSION 3.25)
4+
cmake_minimum_required(VERSION 3.26)
65
#policies
76
cmake_policy(SET CMP0112 NEW)
87

@@ -56,6 +55,7 @@ endif()
5655

5756
get_filename_component(NBL_ROOT_PATH "${CMAKE_CURRENT_SOURCE_DIR}" ABSOLUTE)
5857
get_filename_component(NBL_ROOT_PATH_BINARY "${CMAKE_CURRENT_BINARY_DIR}" ABSOLUTE)
58+
set(NBL_BUILTIN_RESOURCES_DIRECTORY_PATH "${NBL_ROOT_PATH}/include")
5959

6060
# Configure CCache if available
6161
find_program(CCACHE_FOUND ccache)

Jenkinsfile

Lines changed: 0 additions & 11 deletions
This file was deleted.

cmake/common.cmake

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,7 @@ macro(nbl_create_ext_library_project EXT_NAME LIB_HEADERS LIB_SOURCES LIB_INCLUD
221221
add_dependencies(${LIB_NAME} Nabla)
222222

223223
get_target_property(_NBL_NABLA_TARGET_BINARY_DIR_ Nabla BINARY_DIR)
224+
get_target_property(_BUILTIN_RESOURCES_INCLUDE_SEARCH_DIRECTORY_ nblBuiltinResourceData BUILTIN_RESOURCES_INCLUDE_SEARCH_DIRECTORY)
224225

225226
target_include_directories(${LIB_NAME}
226227
PUBLIC ${_NBL_NABLA_TARGET_BINARY_DIR_}/build/import
@@ -230,6 +231,7 @@ macro(nbl_create_ext_library_project EXT_NAME LIB_HEADERS LIB_SOURCES LIB_INCLUD
230231
PUBLIC ${CMAKE_SOURCE_DIR}/include
231232
PUBLIC ${CMAKE_SOURCE_DIR}/src
232233
PUBLIC ${CMAKE_SOURCE_DIR}/source/Nabla
234+
PUBLIC ${_BUILTIN_RESOURCES_INCLUDE_SEARCH_DIRECTORY_}
233235
PRIVATE ${LIB_INCLUDES}
234236
)
235237
add_dependencies(${LIB_NAME} Nabla)
@@ -339,6 +341,13 @@ function(nbl_install_file _FILE _RELATIVE_DESTINATION)
339341
install(FILES ${_FILE} DESTINATION relwithdebinfo/include/${_RELATIVE_DESTINATION} CONFIGURATIONS RelWithDebInfo)
340342
endfunction()
341343

344+
function(nbl_install_builtin_resources _TARGET_)
345+
get_target_property(_BUILTIN_RESOURCES_INCLUDE_SEARCH_DIRECTORY_ ${_TARGET_} BUILTIN_RESOURCES_INCLUDE_SEARCH_DIRECTORY)
346+
get_target_property(_BUILTIN_RESOURCES_HEADERS_ ${_TARGET_} BUILTIN_RESOURCES_HEADERS)
347+
348+
nbl_install_headers("${_BUILTIN_RESOURCES_HEADERS_}" "${_BUILTIN_RESOURCES_INCLUDE_SEARCH_DIRECTORY_}")
349+
endfunction()
350+
342351
function(nbl_install_config_header _CONF_HDR_NAME)
343352
nbl_get_conf_dir(dir_deb Debug)
344353
nbl_get_conf_dir(dir_rel Release)
@@ -351,6 +360,18 @@ function(nbl_install_config_header _CONF_HDR_NAME)
351360
install(FILES ${file_relWithDebInfo} DESTINATION relwithdebinfo/include CONFIGURATIONS RelWithDebInfo)
352361
endfunction()
353362

363+
# links builtin resource target to a target
364+
# @_TARGET_@ is target name builtin resource target will be linked to
365+
# @_BS_TARGET_@ is a builtin resource target
366+
367+
function(LINK_BUILTIN_RESOURCES_TO_TARGET _TARGET_ _BS_TARGET_)
368+
add_dependencies(${EXECUTABLE_NAME} ${_BS_TARGET_})
369+
target_link_libraries(${EXECUTABLE_NAME} PUBLIC ${_BS_TARGET_})
370+
371+
get_target_property(_BUILTIN_RESOURCES_INCLUDE_SEARCH_DIRECTORY_ ${_BS_TARGET_} BUILTIN_RESOURCES_INCLUDE_SEARCH_DIRECTORY)
372+
target_include_directories(${EXECUTABLE_NAME} PUBLIC "${_BUILTIN_RESOURCES_INCLUDE_SEARCH_DIRECTORY_}")
373+
endfunction()
374+
354375
macro(nbl_android_create_apk _TARGET)
355376
get_target_property(TARGET_NAME ${_TARGET} NAME)
356377
# TARGET_NAME_IDENTIFIER is identifier that can be used in code

cmake/install/nbl/sharedDefines.h.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,5 @@
44
*/
55

66
#define _NABLA_DLL_NAME_ "@_NABLA_DLL_NAME_@"
7+
#define _DXC_DLL_NAME_ "@_DXC_DLL_NAME_@"
78
#define _NABLA_INSTALL_DIR_ @_NABLA_INSTALL_DIR_@

cmake/scripts/nbl/nablaDefines.cmake

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,10 @@ if(NOT DEFINED _NABLA_DLL_NAME_)
4242
message(FATAL_ERROR "_NABLA_DLL_NAME_ variable must be specified for this script!")
4343
endif()
4444

45+
if(NOT DEFINED _DXC_DLL_NAME_)
46+
message(FATAL_ERROR "_DXC_DLL_NAME_ variable must be specified for this script!")
47+
endif()
48+
4549
if(NOT DEFINED _NABLA_INSTALL_DIR_)
4650
message(FATAL_ERROR "_NABLA_INSTALL_DIR_ variable must be specified for this script!")
4751
endif()

include/nbl/builtin/common.h

Lines changed: 0 additions & 37 deletions
This file was deleted.

include/nbl/config/BuildConfigOptions.h.in

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,8 @@
7979
#endif
8080
#endif
8181

82+
#define NBL_BUILTIN_RESOURCES_DIRECTORY_PATH "@NBL_BUILTIN_RESOURCES_DIRECTORY_PATH@"
83+
8284
// DDL exports
8385
#cmakedefine _NBL_SHARED_BUILD_
8486
#ifdef _NBL_SHARED_BUILD_

include/nbl/scene/ICullingLoDSelectionSystem.h

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -490,7 +490,17 @@ class ICullingLoDSelectionSystem : public virtual core::IReferenceCounted
490490
auto getShader = [device]<core::StringLiteral Path>() -> shader_source_and_path
491491
{
492492
auto system = device->getPhysicalDevice()->getSystem();
493-
auto glslFile = system->loadBuiltinData<Path>();
493+
494+
auto loadBuiltinData = [&](const std::string _path) -> core::smart_refctd_ptr<const nbl::system::IFile>
495+
{
496+
nbl::system::ISystem::future_t<core::smart_refctd_ptr<nbl::system::IFile>> future;
497+
system->createFile(future, system::path(_path), core::bitflag(nbl::system::IFileBase::ECF_READ) | nbl::system::IFileBase::ECF_MAPPABLE);
498+
if (future.wait())
499+
return future.copy();
500+
return nullptr;
501+
};
502+
503+
auto glslFile = loadBuiltinData(Path.value);
494504
core::smart_refctd_ptr<asset::ICPUBuffer> glsl;
495505
{
496506
glsl = core::make_smart_refctd_ptr<asset::ICPUBuffer>(glslFile->getSize());

0 commit comments

Comments
 (0)