From: Mikko Rasa Date: Mon, 8 Nov 2021 00:03:54 +0000 (+0200) Subject: Refactor assignment target overlap check into a function X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=c849969d056972dd976cfa616363f1bc8cbc6291;p=libs%2Fgl.git Refactor assignment target overlap check into a function --- diff --git a/source/glsl/optimize.cpp b/source/glsl/optimize.cpp index 8008465e..a7f29a16 100644 --- a/source/glsl/optimize.cpp +++ b/source/glsl/optimize.cpp @@ -1284,36 +1284,12 @@ void UnusedVariableRemover::referenced(const Assignment::Target &target, Node &n { bool loop_external = false; for(AssignmentInfo *a: var_info.assignments) - { - bool covered = true; - for(unsigned j=0; (covered && jtarget.chain_len && j(a->target.chain[j]&0xC0); - Assignment::Target::ChainType type2 = static_cast(target.chain[j]&0xC0); - unsigned index1 = a->target.chain[j]&0x3F; - unsigned index2 = target.chain[j]&0x3F; - if(type1==Assignment::Target::SWIZZLE || type2==Assignment::Target::SWIZZLE) - { - if(type1==Assignment::Target::SWIZZLE && type2==Assignment::Target::SWIZZLE) - covered = index1&index2; - else if(type1==Assignment::Target::ARRAY && index1<4) - covered = index2&(1<target, target)) { a->used_by.push_back(&node); if(a->in_loop(target1.chain[i]&0xC0); + Assignment::Target::ChainType type2 = static_cast(target2.chain[i]&0xC0); + unsigned index1 = target1.chain[i]&0x3F; + unsigned index2 = target2.chain[i]&0x3F; + if(type1==Assignment::Target::SWIZZLE || type2==Assignment::Target::SWIZZLE) + { + if(type1==Assignment::Target::SWIZZLE && type2==Assignment::Target::SWIZZLE) + overlap = index1&index2; + else if(type1==Assignment::Target::ARRAY && index1<4) + overlap = index2&(1<