diff --git a/ROADMAP.md b/ROADMAP.md index 0e6d0cf..45cacb7 100644 --- a/ROADMAP.md +++ b/ROADMAP.md @@ -94,7 +94,7 @@ Treat JSON config as a declarative control plane that compiles into scene, resou - Implement `MaterialXShaderSystem` using existing MaterialX generator logic. - Update shader loading to use the selected shader system to build `ShaderPaths`. - Deliverable: shader generation/compilation becomes a plugin choice, not hardcoded. -- Status: `IShaderSystem` + registry wired into shader loading, with `materialx` and `glsl` systems registered; config compiler validates shader system declarations; default texture lookup is now exposed via the registry. +- Status: `IShaderSystem` + registry wired into shader loading, with `materialx` and `glsl` systems registered; config compiler validates shader system declarations; registry exposes reflection + default textures (reflection uses shader texture bindings where available). - Acceptance: MaterialX stays working, and a second stub system (e.g., `glsl`) can be registered without touching `IGraphicsService`. ### Phase 3: Resource IR → Runtime Resource Registry (3-6 days) diff --git a/src/services/impl/glsl_shader_system.cpp b/src/services/impl/glsl_shader_system.cpp index 2de5382..eae7e2f 100644 --- a/src/services/impl/glsl_shader_system.cpp +++ b/src/services/impl/glsl_shader_system.cpp @@ -68,7 +68,16 @@ ShaderReflection GlslShaderSystem::GetReflection(const std::string& shaderKey) c if (logger_) { logger_->Trace("GlslShaderSystem", "GetReflection", "shaderKey=" + shaderKey); } - return {}; + ShaderReflection reflection; + auto it = lastShaderMap_.find(shaderKey); + if (it == lastShaderMap_.end()) { + return reflection; + } + reflection.textures.reserve(it->second.textures.size()); + for (const auto& binding : it->second.textures) { + reflection.textures.push_back(binding.uniformName); + } + return reflection; } std::vector GlslShaderSystem::GetDefaultTextures( diff --git a/src/services/impl/materialx_shader_system.cpp b/src/services/impl/materialx_shader_system.cpp index b84c2cd..e4c0092 100644 --- a/src/services/impl/materialx_shader_system.cpp +++ b/src/services/impl/materialx_shader_system.cpp @@ -123,7 +123,16 @@ ShaderReflection MaterialXShaderSystem::GetReflection(const std::string& shaderK if (logger_) { logger_->Trace("MaterialXShaderSystem", "GetReflection", "shaderKey=" + shaderKey); } - return {}; + ShaderReflection reflection; + auto it = lastShaderMap_.find(shaderKey); + if (it == lastShaderMap_.end()) { + return reflection; + } + reflection.textures.reserve(it->second.textures.size()); + for (const auto& binding : it->second.textures) { + reflection.textures.push_back(binding.uniformName); + } + return reflection; } std::vector MaterialXShaderSystem::GetDefaultTextures( diff --git a/tests/shader_system_registry_test.cpp b/tests/shader_system_registry_test.cpp index 3e9e43d..6b63660 100644 --- a/tests/shader_system_registry_test.cpp +++ b/tests/shader_system_registry_test.cpp @@ -70,6 +70,10 @@ TEST(ShaderSystemRegistryTest, UsesActiveGlslSystem) { auto shaderMap = registry.BuildShaderMap(); EXPECT_EQ(registry.GetActiveSystemId(), "glsl"); + auto reflection = registry.GetReflection("flat"); + EXPECT_TRUE(reflection.textures.empty()); + auto defaults = registry.GetDefaultTextures("flat"); + EXPECT_TRUE(defaults.empty()); auto it = shaderMap.find("flat"); ASSERT_NE(it, shaderMap.end()); EXPECT_EQ(it->second.vertex, "shaders/flat.vs"); @@ -107,6 +111,8 @@ TEST(ShaderSystemRegistryTest, FiltersShadersBySystem) { EXPECT_NE(shaderMap.find("glsl"), shaderMap.end()); EXPECT_NE(shaderMap.find("default"), shaderMap.end()); EXPECT_EQ(shaderMap.find("mx"), shaderMap.end()); + auto reflection = registry.GetReflection("glsl"); + EXPECT_TRUE(reflection.textures.empty()); } } // namespace