summaryrefslogtreecommitdiff
path: root/drivers/gles2/shader_compiler_gles2.cpp
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2019-08-24 14:47:44 +0200
committerGitHub <noreply@github.com>2019-08-24 14:47:44 +0200
commitf2777c04c3957984ac66f5c19b4b796b57ef790c (patch)
tree3b1ab6bafdacc2556ff9b3da56d274d323046c93 /drivers/gles2/shader_compiler_gles2.cpp
parent912f4fca6f31c713835200081102d40589fcffb7 (diff)
parent4dda253ee05b2a459c596c5775e40ae27e2cb872 (diff)
Merge pull request #31596 from Chaosus/shader_switch
Implements switch flow control operator in shaders
Diffstat (limited to 'drivers/gles2/shader_compiler_gles2.cpp')
-rw-r--r--drivers/gles2/shader_compiler_gles2.cpp9
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";