Merge pull request #13341 from scayze/interp_v2
Added interpolation qualifiers to shaderlang
This commit is contained in:
commit
ccef401700
3 changed files with 53 additions and 2 deletions
|
|
@ -81,6 +81,16 @@ static int _get_datatype_size(SL::DataType p_type) {
|
|||
ERR_FAIL_V(0);
|
||||
}
|
||||
|
||||
static String _interpstr(SL::DataInterpolation p_interp) {
|
||||
|
||||
switch (p_interp) {
|
||||
case SL::INTERPOLATION_FLAT: return "flat ";
|
||||
case SL::INTERPOLATION_NO_PERSPECTIVE: return "noperspective ";
|
||||
case SL::INTERPOLATION_SMOOTH: return "smooth ";
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
static String _prestr(SL::DataPrecision p_pres) {
|
||||
|
||||
switch (p_pres) {
|
||||
|
|
@ -383,12 +393,13 @@ String ShaderCompilerGLES3::_dump_node_code(SL::Node *p_node, int p_level, Gener
|
|||
for (Map<StringName, SL::ShaderNode::Varying>::Element *E = pnode->varyings.front(); E; E = E->next()) {
|
||||
|
||||
String vcode;
|
||||
String interp_mode = _interpstr(E->get().interpolation);
|
||||
vcode += _prestr(E->get().precission);
|
||||
vcode += _typestr(E->get().type);
|
||||
vcode += " " + _mkid(E->key());
|
||||
vcode += ";\n";
|
||||
r_gen_code.vertex_global += "out " + vcode;
|
||||
r_gen_code.fragment_global += "in " + vcode;
|
||||
r_gen_code.vertex_global += interp_mode + "out " + vcode;
|
||||
r_gen_code.fragment_global += interp_mode + "in " + vcode;
|
||||
}
|
||||
|
||||
Map<StringName, String> function_code;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue