diff options
author | Scayze <manuel.strey@gmx.de> | 2017-11-27 16:47:46 +0100 |
---|---|---|
committer | Scayze <manuel.strey@gmx.de> | 2017-11-27 16:47:46 +0100 |
commit | b0fb6b138099856c52c1fbdb76914eee0ee55d4a (patch) | |
tree | 1b1ea49944d70314212642d8ad42dbc185e458ea /drivers/gles3 | |
parent | d992eb1b25e3612293d6c72cd462a99cd5a0e4a3 (diff) |
Added interpolation modifiers to shaderlang
Diffstat (limited to 'drivers/gles3')
-rw-r--r-- | drivers/gles3/shader_compiler_gles3.cpp | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/drivers/gles3/shader_compiler_gles3.cpp b/drivers/gles3/shader_compiler_gles3.cpp index 325df8e4f1..05381da9b9 100644 --- a/drivers/gles3/shader_compiler_gles3.cpp +++ b/drivers/gles3/shader_compiler_gles3.cpp @@ -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; |