Merge pull request #35202 from xix-xeaon/master

Make fake int mod op (%) actually return int
This commit is contained in:
Rémi Verschelde 2020-10-02 12:29:55 +02:00 committed by GitHub
commit de067cf56f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -625,13 +625,10 @@ String ShaderCompilerGLES2::_dump_node_code(SL::Node *p_node, int p_level, Gener
} break;
case SL::OP_ASSIGN_MOD: {
code += _dump_node_code(op_node->arguments[0], p_level, r_gen_code, p_actions, p_default_actions, true);
code += " = ";
code += "mod(";
code += _dump_node_code(op_node->arguments[0], p_level, r_gen_code, p_actions, p_default_actions, true);
code += ", ";
code += _dump_node_code(op_node->arguments[1], p_level, r_gen_code, p_actions, p_default_actions, p_assigning);
code += ")";
String a = _dump_node_code(op_node->arguments[0], p_level, r_gen_code, p_actions, p_default_actions, p_assigning);
String n = _dump_node_code(op_node->arguments[1], p_level, r_gen_code, p_actions, p_default_actions, p_assigning);
code += a + " = " + n + " == 0 ? 0 : ";
code += a + " - " + n + " * (" + a + " / " + n + ")";
} break;
case SL::OP_BIT_INVERT:
@ -764,12 +761,10 @@ String ShaderCompilerGLES2::_dump_node_code(SL::Node *p_node, int p_level, Gener
} break;
case SL::OP_MOD: {
code += "mod(float(";
code += _dump_node_code(op_node->arguments[0], p_level, r_gen_code, p_actions, p_default_actions, p_assigning);
code += "), float(";
code += _dump_node_code(op_node->arguments[1], p_level, r_gen_code, p_actions, p_default_actions, p_assigning);
code += "))";
String a = _dump_node_code(op_node->arguments[0], p_level, r_gen_code, p_actions, p_default_actions, p_assigning);
String n = _dump_node_code(op_node->arguments[1], p_level, r_gen_code, p_actions, p_default_actions, p_assigning);
code += "(" + n + " == 0 ? 0 : ";
code += a + " - " + n + " * (" + a + " / " + n + "))";
} break;
default: {