X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fglsl%2Freflect.cpp;h=8ee8a88dfe96750dd3234d88a751cc131e27ad10;hb=23779cd03a8b1f6fdc3b2e4d8880170d3fa6146f;hp=83af09a6f8b092bfb9cf3a76d949644ae5638793;hpb=3f245515062d10e4d527827e5126fe412de06ce0;p=libs%2Fgl.git diff --git a/source/glsl/reflect.cpp b/source/glsl/reflect.cpp index 83af09a6..8ee8a88d 100644 --- a/source/glsl/reflect.cpp +++ b/source/glsl/reflect.cpp @@ -49,13 +49,6 @@ bool can_convert(const BasicTypeDeclaration &from, const BasicTypeDeclaration &t unsigned TypeComparer::next_tag = 1; -TypeComparer::TypeComparer(): - first(0), - second(0), - first_tag(0), - r_result(false) -{ } - void TypeComparer::compare(Node &node1, Node &node2) { if(&node1==&node2) @@ -234,10 +227,6 @@ void TypeComparer::visit(VariableDeclaration &var) } -LocationCounter::LocationCounter(): - r_count(0) -{ } - void LocationCounter::visit(BasicTypeDeclaration &basic) { r_count = basic.kind==BasicTypeDeclaration::MATRIX ? basic.size>>16 : 1; @@ -331,7 +320,11 @@ void MemoryRequirementsCalculator::visit(VariableDeclaration &var) if(var.array) if(const Literal *literal = dynamic_cast(var.array_size.get())) if(literal->value.check_type()) - r_size += r_alignment*(literal->value.value()-1); + { + unsigned aligned_size = r_size+r_alignment-1; + aligned_size -= aligned_size%r_alignment; + r_size += aligned_size*(literal->value.value()-1); + } } @@ -391,6 +384,19 @@ void DependencyCollector::visit(FunctionDeclaration &func) } } + +set AssignmentCollector::apply(Node &node) +{ + node.visit(*this); + return assigned_variables; +} + +void AssignmentCollector::visit(Assignment &assign) +{ + if(VariableDeclaration *var = dynamic_cast(assign.target.declaration)) + assigned_variables.insert(var); +} + } // namespace SL } // namespace GL } // namespace Msp