Merge pull request #40406 from Chaosus/fix_shader_3.2

[3.2] Fix some incorrect conversions which lead to crash in shaders
This commit is contained in:
Rémi Verschelde 2020-07-15 09:13:41 +02:00 committed by GitHub
commit d2be483e96
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1081,13 +1081,13 @@ bool ShaderLanguage::_validate_operator(OperatorNode *p_op, DataType *r_ret_type
} else if (na == TYPE_FLOAT && nb == TYPE_VEC4) { } else if (na == TYPE_FLOAT && nb == TYPE_VEC4) {
valid = true; valid = true;
ret_type = TYPE_VEC4; ret_type = TYPE_VEC4;
} else if (p_op->op == OP_MUL && na == TYPE_FLOAT && nb == TYPE_MAT2) { } else if (na == TYPE_FLOAT && nb == TYPE_MAT2) {
valid = true; valid = true;
ret_type = TYPE_MAT2; ret_type = TYPE_MAT2;
} else if (p_op->op == OP_MUL && na == TYPE_FLOAT && nb == TYPE_MAT3) { } else if (na == TYPE_FLOAT && nb == TYPE_MAT3) {
valid = true; valid = true;
ret_type = TYPE_MAT3; ret_type = TYPE_MAT3;
} else if (p_op->op == OP_MUL && na == TYPE_FLOAT && nb == TYPE_MAT4) { } else if (na == TYPE_FLOAT && nb == TYPE_MAT4) {
valid = true; valid = true;
ret_type = TYPE_MAT4; ret_type = TYPE_MAT4;
} else if (p_op->op == OP_MUL && na == TYPE_VEC2 && nb == TYPE_MAT2) { } else if (p_op->op == OP_MUL && na == TYPE_VEC2 && nb == TYPE_MAT2) {
@ -1255,13 +1255,13 @@ bool ShaderLanguage::_validate_operator(OperatorNode *p_op, DataType *r_ret_type
} else if (na == TYPE_VEC4 && nb == TYPE_FLOAT) { } else if (na == TYPE_VEC4 && nb == TYPE_FLOAT) {
valid = true; valid = true;
ret_type = TYPE_VEC4; ret_type = TYPE_VEC4;
} else if (p_op->op == OP_ASSIGN_MUL && na == TYPE_MAT2 && nb == TYPE_VEC2) { } else if (na == TYPE_MAT2 && nb == TYPE_FLOAT) {
valid = true; valid = true;
ret_type = TYPE_MAT2; ret_type = TYPE_MAT2;
} else if (p_op->op == OP_ASSIGN_MUL && na == TYPE_MAT3 && nb == TYPE_VEC3) { } else if (na == TYPE_MAT3 && nb == TYPE_FLOAT) {
valid = true; valid = true;
ret_type = TYPE_MAT3; ret_type = TYPE_MAT3;
} else if (p_op->op == OP_ASSIGN_MUL && na == TYPE_MAT4 && nb == TYPE_VEC4) { } else if (na == TYPE_MAT4 && nb == TYPE_FLOAT) {
valid = true; valid = true;
ret_type = TYPE_MAT4; ret_type = TYPE_MAT4;
} else if (p_op->op == OP_ASSIGN_MUL && na == TYPE_VEC2 && nb == TYPE_MAT2) { } else if (p_op->op == OP_ASSIGN_MUL && na == TYPE_VEC2 && nb == TYPE_MAT2) {