Fix shader crash when using boolean type for vertex->fragment varyings

This commit is contained in:
Yuri Rubinsky 2022-12-22 23:19:30 +03:00
parent c547c4ef59
commit f28348fc5c
3 changed files with 40 additions and 2 deletions

View file

@ -134,6 +134,8 @@ static String _interpstr(SL::DataInterpolation p_interp) {
return "flat ";
case SL::INTERPOLATION_SMOOTH:
return "";
case SL::INTERPOLATION_DEFAULT:
return "";
}
return "";
}
@ -667,6 +669,9 @@ String ShaderCompiler::_dump_node_code(const SL::Node *p_node, int p_level, Gene
fragment_varyings.insert(varying_name);
continue;
}
if (varying.type < SL::TYPE_INT) {
continue; // Ignore boolean types to prevent crashing (if varying is just declared).
}
String vcode;
String interp_mode = _interpstr(varying.interpolation);