diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2019-08-24 14:47:44 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-08-24 14:47:44 +0200 |
commit | f2777c04c3957984ac66f5c19b4b796b57ef790c (patch) | |
tree | 3b1ab6bafdacc2556ff9b3da56d274d323046c93 /drivers/gles2 | |
parent | 912f4fca6f31c713835200081102d40589fcffb7 (diff) | |
parent | 4dda253ee05b2a459c596c5775e40ae27e2cb872 (diff) |
Merge pull request #31596 from Chaosus/shader_switch
Implements switch flow control operator in shaders
Diffstat (limited to 'drivers/gles2')
-rw-r--r-- | drivers/gles2/shader_compiler_gles2.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/drivers/gles2/shader_compiler_gles2.cpp b/drivers/gles2/shader_compiler_gles2.cpp index 40574d8c77..afc63cc416 100644 --- a/drivers/gles2/shader_compiler_gles2.cpp +++ b/drivers/gles2/shader_compiler_gles2.cpp @@ -804,6 +804,15 @@ String ShaderCompilerGLES2::_dump_node_code(SL::Node *p_node, int p_level, Gener code += "else\n"; code += _dump_node_code(cf_node->blocks[1], p_level + 1, r_gen_code, p_actions, p_default_actions, p_assigning); } + } else if (cf_node->flow_op == SL::FLOW_OP_SWITCH) { + code += _mktab(p_level) + "switch (" + _dump_node_code(cf_node->expressions[0], p_level, r_gen_code, p_actions, p_default_actions, p_assigning) + ")\n"; + code += _dump_node_code(cf_node->blocks[0], p_level + 1, r_gen_code, p_actions, p_default_actions, p_assigning); + } else if (cf_node->flow_op == SL::FLOW_OP_CASE) { + code += _mktab(p_level) + "case " + _dump_node_code(cf_node->expressions[0], p_level, r_gen_code, p_actions, p_default_actions, p_assigning) + ":\n"; + code += _dump_node_code(cf_node->blocks[0], p_level + 1, r_gen_code, p_actions, p_default_actions, p_assigning); + } else if (cf_node->flow_op == SL::FLOW_OP_DEFAULT) { + code += _mktab(p_level) + "default:\n"; + code += _dump_node_code(cf_node->blocks[0], p_level + 1, r_gen_code, p_actions, p_default_actions, p_assigning); } else if (cf_node->flow_op == SL::FLOW_OP_DO) { code += _mktab(p_level); code += "do"; |