]> git.tdb.fi Git - libs/gl.git/commitdiff
Isolate expressions from surrounding composite access
authorMikko Rasa <tdb@tdb.fi>
Mon, 8 Nov 2021 13:23:02 +0000 (15:23 +0200)
committerMikko Rasa <tdb@tdb.fi>
Mon, 8 Nov 2021 13:23:02 +0000 (15:23 +0200)
source/glsl/spirv.cpp

index 2dcc285c624a2806dab80d3a6e487783138f732f..e12d0bfc6285c0fa65858f71fdb1d0cb0ad74025 100644 (file)
@@ -690,6 +690,9 @@ void SpirVGenerator::visit(Swizzle &swizzle)
 
 void SpirVGenerator::visit(UnaryExpression &unary)
 {
+       if(composite_access)
+               return visit_isolated(unary);
+
        unary.expression->visit(*this);
 
        char oper = unary.oper->token[0];
@@ -774,6 +777,8 @@ void SpirVGenerator::visit(BinaryExpression &binary)
                visit_isolated(*binary.right);
                return visit_composite(*binary.left, 0x400000|r_expression_result_id, *binary.type);
        }
+       else if(composite_access)
+               return visit_isolated(binary);
 
        if(assignment_source_id)
                throw internal_error("invalid binary expression in assignment target");
@@ -998,6 +1003,8 @@ void SpirVGenerator::visit(Assignment &assign)
 
 void SpirVGenerator::visit(TernaryExpression &ternary)
 {
+       if(composite_access)
+               return visit_isolated(ternary);
        if(constant_expression)
        {
                ternary.condition->visit(*this);