Skip to content

Commit

Permalink
Merge pull request godotengine#93793 from Chaosus/shader_fix_bool_op_…
Browse files Browse the repository at this point in the history
…crash

Prevent shader crash when doing invalid operation on boolean vector
  • Loading branch information
akien-mga committed Jul 1, 2024
2 parents e78c4be + 4bf9f3e commit 446e7a7
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions servers/rendering/shader_language.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1547,7 +1547,7 @@ bool ShaderLanguage::_validate_operator(OperatorNode *p_op, DataType *r_ret_type
}

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;
} break;
case OP_ADD:
Expand All @@ -1567,7 +1567,7 @@ bool ShaderLanguage::_validate_operator(OperatorNode *p_op, DataType *r_ret_type
}

if (na == nb) {
valid = (na > TYPE_BOOL && na <= TYPE_MAT4);
valid = (na > TYPE_BVEC4 && na <= TYPE_MAT4);
ret_type = na;
} else if (na == TYPE_INT && nb == TYPE_IVEC2) {
valid = true;
Expand Down Expand Up @@ -1776,7 +1776,7 @@ bool ShaderLanguage::_validate_operator(OperatorNode *p_op, DataType *r_ret_type
DataType nb = p_op->arguments[1]->get_datatype();

if (na == nb) {
valid = (na > TYPE_BOOL && na <= TYPE_MAT4);
valid = (na > TYPE_BVEC4 && na <= TYPE_MAT4);
ret_type = na;
} else if (na == TYPE_IVEC2 && nb == TYPE_INT) {
valid = true;
Expand Down

0 comments on commit 446e7a7

Please sign in to comment.