From 0422eb234f7ee7613b51ed3904647b64f39b207a Mon Sep 17 00:00:00 2001 From: "t.jung" Date: Sat, 1 Jul 2017 10:26:23 +0200 Subject: [PATCH] io resolver improvements - adds stage parameter to end notify - adds begin notify - adds begin resolve - adds end resolve Change-Id: Ib134fe42a1a6d996d81dca59475cce6b4a9ff865 --- glslang/MachineIndependent/iomapper.cpp | 10 ++++++++-- glslang/Public/ShaderLang.h | 8 +++++++- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/glslang/MachineIndependent/iomapper.cpp b/glslang/MachineIndependent/iomapper.cpp index 40a0e416..88c9bd60 100644 --- a/glslang/MachineIndependent/iomapper.cpp +++ b/glslang/MachineIndependent/iomapper.cpp @@ -436,7 +436,10 @@ struct TDefaultIoResolverBase : public glslang::TIoMapResolver void notifyBinding(EShLanguage, const char* /*name*/, const TType&, bool /*is_live*/) override {} void notifyInOut(EShLanguage, const char* /*name*/, const TType&, bool /*is_live*/) override {} - void endNotifications() override {} + void endNotifications(EShLanguage) override {} + void beginNotifications(EShLanguage) override {} + void beginResolve(EShLanguage) override {} + void endResolve(EShLanguage) override {} protected: static int getLayoutSet(const glslang::TType& type) { @@ -704,13 +707,16 @@ bool TIoMapper::addStage(EShLanguage stage, TIntermediate &intermediate, TInfoSi TNotifyUniformAdaptor uniformNotify(stage, *resolver); TResolverUniformAdaptor uniformResolve(stage, *resolver, infoSink, hadError, intermediate); TResolverInOutAdaptor inOutResolve(stage, *resolver, infoSink, hadError, intermediate); + resolver->beginNotifications(stage); std::for_each(inVarMap.begin(), inVarMap.end(), inOutNotify); std::for_each(outVarMap.begin(), outVarMap.end(), inOutNotify); std::for_each(uniformVarMap.begin(), uniformVarMap.end(), uniformNotify); - resolver->endNotifications(); + resolver->endNotifications(stage); + resolver->beginResolve(stage); std::for_each(inVarMap.begin(), inVarMap.end(), inOutResolve); std::for_each(outVarMap.begin(), outVarMap.end(), inOutResolve); std::for_each(uniformVarMap.begin(), uniformVarMap.end(), uniformResolve); + resolver->endResolve(stage); if (!hadError) { // sort by id again, so we can use lower bound to find entries diff --git a/glslang/Public/ShaderLang.h b/glslang/Public/ShaderLang.h index 10c1b1c5..e2cafbb2 100644 --- a/glslang/Public/ShaderLang.h +++ b/glslang/Public/ShaderLang.h @@ -583,7 +583,13 @@ public: // Notification of a in or out variable virtual void notifyInOut(EShLanguage stage, const char* name, const TType& type, bool is_live) = 0; // Called by mapIO when it has finished the notify pass - virtual void endNotifications() = 0; + virtual void endNotifications(EShLanguage stage) = 0; + // Called by mapIO when it starts its notify pass for the given stage + virtual void beginNotifications(EShLanguage stage) = 0; + // Called by mipIO when it starts its resolve pass for the given stage + virtual void beginResolve(EShLanguage stage) = 0; + // Called by mapIO when it has finished the resolve pass + virtual void endResolve(EShLanguage stage) = 0; }; // Make one TProgram per set of shaders that will get linked together. Add all