MayaFlux 0.5.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ resolve_shader_path()

std::optional< std::filesystem::path > MayaFlux::Portal::Graphics::ShaderFoundry::resolve_shader_path ( const std::string &  filepath) const
private

Definition at line 439 of file ShaderFoundry.cpp.

440{
441 namespace fs = std::filesystem;
442
443 fs::path path(filepath);
444
445 if (path.is_absolute() || fs::exists(filepath)) {
446 return path;
447 }
448
449 std::vector<std::string> search_paths = {
450 Core::SHADER_BUILD_OUTPUT_DIR,
451 Core::SHADER_INSTALL_DIR,
452 Core::SHADER_SOURCE_DIR,
453 "./shaders",
454 "../shaders",
455 "data/shaders",
456 "./data/shaders",
457 "../data/shaders"
458 };
459
460 if (std::string_view(Core::SHADER_EXAMPLE_DIR).length() > 0) {
461 search_paths.emplace_back(Core::SHADER_EXAMPLE_DIR);
462 }
463
464#ifdef MAYAFLUX_PROJECT_SHADER_DIR
465 search_paths.emplace_back(MAYAFLUX_PROJECT_SHADER_DIR);
466#endif
467
468 for (const auto& search_path : search_paths) {
469 fs::path full_path = fs::path(search_path) / filepath;
470 if (fs::exists(full_path)) {
471 return full_path;
472 }
473 }
474
475 return std::nullopt;
476}

Referenced by detect_source_type().

+ Here is the caller graph for this function: