diff options
author | Chaosus <chaosus89@gmail.com> | 2019-05-30 17:19:24 +0300 |
---|---|---|
committer | Chaosus <chaosus89@gmail.com> | 2019-06-01 13:41:07 +0300 |
commit | c2d4abf62e3673c976adfef06ef34852d4dce248 (patch) | |
tree | 28901a2647fdfad85bea348c8d723391e2193035 /drivers/gles2 | |
parent | 7310c84367ad336f3c58253f7adea6ba21e24b91 (diff) |
Added constant support to shaders
Co-authored-by: DavidSichma <sichmada@gmail.com>
Diffstat (limited to 'drivers/gles2')
-rw-r--r-- | drivers/gles2/shader_compiler_gles2.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/drivers/gles2/shader_compiler_gles2.cpp b/drivers/gles2/shader_compiler_gles2.cpp index 9778d39a21..b48b93944c 100644 --- a/drivers/gles2/shader_compiler_gles2.cpp +++ b/drivers/gles2/shader_compiler_gles2.cpp @@ -361,6 +361,21 @@ String ShaderCompilerGLES2::_dump_node_code(SL::Node *p_node, int p_level, Gener fragment_global += final_code; } + // constants + + for (Map<StringName, SL::ShaderNode::Constant>::Element *E = snode->constants.front(); E; E = E->next()) { + String gcode; + gcode += "const "; + gcode += _prestr(E->get().precision); + gcode += _typestr(E->get().type); + gcode += " " + _mkid(E->key()); + gcode += "="; + gcode += _dump_node_code(E->get().initializer, p_level, r_gen_code, p_actions, p_default_actions, p_assigning); + gcode += ";\n"; + vertex_global += gcode; + fragment_global += gcode; + } + // functions Map<StringName, String> function_code; |