X-Git-Url: http://git.tdb.fi/?p=libs%2Fgl.git;a=blobdiff_plain;f=source%2Fglsl%2Fresolve.cpp;h=176b13c5f1f55ad13e1613be145676150ef93db5;hp=fec3cf143130a583c38a961b38b70087309b555e;hb=523491787b2b0321748a53f139c1a4355d2f9e85;hpb=03b21dc33ad615efa26849323a2018dd989218c3 diff --git a/source/glsl/resolve.cpp b/source/glsl/resolve.cpp index fec3cf14..176b13c5 100644 --- a/source/glsl/resolve.cpp +++ b/source/glsl/resolve.cpp @@ -1,6 +1,7 @@ #include #include #include +#include "reflect.h" #include "resolve.h" using namespace std; @@ -459,43 +460,6 @@ bool ExpressionResolver::apply(Stage &s) return r_any_resolved; } -bool ExpressionResolver::is_scalar(BasicTypeDeclaration &type) -{ - return (type.kind==BasicTypeDeclaration::INT || type.kind==BasicTypeDeclaration::FLOAT); -} - -bool ExpressionResolver::is_vector_or_matrix(BasicTypeDeclaration &type) -{ - return (type.kind==BasicTypeDeclaration::VECTOR || type.kind==BasicTypeDeclaration::MATRIX); -} - -BasicTypeDeclaration *ExpressionResolver::get_element_type(BasicTypeDeclaration &type) -{ - if(is_vector_or_matrix(type) || type.kind==BasicTypeDeclaration::ARRAY) - { - BasicTypeDeclaration *basic_base = dynamic_cast(type.base_type); - return (basic_base ? get_element_type(*basic_base) : 0); - } - else - return &type; -} - -bool ExpressionResolver::can_convert(BasicTypeDeclaration &from, BasicTypeDeclaration &to) -{ - if(from.kind==BasicTypeDeclaration::INT && to.kind==BasicTypeDeclaration::FLOAT) - return from.size<=to.size; - else if(from.kind!=to.kind) - return false; - else if((from.kind==BasicTypeDeclaration::VECTOR || from.kind==BasicTypeDeclaration::MATRIX) && from.size==to.size) - { - BasicTypeDeclaration *from_base = dynamic_cast(from.base_type); - BasicTypeDeclaration *to_base = dynamic_cast(to.base_type); - return (from_base && to_base && can_convert(*from_base, *to_base)); - } - else - return false; -} - ExpressionResolver::Compatibility ExpressionResolver::get_compatibility(BasicTypeDeclaration &left, BasicTypeDeclaration &right) { if(&left==&right)