summaryrefslogtreecommitdiff
path: root/drivers/gles3
diff options
context:
space:
mode:
authorDavid Sichma <sichmada@gmail.com>2018-08-02 21:04:33 +0200
committerDavid Sichma <sichmada@gmail.com>2018-08-02 21:55:02 +0200
commitc101dd5fa62708b5c8175a9d8b0bfedd2b306961 (patch)
tree27f99b6dadd43ed461a1519ed82414979e5529d4 /drivers/gles3
parent6c569c90b666c7fb773eca3948fc76ba7a160a27 (diff)
Keeping track of discard
Shader compilation now keeps track of the discard key word. Previously only variables were monitored. But discard, which needs special treatment in some cases, went unnoticed by the compiler as discard is not a variable but a flow control. This commit adds monitoring for discard.
Diffstat (limited to 'drivers/gles3')
-rw-r--r--drivers/gles3/shader_compiler_gles3.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/gles3/shader_compiler_gles3.cpp b/drivers/gles3/shader_compiler_gles3.cpp
index 4ff8c72e13..510188184b 100644
--- a/drivers/gles3/shader_compiler_gles3.cpp
+++ b/drivers/gles3/shader_compiler_gles3.cpp
@@ -700,6 +700,11 @@ String ShaderCompilerGLES3::_dump_node_code(SL::Node *p_node, int p_level, Gener
}
} else if (cfnode->flow_op == SL::FLOW_OP_DISCARD) {
+ if (p_actions.usage_flag_pointers.has("DISCARD") && !used_flag_pointers.has("DISCARD")) {
+ *p_actions.usage_flag_pointers["DISCARD"] = true;
+ used_flag_pointers.insert("DISCARD");
+ }
+
code = "discard;";
} else if (cfnode->flow_op == SL::FLOW_OP_CONTINUE) {