@@ -258,7 +258,8 @@ uint32_t select_first(const std::vector<Runtime::DeviceMapping>& devices) {
258258// Global runtime initialization
259259//
260260
261- std::unique_ptr<Runtime> init_global_vulkan_runtime () {
261+ std::unique_ptr<Runtime> init_global_vulkan_runtime (
262+ const std::string& cache_data_path) {
262263 // Load Vulkan drivers
263264#if defined(USE_VULKAN_VOLK)
264265 if (VK_SUCCESS != volkInitialize ()) {
@@ -278,7 +279,6 @@ std::unique_ptr<Runtime> init_global_vulkan_runtime() {
278279#endif /* VULKAN_DEBUG */
279280 const bool init_default_device = true ;
280281 const uint32_t num_requested_queues = 1 ; // TODO: raise this value
281- const std::string cache_data_path = " " ; // TODO: expose to client
282282
283283 const RuntimeConfig default_config{
284284 enable_validation_messages,
@@ -377,13 +377,24 @@ uint32_t Runtime::create_adapter(const Selector& selector) {
377377 return adapter_i;
378378}
379379
380+ std::string& set_and_get_pipeline_cache_data_path (
381+ const std::string& file_path) {
382+ // The global cache data path is declared as a static local variable for the
383+ // same reasons as the global runtime below.
384+ static std::string global_cache_data_path;
385+ if (file_path.size () > 0 ) {
386+ global_cache_data_path = file_path;
387+ }
388+ return global_cache_data_path;
389+ }
390+
380391Runtime* runtime () {
381392 // The global vulkan runtime is declared as a static local variable within a
382393 // non-static function to ensure it has external linkage. If it were a global
383394 // static variable there would be one copy per translation unit that includes
384395 // Runtime.h as it would have internal linkage.
385396 static const std::unique_ptr<Runtime> p_runtime =
386- init_global_vulkan_runtime ();
397+ init_global_vulkan_runtime (set_and_get_pipeline_cache_data_path ( " " ) );
387398
388399 VK_CHECK_COND (
389400 p_runtime,
0 commit comments