24 #ifndef __LAYOUT_LOADER_INCLUDE__
25 #define __LAYOUT_LOADER_INCLUDE__
39 using namespace CoreGL;
40 using namespace CorePipeline;
48 enum LayoutLoaderKeyword
55 KW_LL_PIPELINE_LAYOUT,
58 KW_LL_FILTER_INSTANCE,
59 KW_LL_PIPELINE_INSTANCE,
64 KW_LL_REQUIRED_FORMAT,
65 KW_LL_REQUIRED_SOURCE,
66 KW_LL_REQUIRED_GEOMETRY,
67 KW_LL_REQUIRED_PIPELINE,
720 std::vector<std::string> addedPaths,
750 std::vector<std::string> mainPipelineInputs,
756 static const char* keywords[LL_NumKeywords];
761 std::string currentPath;
762 std::vector<std::string> dynamicPaths;
763 std::vector<LayoutLoaderKeyword> associatedKeyword;
764 std::vector<std::string> uniqueList;
765 std::map<std::string, HdlTextureFormat> formatList;
766 std::map<std::string, ShaderSource> sourceList;
767 std::map<std::string, GeometryModel> geometryList;
768 std::map<std::string, FilterLayout> filterList;
769 std::map<std::string, PipelineLayout> pipelineList;
772 std::vector<std::string> staticPaths;
773 std::map<std::string, HdlTextureFormat> requiredFormatList;
774 std::map<std::string, ShaderSource> requiredSourceList;
775 std::map<std::string, GeometryModel> requiredGeometryList;
776 std::map<std::string, PipelineLayout> requiredPipelineList;
777 std::map<std::string, LayoutLoaderModule*> modules;
782 LayoutLoaderKeyword getKeyword(
const std::string& str);
785 void classify(
const std::vector<VanillaParserSpace::Element>& elements, std::vector<LayoutLoaderKeyword>& associatedKeywords);
786 bool fileExists(
const std::string& filename, std::string& source,
const bool test=
false);
787 void loadFile(
const std::string& filename, std::string& content, std::string& usedPath);
788 void preliminaryTests(
const VanillaParserSpace::Element& e,
char nameProperty,
int minArguments,
int maxArguments,
char bodyProperty,
const std::string& objectName);
789 ShaderSource enhanceShaderSource(
const std::string& str,
const std::string& sourceName,
int startLine=1);
791 void appendPath(
const VanillaParserSpace::Element& e);
792 void includeFile(
const VanillaParserSpace::Element& e);
793 bool checkUnique(
const VanillaParserSpace::Element& e);
794 void buildRequiredFormat(
const VanillaParserSpace::Element& e);
795 void buildRequiredSource(
const VanillaParserSpace::Element& e);
796 void buildRequiredGeometry(
const VanillaParserSpace::Element& e);
797 void buildRequiredPipeline(
const VanillaParserSpace::Element& e);
798 void moduleCall(
const VanillaParserSpace::Element& e, std::string& mainPipelineName,
const bool safe=
false);
799 void buildFormat(
const VanillaParserSpace::Element& e);
800 void buildSource(
const VanillaParserSpace::Element& e);
801 void buildGeometry(
const VanillaParserSpace::Element& e);
802 void buildFilter(
const VanillaParserSpace::Element& e);
803 void buildPipeline(
const VanillaParserSpace::Element& e);
804 void process(
const std::string& code, std::string& mainPipelineName,
const std::string& sourceName,
int startLine=1);
806 void listPipelinePorts(
const VanillaParserSpace::Element& e, std::vector<std::string>& inputs, std::vector<std::string>& outputs);
812 const std::vector<std::string>& paths(
void)
const;
813 void clearPaths(
void);
814 void addToPaths(std::string p);
815 void addToPaths(
const std::vector<std::string>& paths);
816 bool removeFromPaths(
const std::string& p);
818 AbstractPipelineLayout getPipelineLayout(
const std::string& source, std::string sourceName=
"",
int startLine=1);
819 Pipeline* getPipeline(
const std::string& source, std::string pipelineName=
"", std::string sourceName=
"",
int startLine=1);
822 bool hasRequiredFormat(
const std::string& name)
const;
824 int clearRequiredFormat(
const std::string& name=
"");
825 int clearRequiredFormat(
bool (*filter)(
const std::string&));
826 void addRequiredElement(
const std::string& name,
const ShaderSource& src,
bool replace=
true);
827 bool hasRequiredSource(
const std::string& name)
const;
828 const ShaderSource& getRequiredSource(
const std::string& name)
const;
829 int clearRequiredSource(
const std::string& name=
"");
830 int clearRequiredSource(
bool (*filter)(
const std::string&));
831 void addRequiredElement(
const std::string& name,
const GeometryModel& mdl,
bool replace=
true);
832 bool hasRequiredGeometry(
const std::string& name)
const;
833 const GeometryModel& getRequiredGeometry(
const std::string& name)
const;
834 int clearRequiredGeometry(
const std::string& name=
"");
835 int clearRequiredGeometry(
bool (*filter)(
const std::string&));
837 bool hasRequiredPipeline(
const std::string& name)
const;
839 int clearRequiredPipelineLayout(
const std::string& name=
"");
840 int clearRequiredPipelineLayout(
bool (*filter)(
const std::string&));
841 int clearRequiredElements(
const std::string& name=
"");
842 int clearRequiredElements(
bool (*filter)(
const std::string&));
844 PipelineScriptElements listElements(
const std::string& source, std::string sourceName=
"",
int startLine=1);
848 bool hasModule(
const std::string& name)
const;
849 std::vector<const LayoutLoaderModule*> listModules(
void)
const;
850 std::vector<LayoutLoaderModule*> listModules(
void);
851 std::vector<std::string> listModuleNames(
void)
const;
857 static const char* getKeyword(LayoutLoaderKeyword k);
878 static VanillaParserSpace::Element write(
const ShaderSource& source,
const std::string& name);
879 static VanillaParserSpace::Element write(
const GeometryModel& mdl,
const std::string& name);
Contains data about a script, possibly made before the load operation.
Definition: LayoutLoader.hpp:715
std::string mainPipeline
Name of the main pipeline contained in the script.
Definition: LayoutLoader.hpp:748
Module description for the LayoutLoader class.
Definition: LayoutLoaderModules.hpp:746
Filter layout (Read Only).
Definition: Filter.hpp:59
Pipeline layout (Read Only).
Definition: Pipeline.hpp:63
std::vector< std::string > mainPipelineOutputs
List of the output ports for the main pipeline contained in the script.
Definition: LayoutLoader.hpp:750
Definition: Component.hpp:32
std::string unique
Unique identifier.
Definition: LayoutLoader.hpp:718
std::vector< std::vector< std::string > > pipelineOutputs
List of the output ports for each pipeline contained in the script (same order as pipelines)...
Definition: LayoutLoader.hpp:746
std::vector< std::string > sources
Names of the shader source code contained in the script.
Definition: LayoutLoader.hpp:720
Geometry objects and memory management.
Shader source code and infos.
Definition: ShaderSource.hpp:55
Get equivalent pipeline code from a pipeline layout.
Definition: LayoutLoader.hpp:874
Geometry stored on the host.
Definition: Geometry.hpp:50
Pipeline object.
Definition: Pipeline.hpp:261
std::vector< std::vector< std::string > > pipelineInputs
List of the input ports for each pipeline contained in the script (same order as pipelines).
Definition: LayoutLoader.hpp:744
Load and save pipelines layouts to file.
Definition: LayoutLoader.hpp:706
Object handle for OpenGL texture formats (Read Only).
Definition: HdlTexture.hpp:42