X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fglsl%2Fcompatibility.h;h=212007131e80a3d0e37173364005d68f3b8d1166;hb=f2ad2730858046b08e8147297fa01bf3499b86a3;hp=d3a3a74c0dc493fba95e34f06b1b5eb72f8a3266;hpb=c0be4e4ae1a8b6ac31ff6b7080e2242c13d947ff;p=libs%2Fgl.git diff --git a/source/glsl/compatibility.h b/source/glsl/compatibility.h index d3a3a74c..21200713 100644 --- a/source/glsl/compatibility.h +++ b/source/glsl/compatibility.h @@ -8,6 +8,8 @@ namespace Msp { namespace GL { namespace SL { +/** Generates default precision declarations if they are missing, to satisfy +GLSL ES requirements. */ class DefaultPrecisionGenerator: private TraversingVisitor { private: @@ -24,9 +26,10 @@ private: virtual void visit(Block &); virtual void visit(Precision &); virtual void visit(VariableDeclaration &); - using TraversingVisitor::visit; }; +/** Removes precision qualifiers from variable declarations, as well as +default precision declarations. */ class PrecisionRemover: private TraversingVisitor { private: @@ -38,15 +41,16 @@ public: private: virtual void visit(Precision &); virtual void visit(VariableDeclaration &); - using TraversingVisitor::visit; }; +/** Converts structures of the syntax tree to match a particular set of +features. */ class LegacyConverter: private TraversingVisitor { private: Stage *stage; Features features; - std::string type; + std::string r_type; VariableDeclaration *frag_out; NodeList::iterator uniform_insert_point; std::set nodes_to_remove; @@ -57,9 +61,12 @@ public: virtual void apply(Stage &, const Features &); private: + void unsupported(const std::string &); + virtual void visit(Block &); bool check_version(const Version &) const; bool check_extension(bool Features::*) const; + bool supports_stage(Stage::Type) const; bool supports_unified_interface_syntax() const; virtual void visit(VariableReference &); virtual void visit(Assignment &); @@ -71,7 +78,6 @@ private: virtual void visit(VariableDeclaration &); bool supports_interface_blocks(const std::string &) const; virtual void visit(InterfaceBlock &); - using TraversingVisitor::visit; }; } // namespace SL