55#include " nbl/ext/DebugDraw/CDrawAABB.h"
66
77#ifdef NBL_EMBED_BUILTIN_RESOURCES
8- #include " nbl/ext/debug_draw/builtin/CArchive.h"
8+ #include " nbl/ext/debug_draw/builtin/build/ CArchive.h"
99#endif
1010
1111#include " nbl/ext/DebugDraw/builtin/build/spirv/keys.hpp"
@@ -75,47 +75,44 @@ core::smart_refctd_ptr<DrawAABB> DrawAABB::create(SCreationParameters&& params)
7575 return core::smart_refctd_ptr<DrawAABB>(new DrawAABB (std::move (constructorParams)));
7676}
7777
78- // note we use archive entry explicitly for temporary compiler include search path & asset cwd to use keys directly
79- constexpr std::string_view NBL_ARCHIVE_ENTRY = NBL_DEBUG_DRAW_HLSL_MOUNT_POINT ;
78+ // extension data mount alias
79+ constexpr std::string_view NBL_EXT_MOUNT_ENTRY = " nbl/ext/DebugDraw " ;
8080
81- const smart_refctd_ptr<IFileArchive> DrawAABB::mount (smart_refctd_ptr<ILogger> logger, ISystem* system, const core::string& spvPath , const std::string_view archiveAlias)
81+ const smart_refctd_ptr<IFileArchive> DrawAABB::mount (smart_refctd_ptr<ILogger> logger, ISystem* system, video::ILogicalDevice* device , const std::string_view archiveAlias)
8282{
8383 assert (system);
8484
8585 if (!system)
8686 return nullptr ;
8787
88- if (system-> exists ( path (NBL_ARCHIVE_ENTRY) / spvPath. c_str (), {}))
89- {
90- logger-> log ( " CDrawAABB .spv directory is already mounted! " , ILogger::ELL_WARNING);
88+ // the key is deterministic, we are validating presence of required .spv
89+ const auto composed = path (archiveAlias. data ()) / nbl::ext::debug_draw::builtin::build::get_spirv_key< " draw_aabb " >(device);
90+ if (system-> exists (composed, {}))
9191 return nullptr ;
92- }
9392
9493 // extension should mount everything for you, regardless if content goes from virtual filesystem
9594 // or disk directly - and you should never rely on application framework to expose extension data
96- #ifdef NBL_EMBED_BUILTIN_RESOURCES
95+ #ifdef NBL_EMBED_BUILTIN_RESOURCES
9796 auto archive = make_smart_refctd_ptr<builtin::build::CArchive>(smart_refctd_ptr (logger));
98- system->mount (smart_refctd_ptr (archive), archiveAlias.data ());
99- #else
100- auto archive = make_smart_refctd_ptr<nbl::system::CMountDirectoryArchive>(std::move (NBL_ARCHIVE_ENTRY), smart_refctd_ptr (logger), system);
101- system->mount (smart_refctd_ptr (archive), archiveAlias.data ());
102- #endif
97+ #else
98+ auto archive = make_smart_refctd_ptr<nbl::system::CMountDirectoryArchive>(std::string_view (NBL_DEBUG_DRAW_HLSL_MOUNT_POINT), smart_refctd_ptr (logger), system);
99+ #endif
103100
101+ system->mount (smart_refctd_ptr (archive), archiveAlias.data ());
104102 return smart_refctd_ptr (archive);
105103}
106104
107105smart_refctd_ptr<IGPUGraphicsPipeline> DrawAABB::createPipeline (SCreationParameters& params, const IGPUPipelineLayout* pipelineLayout, DrawMode mode)
108106{
109107 system::logger_opt_ptr logger = params.utilities ->getLogger ();
110108 auto system = smart_refctd_ptr<ISystem>(params.assetManager ->getSystem ());
111-
112- const auto key = nbl::ext::debug_draw::builtin::build::get_spirv_key<" draw_aabb" >(params.utilities ->getLogicalDevice ());
113- mount (smart_refctd_ptr<ILogger>(params.utilities ->getLogger ()), system.get (), key, NBL_ARCHIVE_ENTRY);
109+ auto * device = params.utilities ->getLogicalDevice ();
110+ mount (smart_refctd_ptr<ILogger>(params.utilities ->getLogger ()), system.get (), params.utilities ->getLogicalDevice (), NBL_EXT_MOUNT_ENTRY);
114111
115112 auto getShader = [&](const core::string& key)->smart_refctd_ptr <IShader> {
116113 IAssetLoader::SAssetLoadParams lp = {};
117114 lp.logger = params.utilities ->getLogger ();
118- lp.workingDirectory = NBL_DEBUG_DRAW_HLSL_MOUNT_POINT ;
115+ lp.workingDirectory = NBL_EXT_MOUNT_ENTRY ;
119116 auto bundle = params.assetManager ->getAsset (key.c_str (), lp);
120117
121118 const auto contents = bundle.getContents ();
@@ -135,6 +132,7 @@ smart_refctd_ptr<IGPUGraphicsPipeline> DrawAABB::createPipeline(SCreationParamet
135132 return IAsset::castDown<IShader>(contents[0 ]);
136133 };
137134
135+ const auto key = nbl::ext::debug_draw::builtin::build::get_spirv_key<" draw_aabb" >(device);
138136 smart_refctd_ptr<IShader> unifiedShader = getShader (key);
139137 if (!unifiedShader)
140138 {
0 commit comments