X-Git-Url: http://git.tdb.fi/?p=libs%2Fgl.git;a=blobdiff_plain;f=source%2Fglsl%2Fresolve.h;h=f32d0cd530fe03b289d04176da2535e43e86221a;hp=9e1d4f51c8dd8a6f75f3bd601a45532bdf439917;hb=38712d8ecc57d043a2419ffbaeeb57f7a6586f14;hpb=fdf2d162b21f55ad60bfeec2ad98c58356a083c0 diff --git a/source/glsl/resolve.h b/source/glsl/resolve.h index 9e1d4f51..f32d0cd5 100644 --- a/source/glsl/resolve.h +++ b/source/glsl/resolve.h @@ -15,11 +15,9 @@ namespace SL { class BlockHierarchyResolver: private TraversingVisitor { private: - bool r_any_resolved; + bool r_any_resolved = false; public: - BlockHierarchyResolver(): r_any_resolved(false) { } - bool apply(Stage &s) { r_any_resolved = false; s.content.visit(*this); return r_any_resolved; } private: @@ -30,16 +28,14 @@ private: class TypeResolver: private TraversingVisitor { private: - Stage *stage; + Stage *stage = 0; std::map alias_map; std::map array_types; NodeList::iterator type_insert_point; - InterfaceBlock *iface_block; - bool r_any_resolved; + InterfaceBlock *iface_block = 0; + bool r_any_resolved = false; public: - TypeResolver(); - bool apply(Stage &); private: @@ -59,18 +55,16 @@ of an interface block are turned into interface block references. */ class VariableResolver: private TraversingVisitor { private: - Stage *stage; + Stage *stage = 0; RefPtr r_replacement_expr; - bool r_any_resolved; - bool record_target; - bool r_self_referencing; + bool r_any_resolved = false; + bool record_target = false; + bool r_self_referencing = false; Assignment::Target r_assignment_target; std::vector redeclared_builtins; std::set nodes_to_remove; public: - VariableResolver(); - bool apply(Stage &); private: @@ -102,29 +96,21 @@ private: struct ArgumentInfo { - BasicTypeDeclaration *type; - unsigned component_count; - - ArgumentInfo(): type(0), component_count(0) { } + BasicTypeDeclaration *type = 0; + unsigned component_count = 0; }; - Stage *stage; + Stage *stage = 0; std::vector basic_types; NodeList::iterator insert_point; - bool r_any_resolved; + bool r_any_resolved = false; public: - ExpressionResolver(); - bool apply(Stage &); private: - static bool is_scalar(BasicTypeDeclaration &); - static bool is_vector_or_matrix(BasicTypeDeclaration &); - static BasicTypeDeclaration *get_element_type(BasicTypeDeclaration &); - static bool can_convert(BasicTypeDeclaration &, BasicTypeDeclaration &); static Compatibility get_compatibility(BasicTypeDeclaration &, BasicTypeDeclaration &); - BasicTypeDeclaration *find_type(BasicTypeDeclaration::Kind, unsigned); + BasicTypeDeclaration *find_type(BasicTypeDeclaration::Kind, unsigned, bool = true); BasicTypeDeclaration *find_type(BasicTypeDeclaration &, BasicTypeDeclaration::Kind, unsigned); void convert_to(RefPtr &, BasicTypeDeclaration &); bool convert_to_element(RefPtr &, BasicTypeDeclaration &); @@ -152,14 +138,16 @@ private: class FunctionResolver: private TraversingVisitor { private: - Stage *stage; + Stage *stage = 0; std::map > declarations; - bool r_any_resolved; + bool r_any_resolved = false; public: bool apply(Stage &); private: + static bool can_convert_arguments(const FunctionCall &, const FunctionDeclaration &); + virtual void visit(FunctionCall &); virtual void visit(FunctionDeclaration &); };