Prevent shader crash when doing invalid operation on boolean vector
This commit is contained in:
parent
4ab8fb8093
commit
4bf9f3eb58
1 changed files with 3 additions and 3 deletions
|
@ -1547,7 +1547,7 @@ bool ShaderLanguage::_validate_operator(OperatorNode *p_op, DataType *r_ret_type
|
||||||
}
|
}
|
||||||
|
|
||||||
DataType na = p_op->arguments[0]->get_datatype();
|
DataType na = p_op->arguments[0]->get_datatype();
|
||||||
valid = na > TYPE_BOOL && na < TYPE_MAT2;
|
valid = na > TYPE_BVEC4 && na < TYPE_MAT2;
|
||||||
ret_type = na;
|
ret_type = na;
|
||||||
} break;
|
} break;
|
||||||
case OP_ADD:
|
case OP_ADD:
|
||||||
|
@ -1567,7 +1567,7 @@ bool ShaderLanguage::_validate_operator(OperatorNode *p_op, DataType *r_ret_type
|
||||||
}
|
}
|
||||||
|
|
||||||
if (na == nb) {
|
if (na == nb) {
|
||||||
valid = (na > TYPE_BOOL && na <= TYPE_MAT4);
|
valid = (na > TYPE_BVEC4 && na <= TYPE_MAT4);
|
||||||
ret_type = na;
|
ret_type = na;
|
||||||
} else if (na == TYPE_INT && nb == TYPE_IVEC2) {
|
} else if (na == TYPE_INT && nb == TYPE_IVEC2) {
|
||||||
valid = true;
|
valid = true;
|
||||||
|
@ -1776,7 +1776,7 @@ bool ShaderLanguage::_validate_operator(OperatorNode *p_op, DataType *r_ret_type
|
||||||
DataType nb = p_op->arguments[1]->get_datatype();
|
DataType nb = p_op->arguments[1]->get_datatype();
|
||||||
|
|
||||||
if (na == nb) {
|
if (na == nb) {
|
||||||
valid = (na > TYPE_BOOL && na <= TYPE_MAT4);
|
valid = (na > TYPE_BVEC4 && na <= TYPE_MAT4);
|
||||||
ret_type = na;
|
ret_type = na;
|
||||||
} else if (na == TYPE_IVEC2 && nb == TYPE_INT) {
|
} else if (na == TYPE_IVEC2 && nb == TYPE_INT) {
|
||||||
valid = true;
|
valid = true;
|
||||||
|
|
Loading…
Reference in a new issue