+private:
+ void clear();
+
+public:
+ /** Sets the source code to be compiled. Only builtin imports are
+ available. */
+ void set_source(const std::string &, const std::string & = "<string>");
+
+ /** Loads source code from an I/O object. If a collection is used, imports
+ can be fetched from it. */
+ void load_source(IO::Base &, DataFile::Collection * = 0, const std::string & = "<file>");
+
+ /** Loads source code from an I/O object. Only builtin imports are
+ available. */
+ void load_source(IO::Base &, const std::string &);
+
+ /** Specializes the shader. All specialization constants are considered
+ specialized, even if they do not appear in the map. */
+ void specialize(const std::map<std::string, int> &);
+
+ /** Compiles the shader. */
+ void compile(Mode);
+
+ /** Returns combined GLSL source for all shader stages. The result is
+ suitable for feeding back to the compiler. */
+ std::string get_combined_glsl() const;
+
+ /** Returns a list of compiled stage types. */
+ std::vector<Stage::Type> get_stages() const;
+
+ /** Returns GLSL source for a single shader stage. The result is standard
+ GLSL suitable for OpenGL or an external GLSL compiler. */
+ std::string get_stage_glsl(Stage::Type) const;
+
+ /** Returns a combined SPIR-V binary for all shader stages. The result is
+ suitable for use with OpenGL or Vulkan. */
+ std::vector<std::uint32_t> get_combined_spirv() const;
+
+ /** Returns a map of vertex attribute locations. If the target GLSL version
+ supports interface layouts, the map is empty (locations are included in the
+ GLSL soucre). */
+ const std::map<std::string, unsigned> &get_vertex_attributes() const;
+
+ /** Returns a map of fragment output locations. If the target GLSL version
+ supports interface layouts, the map is empty (locations are included in the
+ GLSL soucre). */
+ const std::map<std::string, unsigned> &get_fragment_outputs() const;
+
+ /** Returns a map of texture bindings. If the target GLSL version supports
+ bindings, the map is empty (bindings are included in the GLSL source). */
+ const std::map<std::string, unsigned> &get_texture_bindings() const;
+
+ /** Returns a map of uniform block bindings. If the target GLSL version
+ supports bindings, the map is empty (bindings are included in the GLSL
+ source). */
+ const std::map<std::string, unsigned> &get_uniform_block_bindings() const;
+
+ /** Returns the mapping of source indices to filenames. Can be used to
+ translate error messages. */
+ const SourceMap &get_source_map() const;
+
+ /** Returns a textual representation of the syntax tree for a shader stage.
+ Intended for debugging purposes. */
+ std::string get_stage_debug(Stage::Type) const;
+
+ /** Returns diagnostics from compilation. The output is intended to be
+ viewed by humans. */
+ std::string get_diagnostics() const;