Skip to content

Commit e0a57b0

Browse files
committed
fix compilation errors && add jit include loader to default include finders
1 parent 68c113a commit e0a57b0

File tree

5 files changed

+24
-4
lines changed

5 files changed

+24
-4
lines changed

include/nbl/asset/utils/CJITIncludeLoader.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
namespace nbl::video
1212
{
1313

14-
class NBL_API2 CJITIncludeLoader : public IShaderCompiler::IIncludeLoader
14+
class NBL_API2 CJITIncludeLoader : public asset::IShaderCompiler::IIncludeLoader
1515
{
1616
public:
1717
CJITIncludeLoader(const SPhysicalDeviceLimits& limits, const SPhysicalDeviceFeatures& features);

include/nbl/video/ILogicalDevice.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
#include "nbl/asset/asset.h"
55
#include "nbl/asset/utils/ISPIRVOptimizer.h"
66
#include "nbl/asset/utils/CCompilerSet.h"
7+
#include "nbl/asset/utils/CJITIncludeLoader.h"
78

89
#include "nbl/video/IGPUFence.h"
910
/*
@@ -509,8 +510,12 @@ class NBL_API2 ILogicalDevice : public core::IReferenceCounted, public IDeviceMe
509510
(*m_offsets)[qci.familyIndex + 1u] = qci.count;
510511
}
511512
std::inclusive_scan(m_offsets->begin(),m_offsets->end(),m_offsets->begin());
513+
514+
addJITIncludeLoader();
512515
}
513516

517+
void addJITIncludeLoader();
518+
514519
// must be called by implementations of mapMemory()
515520
static void post_mapMemory(IDeviceMemoryAllocation* memory, void* ptr, IDeviceMemoryAllocation::MemoryRange rng, core::bitflag<IDeviceMemoryAllocation::E_MAPPING_CPU_ACCESS_FLAGS> access)
516521
{

src/nbl/CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,10 +195,11 @@ set(NBL_ASSET_SOURCES
195195
${NBL_ROOT_PATH}/src/nbl/asset/utils/CHLSLCompiler.cpp
196196
${NBL_ROOT_PATH}/src/nbl/asset/utils/CCompilerSet.cpp
197197
${NBL_ROOT_PATH}/src/nbl/asset/utils/CSPIRVIntrospector.cpp
198+
${NBL_ROOT_PATH}/src/nbl/asset/utils/CJITIncludeLoader.cpp
198199
${NBL_ROOT_PATH}/src/nbl/asset/interchange/CGLSLLoader.cpp
199200
${NBL_ROOT_PATH}/src/nbl/asset/interchange/CHLSLLoader.cpp
200201
${NBL_ROOT_PATH}/src/nbl/asset/interchange/CSPVLoader.cpp
201-
202+
202203
# Pipeline loaders
203204
${NBL_ROOT_PATH}/src/nbl/asset/interchange/CGraphicsPipelineLoaderMTL.cpp
204205

src/nbl/asset/utils/CJITIncludeLoader.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1+
#include "nbl/asset/utils/CJITIncludeLoader.h"
12

2-
#include "CJITIncludeLoader.h"
3-
3+
namespace nbl::video
4+
{
45

56
CJITIncludeLoader::CJITIncludeLoader(const SPhysicalDeviceLimits& limits, const SPhysicalDeviceFeatures& features)
67
{
@@ -53,3 +54,5 @@ std::string CJITIncludeLoader::collectDeviceCaps(const SPhysicalDeviceLimits& li
5354
#endif // _NBL_BUILTIN_HLSL_JIT_DEVICE_CAPABILITIES_INCLUDED_
5455
)===";
5556
}
57+
58+
}

src/nbl/video/ILogicalDevice.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,17 @@ using namespace nbl::video;
66

77
E_API_TYPE ILogicalDevice::getAPIType() const { return m_physicalDevice->getAPIType(); }
88

9+
void ILogicalDevice::addJITIncludeLoader()
10+
{
11+
if(auto cc = (m_physicalDevice && m_compilerSet) ? m_compilerSet->getShaderCompiler(asset::IShader::E_CONTENT_TYPE::ECT_HLSL) : nullptr)
12+
{
13+
if(auto finder = cc->getDefaultIncludeFinder())
14+
{
15+
finder->addSearchPath("", core::make_smart_refctd_ptr<CJITIncludeLoader>(m_physicalDevice->getLimits(), m_physicalDevice->getFeatures()));
16+
}
17+
}
18+
}
19+
920
core::smart_refctd_ptr<IGPUDescriptorSetLayout> ILogicalDevice::createDescriptorSetLayout(const IGPUDescriptorSetLayout::SBinding* _begin, const IGPUDescriptorSetLayout::SBinding* _end)
1021
{
1122
uint32_t dynamicSSBOCount=0u,dynamicUBOCount=0u;

0 commit comments

Comments
 (0)