MayaFlux 0.3.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 355 of file ShaderFoundry.cpp.

356{
357 namespace fs = std::filesystem;
358
359 fs::path path(filepath);
360
361 if (path.is_absolute() || fs::exists(filepath)) {
362 return path;
363 }
364
365 std::vector<std::string> search_paths = {
366 Core::SHADER_BUILD_OUTPUT_DIR,
367 Core::SHADER_INSTALL_DIR,
368 Core::SHADER_SOURCE_DIR,
369 "./shaders",
370 "../shaders",
371 "data/shaders",
372 "./data/shaders",
373 "../data/shaders"
374 };
375
376 if (std::string_view(Core::SHADER_EXAMPLE_DIR).length() > 0) {
377 search_paths.emplace_back(Core::SHADER_EXAMPLE_DIR);
378 }
379
380#ifdef MAYAFLUX_PROJECT_SHADER_DIR
381 search_paths.emplace_back(MAYAFLUX_PROJECT_SHADER_DIR);
382#endif
383
384 for (const auto& search_path : search_paths) {
385 fs::path full_path = fs::path(search_path) / filepath;
386 if (fs::exists(full_path)) {
387 return full_path;
388 }
389 }
390
391 return std::nullopt;
392}

Referenced by detect_source_type().

+ Here is the caller graph for this function: