From 9f2faa389dc6f3bd356f81d5f446c81189004ad2 Mon Sep 17 00:00:00 2001 From: johndoe6345789 Date: Tue, 6 Jan 2026 16:21:43 +0000 Subject: [PATCH] feat(materialx): Update source search path handling in shader generation --- src/services/impl/materialx_shader_generator.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/services/impl/materialx_shader_generator.cpp b/src/services/impl/materialx_shader_generator.cpp index 35bff19..3436be3 100644 --- a/src/services/impl/materialx_shader_generator.cpp +++ b/src/services/impl/materialx_shader_generator.cpp @@ -57,6 +57,13 @@ ShaderPaths MaterialXShaderGenerator::Generate(const MaterialXConfig& config, if (!libraryPath.empty()) { searchPath.append(mx::FilePath(libraryPath.string())); } + mx::FileSearchPath sourceSearchPath = searchPath; + if (!libraryPath.empty() && libraryPath.filename() == "libraries") { + std::filesystem::path libraryRoot = libraryPath.parent_path(); + if (!libraryRoot.empty()) { + sourceSearchPath.append(mx::FilePath(libraryRoot.string())); + } + } if (logger_) { logger_->Trace("MaterialXShaderGenerator", "Generate", "libraryPath=" + libraryPath.string() + @@ -74,7 +81,7 @@ ShaderPaths MaterialXShaderGenerator::Generate(const MaterialXConfig& config, mx::ShaderGeneratorPtr generator = mx::VkShaderGenerator::create(); mx::GenContext context(generator); - context.registerSourceCodeSearchPath(searchPath); + context.registerSourceCodeSearchPath(sourceSearchPath); mx::ShaderPtr shader; if (config.useConstantColor) {